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

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

Issue 2867293002: [LayoutNG] Compute baseline from fragment tree (Closed)
Patch Set: Cleanup Created 3 years, 5 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/LayoutBlock.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
index 403034d33a600615a5bb2b6ac676e12bcf7f600a..68b55f5c4543d58dc23872407c9f683329de62e5 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
@@ -1723,11 +1723,23 @@ int LayoutBlock::FirstLineBoxBaseline() const {
return -1;
}
+bool LayoutBlock::UseLogicalBottomMarginEdgeForInlineBlockBaseline() const {
+ // CSS2.1 states that the baseline of an 'inline-block' is:
+ // the baseline of the last line box in the normal flow, unless it has
+ // either no in-flow line boxes or if its 'overflow' property has a computed
+ // value other than 'visible', in which case the baseline is the bottom
+ // margin edge.
+ // We likewise avoid using the last line box in the case of size containment,
+ // where the block's contents shouldn't be considered when laying out its
+ // ancestors or siblings.
+ return (!Style()->IsOverflowVisible() &&
+ !ShouldIgnoreOverflowPropertyForInlineBlockBaseline()) ||
+ Style()->ContainsSize();
+}
+
int LayoutBlock::InlineBlockBaseline(LineDirectionMode line_direction) const {
DCHECK(!ChildrenInline());
- if ((!Style()->IsOverflowVisible() &&
- !ShouldIgnoreOverflowPropertyForInlineBlockBaseline()) ||
- Style()->ContainsSize()) {
+ if (UseLogicalBottomMarginEdgeForInlineBlockBaseline()) {
// We are not calling LayoutBox::baselinePosition here because the caller
// should add the margin-top/margin-right, not us.
return (line_direction == kHorizontalLine ? Size().Height() + MarginBottom()

Powered by Google App Engine
This is Rietveld 408576698