Changeset 108111 in webkit


Ignore:
Timestamp:
Feb 17, 2012 1:10:42 PM (12 years ago)
Author:
robert@webkit.org
Message:

REGRESSION: empty span creates renders with non-zero height
https://bugs.webkit.org/show_bug.cgi?id=76465

Reviewed by David Hyatt.

Source/WebCore:

Tests: fast/css/empty-span.html

fast/css/non-empty-span.html

Empty inlines with line-height, vertical-alignment or font metrics should only get a linebox if there is some
other content in the line. So only create line boxes for such elements on lines that are not empty.

This patch fixes a regression where an empty inline with line-height was propagating its height to an empty line.
It also fixes cases where lines with content that had a leading empty inline element weren't respecting the
vertical alignment or font-height of the empty inline.

  • rendering/RenderBlockLineLayout.cpp:

(WebCore::RenderBlock::constructLine): only create line boxes for lines that are not empty.
(WebCore::requiresLineBoxForContent): an inline flow with line-height, vertical-alignment, or font-size

will need a linebox if the rest of the line is not empty.

(WebCore):
(WebCore::alwaysRequiresLineBox): rename from inlineFlowRequiresLineBox.
(WebCore::requiresLineBox):
(WebCore::RenderBlock::LineBreaker::nextLineBreak): if the inline flow definitely requires a line, mark

the line non-empty - otherwise hold off.

LayoutTests:

  • fast/css/empty-span-expected.html: Added.
  • fast/css/empty-span.html: Added.
  • fast/css/non-empty-span.html: Added.
  • platform/chromium/test_expectations.txt: Suppress result until rebaseline on MAC and WIN.
  • platform/chromium-linux-x86/fast/css/non-empty-span-expected.png: Added.
  • platform/chromium-linux-x86/fast/css/non-empty-span-expected.txt: Added.
Location:
trunk
Files:
5 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r108109 r108111  
     12012-01-23  Robert Hogan  <robert@webkit.org>
     2
     3        REGRESSION: empty span creates renders with non-zero height
     4        https://bugs.webkit.org/show_bug.cgi?id=76465
     5
     6        Reviewed by David Hyatt.
     7
     8        * fast/css/empty-span-expected.html: Added.
     9        * fast/css/empty-span.html: Added.
     10        * fast/css/non-empty-span.html: Added.
     11        * platform/chromium/test_expectations.txt: Suppress result until rebaseline on MAC and WIN.
     12        * platform/chromium-linux-x86/fast/css/non-empty-span-expected.png: Added.
     13        * platform/chromium-linux-x86/fast/css/non-empty-span-expected.txt: Added.
     14
    1152012-02-17  Abhishek Arya  <inferno@chromium.org>
    216
  • trunk/LayoutTests/platform/chromium/test_expectations.txt

    r108088 r108111  
    42074207// Started failing http://trac.webkit.org/log/?verbose=on&rev=107837&stop_rev=107836
    42084208BUGWK78755 : compositing/culling/scrolled-within-boxshadow.html = IMAGE
     4209
     4210// Needs baselines for MAC and WIN.
     4211BUGWK76465 MAC WIN : fast/css/non-empty-span.html = IMAGE+TEXT
  • trunk/Source/WebCore/ChangeLog

    r108110 r108111  
     12012-01-23  Robert Hogan  <robert@webkit.org>
     2
     3        REGRESSION: empty span creates renders with non-zero height
     4        https://bugs.webkit.org/show_bug.cgi?id=76465
     5
     6        Reviewed by David Hyatt.
     7
     8        Tests: fast/css/empty-span.html
     9               fast/css/non-empty-span.html
     10
     11        Empty inlines with line-height, vertical-alignment or font metrics should only get a linebox if there is some
     12        other content in the line. So only create line boxes for such elements on lines that are not empty.
     13
     14        This patch fixes a regression where an empty inline with line-height was propagating its height to an empty line.
     15        It also fixes cases where lines with content that had a leading empty inline element weren't respecting the
     16        vertical alignment or font-height of the empty inline.
     17
     18        * rendering/RenderBlockLineLayout.cpp:
     19        (WebCore::RenderBlock::constructLine): only create line boxes for lines that are not empty.
     20        (WebCore::requiresLineBoxForContent): an inline flow with line-height, vertical-alignment, or font-size
     21         will need a linebox if the rest of the line is not empty.
     22        (WebCore):
     23        (WebCore::alwaysRequiresLineBox): rename from inlineFlowRequiresLineBox.
     24        (WebCore::requiresLineBox):
     25        (WebCore::RenderBlock::LineBreaker::nextLineBreak): if the inline flow definitely requires a line, mark
     26         the line non-empty - otherwise hold off.
     27
    1282012-02-17  Raymond Toy  <rtoy@google.com>
    229
  • trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp

    r107880 r108111  
    491491        if (runCount == 2 && !r->m_object->isListMarker())
    492492            isOnlyRun = (!style()->isLeftToRightDirection() ? bidiRuns.lastRun() : bidiRuns.firstRun())->m_object->isListMarker();
     493
     494        if (lineInfo.isEmpty())
     495            continue;
    493496
    494497        InlineBox* box = createInlineBoxForRenderer(r->m_object, false, isOnlyRun);
     
    18321835}
    18331836
    1834 static bool inlineFlowRequiresLineBox(RenderInline* flow, const LineInfo& lineInfo)
     1837static bool requiresLineBoxForContent(RenderInline* flow, const LineInfo& lineInfo)
     1838{
     1839    RenderObject* parent = flow->parent();
     1840    if (flow->document()->inNoQuirksMode()
     1841        && (flow->style(lineInfo.isFirstLine())->lineHeight() != parent->style(lineInfo.isFirstLine())->lineHeight()
     1842        || flow->style()->verticalAlign() != parent->style()->verticalAlign()
     1843        || !parent->style()->font().fontMetrics().hasIdenticalAscentDescentAndLineGap(flow->style()->font().fontMetrics())))
     1844        return true;
     1845    return false;
     1846}
     1847
     1848static bool alwaysRequiresLineBox(RenderInline* flow, const LineInfo& lineInfo)
    18351849{
    18361850    // FIXME: Right now, we only allow line boxes for inlines that are truly empty.
    18371851    // We need to fix this, though, because at the very least, inlines containing only
    18381852    // ignorable whitespace should should also have line boxes.
    1839     if (!flow->document()->inQuirksMode() && flow->style(lineInfo.isFirstLine())->lineHeight() != flow->parent()->style(lineInfo.isFirstLine())->lineHeight())
    1840         return true;
    1841 
    18421853    return !flow->firstChild() && flow->hasInlineDirectionBordersPaddingOrMargin();
    18431854}
     
    18481859        return false;
    18491860
    1850     if (it.m_obj->isRenderInline() && !inlineFlowRequiresLineBox(toRenderInline(it.m_obj), lineInfo))
     1861    if (it.m_obj->isRenderInline() && !alwaysRequiresLineBox(toRenderInline(it.m_obj), lineInfo) && !requiresLineBoxForContent(toRenderInline(it.m_obj), lineInfo))
    18511862        return false;
    18521863
     
    22362247            // If this object is at the start of the line, we need to behave like list markers and
    22372248            // start ignoring spaces.
    2238             if (inlineFlowRequiresLineBox(flowBox, lineInfo)) {
    2239                 lineInfo.setEmpty(false, m_block, &width);
     2249            bool requiresLineBox = alwaysRequiresLineBox(flowBox, lineInfo);
     2250            if (requiresLineBox || requiresLineBoxForContent(flowBox, lineInfo)) {
     2251                // An empty inline that only has line-height, vertical-align or font-metrics will only get a
     2252                // line box to affect the height of the line if the rest of the line is not empty.
     2253                if (requiresLineBox)
     2254                    lineInfo.setEmpty(false, m_block, &width);
    22402255                if (ignoringSpaces) {
    22412256                    trailingObjects.clear();
Note: See TracChangeset for help on using the changeset viewer.