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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 7 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 1705 matching lines...) Expand 10 before | Expand all | Expand 10 after
1716 if (!curr->IsFloatingOrOutOfFlowPositioned()) { 1716 if (!curr->IsFloatingOrOutOfFlowPositioned()) {
1717 int result = curr->FirstLineBoxBaseline(); 1717 int result = curr->FirstLineBoxBaseline();
1718 if (result != -1) 1718 if (result != -1)
1719 return (curr->LogicalTop() + result) 1719 return (curr->LogicalTop() + result)
1720 .ToInt(); // Translate to our coordinate space. 1720 .ToInt(); // Translate to our coordinate space.
1721 } 1721 }
1722 } 1722 }
1723 return -1; 1723 return -1;
1724 } 1724 }
1725 1725
1726 bool LayoutBlock::UseLogicalBottomMarginEdgeForInlineBlockBaseline() const {
1727 // CSS2.1 states that the baseline of an 'inline-block' is:
1728 // the baseline of the last line box in the normal flow, unless it has
1729 // either no in-flow line boxes or if its 'overflow' property has a computed
1730 // value other than 'visible', in which case the baseline is the bottom
1731 // margin edge.
1732 // We likewise avoid using the last line box in the case of size containment,
1733 // where the block's contents shouldn't be considered when laying out its
1734 // ancestors or siblings.
1735 return (!Style()->IsOverflowVisible() &&
1736 !ShouldIgnoreOverflowPropertyForInlineBlockBaseline()) ||
1737 Style()->ContainsSize();
1738 }
1739
1726 int LayoutBlock::InlineBlockBaseline(LineDirectionMode line_direction) const { 1740 int LayoutBlock::InlineBlockBaseline(LineDirectionMode line_direction) const {
1727 DCHECK(!ChildrenInline()); 1741 DCHECK(!ChildrenInline());
1728 if ((!Style()->IsOverflowVisible() && 1742 if (UseLogicalBottomMarginEdgeForInlineBlockBaseline()) {
1729 !ShouldIgnoreOverflowPropertyForInlineBlockBaseline()) ||
1730 Style()->ContainsSize()) {
1731 // We are not calling LayoutBox::baselinePosition here because the caller 1743 // We are not calling LayoutBox::baselinePosition here because the caller
1732 // should add the margin-top/margin-right, not us. 1744 // should add the margin-top/margin-right, not us.
1733 return (line_direction == kHorizontalLine ? Size().Height() + MarginBottom() 1745 return (line_direction == kHorizontalLine ? Size().Height() + MarginBottom()
1734 : Size().Width() + MarginLeft()) 1746 : Size().Width() + MarginLeft())
1735 .ToInt(); 1747 .ToInt();
1736 } 1748 }
1737 1749
1738 if (IsWritingModeRoot() && !IsRubyRun()) 1750 if (IsWritingModeRoot() && !IsRubyRun())
1739 return -1; 1751 return -1;
1740 1752
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
2184 bool LayoutBlock::HasDefiniteLogicalHeight() const { 2196 bool LayoutBlock::HasDefiniteLogicalHeight() const {
2185 return AvailableLogicalHeightForPercentageComputation() != LayoutUnit(-1); 2197 return AvailableLogicalHeightForPercentageComputation() != LayoutUnit(-1);
2186 } 2198 }
2187 2199
2188 bool LayoutBlock::NeedsPreferredWidthsRecalculation() const { 2200 bool LayoutBlock::NeedsPreferredWidthsRecalculation() const {
2189 return (HasRelativeLogicalHeight() && Style()->LogicalWidth().IsAuto()) || 2201 return (HasRelativeLogicalHeight() && Style()->LogicalWidth().IsAuto()) ||
2190 LayoutBox::NeedsPreferredWidthsRecalculation(); 2202 LayoutBox::NeedsPreferredWidthsRecalculation();
2191 } 2203 }
2192 2204
2193 } // namespace blink 2205 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698