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

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

Issue 2826153002: Don't assume line-height properties can't change between text and its container.
Patch Set: Don't assume line-height properties can't change between text and its container. 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/css-display-3/display-contents-line-height-expected.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc.
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 const ComputedStyle& parent_style, 84 const ComputedStyle& parent_style,
85 const ComputedStyle& child_style, 85 const ComputedStyle& child_style,
86 bool is_root) { 86 bool is_root) {
87 return parent_style.HasIdenticalAscentDescentAndLineGap(child_style) && 87 return parent_style.HasIdenticalAscentDescentAndLineGap(child_style) &&
88 parent_style.LineHeight() == child_style.LineHeight() && 88 parent_style.LineHeight() == child_style.LineHeight() &&
89 (parent_style.VerticalAlign() == EVerticalAlign::kBaseline || 89 (parent_style.VerticalAlign() == EVerticalAlign::kBaseline ||
90 is_root) && 90 is_root) &&
91 child_style.VerticalAlign() == EVerticalAlign::kBaseline; 91 child_style.VerticalAlign() == EVerticalAlign::kBaseline;
92 } 92 }
93 93
94 static inline bool ParentIsDOMParent(LineLayoutItem parent,
95 LineLayoutItem child) {
96 return child.GetNode() &&
97 FlatTreeTraversal::Parent(*child.GetNode()) == parent.GetNode();
eae 2017/04/21 10:54:52 Can child.GetNode() ever be null? Might be worth a
98 }
99
94 void InlineFlowBox::AddToLine(InlineBox* child) { 100 void InlineFlowBox::AddToLine(InlineBox* child) {
95 DCHECK(!child->Parent()); 101 DCHECK(!child->Parent());
96 DCHECK(!child->NextOnLine()); 102 DCHECK(!child->NextOnLine());
97 DCHECK(!child->PrevOnLine()); 103 DCHECK(!child->PrevOnLine());
98 CheckConsistency(); 104 CheckConsistency();
99 105
100 child->SetParent(this); 106 child->SetParent(this);
101 if (!first_child_) { 107 if (!first_child_) {
102 first_child_ = child; 108 first_child_ = child;
103 last_child_ = child; 109 last_child_ = child;
(...skipping 18 matching lines...) Expand all
122 const ComputedStyle& parent_style = 128 const ComputedStyle& parent_style =
123 GetLineLayoutItem().StyleRef(IsFirstLineStyle()); 129 GetLineLayoutItem().StyleRef(IsFirstLineStyle());
124 const ComputedStyle& child_style = 130 const ComputedStyle& child_style =
125 child->GetLineLayoutItem().StyleRef(IsFirstLineStyle()); 131 child->GetLineLayoutItem().StyleRef(IsFirstLineStyle());
126 bool root = IsRootInlineBox(); 132 bool root = IsRootInlineBox();
127 bool should_clear_descendants_have_same_line_height_and_baseline = false; 133 bool should_clear_descendants_have_same_line_height_and_baseline = false;
128 if (child->GetLineLayoutItem().IsAtomicInlineLevel()) { 134 if (child->GetLineLayoutItem().IsAtomicInlineLevel()) {
129 should_clear_descendants_have_same_line_height_and_baseline = true; 135 should_clear_descendants_have_same_line_height_and_baseline = true;
130 } else if (child->IsText()) { 136 } else if (child->IsText()) {
131 if (child->GetLineLayoutItem().IsBR() || 137 if (child->GetLineLayoutItem().IsBR() ||
132 (child->GetLineLayoutItem().Parent() != GetLineLayoutItem())) { 138 child->GetLineLayoutItem().Parent() != GetLineLayoutItem() ||
139 !ParentIsDOMParent(GetLineLayoutItem(), child->GetLineLayoutItem())) {
133 if (!HasIdenticalLineHeightProperties(parent_style, child_style, root)) 140 if (!HasIdenticalLineHeightProperties(parent_style, child_style, root))
134 should_clear_descendants_have_same_line_height_and_baseline = true; 141 should_clear_descendants_have_same_line_height_and_baseline = true;
135 } 142 }
136 if (child_style.HasTextCombine() || 143 if (child_style.HasTextCombine() ||
137 child_style.GetTextEmphasisMark() != kTextEmphasisMarkNone) 144 child_style.GetTextEmphasisMark() != kTextEmphasisMarkNone)
138 should_clear_descendants_have_same_line_height_and_baseline = true; 145 should_clear_descendants_have_same_line_height_and_baseline = true;
139 } else { 146 } else {
140 if (child->GetLineLayoutItem().IsBR()) { 147 if (child->GetLineLayoutItem().IsBR()) {
141 // FIXME: This is dumb. We only turn off because current layout test 148 // FIXME: This is dumb. We only turn off because current layout test
142 // results expect the <br> to be 0-height on the baseline. 149 // results expect the <br> to be 0-height on the baseline.
(...skipping 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after
1753 DCHECK_EQ(child->prevOnLine(), prev); 1760 DCHECK_EQ(child->prevOnLine(), prev);
1754 prev = child; 1761 prev = child;
1755 } 1762 }
1756 DCHECK_EQ(prev, m_lastChild); 1763 DCHECK_EQ(prev, m_lastChild);
1757 #endif 1764 #endif
1758 } 1765 }
1759 1766
1760 #endif 1767 #endif
1761 1768
1762 } // namespace blink 1769 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/css-display-3/display-contents-line-height-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698