Backed out changesets d0ee7053aaf3 and c83f17cd74be (bug 727125) for B2G reftest failures.

CLOSED TREE
This commit is contained in:
Ryan VanderMeulen 2014-06-12 14:45:40 -04:00
parent 4820eab88b
commit 3ed2bbef13
17 changed files with 47 additions and 335 deletions

View File

@ -513,22 +513,6 @@ RestyleManager::StyleChangeReflow(nsIFrame* aFrame, nsChangeHint aHint)
return;
}
void
RestyleManager::AddSubtreeToOverflowTracker(nsIFrame* aFrame)
{
mOverflowChangedTracker.AddFrame(
aFrame,
OverflowChangedTracker::CHILDREN_AND_PARENT_CHANGED);
nsIFrame::ChildListIterator lists(aFrame);
for (; !lists.IsDone(); lists.Next()) {
nsFrameList::Enumerator childFrames(lists.CurrentList());
for (; !childFrames.AtEnd(); childFrames.Next()) {
nsIFrame* child = childFrames.get();
AddSubtreeToOverflowTracker(child);
}
}
}
NS_DECLARE_FRAME_PROPERTY(ChangeListProperty, nullptr)
/**
@ -732,7 +716,6 @@ RestyleManager::ProcessRestyledFrames(nsStyleChangeList& aChangeList)
StyleChangeReflow(frame, hint);
didReflowThisFrame = true;
}
if (hint & (nsChangeHint_RepaintFrame | nsChangeHint_SyncFrameView |
nsChangeHint_UpdateOpacityLayer | nsChangeHint_UpdateTransformLayer |
nsChangeHint_ChildrenOnlyTransform)) {
@ -750,11 +733,7 @@ RestyleManager::ProcessRestyledFrames(nsStyleChangeList& aChangeList)
"nsChangeHint_UpdateOverflow should be passed too");
if (!didReflowThisFrame &&
(hint & (nsChangeHint_UpdateOverflow |
nsChangeHint_UpdatePostTransformOverflow |
nsChangeHint_UpdateSubtreeOverflow))) {
if (hint & nsChangeHint_UpdateSubtreeOverflow) {
AddSubtreeToOverflowTracker(frame);
}
nsChangeHint_UpdatePostTransformOverflow))) {
OverflowChangedTracker::ChangeKind changeKind;
if (hint & nsChangeHint_ChildrenOnlyTransform) {
// The overflow areas of the child frames need to be updated:
@ -790,8 +769,7 @@ RestyleManager::ProcessRestyledFrames(nsStyleChangeList& aChangeList)
// If we have both nsChangeHint_UpdateOverflow and
// nsChangeHint_UpdatePostTransformOverflow, CHILDREN_AND_PARENT_CHANGED
// is selected as it is stronger.
if (hint & (nsChangeHint_UpdateOverflow |
nsChangeHint_UpdateSubtreeOverflow)) {
if (hint & nsChangeHint_UpdateOverflow) {
changeKind = OverflowChangedTracker::CHILDREN_AND_PARENT_CHANGED;
} else {
changeKind = OverflowChangedTracker::TRANSFORM_CHANGED;

View File

@ -245,9 +245,6 @@ private:
void StyleChangeReflow(nsIFrame* aFrame, nsChangeHint aHint);
// Recursively add all the given frame and all children to the tracker.
void AddSubtreeToOverflowTracker(nsIFrame* aFrame);
// Returns true if this function managed to successfully move a frame, and
// false if it could not process the position change, and a reflow should
// be performed instead.

View File

@ -72,28 +72,23 @@ enum nsChangeHint {
nsChangeHint_ReconstructFrame = 0x400,
/**
* The frame's overflow area has changed. Does not update any descendant
* The frame's overflow area has changed, either through a change in its
* transform or a change in its position. Does not update any descendant
* frames.
*/
nsChangeHint_UpdateOverflow = 0x800,
/**
* The overflow area of the frame and all of its descendants has changed. This
* can happen through a text-decoration change.
*/
nsChangeHint_UpdateSubtreeOverflow = 0x1000,
/**
* The frame's overflow area has changed, through a change in its transform.
* Does not update any descendant frames.
*/
nsChangeHint_UpdatePostTransformOverflow = 0x2000,
nsChangeHint_UpdatePostTransformOverflow = 0x1000,
/**
* The children-only transform of an SVG frame changed, requiring the
* overflow rects of the frame's immediate children to be updated.
*/
nsChangeHint_ChildrenOnlyTransform = 0x4000,
nsChangeHint_ChildrenOnlyTransform = 0x2000,
/**
* The frame's offsets have changed, while its dimensions might have
@ -105,7 +100,7 @@ enum nsChangeHint {
* nsChangeHint_UpdateOverflow in order to get the overflow areas of
* the ancestors updated as well.
*/
nsChangeHint_RecomputePosition = 0x8000,
nsChangeHint_RecomputePosition = 0x4000,
/**
* Behaves like ReconstructFrame, but only if the frame has descendants
@ -113,7 +108,7 @@ enum nsChangeHint {
* has changed whether the frame is a container for fixed-pos or abs-pos
* elements, but reframing is otherwise not needed.
*/
nsChangeHint_AddOrRemoveTransform = 0x10000,
nsChangeHint_AddOrRemoveTransform = 0x8000,
/**
* This change hint has *no* change handling behavior. However, it
@ -121,13 +116,13 @@ enum nsChangeHint {
* changes, and it's inherited by a child, that might require a reflow
* due to the border-width change on the child.
*/
nsChangeHint_BorderStyleNoneChange = 0x20000,
nsChangeHint_BorderStyleNoneChange = 0x10000,
/**
* SVG textPath needs to be recomputed because the path has changed.
* This means that the glyph positions of the text need to be recomputed.
*/
nsChangeHint_UpdateTextPath = 0x40000
nsChangeHint_UpdateTextPath = 0x20000
// IMPORTANT NOTE: When adding new hints, consider whether you need to
// add them to NS_HintsNotHandledForDescendantsIn() below.

View File

@ -731,16 +731,6 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
printf("\n");
#endif
if (mCurrentSpan == mRootSpan) {
pfd->mFrame->Properties().Remove(nsIFrame::LineBaselineOffset());
} else {
#ifdef DEBUG
bool hasLineOffset;
pfd->mFrame->Properties().Get(nsIFrame::LineBaselineOffset(), &hasLineOffset);
NS_ASSERTION(!hasLineOffset, "LineBaselineOffset was set but was not expected");
#endif
}
mTextJustificationNumSpaces = 0;
mTextJustificationNumLetters = 0;
@ -1462,6 +1452,22 @@ nsLineLayout::BlockDirAlignLine()
}
PlaceStartEndFrames(psd, -mBStartEdge, lineBSize);
// If the frame being reflowed has text decorations, we simulate the
// propagation of those decorations to a line-level element by storing the
// offset in a frame property on any child frames that are aligned in the
// block direction somewhere other than the baseline. This property is then
// used by nsTextFrame::GetTextDecorations when the same conditions are met.
if (rootPFD.mFrame->StyleContext()->HasTextDecorationLines()) {
for (const PerFrameData* pfd = psd->mFirstFrame; pfd; pfd = pfd->mNext) {
const nsIFrame *const f = pfd->mFrame;
if (f->VerticalAlignEnum() != NS_STYLE_VERTICAL_ALIGN_BASELINE) {
const nscoord offset = baselineBCoord - pfd->mBounds.BStart(lineWM);
f->Properties().Set(nsIFrame::LineBaselineOffset(),
NS_INT32_TO_PTR(offset));
}
}
}
// Fill in returned line-box and max-element-width data
mLineBox->SetBounds(lineWM,
psd->mIStart, mBStartEdge,

View File

@ -4620,40 +4620,6 @@ PaintSelectionBackground(gfxContext* aCtx, nsPresContext* aPresContext,
}
}
// Attempt to get the LineBaselineOffset property of aChildFrame
// If not set, calculate this value for all child frames of aBlockFrame
static nscoord
LazyGetLineBaselineOffset(nsIFrame* aChildFrame, nsBlockFrame* aBlockFrame)
{
bool offsetFound;
nscoord offset = NS_PTR_TO_INT32(
aChildFrame->Properties().Get(nsIFrame::LineBaselineOffset(), &offsetFound)
);
if (!offsetFound) {
for (nsBlockFrame::line_iterator line = aBlockFrame->begin_lines(),
line_end = aBlockFrame->end_lines();
line != line_end; line++) {
if (line->IsInline()) {
int32_t n = line->GetChildCount();
nscoord lineBaseline = line->BStart() + line->GetAscent();
for (nsIFrame* lineFrame = line->mFirstChild;
n > 0; lineFrame = lineFrame->GetNextSibling(), --n) {
offset = lineBaseline - lineFrame->GetNormalPosition().y;
lineFrame->Properties().Set(nsIFrame::LineBaselineOffset(),
NS_INT32_TO_PTR(offset));
}
}
}
return NS_PTR_TO_INT32(
aChildFrame->Properties().Get(nsIFrame::LineBaselineOffset(), &offsetFound)
);
} else {
return offset;
}
}
void
nsTextFrame::GetTextDecorations(
nsPresContext* aPresContext,
@ -4697,8 +4663,7 @@ nsTextFrame::GetTextDecorations(
nsLayoutUtils::GetColor(f, eCSSProperty_text_decoration_color);
}
nsBlockFrame* fBlock = nsLayoutUtils::GetAsBlock(f);
const bool firstBlock = !nearestBlockFound && fBlock;
const bool firstBlock = !nearestBlockFound && nsLayoutUtils::GetAsBlock(f);
// Not updating positions once we hit a parent block is equivalent to
// the CSS 2.1 spec that blocks should propagate decorations down to their
@ -4709,15 +4674,13 @@ nsTextFrame::GetTextDecorations(
if (firstBlock) {
// At this point, fChild can't be null since TextFrames can't be blocks
if (fChild->VerticalAlignEnum() != NS_STYLE_VERTICAL_ALIGN_BASELINE) {
// Since offset is the offset in the child's coordinate space, we have
// to undo the accumulation to bring the transform out of the block's
// coordinate space
const nscoord lineBaselineOffset = LazyGetLineBaselineOffset(fChild,
fBlock);
baselineOffset =
frameTopOffset - fChild->GetNormalPosition().y - lineBaselineOffset;
frameTopOffset - fChild->GetNormalPosition().y
- NS_PTR_TO_INT32(
fChild->Properties().Get(nsIFrame::LineBaselineOffset()));
}
}
else if (!nearestBlockFound) {
@ -4801,7 +4764,7 @@ GetInflationForTextDecorations(nsIFrame* aFrame, nscoord aInflationMinFontSize)
void
nsTextFrame::UnionAdditionalOverflow(nsPresContext* aPresContext,
nsIFrame* aBlock,
const nsHTMLReflowState& aBlockReflowState,
PropertyProvider& aProvider,
nsRect* aVisualOverflowRect,
bool aIncludeTextDecorations)
@ -4814,8 +4777,8 @@ nsTextFrame::UnionAdditionalOverflow(nsPresContext* aPresContext,
if (IsFloatingFirstLetterChild()) {
// The underline/overline drawable area must be contained in the overflow
// rect when this is in floating first letter frame at *both* modes.
// In this case, aBlock is the ::first-letter frame.
uint8_t decorationStyle = aBlock->StyleContext()->
nsIFrame* firstLetterFrame = aBlockReflowState.frame;
uint8_t decorationStyle = firstLetterFrame->StyleContext()->
StyleTextReset()->GetDecorationStyle();
// If the style is none, let's include decoration line rect as solid style
// since changing the style from none to solid/dotted/dashed doesn't cause
@ -4859,7 +4822,7 @@ nsTextFrame::UnionAdditionalOverflow(nsPresContext* aPresContext,
GetTextDecorations(aPresContext, eResolvedColors, textDecs);
if (textDecs.HasDecorationLines()) {
nscoord inflationMinFontSize =
nsLayoutUtils::InflationMinFontSizeFor(aBlock);
nsLayoutUtils::InflationMinFontSizeFor(aBlockReflowState.frame);
const nscoord width = GetSize().width;
const gfxFloat appUnitsPerDevUnit = aPresContext->AppUnitsPerDevPixel(),
@ -8044,7 +8007,7 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
// When we have text decorations, we don't need to compute their overflow now
// because we're guaranteed to do it later
// (see nsLineLayout::RelativePositionFrames)
UnionAdditionalOverflow(presContext, aLineLayout.LineContainerRS()->frame,
UnionAdditionalOverflow(presContext, *aLineLayout.LineContainerRS(),
provider, &aMetrics.VisualOverflow(), false);
/////////////////////////////////////////////////////////////////////
@ -8286,7 +8249,7 @@ nsTextFrame::RecomputeOverflow(const nsHTMLReflowState& aBlockReflowState)
&provider);
nsRect &vis = result.VisualOverflow();
vis.UnionRect(vis, RoundOut(textMetrics.mBoundingBox) + nsPoint(0, mAscent));
UnionAdditionalOverflow(PresContext(), aBlockReflowState.frame, provider,
UnionAdditionalOverflow(PresContext(), aBlockReflowState, provider,
&vis, true);
return result;
}
@ -8577,36 +8540,3 @@ nsTextFrame::HasAnyNoncollapsedCharacters()
int32_t skippedOffsetEnd = iter.ConvertOriginalToSkipped(offsetEnd);
return skippedOffset != skippedOffsetEnd;
}
bool
nsTextFrame::UpdateOverflow()
{
nsRect rect(nsPoint(0, 0), GetSize());
nsOverflowAreas overflowAreas(rect, rect);
if (GetStateBits() & NS_FRAME_FIRST_REFLOW) {
return false;
}
gfxSkipCharsIterator iter = EnsureTextRun(nsTextFrame::eInflated);
if (!mTextRun) {
return false;
}
PropertyProvider provider(this, iter, nsTextFrame::eInflated);
provider.InitializeForDisplay(true);
nsIFrame*decorationsBlock;
if (IsFloatingFirstLetterChild()) {
decorationsBlock = GetParent();
} else {
for (nsIFrame* f = this; f; f = f->GetParent()) {
nsBlockFrame* fBlock = nsLayoutUtils::GetAsBlock(f);
if (fBlock) {
decorationsBlock = fBlock;
break;
}
}
}
UnionAdditionalOverflow(PresContext(), decorationsBlock, provider,
&overflowAreas.VisualOverflow(), true);
return FinishAndStoreOverflow(overflowAreas, GetSize());
}

View File

@ -519,8 +519,6 @@ public:
bool IsFloatingFirstLetterChild() const;
virtual bool UpdateOverflow() MOZ_OVERRIDE;
protected:
virtual ~nsTextFrame();
@ -554,7 +552,7 @@ protected:
SelectionDetails* GetSelectionDetails();
void UnionAdditionalOverflow(nsPresContext* aPresContext,
nsIFrame* aBlock,
const nsHTMLReflowState& aBlockReflowState,
PropertyProvider& aProvider,
nsRect* aVisualOverflowRect,
bool aIncludeTextDecorations);

View File

@ -1,21 +0,0 @@
<html>
<head>
<style>
.underline {
text-decoration: underline;
}
.align-bottom {
vertical-align: bottom;
}
.align-top {
vertical-align: top;
}
</style>
</head>
<body>
<p class="underline">
<span class="align-bottom">This</span> line has a bottom vertical align span. <br />
<span class="align-top">This</span> line has a top vertical align span.
</p>
</body>
</html>

View File

@ -1,26 +0,0 @@
<html class="reftest-wait">
<head>
<script type="text/javascript">
function addUnderline() {
var element = document.getElementById("dynamicUnderline");
element.style.textDecoration = "underline";
document.documentElement.removeAttribute("class");
}
document.addEventListener('MozReftestInvalidate', addUnderline, false);
</script>
<style>
.align-bottom {
vertical-align: bottom;
}
.align-top {
vertical-align: top;
}
</style>
</head>
<body>
<p id="dynamicUnderline">
<span class="align-bottom">This</span> line has a bottom vertical align span. <br />
<span class="align-top">This</span> line has a top vertical align span.
</p>
</body>
</html>

View File

@ -1,21 +0,0 @@
<html>
<head>
<style>
.underline {
text-decoration: underline;
}
.align-bottom {
vertical-align: bottom;
}
.align-top {
vertical-align: top;
}
</style>
</head>
<body>
<p class="underline">
<span class="align-bottom">This line has only a bottom vertical align span.</span> <br />
<span class="align-top">This line has a top vertical align span.</span>
</p>
</body>
</html>

View File

@ -1,26 +0,0 @@
<html class="reftest-wait">
<head>
<script type="text/javascript">
function addUnderline() {
var element = document.getElementById("dynamicUnderline");
element.style.textDecoration = "underline";
document.documentElement.removeAttribute("class");
}
document.addEventListener('MozReftestInvalidate', addUnderline, false);
</script>
<style>
.align-bottom {
vertical-align: bottom;
}
.align-top {
vertical-align: top;
}
</style>
</head>
<body>
<p id="dynamicUnderline">
<span class="align-bottom">This line has only a bottom vertical align span.</span> <br />
<span class="align-top">This line has a top vertical align span.</span>
</p>
</body>
</html>

View File

@ -1,22 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<style>
.underline {
text-decoration: underline;
}
.align-bottom {
vertical-align: bottom;
}
.align-top {
vertical-align: top;
}
</style>
</head>
<body>
<p class="underline">
<span class="align-bottom">This</span> line has a bottom vertical align span. <br />
<span class="align-top">This</span> line has a top vertical align span.
</p>
</body>
</html>

View File

@ -1,27 +0,0 @@
<!DOCTYPE html>
<html class="reftest-wait">
<head>
<script type="text/javascript">
function addUnderline() {
var element = document.getElementById("dynamicUnderline");
element.style.textDecoration = "underline";
document.documentElement.removeAttribute("class");
}
document.addEventListener('MozReftestInvalidate', addUnderline, false);
</script>
<style>
.align-bottom {
vertical-align: bottom;
}
.align-top {
vertical-align: top;
}
</style>
</head>
<body>
<p id="dynamicUnderline">
<span class="align-bottom">This</span> line has a bottom vertical align span. <br />
<span class="align-top">This</span> line has a top vertical align span.
</p>
</body>
</html>

View File

@ -1,22 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<style>
.underline {
text-decoration: underline;
}
.align-bottom {
vertical-align: bottom;
}
.align-top {
vertical-align: top;
}
</style>
</head>
<body>
<p class="underline">
<span class="align-bottom">This line has only a bottom vertical align span.</span> <br />
<span class="align-top">This line has a top vertical align span.</span>
</p>
</body>
</html>

View File

@ -1,27 +0,0 @@
<!DOCTYPE html>
<html class="reftest-wait">
<head>
<script type="text/javascript">
function addUnderline() {
var element = document.getElementById("dynamicUnderline");
element.style.textDecoration = "underline";
document.documentElement.removeAttribute("class");
}
document.addEventListener('MozReftestInvalidate', addUnderline, false);
</script>
<style>
.align-bottom {
vertical-align: bottom;
}
.align-top {
vertical-align: top;
}
</style>
</head>
<body>
<p id="dynamicUnderline">
<span class="align-bottom">This line has only a bottom vertical align span.</span> <br />
<span class="align-top">This line has a top vertical align span.</span>
</p>
</body>
</html>

View File

@ -4,10 +4,6 @@ skip-if(B2G) == complex-decoration-style-standards.html complex-decoration-style
== decoration-color-standards.html decoration-color-standards-ref.html
== decoration-style-quirks.html decoration-style-quirks-ref.html
== decoration-style-standards.html decoration-style-standards-ref.html
== dynamic-underline-vertical-align-quirks-1.html dynamic-underline-vertical-align-quirks-1-ref.html
== dynamic-underline-vertical-align-standards-1.html dynamic-underline-vertical-align-standards-1-ref.html
== dynamic-underline-vertical-align-quirks-2.html dynamic-underline-vertical-align-quirks-2-ref.html
== dynamic-underline-vertical-align-standards-2.html dynamic-underline-vertical-align-standards-2-ref.html
== line-through-style-block-solid-quirks.html line-through-style-block-quirks-ref.html
!= line-through-style-block-dotted-quirks.html line-through-style-block-quirks-ref.html
!= line-through-style-block-dashed-quirks.html line-through-style-block-quirks-ref.html

View File

@ -2992,11 +2992,17 @@ nsChangeHint nsStyleTextReset::CalcDifference(const nsStyleTextReset& aOther) co
uint8_t otherLineStyle = aOther.GetDecorationStyle();
if (mTextDecorationLine != aOther.mTextDecorationLine ||
lineStyle != otherLineStyle) {
// Reflow for decoration line style changes only to or from double or
// wave because that may cause overflow area changes
if (lineStyle == NS_STYLE_TEXT_DECORATION_STYLE_DOUBLE ||
lineStyle == NS_STYLE_TEXT_DECORATION_STYLE_WAVY ||
otherLineStyle == NS_STYLE_TEXT_DECORATION_STYLE_DOUBLE ||
otherLineStyle == NS_STYLE_TEXT_DECORATION_STYLE_WAVY) {
return NS_STYLE_HINT_REFLOW;
}
// Repaint for other style decoration lines because they must be in
// default overflow rect
nsChangeHint hint = NS_STYLE_HINT_VISUAL;
NS_UpdateHint(hint, nsChangeHint_UpdateSubtreeOverflow);
return hint;
return NS_STYLE_HINT_VISUAL;
}
// Repaint for decoration color changes

View File

@ -1480,9 +1480,7 @@ struct nsStyleTextReset {
nsChangeHint CalcDifference(const nsStyleTextReset& aOther) const;
static nsChangeHint MaxDifference() {
return nsChangeHint(
NS_STYLE_HINT_REFLOW |
nsChangeHint_UpdateSubtreeOverflow);
return NS_STYLE_HINT_REFLOW;
}
static nsChangeHint MaxDifferenceNeverInherited() {
// CalcDifference never returns nsChangeHint_NeedReflow or