# HG changeset patch # User Boris Zbarsky # Date 1295418330 18000 # Node ID a5228ac8e683857e2bf38d44f3945b0a32732960 # Parent 6e50eac51f45662288369a19f644a0114a003ccd Bug 626395 hackery diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -1463,17 +1463,18 @@ nsBlockFrame::ComputeOverflowAreas(const nscoord aBottomEdgeOfChildren) { // Compute the overflow areas of our children // XXX_perf: This can be done incrementally. It is currently one of // the things that makes incremental reflow O(N^2). nsRect bounds(0, 0, aMetrics.width, aMetrics.height); nsOverflowAreas areas(bounds, bounds); - if (NS_STYLE_OVERFLOW_CLIP != aReflowState.mStyleDisplay->mOverflowX) { + if (NS_STYLE_OVERFLOW_CLIP != aReflowState.mStyleDisplay->mOverflowX && + !ApplyPaginatedOverflowClipping(this)) { PRBool inQuirks = (PresContext()->CompatibilityMode() == eCompatibility_NavQuirks); for (line_iterator line = begin_lines(), line_end = end_lines(); line != line_end; ++line) { // Text-shadow overflows if (!inQuirks && line->IsInline()) { nsRect shadowRect = nsLayoutUtils::GetTextShadowRectsUnion( diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -1223,41 +1223,29 @@ static inline PRBool ApplyOverflowHidden // CSS 2.1 so I removed them. Also, we used to clip at tableOuterFrame // but we should actually clip at tableFrame (as per discussion with Hixie and // bz). return type == nsGkAtoms::tableFrame || type == nsGkAtoms::tableCellFrame || type == nsGkAtoms::bcTableCellFrame; } -static inline PRBool ApplyPaginatedOverflowClipping(nsIFrame* aFrame, - const nsStyleDisplay* aDisp) -{ - // If we're paginated and aFrame is a block, and it has - // NS_BLOCK_CLIP_PAGINATED_OVERFLOW set, then we want to clip our - // overflow. - return - aFrame->PresContext()->IsPaginated() && - aFrame->GetType() == nsGkAtoms::blockFrame && - (aFrame->GetStateBits() & NS_BLOCK_CLIP_PAGINATED_OVERFLOW) != 0; -} - static PRBool ApplyOverflowClipping(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, const nsStyleDisplay* aDisp, nsRect* aRect) { // REVIEW: from nsContainerFrame.cpp SyncFrameViewGeometryDependentProperties, // except that that function used the border-edge for // -moz-hidden-unscrollable which I don't think is correct... Also I've // changed -moz-hidden-unscrollable to apply to any kind of frame. // Only -moz-hidden-unscrollable is handled here (and 'hidden' for table // frames, and any non-visible value for blocks in a paginated context). // Other overflow clipping is applied by nsHTML/XULScrollFrame. if (!ApplyOverflowHiddenClipping(aFrame, aDisp) && - !ApplyPaginatedOverflowClipping(aFrame, aDisp)) { + !nsFrame::ApplyPaginatedOverflowClipping(aFrame)) { PRBool clip = aDisp->mOverflowX == NS_STYLE_OVERFLOW_CLIP; if (!clip) return PR_FALSE; // We allow -moz-hidden-unscrollable to apply to any kind of frame. This // is required by comboboxes which make their display text (an inline frame) // have clipping. } @@ -6124,17 +6112,18 @@ nsIFrame::FinishAndStoreOverflow(nsOverf // If we clip our children, clear accumulated overflow area. The // children are actually clipped to the padding-box, but since the // overflow area should include the entire border-box, just set it to // the border-box here. const nsStyleDisplay *disp = GetStyleDisplay(); NS_ASSERTION((disp->mOverflowY == NS_STYLE_OVERFLOW_CLIP) == (disp->mOverflowX == NS_STYLE_OVERFLOW_CLIP), "If one overflow is clip, the other should be too"); - if (disp->mOverflowX == NS_STYLE_OVERFLOW_CLIP) { + if (disp->mOverflowX == NS_STYLE_OVERFLOW_CLIP || + nsFrame::ApplyPaginatedOverflowClipping(this)) { // The contents are actually clipped to the padding area aOverflowAreas.SetAllTo(bounds); } // Overflow area must always include the frame's top-left and bottom-right, // even if the frame rect is empty. // Pending a real fix for bug 426879, don't do this for inline frames // with zero width. diff --git a/layout/generic/nsFrame.h b/layout/generic/nsFrame.h --- a/layout/generic/nsFrame.h +++ b/layout/generic/nsFrame.h @@ -45,16 +45,17 @@ #include "nsRect.h" #include "nsString.h" #include "prlog.h" #include "nsIPresShell.h" #include "nsFrameSelection.h" #include "nsHTMLReflowState.h" #include "nsHTMLReflowMetrics.h" +#include "nsHTMLParts.h" /** * nsFrame logging constants. We redefine the nspr * PRLogModuleInfo.level field to be a bitfield. Each bit controls a * specific type of logging. Each logging operation has associated * inline methods defined below. */ #define NS_FRAME_TRACE_CALLS 0x1 @@ -567,16 +568,27 @@ public: // Return the line number of the aFrame, and (optionally) the containing block // frame. // If aScrollLock is true, don't break outside scrollframes when looking for a // containing block frame. static PRInt32 GetLineNumber(nsIFrame *aFrame, PRBool aLockScroll, nsIFrame** aContainingBlock = nsnull); + // test whether this frame should apply paginated overflow clipping. + static PRBool ApplyPaginatedOverflowClipping(nsIFrame* aFrame) + { + // If we're paginated and a block, and have NS_BLOCK_CLIP_PAGINATED_OVERFLOW + // set, then we want to clip our overflow. + return + aFrame->PresContext()->IsPaginated() && + aFrame->GetType() == nsGkAtoms::blockFrame && + (aFrame->GetStateBits() & NS_BLOCK_CLIP_PAGINATED_OVERFLOW) != 0; + } + protected: // Test if we are selecting a table object: // Most table/cell selection requires that Ctrl (Cmd on Mac) key is down // during a mouse click or drag. Exception is using Shift+click when // already in "table/cell selection mode" to extend a block selection // Get the parent content node and offset of the frame // of the enclosing cell or table (if not inside a cell) diff --git a/layout/reftests/printing/626395-1-ref.html b/layout/reftests/printing/626395-1-ref.html new file mode 100644 --- /dev/null +++ b/layout/reftests/printing/626395-1-ref.html @@ -0,0 +1,8 @@ + + + +
+
+ Some text + + diff --git a/layout/reftests/printing/626395-1.html b/layout/reftests/printing/626395-1.html new file mode 100644 --- /dev/null +++ b/layout/reftests/printing/626395-1.html @@ -0,0 +1,9 @@ + + + +
+
+
+ Some text + + diff --git a/layout/reftests/printing/reftest.list b/layout/reftests/printing/reftest.list --- a/layout/reftests/printing/reftest.list +++ b/layout/reftests/printing/reftest.list @@ -5,8 +5,9 @@ == 272830-1.html 272830-1-ref.html == 318022-1.html 318022-1-ref.html == 403669-1.html 403669-1-ref.html == 381497-n.html 381497-f.html == test-async-print.html 272830-1-ref.html == 129941-1a.html 129941-1-ref.html == 129941-1b.html 129941-1-ref.html == 577450-1.html 577450-1-ref.html +== 626395-1.html 626395-1-ref.html