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

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

Issue 1278543002: Include the whole outline into visual overflow (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Avoid the global map 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
Index: Source/core/layout/LayoutBlockFlowLine.cpp
diff --git a/Source/core/layout/LayoutBlockFlowLine.cpp b/Source/core/layout/LayoutBlockFlowLine.cpp
index 1c192276d25404ba9e39b814d1c0683b9308e72a..816578bb988803eb82c703b81b29d5006d9b5332 100644
--- a/Source/core/layout/LayoutBlockFlowLine.cpp
+++ b/Source/core/layout/LayoutBlockFlowLine.cpp
@@ -1490,6 +1490,11 @@ void LayoutBlockFlow::computeInlinePreferredLogicalWidths(LayoutUnit& minLogical
maxLogicalWidth = std::max(maxLogicalWidth, inlineMax);
}
+static bool isInlineWithOutlineAndContinuation(const LayoutObject& o)
+{
+ return o.isLayoutInline() && o.styleRef().hasOutline() && !o.isElementContinuation() && toLayoutInline(o).continuation();
+}
+
void LayoutBlockFlow::layoutInlineChildren(bool relayoutChildren, LayoutUnit& paintInvalidationLogicalTop, LayoutUnit& paintInvalidationLogicalBottom, LayoutUnit afterEdge)
{
LayoutFlowThread* flowThread = flowThreadContainingBlock();
@@ -1523,6 +1528,8 @@ void LayoutBlockFlow::layoutInlineChildren(bool relayoutChildren, LayoutUnit& pa
if (hasTextOverflow)
deleteEllipsisLineBoxes();
+ setContainsInlineWithOutlineAndContinuation(false);
chrishtr 2015/08/27 18:20:59 If the DOM changes to remove all inline children,
Xianzhu 2015/08/27 19:23:12 Nice catch. Done.
+
if (firstChild()) {
// In full layout mode, clear the line boxes of children upfront. Otherwise,
// siblings can run into stale root lineboxes during layout. Then layout
@@ -1567,6 +1574,9 @@ void LayoutBlockFlow::layoutInlineChildren(bool relayoutChildren, LayoutUnit& pa
}
if (!o->isText() || !toLayoutText(o)->isAllCollapsibleWhitespace())
lastChild = o;
+
+ if (!containsInlineWithOutlineAndContinuation() && isInlineWithOutlineAndContinuation(*o))
chrishtr 2015/08/27 18:20:59 What's the point of checking for !containsInlineWi
Xianzhu 2015/08/27 19:23:12 Was to avoid the cost of isInlineWithOutlineAndCon
+ setContainsInlineWithOutlineAndContinuation(true);
}
// If there is a trailing float on the line that will possibly occur after a natural line break
// then dirty its adjacent lineboxes to ensure it gets placed.
@@ -1859,6 +1869,24 @@ void LayoutBlockFlow::addOverflowFromInlineChildren()
LayoutRect visualOverflow = curr->visualOverflowRect(curr->lineTop(), curr->lineBottom());
addContentsVisualOverflow(visualOverflow);
}
+
+ if (!containsInlineWithOutlineAndContinuation())
+ return;
+
+ // Add outline rects of continuations of descendant inlines into visual overflow of this block.
+ LayoutRect outlineBoundsOfAllContinuations;
+ for (InlineWalker walker(this); !walker.atEnd(); walker.advance()) {
+ const LayoutObject& o = *walker.current();
+ if (!isInlineWithOutlineAndContinuation(o))
+ continue;
+
+ Vector<LayoutRect> outlineRects;
+ toLayoutInline(o).addOutlineRectsForContinuations(outlineRects, LayoutPoint());
+ LayoutRect outlineBounds = unionRect(outlineRects);
+ outlineBounds.inflate(o.styleRef().outlineOutsetExtent());
+ outlineBoundsOfAllContinuations.unite(outlineBounds);
+ }
+ addContentsVisualOverflow(outlineBoundsOfAllContinuations);
}
void LayoutBlockFlow::deleteEllipsisLineBoxes()

Powered by Google App Engine
This is Rietveld 408576698