mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-11 08:13:35 +00:00
Make overflow from text frames be visual overflow only, and not scrollable. (Bug 542595, patch 8) r=roc a2.0=blocking2.0:beta8
This commit is contained in:
parent
dd079acd74
commit
24d9099920
@ -2598,7 +2598,7 @@ nsLineLayout::RelativePositionFrames(PerSpanData* psd, nsOverflowAreas& aOverflo
|
|||||||
if (pfd->GetFlag(PFD_ISTEXTFRAME)) {
|
if (pfd->GetFlag(PFD_ISTEXTFRAME)) {
|
||||||
if (pfd->GetFlag(PFD_RECOMPUTEOVERFLOW)) {
|
if (pfd->GetFlag(PFD_RECOMPUTEOVERFLOW)) {
|
||||||
nsTextFrame* f = static_cast<nsTextFrame*>(frame);
|
nsTextFrame* f = static_cast<nsTextFrame*>(frame);
|
||||||
r = f->RecomputeOverflowRect();
|
r = f->RecomputeOverflow();
|
||||||
}
|
}
|
||||||
frame->FinishAndStoreOverflow(r, frame->GetSize());
|
frame->FinishAndStoreOverflow(r, frame->GetSize());
|
||||||
}
|
}
|
||||||
|
@ -241,7 +241,7 @@ public:
|
|||||||
// placeholders or inlines containing such).
|
// placeholders or inlines containing such).
|
||||||
struct TrimOutput {
|
struct TrimOutput {
|
||||||
// true if we trimmed some space or changed metrics in some other way.
|
// true if we trimmed some space or changed metrics in some other way.
|
||||||
// In this case, we should call RecomputeOverflowRect on this frame.
|
// In this case, we should call RecomputeOverflow on this frame.
|
||||||
PRPackedBool mChanged;
|
PRPackedBool mChanged;
|
||||||
// true if the last character is not justifiable so should be subtracted
|
// true if the last character is not justifiable so should be subtracted
|
||||||
// from the count of justifiable characters in the frame, since the last
|
// from the count of justifiable characters in the frame, since the last
|
||||||
@ -257,7 +257,7 @@ public:
|
|||||||
PRUint32 aSkippedStartOffset = 0,
|
PRUint32 aSkippedStartOffset = 0,
|
||||||
PRUint32 aSkippedMaxLength = PR_UINT32_MAX);
|
PRUint32 aSkippedMaxLength = PR_UINT32_MAX);
|
||||||
|
|
||||||
nsRect RecomputeOverflowRect();
|
nsOverflowAreas RecomputeOverflow();
|
||||||
|
|
||||||
void AddInlineMinWidthForFlow(nsIRenderingContext *aRenderingContext,
|
void AddInlineMinWidthForFlow(nsIRenderingContext *aRenderingContext,
|
||||||
nsIFrame::InlineMinWidthData *aData);
|
nsIFrame::InlineMinWidthData *aData);
|
||||||
@ -400,7 +400,7 @@ protected:
|
|||||||
|
|
||||||
void UnionTextDecorationOverflow(nsPresContext* aPresContext,
|
void UnionTextDecorationOverflow(nsPresContext* aPresContext,
|
||||||
PropertyProvider& aProvider,
|
PropertyProvider& aProvider,
|
||||||
nsRect* aOverflowRect);
|
nsRect* aVisualOverflowRect);
|
||||||
|
|
||||||
void DrawText(gfxContext* aCtx,
|
void DrawText(gfxContext* aCtx,
|
||||||
const gfxPoint& aTextBaselinePt,
|
const gfxPoint& aTextBaselinePt,
|
||||||
|
@ -4104,11 +4104,12 @@ nsTextFrame::GetTextDecorations(nsPresContext* aPresContext)
|
|||||||
void
|
void
|
||||||
nsTextFrame::UnionTextDecorationOverflow(nsPresContext* aPresContext,
|
nsTextFrame::UnionTextDecorationOverflow(nsPresContext* aPresContext,
|
||||||
PropertyProvider& aProvider,
|
PropertyProvider& aProvider,
|
||||||
nsRect* aOverflowRect)
|
nsRect* aVisualOverflowRect)
|
||||||
{
|
{
|
||||||
// Text-shadow overflows
|
// Text-shadow overflows
|
||||||
nsRect shadowRect = nsLayoutUtils::GetTextShadowRectsUnion(*aOverflowRect, this);
|
nsRect shadowRect =
|
||||||
aOverflowRect->UnionRect(*aOverflowRect, shadowRect);
|
nsLayoutUtils::GetTextShadowRectsUnion(*aVisualOverflowRect, this);
|
||||||
|
aVisualOverflowRect->UnionRect(*aVisualOverflowRect, shadowRect);
|
||||||
|
|
||||||
if (IsFloatingFirstLetterChild()) {
|
if (IsFloatingFirstLetterChild()) {
|
||||||
// The underline/overline drawable area must be contained in the overflow
|
// The underline/overline drawable area must be contained in the overflow
|
||||||
@ -4118,14 +4119,14 @@ nsTextFrame::UnionTextDecorationOverflow(nsPresContext* aPresContext,
|
|||||||
fm->GetMaxAscent(fontAscent);
|
fm->GetMaxAscent(fontAscent);
|
||||||
fm->GetMaxHeight(fontHeight);
|
fm->GetMaxHeight(fontHeight);
|
||||||
nsRect fontRect(0, mAscent - fontAscent, GetSize().width, fontHeight);
|
nsRect fontRect(0, mAscent - fontAscent, GetSize().width, fontHeight);
|
||||||
aOverflowRect->UnionRect(*aOverflowRect, fontRect);
|
aVisualOverflowRect->UnionRect(*aVisualOverflowRect, fontRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
// When this frame is not selected, the text-decoration area must be in
|
// When this frame is not selected, the text-decoration area must be in
|
||||||
// frame bounds.
|
// frame bounds.
|
||||||
nsRect decorationRect;
|
nsRect decorationRect;
|
||||||
if (!(GetStateBits() & NS_FRAME_SELECTED_CONTENT) ||
|
if (!(GetStateBits() & NS_FRAME_SELECTED_CONTENT) ||
|
||||||
!CombineSelectionUnderlineRect(aPresContext, *aOverflowRect))
|
!CombineSelectionUnderlineRect(aPresContext, *aVisualOverflowRect))
|
||||||
return;
|
return;
|
||||||
AddStateBits(TEXT_SELECTION_UNDERLINE_OVERFLOWED);
|
AddStateBits(TEXT_SELECTION_UNDERLINE_OVERFLOWED);
|
||||||
}
|
}
|
||||||
@ -6581,10 +6582,10 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
|
|||||||
|
|
||||||
// Handle text that runs outside its normal bounds.
|
// Handle text that runs outside its normal bounds.
|
||||||
nsRect boundingBox = RoundOut(textMetrics.mBoundingBox) + nsPoint(0, mAscent);
|
nsRect boundingBox = RoundOut(textMetrics.mBoundingBox) + nsPoint(0, mAscent);
|
||||||
aMetrics.mOverflowArea.UnionRect(boundingBox,
|
aMetrics.SetOverflowAreasToDesiredBounds();
|
||||||
nsRect(0, 0, aMetrics.width, aMetrics.height));
|
aMetrics.VisualOverflow().UnionRect(aMetrics.VisualOverflow(), boundingBox);
|
||||||
|
|
||||||
UnionTextDecorationOverflow(presContext, provider, &aMetrics.mOverflowArea);
|
UnionTextDecorationOverflow(presContext, provider, &aMetrics.VisualOverflow());
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
// Clean up, update state
|
// Clean up, update state
|
||||||
@ -6812,12 +6813,15 @@ nsTextFrame::TrimTrailingWhiteSpace(nsIRenderingContext* aRC)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRect
|
nsOverflowAreas
|
||||||
nsTextFrame::RecomputeOverflowRect()
|
nsTextFrame::RecomputeOverflow()
|
||||||
{
|
{
|
||||||
|
nsRect bounds(nsPoint(0, 0), GetSize());
|
||||||
|
nsOverflowAreas result(bounds, bounds);
|
||||||
|
|
||||||
gfxSkipCharsIterator iter = EnsureTextRun();
|
gfxSkipCharsIterator iter = EnsureTextRun();
|
||||||
if (!mTextRun)
|
if (!mTextRun)
|
||||||
return nsRect(nsPoint(0,0), GetSize());
|
return result;
|
||||||
|
|
||||||
PropertyProvider provider(this, iter);
|
PropertyProvider provider(this, iter);
|
||||||
provider.InitializeForDisplay(PR_TRUE);
|
provider.InitializeForDisplay(PR_TRUE);
|
||||||
@ -6828,13 +6832,12 @@ nsTextFrame::RecomputeOverflowRect()
|
|||||||
gfxFont::LOOSE_INK_EXTENTS, nsnull,
|
gfxFont::LOOSE_INK_EXTENTS, nsnull,
|
||||||
&provider);
|
&provider);
|
||||||
|
|
||||||
nsRect boundingBox = RoundOut(textMetrics.mBoundingBox) + nsPoint(0, mAscent);
|
nsRect &vis = result.VisualOverflow();
|
||||||
boundingBox.UnionRect(boundingBox,
|
vis.UnionRect(vis, RoundOut(textMetrics.mBoundingBox) + nsPoint(0, mAscent));
|
||||||
nsRect(nsPoint(0,0), GetSize()));
|
|
||||||
|
|
||||||
UnionTextDecorationOverflow(PresContext(), provider, &boundingBox);
|
UnionTextDecorationOverflow(PresContext(), provider, &vis);
|
||||||
|
|
||||||
return boundingBox;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PRUnichar TransformChar(const nsStyleText* aStyle, gfxTextRun* aTextRun,
|
static PRUnichar TransformChar(const nsStyleText* aStyle, gfxTextRun* aTextRun,
|
||||||
|
@ -956,11 +956,15 @@ nsTextBoxFrame::DoLayout(nsBoxLayoutState& aBoxLayoutState)
|
|||||||
|
|
||||||
const nsStyleText* textStyle = GetStyleText();
|
const nsStyleText* textStyle = GetStyleText();
|
||||||
if (textStyle->mTextShadow) {
|
if (textStyle->mTextShadow) {
|
||||||
|
nsRect bounds(nsPoint(0, 0), GetSize());
|
||||||
|
nsOverflowAreas overflow(bounds, bounds);
|
||||||
|
// Our scrollable overflow is our bounds; our visual overflow may
|
||||||
|
// extend beyond that.
|
||||||
nsPoint origin(0,0);
|
nsPoint origin(0,0);
|
||||||
nsRect textRect = CalcTextRect(*aBoxLayoutState.GetRenderingContext(), origin);
|
nsRect textRect = CalcTextRect(*aBoxLayoutState.GetRenderingContext(), origin);
|
||||||
nsRect overflowRect(nsLayoutUtils::GetTextShadowRectsUnion(textRect, this));
|
nsRect &vis = overflow.VisualOverflow();
|
||||||
overflowRect.UnionRect(overflowRect, nsRect(nsPoint(0, 0), GetSize()));
|
vis.UnionRect(vis, nsLayoutUtils::GetTextShadowRectsUnion(textRect, this));
|
||||||
FinishAndStoreOverflow(&overflowRect, GetSize());
|
FinishAndStoreOverflow(overflow, GetSize());
|
||||||
}
|
}
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user