⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 181387 in webkit


Ignore:
Timestamp:
Mar 11, 2015, 7:41:01 AM (11 years ago)
Author:
mmaxfield@apple.com
Message:

Inline block children do not have correct baselines if their children are also block elements
https://bugs.webkit.org/show_bug.cgi?id=142559

Patch by Myles C. Maxfield <mmaxfield@apple.com> on 2015-03-11
Reviewed by Darin Adler.

Source/WebCore:

Perform the same computation on child block elements as child inline elements.

Test: fast/text/baseline-inline-block-block-children.html

  • rendering/RenderBlockFlow.cpp:

(WebCore::RenderBlockFlow::inlineBlockBaseline):

LayoutTests:

  • fast/text/baseline-inline-block-block-children-expected.html: Added.
  • fast/text/baseline-inline-block-block-children.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r181367 r181387  
     12015-03-11  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        Inline block children do not have correct baselines if their children are also block elements
     4        https://bugs.webkit.org/show_bug.cgi?id=142559
     5
     6        Reviewed by Darin Adler.
     7
     8        * fast/text/baseline-inline-block-block-children-expected.html: Added.
     9        * fast/text/baseline-inline-block-block-children.html: Added.
     10
    1112015-03-10  Joseph Pecoraro  <pecoraro@apple.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r181385 r181387  
     12015-03-11  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        Inline block children do not have correct baselines if their children are also block elements
     4        https://bugs.webkit.org/show_bug.cgi?id=142559
     5
     6        Reviewed by Darin Adler.
     7
     8        Perform the same computation on child block elements as child inline elements.
     9
     10        Test: fast/text/baseline-inline-block-block-children.html
     11
     12        * rendering/RenderBlockFlow.cpp:
     13        (WebCore::RenderBlockFlow::inlineBlockBaseline):
     14
    1152015-03-11  Carlos Alberto Lopez Perez  <clopez@igalia.com>
    216
  • trunk/Source/WebCore/rendering/RenderBlockFlow.cpp

    r181292 r181387  
    30123012        return -1;
    30133013
    3014     if (!childrenInline())
    3015         return RenderBlock::inlineBlockBaseline(lineDirection);
    3016 
    3017     if (!hasLines()) {
    3018         if (!hasLineIfEmpty())
    3019             return -1;
    3020         const FontMetrics& fontMetrics = firstLineStyle().fontMetrics();
    3021         return fontMetrics.ascent()
    3022              + (lineHeight(true, lineDirection, PositionOfInteriorLineBoxes) - fontMetrics.height()) / 2
    3023              + (lineDirection == HorizontalLine ? borderTop() + paddingTop() : borderRight() + paddingRight());
    3024     }
    3025 
    30263014    // Note that here we only take the left and bottom into consideration. Our caller takes the right and top into consideration.
    30273015    float boxHeight = lineDirection == HorizontalLine ? height() + m_marginBox.bottom() : width() + m_marginBox.left();
    30283016    float lastBaseline;
    3029     if (auto simpleLineLayout = this->simpleLineLayout())
    3030         lastBaseline = SimpleLineLayout::computeFlowLastLineBaseline(*this, *simpleLineLayout);
     3017    if (!childrenInline())
     3018        lastBaseline = RenderBlock::inlineBlockBaseline(lineDirection);
    30313019    else {
    3032         bool isFirstLine = lastRootBox() == firstRootBox();
    3033         const RenderStyle& style = isFirstLine ? firstLineStyle() : this->style();
    3034         lastBaseline = lastRootBox()->logicalTop() + style.fontMetrics().ascent(lastRootBox()->baselineType());
     3020        if (!hasLines()) {
     3021            if (!hasLineIfEmpty())
     3022                return -1;
     3023            const auto& fontMetrics = firstLineStyle().fontMetrics();
     3024            return fontMetrics.ascent()
     3025                + (lineHeight(true, lineDirection, PositionOfInteriorLineBoxes) - fontMetrics.height()) / 2
     3026                + (lineDirection == HorizontalLine ? borderTop() + paddingTop() : borderRight() + paddingRight());
     3027        }
     3028
     3029        if (auto simpleLineLayout = this->simpleLineLayout())
     3030            lastBaseline = SimpleLineLayout::computeFlowLastLineBaseline(*this, *simpleLineLayout);
     3031        else {
     3032            bool isFirstLine = lastRootBox() == firstRootBox();
     3033            const auto& style = isFirstLine ? firstLineStyle() : this->style();
     3034            lastBaseline = lastRootBox()->logicalTop() + style.fontMetrics().ascent(lastRootBox()->baselineType());
     3035        }
    30353036    }
    30363037    // According to the CSS spec http://www.w3.org/TR/CSS21/visudet.html, we shouldn't be performing this min, but should
Note: See TracChangeset for help on using the changeset viewer.