Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Unified Diff: Source/core/rendering/RenderInline.cpp

Issue 538213002: Cleanup RenderInline style propagation to continuations (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/rendering/RenderInline.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderInline.cpp
diff --git a/Source/core/rendering/RenderInline.cpp b/Source/core/rendering/RenderInline.cpp
index c9dfa1fe9c3de2aa59f46a6e8fedd6159886ce8d..67ae0146d9a2c768192f80e26794519c4f44e42e 100644
--- a/Source/core/rendering/RenderInline.cpp
+++ b/Source/core/rendering/RenderInline.cpp
@@ -162,10 +162,11 @@ static void updateStyleOfAnonymousBlockContinuations(RenderObject* block, const
if (!toRenderBlock(block)->isAnonymousBlockContinuation())
continue;
+ RefPtr<RenderStyle> newBlockStyle;
+
if (!block->style()->isOutlineEquivalent(newStyle)) {
- RefPtr<RenderStyle> blockStyle = RenderStyle::clone(block->style());
- blockStyle->setOutlineFromStyle(*newStyle);
- block->setStyle(blockStyle);
+ newBlockStyle = RenderStyle::clone(block->style());
+ newBlockStyle->setOutlineFromStyle(*newStyle);
}
if (block->style()->position() != newStyle->position()) {
@@ -174,12 +175,13 @@ static void updateStyleOfAnonymousBlockContinuations(RenderObject* block, const
if (oldStyle->hasInFlowPosition()
&& inFlowPositionedInlineAncestor(toRenderBlock(block)->inlineElementContinuation()))
continue;
- // FIXME: We should share blockStyle with the outline case, but it fails layout tests
- // for dynamic position change of inlines containing block continuations. crbug.com/405222.
- RefPtr<RenderStyle> blockStyle = RenderStyle::createAnonymousStyleWithDisplay(block->style(), BLOCK);
- blockStyle->setPosition(newStyle->position());
- block->setStyle(blockStyle);
+ if (!newBlockStyle)
+ newBlockStyle = RenderStyle::clone(block->style());
+ newBlockStyle->setPosition(newStyle->position());
}
+
+ if (newBlockStyle)
+ block->setStyle(newBlockStyle);
}
}
@@ -202,8 +204,8 @@ void RenderInline::styleDidChange(StyleDifference diff, const RenderStyle* oldSt
currCont->setContinuation(nextCont);
}
- // If an inline's in-flow positioning has changed then any descendant blocks will need to change their in-flow positioning accordingly.
- // Do this by updating the position of the descendant blocks' containing anonymous blocks - there may be more than one.
+ // If an inline's outline or in-flow positioning has changed then any descendant blocks will need to change their styles accordingly.
+ // Do this by updating the styles of the descendant blocks' containing anonymous blocks - there may be more than one.
if (continuation && oldStyle
&& (!newStyle->isOutlineEquivalent(oldStyle)
|| (newStyle->position() != oldStyle->position() && (newStyle->hasInFlowPosition() || oldStyle->hasInFlowPosition())))) {
@@ -223,18 +225,6 @@ void RenderInline::styleDidChange(StyleDifference diff, const RenderStyle* oldSt
}
}
-void RenderInline::setContinuation(RenderBoxModelObject* continuation)
-{
- RenderBoxModelObject::setContinuation(continuation);
- if (continuation && continuation->isAnonymousBlock() && !continuation->style()->isOutlineEquivalent(style())) {
- // Push outline style to the block continuation.
- RefPtr<RenderStyle> blockStyle = RenderStyle::clone(continuation->style());
- blockStyle->setOutlineFromStyle(*style());
- continuation->setStyle(blockStyle);
- }
- // FIXME: What if continuation is added when the inline has relative position? crbug.com/405222.
-}
-
void RenderInline::updateAlwaysCreateLineBoxes(bool fullLayout)
{
// Once we have been tainted once, just assume it will happen again. This way effects like hover highlighting that change the
@@ -349,6 +339,9 @@ void RenderInline::addChildIgnoringContinuation(RenderObject* newChild, RenderOb
if (RenderObject* positionedAncestor = inFlowPositionedInlineAncestor(this))
newStyle->setPosition(positionedAncestor->style()->position());
+ if (!newStyle->isOutlineEquivalent(style()))
Julien - ping for review 2014/09/05 19:57:35 I would put a comment here to explain why this is
Xianzhu 2014/09/05 22:04:16 Done.
+ newStyle->setOutlineFromStyle(*style());
+
RenderBlockFlow* newBox = RenderBlockFlow::createAnonymous(&document());
newBox->setStyle(newStyle.release());
RenderBoxModelObject* oldContinuation = continuation();
« no previous file with comments | « Source/core/rendering/RenderInline.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698