From ed9e1a5bd5e3ad2cb04ce6da1bfb4955d80d314a Mon Sep 17 00:00:00 2001 From: fantasai Date: Mon, 6 Jul 2009 18:23:24 -0700 Subject: [PATCH] Bug 389462 - columns don't reflow on resize r=roc --- layout/generic/nsBlockFrame.cpp | 12 +++++++- layout/generic/nsColumnSetFrame.cpp | 12 +++++++- layout/reftests/pagination/reftest.list | 2 ++ .../pagination/resize-reflow-000.html | 28 +++++++++++++++++++ .../pagination/resize-reflow-000.ref.html | 22 +++++++++++++++ .../pagination/resize-reflow-001.html | 19 +++++++++++++ .../pagination/resize-reflow-001.inner.html | 26 +++++++++++++++++ .../pagination/resize-reflow-001.ref.html | 22 +++++++++++++++ 8 files changed, 141 insertions(+), 2 deletions(-) create mode 100644 layout/reftests/pagination/resize-reflow-000.html create mode 100644 layout/reftests/pagination/resize-reflow-000.ref.html create mode 100644 layout/reftests/pagination/resize-reflow-001.html create mode 100644 layout/reftests/pagination/resize-reflow-001.inner.html create mode 100644 layout/reftests/pagination/resize-reflow-001.ref.html diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index 54d4d9b7355e..edb8768d3a7b 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -1777,7 +1777,17 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) PRBool selfDirty = (GetStateBits() & NS_FRAME_IS_DIRTY) || (aState.mReflowState.mFlags.mVResize && (GetStateBits() & NS_FRAME_CONTAINS_RELATIVE_HEIGHT)); - + + // Reflow our last line if our availableHeight has increased + // so that we (and our last child) pull up content as necessary + if (aState.mReflowState.availableHeight != NS_UNCONSTRAINEDSIZE + && GetNextInFlow() && aState.mReflowState.availableHeight > mRect.height) { + line_iterator lastLine = end_lines(); + if (lastLine != begin_lines()) { + --lastLine; + lastLine->MarkDirty(); + } + } // the amount by which we will slide the current line if it is not // dirty nscoord deltaY = 0; diff --git a/layout/generic/nsColumnSetFrame.cpp b/layout/generic/nsColumnSetFrame.cpp index d7e48e8eac24..4f678a195676 100644 --- a/layout/generic/nsColumnSetFrame.cpp +++ b/layout/generic/nsColumnSetFrame.cpp @@ -591,7 +591,7 @@ nsColumnSetFrame::ReflowChildren(nsHTMLReflowMetrics& aDesiredSize, // content from its next sibling. (Note that it might be the last // column, but not be the last child because the desired number of columns // has changed.) - PRBool skipIncremental = !(GetStateBits() & NS_FRAME_IS_DIRTY) + PRBool skipIncremental = !aReflowState.ShouldReflowAllKids() && !NS_SUBTREE_DIRTY(child) && child->GetNextSibling() && !(aUnboundedLastColumn && columnCount == aConfig.mBalanceColCount - 1) @@ -907,6 +907,16 @@ nsColumnSetFrame::Reflow(nsPresContext* aPresContext, // Initialize OUT parameter aStatus = NS_FRAME_COMPLETE; + // Our children depend on our height if we have a fixed height. + if (aReflowState.ComputedHeight() != NS_AUTOHEIGHT) { + NS_ASSERTION(aReflowState.ComputedHeight() != NS_INTRINSICSIZE, + "Unexpected mComputedHeight"); + AddStateBits(NS_FRAME_CONTAINS_RELATIVE_HEIGHT); + } + else { + RemoveStateBits(NS_FRAME_CONTAINS_RELATIVE_HEIGHT); + } + //------------ Handle Incremental Reflow ----------------- ReflowConfig config = ChooseColumnStrategy(aReflowState); diff --git a/layout/reftests/pagination/reftest.list b/layout/reftests/pagination/reftest.list index 4bbca1acdd72..330baad8e52a 100644 --- a/layout/reftests/pagination/reftest.list +++ b/layout/reftests/pagination/reftest.list @@ -23,3 +23,5 @@ fails == border-breaking-004-cols.xhtml border-breaking-002-cols.ref.xhtml == abspos-breaking-000.xhtml abspos-breaking-000.ref.xhtml == abspos-breaking-001.xhtml abspos-breaking-000.ref.xhtml == abspos-breaking-002.xhtml abspos-breaking-000.ref.xhtml +== resize-reflow-000.html resize-reflow-000.ref.html +== resize-reflow-001.html resize-reflow-001.ref.html diff --git a/layout/reftests/pagination/resize-reflow-000.html b/layout/reftests/pagination/resize-reflow-000.html new file mode 100644 index 000000000000..549b04d611f2 --- /dev/null +++ b/layout/reftests/pagination/resize-reflow-000.html @@ -0,0 +1,28 @@ + + + + Resize Reflow Test + + + +
+x
+ blah
+ blah
+ blah
+ blah +
+
+ + + + + diff --git a/layout/reftests/pagination/resize-reflow-000.ref.html b/layout/reftests/pagination/resize-reflow-000.ref.html new file mode 100644 index 000000000000..5190ce1d1faa --- /dev/null +++ b/layout/reftests/pagination/resize-reflow-000.ref.html @@ -0,0 +1,22 @@ + + + + Resize Reflow Test + + + +
+
+ blah
+ blah
+ blah
+ blah +
+
+ + + diff --git a/layout/reftests/pagination/resize-reflow-001.html b/layout/reftests/pagination/resize-reflow-001.html new file mode 100644 index 000000000000..b28a07d657e3 --- /dev/null +++ b/layout/reftests/pagination/resize-reflow-001.html @@ -0,0 +1,19 @@ + + +Resize Reflow Harness + + + + + + diff --git a/layout/reftests/pagination/resize-reflow-001.inner.html b/layout/reftests/pagination/resize-reflow-001.inner.html new file mode 100644 index 000000000000..91130ff868cc --- /dev/null +++ b/layout/reftests/pagination/resize-reflow-001.inner.html @@ -0,0 +1,26 @@ + + + + Resize Reflow Test + + + + +
+
+ blah
+ blah
+ blah
+ blah +
+
+ + + diff --git a/layout/reftests/pagination/resize-reflow-001.ref.html b/layout/reftests/pagination/resize-reflow-001.ref.html new file mode 100644 index 000000000000..b35efa7c0a90 --- /dev/null +++ b/layout/reftests/pagination/resize-reflow-001.ref.html @@ -0,0 +1,22 @@ + + + + Resize Reflow Test + + + +
+
+ blah
+ blah
+ blah
+ blah +
+
+ + +