author | L. David Baron <dbaron@dbaron.org> |
Wed, 23 Nov 2011 18:48:23 -0800 | |
changeset 80689 | d090012f8439e926489cbfaa44600f24eb18e20d |
parent 80688 | 236ba3dfe6472a0acd8863f32d360dabf9d5a9da |
child 80690 | d3724c31c3a0a083728d21f681a414900f982b6f |
push id | 21522 |
push user | dbaron@mozilla.com |
push date | Thu, 24 Nov 2011 02:50:31 +0000 |
treeherder | mozilla-central@cf764be32bc3 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | roc |
bugs | 627842 |
milestone | 11.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/layout/generic/TextOverflow.cpp +++ b/layout/generic/TextOverflow.cpp @@ -100,21 +100,18 @@ static bool IsFullyClipped(nsTextFrame* aFrame, nscoord aLeft, nscoord aRight, nscoord* aSnappedLeft, nscoord* aSnappedRight) { *aSnappedLeft = aLeft; *aSnappedRight = aRight; if (aLeft <= 0 && aRight <= 0) { return false; } - nsRefPtr<nsRenderingContext> rc = - aFrame->PresContext()->PresShell()->GetReferenceRenderingContext(); - return rc && - !aFrame->MeasureCharClippedText(rc->ThebesContext(), aLeft, aRight, - aSnappedLeft, aSnappedRight); + return !aFrame->MeasureCharClippedText(aLeft, aRight, + aSnappedLeft, aSnappedRight); } static bool IsHorizontalOverflowVisible(nsIFrame* aFrame) { NS_PRECONDITION(nsLayoutUtils::GetAsBlock(aFrame) != nsnull, "expected a block frame");
--- a/layout/generic/nsTextFrame.h +++ b/layout/generic/nsTextFrame.h @@ -284,28 +284,26 @@ public: /** * Calculate the horizontal bounds of the grapheme clusters that fit entirely * inside the given left/right edges (which are positive lengths from the * respective frame edge). If an input value is zero it is ignored and the * result for that edge is zero. All out parameter values are undefined when * the method returns false. * @return true if at least one whole grapheme cluster fit between the edges */ - bool MeasureCharClippedText(gfxContext* aCtx, - nscoord aLeftEdge, nscoord aRightEdge, + bool MeasureCharClippedText(nscoord aLeftEdge, nscoord aRightEdge, nscoord* aSnappedLeftEdge, nscoord* aSnappedRightEdge); /** * Same as above; this method also the returns the corresponding text run * offset and number of characters that fit. All out parameter values are * undefined when the method returns false. * @return true if at least one whole grapheme cluster fit between the edges */ - bool MeasureCharClippedText(gfxContext* aCtx, - PropertyProvider& aProvider, + bool MeasureCharClippedText(PropertyProvider& aProvider, nscoord aLeftEdge, nscoord aRightEdge, PRUint32* aStartOffset, PRUint32* aMaxLength, nscoord* aSnappedLeftEdge, nscoord* aSnappedRightEdge); // primary frame paint method called from nsDisplayText // The private DrawText() is what applies the text to a graphics context void PaintText(nsRenderingContext* aRenderingContext, nsPoint aPt, const nsRect& aDirtyRect, const nsCharClipDisplayItem& aItem);
--- a/layout/generic/nsTextFrameThebes.cpp +++ b/layout/generic/nsTextFrameThebes.cpp @@ -5267,35 +5267,34 @@ ComputeTransformedLength(PropertyProvide { gfxSkipCharsIterator iter(aProvider.GetStart()); PRUint32 start = iter.GetSkippedOffset(); iter.AdvanceOriginal(aProvider.GetOriginalLength()); return iter.GetSkippedOffset() - start; } bool -nsTextFrame::MeasureCharClippedText(gfxContext* aCtx, - nscoord aLeftEdge, nscoord aRightEdge, +nsTextFrame::MeasureCharClippedText(nscoord aLeftEdge, nscoord aRightEdge, nscoord* aSnappedLeftEdge, nscoord* aSnappedRightEdge) { - // Don't pass in aRenderingContext here, because we need a *reference* - // context and aRenderingContext might have some transform in it + // We need a *reference* rendering context (not one that might have a + // transform), so we don't have a rendering context argument. // XXX get the block and line passed to us somehow! This is slow! gfxSkipCharsIterator iter = EnsureTextRun(nsTextFrame::eInflated); if (!mTextRun) return false; PropertyProvider provider(this, iter, nsTextFrame::eInflated); // Trim trailing whitespace provider.InitializeForDisplay(true); PRUint32 startOffset = provider.GetStart().GetSkippedOffset(); PRUint32 maxLength = ComputeTransformedLength(provider); - return MeasureCharClippedText(aCtx, provider, aLeftEdge, aRightEdge, + return MeasureCharClippedText(provider, aLeftEdge, aRightEdge, &startOffset, &maxLength, aSnappedLeftEdge, aSnappedRightEdge); } static PRUint32 GetClusterLength(gfxTextRun* aTextRun, PRUint32 aStartOffset, PRUint32 aMaxLength, bool aIsRTL) @@ -5309,18 +5308,17 @@ static PRUint32 GetClusterLength(gfxText break; } ++clusterLength; } return clusterLength; } bool -nsTextFrame::MeasureCharClippedText(gfxContext* aCtx, - PropertyProvider& aProvider, +nsTextFrame::MeasureCharClippedText(PropertyProvider& aProvider, nscoord aLeftEdge, nscoord aRightEdge, PRUint32* aStartOffset, PRUint32* aMaxLength, nscoord* aSnappedLeftEdge, nscoord* aSnappedRightEdge) { *aSnappedLeftEdge = 0; *aSnappedRightEdge = 0; @@ -5396,17 +5394,17 @@ nsTextFrame::PaintText(nsRenderingContex const bool rtl = mTextRun->IsRightToLeft(); const nscoord frameWidth = GetSize().width; gfxPoint framePt(aPt.x, aPt.y); gfxPoint textBaselinePt(rtl ? gfxFloat(aPt.x + frameWidth) : framePt.x, nsLayoutUtils::GetSnappedBaselineY(this, ctx, aPt.y, mAscent)); PRUint32 startOffset = provider.GetStart().GetSkippedOffset(); PRUint32 maxLength = ComputeTransformedLength(provider); nscoord snappedLeftEdge, snappedRightEdge; - if (!MeasureCharClippedText(ctx, provider, aItem.mLeftEdge, aItem.mRightEdge, + if (!MeasureCharClippedText(provider, aItem.mLeftEdge, aItem.mRightEdge, &startOffset, &maxLength, &snappedLeftEdge, &snappedRightEdge)) { return; } textBaselinePt.x += rtl ? -snappedRightEdge : snappedLeftEdge; nsCharClipDisplayItem::ClipEdges clipEdges(aItem, snappedLeftEdge, snappedRightEdge); nsTextPaintStyle textPaintStyle(this);