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

Unified Diff: third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp

Issue 2602793004: Fix positioning of "text-underline-position:under" for multi-elements (Closed)
Patch Set: drott nit Created 3 years, 11 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: third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp
diff --git a/third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp b/third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp
index a3e77bff32e661a5b1991a9f7d9c25338410e0e6..8cf6584280359c5ce6c998f17cbdd35acdcb1626 100644
--- a/third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp
+++ b/third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp
@@ -888,20 +888,58 @@ void InlineFlowBox::placeBoxesInBlockDirection(
}
}
-void InlineFlowBox::computeMaxLogicalTop(LayoutUnit& maxLogicalTop) const {
+LayoutUnit InlineFlowBox::maxLogicalBottomForUnderline(
+ LineLayoutItem decorationObject,
+ LayoutUnit maxLogicalBottom) const {
for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
if (curr->getLineLayoutItem().isOutOfFlowPositioned())
continue; // Positioned placeholders don't affect calculations.
- if (descendantsHaveSameLineHeightAndBaseline())
+ // If the text decoration isn't in effect on the child, it must be outside
+ // of |decorationObject|.
+ if (!(curr->lineStyleRef().textDecorationsInEffect() &
+ TextDecorationUnderline))
continue;
- maxLogicalTop = std::max<LayoutUnit>(maxLogicalTop, curr->y());
- LayoutUnit localMaxLogicalTop;
- if (curr->isInlineFlowBox())
- toInlineFlowBox(curr)->computeMaxLogicalTop(localMaxLogicalTop);
- maxLogicalTop = std::max<LayoutUnit>(maxLogicalTop, localMaxLogicalTop);
+ if (decorationObject && decorationObject.isLayoutInline() &&
+ !isAncestorAndWithinBlock(decorationObject, curr->getLineLayoutItem()))
+ continue;
+
+ if (curr->isInlineFlowBox()) {
+ maxLogicalBottom = toInlineFlowBox(curr)->maxLogicalBottomForUnderline(
+ decorationObject, maxLogicalBottom);
+ } else if (curr->isInlineTextBox()) {
+ maxLogicalBottom = std::max(maxLogicalBottom, curr->logicalBottom());
+ }
+ }
+ return maxLogicalBottom;
+}
+
+LayoutUnit InlineFlowBox::minLogicalTopForUnderline(
+ LineLayoutItem decorationObject,
+ LayoutUnit minLogicalTop) const {
+ for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
+ if (curr->getLineLayoutItem().isOutOfFlowPositioned())
+ continue; // Positioned placeholders don't affect calculations.
+
+ // If the text decoration isn't in effect on the child, it must be outside
+ // of |decorationObject|.
+ if (!(curr->lineStyleRef().textDecorationsInEffect() &
+ TextDecorationUnderline))
+ continue;
+
+ if (decorationObject && decorationObject.isLayoutInline() &&
+ !isAncestorAndWithinBlock(decorationObject, curr->getLineLayoutItem()))
+ continue;
+
+ if (curr->isInlineFlowBox()) {
+ minLogicalTop = toInlineFlowBox(curr)->minLogicalTopForUnderline(
+ decorationObject, minLogicalTop);
+ } else if (curr->isInlineTextBox()) {
+ minLogicalTop = std::min(minLogicalTop, curr->logicalTop());
+ }
}
+ return minLogicalTop;
}
void InlineFlowBox::flipLinesInBlockDirection(LayoutUnit lineTop,
« no previous file with comments | « third_party/WebKit/Source/core/layout/line/InlineFlowBox.h ('k') | third_party/WebKit/Source/core/layout/line/RootInlineBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698