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

Unified Diff: Source/core/layout/LayoutInline.cpp

Issue 1224933002: Combine outline and focus ring code paths (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix empty focus ring on Mac Created 5 years, 4 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/layout/LayoutBlock.cpp ('k') | Source/core/layout/LayoutObject.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/LayoutInline.cpp
diff --git a/Source/core/layout/LayoutInline.cpp b/Source/core/layout/LayoutInline.cpp
index c08cc126bb756663b9c169e2c5a98e4b24e0b932..a72248614be36d9b406d346c03ac60e93da8ad2b 100644
--- a/Source/core/layout/LayoutInline.cpp
+++ b/Source/core/layout/LayoutInline.cpp
@@ -68,19 +68,6 @@ LayoutInline* LayoutInline::createAnonymous(Document* document)
void LayoutInline::willBeDestroyed()
{
-#if ENABLE(ASSERT)
- // Make sure we do not retain "this" in the continuation outline table map of our containing blocks.
- if (parent() && style()->visibility() == VISIBLE && style()->hasOutline()) {
- bool containingBlockPaintsContinuationOutline = continuation() || isInlineElementContinuation();
- if (containingBlockPaintsContinuationOutline) {
- if (LayoutBlock* cb = containingBlock()) {
- if (LayoutBlock* cbCb = cb->containingBlock())
- ASSERT(!cbCb->paintsContinuationOutline(this));
- }
- }
- }
-#endif
-
// Make sure to destroy anonymous children first while they are still connected to the rest of the tree, so that they will
// properly dirty line boxes that they are removed from. Effects that do :before/:after only on hover could crash otherwise.
children()->destroyLeftoverChildren();
@@ -152,31 +139,19 @@ static LayoutObject* inFlowPositionedInlineAncestor(LayoutObject* p)
return nullptr;
}
-static void updateStyleOfAnonymousBlockContinuations(LayoutObject* block, const ComputedStyle& newStyle, const ComputedStyle& oldStyle, LayoutObject* containingBlockOfEndOfContinuation)
+static void updateInFlowPositionOfAnonymousBlockContinuations(LayoutObject* block, const ComputedStyle& newStyle, const ComputedStyle& oldStyle, LayoutObject* containingBlockOfEndOfContinuation)
{
- // If an inline's outline or in-flow positioning has changed then any descendant blocks will need to change their styles accordingly.
- bool updateOutline = !newStyle.isOutlineEquivalent(&oldStyle);
- bool updatePosition = newStyle.position() != oldStyle.position() && (newStyle.hasInFlowPosition() || oldStyle.hasInFlowPosition());
- if (!updateOutline && !updatePosition)
- return;
-
for (; block && block != containingBlockOfEndOfContinuation && block->isAnonymousBlock(); block = block->nextSibling()) {
if (!toLayoutBlock(block)->isAnonymousBlockContinuation())
continue;
- RefPtr<ComputedStyle> newBlockStyle = ComputedStyle::clone(block->styleRef());
-
- if (updateOutline)
- newBlockStyle->setOutlineFromStyle(newStyle);
-
- if (updatePosition) {
- // If we are no longer in-flow positioned but our descendant block(s) still have an in-flow positioned ancestor then
- // their containing anonymous block should keep its in-flow positioning.
- if (oldStyle.hasInFlowPosition() && inFlowPositionedInlineAncestor(toLayoutBlock(block)->inlineElementContinuation()))
- continue;
- newBlockStyle->setPosition(newStyle.position());
- }
+ // If we are no longer in-flow positioned but our descendant block(s) still have an in-flow positioned ancestor then
+ // their containing anonymous block should keep its in-flow positioning.
+ if (oldStyle.hasInFlowPosition() && inFlowPositionedInlineAncestor(toLayoutBlock(block)->inlineElementContinuation()))
+ continue;
+ RefPtr<ComputedStyle> newBlockStyle = ComputedStyle::clone(block->styleRef());
+ newBlockStyle->setPosition(newStyle.position());
block->setStyle(newBlockStyle);
}
}
@@ -205,8 +180,11 @@ void LayoutInline::styleDidChange(StyleDifference diff, const ComputedStyle* old
if (continuation && oldStyle) {
ASSERT(endOfContinuation);
LayoutObject* block = containingBlock()->nextSibling();
- if (block && block->isAnonymousBlock())
- updateStyleOfAnonymousBlockContinuations(block, newStyle, *oldStyle, endOfContinuation->containingBlock());
+ // If an inline's in-flow positioning has changed then any descendant blocks will need to change their styles accordingly.
+ if (block && block->isAnonymousBlock()
+ && newStyle.position() != oldStyle->position()
+ && (newStyle.hasInFlowPosition() || oldStyle->hasInFlowPosition()))
+ updateInFlowPositionOfAnonymousBlockContinuations(block, newStyle, *oldStyle, endOfContinuation->containingBlock());
}
if (!alwaysCreateLineBoxes()) {
@@ -336,10 +314,6 @@ void LayoutInline::addChildIgnoringContinuation(LayoutObject* newChild, LayoutOb
if (LayoutObject* positionedAncestor = inFlowPositionedInlineAncestor(this))
newStyle->setPosition(positionedAncestor->style()->position());
- // Push outline style to the block continuation.
- if (!newStyle->isOutlineEquivalent(style()))
- newStyle->setOutlineFromStyle(*style());
-
LayoutBlockFlow* newBox = LayoutBlockFlow::createAnonymous(&document());
newBox->setStyle(newStyle.release());
LayoutBoxModelObject* oldContinuation = continuation();
« no previous file with comments | « Source/core/layout/LayoutBlock.cpp ('k') | Source/core/layout/LayoutObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698