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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp

Issue 1959623002: Move line-specific parts of addOutlineRects() into LayoutBlockFlow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 | « third_party/WebKit/Source/core/layout/LayoutBlockFlow.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlockFlow.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698