Index: third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp |
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp |
index 97baaabca2d756ceb2d1776496e7c67f0d518d3c..8fe7d43f5ac5b76e17c0e90cc91bb191f0b09f51 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp |
@@ -3191,4 +3191,42 @@ void LayoutBlockFlow::showLineTreeAndMark(const InlineBox* markedBox1, const cha |
#endif |
+void LayoutBlockFlow::addOutlineRects(Vector<LayoutRect>& rects, const LayoutPoint& additionalOffset, IncludeBlockVisualOverflowOrNot includeBlockOverflows) const |
+{ |
+ // For blocks inside inlines, we go ahead and include margins so that we run right up to the |
+ // inline boxes above and below us (thus getting merged with them to form a single irregular |
+ // shape). |
+ const LayoutInline* inlineElementContinuation = this->inlineElementContinuation(); |
+ if (inlineElementContinuation) { |
+ // FIXME: This check really isn't accurate. |
+ bool nextInlineHasLineBox = inlineElementContinuation->firstLineBox(); |
+ // FIXME: This is wrong. The principal layoutObject may not be the continuation preceding this block. |
+ // FIXME: This is wrong for vertical writing-modes. |
+ // https://bugs.webkit.org/show_bug.cgi?id=46781 |
+ bool prevInlineHasLineBox = toLayoutInline(inlineElementContinuation->node()->layoutObject())->firstLineBox(); |
+ LayoutUnit topMargin = prevInlineHasLineBox ? collapsedMarginBefore() : LayoutUnit(); |
+ LayoutUnit bottomMargin = nextInlineHasLineBox ? collapsedMarginAfter() : LayoutUnit(); |
+ if (topMargin || bottomMargin) { |
+ LayoutRect rect(additionalOffset, size()); |
+ rect.expandEdges(topMargin, LayoutUnit(), bottomMargin, LayoutUnit()); |
+ rects.append(rect); |
+ } |
+ } |
+ |
+ LayoutBlock::addOutlineRects(rects, additionalOffset, includeBlockOverflows); |
+ |
+ if (includeBlockOverflows == IncludeBlockVisualOverflow && !hasOverflowClip() && !hasControlClip()) { |
+ for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox()) { |
+ LayoutUnit top = std::max<LayoutUnit>(curr->lineTop(), curr->top()); |
+ LayoutUnit bottom = std::min<LayoutUnit>(curr->lineBottom(), curr->top() + curr->height()); |
+ LayoutRect rect(additionalOffset.x() + curr->x(), additionalOffset.y() + top, curr->width(), bottom - top); |
+ if (!rect.isEmpty()) |
+ rects.append(rect); |
+ } |
+ } |
+ |
+ if (inlineElementContinuation) |
+ inlineElementContinuation->addOutlineRects(rects, additionalOffset + (inlineElementContinuation->containingBlock()->location() - location()), includeBlockOverflows); |
+} |
+ |
} // namespace blink |