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

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

Issue 2643413002: Fix 'text-underline-position: under' to use em height ascent/descent (Closed)
Patch Set: eae review Created 3 years, 8 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 3ccb629a003aa5a9be1522ea1f7ff8471c46fb8a..8522e467abc5153821f02689c3cafd215300ab21 100644
--- a/third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp
+++ b/third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp
@@ -898,36 +898,11 @@ void InlineFlowBox::PlaceBoxesInBlockDirection(
}
}
-LayoutUnit InlineFlowBox::MaxLogicalBottomForUnderline(
- LineLayoutItem decoration_object,
- LayoutUnit max_logical_bottom) 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() &
- kTextDecorationUnderline))
- continue;
-
- if (decoration_object && decoration_object.IsLayoutInline() &&
- !IsAncestorAndWithinBlock(decoration_object, curr->GetLineLayoutItem()))
- continue;
-
- if (curr->IsInlineFlowBox()) {
- max_logical_bottom = ToInlineFlowBox(curr)->MaxLogicalBottomForUnderline(
- decoration_object, max_logical_bottom);
- } else if (curr->IsInlineTextBox()) {
- max_logical_bottom = std::max(max_logical_bottom, curr->LogicalBottom());
- }
- }
- return max_logical_bottom;
-}
-
-LayoutUnit InlineFlowBox::MinLogicalTopForUnderline(
- LineLayoutItem decoration_object,
- LayoutUnit min_logical_top) const {
+LayoutUnit InlineFlowBox::FarthestPositionForUnderline(
+ LineLayoutItem decorating_box,
+ LineVerticalPositionType position_type,
+ FontBaseline baseline_type,
+ LayoutUnit farthest) const {
for (InlineBox* curr = FirstChild(); curr; curr = curr->NextOnLine()) {
if (curr->GetLineLayoutItem().IsOutOfFlowPositioned())
continue; // Positioned placeholders don't affect calculations.
@@ -938,18 +913,23 @@ LayoutUnit InlineFlowBox::MinLogicalTopForUnderline(
kTextDecorationUnderline))
continue;
- if (decoration_object && decoration_object.IsLayoutInline() &&
- !IsAncestorAndWithinBlock(decoration_object, curr->GetLineLayoutItem()))
+ if (decorating_box && decorating_box.IsLayoutInline() &&
+ !IsAncestorAndWithinBlock(decorating_box, curr->GetLineLayoutItem()))
continue;
if (curr->IsInlineFlowBox()) {
- min_logical_top = ToInlineFlowBox(curr)->MinLogicalTopForUnderline(
- decoration_object, min_logical_top);
+ farthest = ToInlineFlowBox(curr)->FarthestPositionForUnderline(
+ decorating_box, position_type, baseline_type, farthest);
} else if (curr->IsInlineTextBox()) {
- min_logical_top = std::min(min_logical_top, curr->LogicalTop());
+ LayoutUnit position =
+ ToInlineTextBox(curr)->VerticalPosition(position_type, baseline_type);
+ if (IsLineOverSide(position_type))
+ farthest = std::min(farthest, position);
+ else
+ farthest = std::max(farthest, position);
}
}
- return min_logical_top;
+ return farthest;
}
void InlineFlowBox::FlipLinesInBlockDirection(LayoutUnit line_top,

Powered by Google App Engine
This is Rietveld 408576698