Changeset 140693 in webkit


Ignore:
Timestamp:
Jan 24, 2013 10:46:11 AM (11 years ago)
Author:
robert@webkit.org
Message:

Inline Containing Only Collapsed Whitespace Not Getting a Linebox
https://bugs.webkit.org/show_bug.cgi?id=31397

Reviewed by David Hyatt.

Source/WebCore:

Treat inlines containing only collapsed whitespace as empty. This allows them
to get a linebox.

Test: fast/inline/inline-containing-collapsed-whitespace-treated-as-empty.html

  • dom/Position.cpp:

(WebCore::boundingBoxLogicalHeight):
(WebCore):
(WebCore::Position::hasRenderedNonAnonymousDescendantsWithHeight):

  • rendering/InlineIterator.h:

(WebCore::isEmptyInline):
(WebCore):
(WebCore::bidiNextShared):
(WebCore::bidiFirstSkippingEmptyInlines):

  • rendering/RenderBlockLineLayout.cpp:

(WebCore::alwaysRequiresLineBox):
(WebCore::requiresLineBox):
(WebCore::RenderBlock::LineBreaker::nextSegmentBreak):

  • rendering/RenderText.cpp:
  • rendering/RenderText.h:

(RenderText):

LayoutTests:

  • fast/css/first-letter-capitalized-edit-select-crash-expected.txt:
  • fast/inline/inline-containing-collapsed-whitespace-treated-as-empty-expected.html: Added.
  • fast/inline/inline-containing-collapsed-whitespace-treated-as-empty-vertical-rl-expected.html: Added.
  • fast/inline/inline-containing-collapsed-whitespace-treated-as-empty-vertical-rl.html: Added.
  • fast/inline/inline-containing-collapsed-whitespace-treated-as-empty.html: Added.
  • platform/chromium/TestExpectations:
  • platform/efl/TestExpectations:
  • platform/gtk/TestExpectations:
  • platform/mac/TestExpectations:
  • platform/qt/TestExpectations:
Location:
trunk
Files:
4 added
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r140691 r140693  
     12013-01-22  Robert Hogan  <robert@webkit.org>
     2
     3        Inline Containing Only Collapsed Whitespace Not Getting a Linebox
     4        https://bugs.webkit.org/show_bug.cgi?id=31397
     5
     6        Reviewed by David Hyatt.
     7
     8        * fast/css/first-letter-capitalized-edit-select-crash-expected.txt:
     9        * fast/inline/inline-containing-collapsed-whitespace-treated-as-empty-expected.html: Added.
     10        * fast/inline/inline-containing-collapsed-whitespace-treated-as-empty-vertical-rl-expected.html: Added.
     11        * fast/inline/inline-containing-collapsed-whitespace-treated-as-empty-vertical-rl.html: Added.
     12        * fast/inline/inline-containing-collapsed-whitespace-treated-as-empty.html: Added.
     13        * platform/chromium/TestExpectations:
     14        * platform/efl/TestExpectations:
     15        * platform/gtk/TestExpectations:
     16        * platform/mac/TestExpectations:
     17        * platform/qt/TestExpectations:
     18
    1192013-01-24  Andrey Lushnikov  <lushnikov@chromium.org>
    220
  • trunk/LayoutTests/fast/css/first-letter-capitalized-edit-select-crash-expected.txt

    r117197 r140693  
    11Pass if no crash or assert in debug
     2 
    23
    3 
  • trunk/LayoutTests/platform/chromium/TestExpectations

    r140670 r140693  
    43344334webkit.org/b/107579 [ Debug ] media/track/track-css-property-whitelist.html [ Crash ]
    43354335
     4336# Rebaseline required after https://webkit.org/b/31397
     4337webkit.org/b/107567 svg/batik/text/xmlSpace.svg [ Failure ]
     4338webkit.org/b/107567 fast/text/capitalize-empty-generated-string.html [ Failure ]
     4339webkit.org/b/107567 fast/text/whitespace/007.html [ Failure ]
     4340webkit.org/b/107567 fast/text/whitespace/006.html [ Failure ]
     4341webkit.org/b/107567 fast/inline/drawStyledEmptyInlinesWithWS.html [ Failure ]
     4342webkit.org/b/107567 tables/mozilla/bugs/bug1318.html [ Failure ]
     4343webkit.org/b/107567 fast/inline/drawStyledEmptyInlines.html [ Failure ]
     4344webkit.org/b/107567 tables/mozilla/bugs/bug113235-3.html [ Failure ]
     4345webkit.org/b/107567 css2.1/t0505-c16-descendant-01-e.html [ Failure ]
     4346webkit.org/b/107567 tables/mozilla/bugs/bug1188.html [ Failure ]
     4347webkit.org/b/107567 editing/selection/extend-by-sentence-001.html [ Failure ]
     4348webkit.org/b/107567 svg/carto.net/combobox.svg [ Failure ]
  • trunk/LayoutTests/platform/efl/TestExpectations

    r140679 r140693  
    18161816webkit.org/b/107476 fast/block/float/024.html [ Failure ]
    18171817webkit.org/b/107476 fast/block/margin-collapse/empty-clear-blocks.html [ Failure ]
     1818
     1819# Rebaseline required after https://webkit.org/b/31397
     1820webkit.org/b/107567 svg/batik/text/xmlSpace.svg [ Failure ]
     1821webkit.org/b/107567 fast/text/capitalize-empty-generated-string.html [ Failure ]
     1822webkit.org/b/107567 fast/text/whitespace/007.html [ Failure ]
     1823webkit.org/b/107567 fast/text/whitespace/006.html [ Failure ]
     1824webkit.org/b/107567 fast/inline/drawStyledEmptyInlinesWithWS.html [ Failure ]
     1825webkit.org/b/107567 tables/mozilla/bugs/bug1318.html [ Failure ]
     1826webkit.org/b/107567 fast/inline/drawStyledEmptyInlines.html [ Failure ]
     1827webkit.org/b/107567 tables/mozilla/bugs/bug113235-3.html [ Failure ]
     1828webkit.org/b/107567 css2.1/t0505-c16-descendant-01-e.html [ Failure ]
     1829webkit.org/b/107567 tables/mozilla/bugs/bug1188.html [ Failure ]
     1830webkit.org/b/107567 editing/selection/extend-by-sentence-001.html [ Failure ]
     1831webkit.org/b/107567 svg/carto.net/combobox.svg [ Failure ]
  • trunk/LayoutTests/platform/gtk/TestExpectations

    r140687 r140693  
    5858webkit.org/b/107476 fast/block/margin-collapse/empty-clear-blocks.html [ Failure ]
    5959
     60# Rebaseline required after https://webkit.org/b/31397
     61webkit.org/b/107567 svg/batik/text/xmlSpace.svg [ Failure ]
     62webkit.org/b/107567 fast/text/capitalize-empty-generated-string.html [ Failure ]
     63webkit.org/b/107567 fast/text/whitespace/007.html [ Failure ]
     64webkit.org/b/107567 fast/text/whitespace/006.html [ Failure ]
     65webkit.org/b/107567 fast/inline/drawStyledEmptyInlinesWithWS.html [ Failure ]
     66webkit.org/b/107567 tables/mozilla/bugs/bug1318.html [ Failure ]
     67webkit.org/b/107567 fast/inline/drawStyledEmptyInlines.html [ Failure ]
     68webkit.org/b/107567 tables/mozilla/bugs/bug113235-3.html [ Failure ]
     69webkit.org/b/107567 css2.1/t0505-c16-descendant-01-e.html [ Failure ]
     70webkit.org/b/107567 tables/mozilla/bugs/bug1188.html [ Failure ]
     71webkit.org/b/107567 editing/selection/extend-by-sentence-001.html [ Failure ]
     72webkit.org/b/107567 svg/carto.net/combobox.svg [ Failure ]
    6073#////////////////////////////////////////////////////////////////////////////////////////
    6174# Expected failures
  • trunk/LayoutTests/platform/mac/TestExpectations

    r140679 r140693  
    12891289webkit.org/b/107208 fast/regions/overflow-size-change-with-stacking-context.html [ Pass Failure ImageOnlyFailure ]
    12901290
     1291# Rebaseline required after https://webkit.org/b/31397
     1292webkit.org/b/107567 svg/batik/text/xmlSpace.svg [ Failure ]
     1293webkit.org/b/107567 fast/text/capitalize-empty-generated-string.html [ Failure ]
     1294webkit.org/b/107567 fast/text/whitespace/007.html [ Failure ]
     1295webkit.org/b/107567 fast/text/whitespace/006.html [ Failure ]
     1296webkit.org/b/107567 fast/inline/drawStyledEmptyInlinesWithWS.html [ Failure ]
     1297webkit.org/b/107567 tables/mozilla/bugs/bug1318.html [ Failure ]
     1298webkit.org/b/107567 fast/inline/drawStyledEmptyInlines.html [ Failure ]
     1299webkit.org/b/107567 tables/mozilla/bugs/bug113235-3.html [ Failure ]
     1300webkit.org/b/107567 css2.1/t0505-c16-descendant-01-e.html [ Failure ]
     1301webkit.org/b/107567 tables/mozilla/bugs/bug1188.html [ Failure ]
     1302webkit.org/b/107567 editing/selection/extend-by-sentence-001.html [ Failure ]
     1303webkit.org/b/107567 svg/carto.net/combobox.svg [ Failure ]
  • trunk/LayoutTests/platform/qt/TestExpectations

    r140689 r140693  
    25442544webkit.org/b/107476 fast/block/float/024.html [ Failure ]
    25452545webkit.org/b/107476 fast/block/margin-collapse/empty-clear-blocks.html [ Failure ]
     2546
     2547# Rebaseline required after https://webkit.org/b/31397
     2548webkit.org/b/107567 svg/batik/text/xmlSpace.svg [ Failure ]
     2549webkit.org/b/107567 fast/text/capitalize-empty-generated-string.html [ Failure ]
     2550webkit.org/b/107567 fast/text/whitespace/007.html [ Failure ]
     2551webkit.org/b/107567 fast/text/whitespace/006.html [ Failure ]
     2552webkit.org/b/107567 fast/inline/drawStyledEmptyInlinesWithWS.html [ Failure ]
     2553webkit.org/b/107567 tables/mozilla/bugs/bug1318.html [ Failure ]
     2554webkit.org/b/107567 fast/inline/drawStyledEmptyInlines.html [ Failure ]
     2555webkit.org/b/107567 tables/mozilla/bugs/bug113235-3.html [ Failure ]
     2556webkit.org/b/107567 css2.1/t0505-c16-descendant-01-e.html [ Failure ]
     2557webkit.org/b/107567 tables/mozilla/bugs/bug1188.html [ Failure ]
     2558webkit.org/b/107567 editing/selection/extend-by-sentence-001.html [ Failure ]
     2559webkit.org/b/107567 svg/carto.net/combobox.svg [ Failure ]
  • trunk/Source/WebCore/ChangeLog

    r140691 r140693  
     12013-01-22  Robert Hogan  <robert@webkit.org>
     2
     3        Inline Containing Only Collapsed Whitespace Not Getting a Linebox
     4        https://bugs.webkit.org/show_bug.cgi?id=31397
     5
     6        Reviewed by David Hyatt.
     7
     8        Treat inlines containing only collapsed whitespace as empty. This allows them
     9        to get a linebox.
     10
     11        Test: fast/inline/inline-containing-collapsed-whitespace-treated-as-empty.html
     12
     13        * dom/Position.cpp:
     14        (WebCore::boundingBoxLogicalHeight):
     15        (WebCore):
     16        (WebCore::Position::hasRenderedNonAnonymousDescendantsWithHeight):
     17        * rendering/InlineIterator.h:
     18        (WebCore::isEmptyInline):
     19        (WebCore):
     20        (WebCore::bidiNextShared):
     21        (WebCore::bidiFirstSkippingEmptyInlines):
     22        * rendering/RenderBlockLineLayout.cpp:
     23        (WebCore::alwaysRequiresLineBox):
     24        (WebCore::requiresLineBox):
     25        (WebCore::RenderBlock::LineBreaker::nextSegmentBreak):
     26        * rendering/RenderText.cpp:
     27        * rendering/RenderText.h:
     28        (RenderText):
     29
    1302013-01-24  Andrey Lushnikov  <lushnikov@chromium.org>
    231
  • trunk/Source/WebCore/dom/Position.cpp

    r139166 r140693  
    2929#include "CSSComputedStyleDeclaration.h"
    3030#include "HTMLNames.h"
     31#include "InlineIterator.h"
    3132#include "InlineTextBox.h"
    3233#include "Logging.h"
    3334#include "PositionIterator.h"
    3435#include "RenderBlock.h"
     36#include "RenderInline.h"
    3537#include "RenderText.h"
    3638#include "RuntimeEnabledFeatures.h"
     
    842844}
    843845
     846static int boundingBoxLogicalHeight(RenderObject *o, const IntRect &rect)
     847{
     848    return o->style()->isHorizontalWritingMode() ? rect.height() : rect.width();
     849}
     850
    844851bool Position::hasRenderedNonAnonymousDescendantsWithHeight(RenderObject* renderer)
    845852{
     
    847854    for (RenderObject *o = renderer->firstChild(); o && o != stop; o = o->nextInPreOrder())
    848855        if (o->nonPseudoNode()) {
    849             if ((o->isText() && toRenderText(o)->linesLogicalBoundingBox().height())
    850                 || (o->isBox() && toRenderBox(o)->pixelSnappedLogicalHeight()))
     856            if ((o->isText() && boundingBoxLogicalHeight(o, toRenderText(o)->linesBoundingBox()))
     857                || (o->isBox() && toRenderBox(o)->pixelSnappedLogicalHeight())
     858                || (o->isRenderInline() && isEmptyInline(o) && boundingBoxLogicalHeight(o, toRenderInline(o)->linesBoundingBox())))
    851859                return true;
    852860        }
  • trunk/Source/WebCore/rendering/InlineIterator.h

    r139213 r140693  
    177177};
    178178
     179static bool isEmptyInline(RenderObject* object)
     180{
     181    if (!object->isRenderInline())
     182        return false;
     183
     184    if (!object->firstChild())
     185        return true;
     186
     187    return object->firstChild()->isText() && (object->firstChild() == object->lastChild()) && toRenderText(object->firstChild())->isAllCollapsibleWhitespace();
     188}
     189
    179190// FIXME: This function is misleadingly named. It has little to do with bidi.
    180191// This function will iterate over inlines within a block, optionally notifying
     
    226237
    227238        if (isIteratorTarget(next)
    228             || ((emptyInlineBehavior == IncludeEmptyInlines || !next->firstChild()) // Always return EMPTY inlines.
     239            || ((emptyInlineBehavior == IncludeEmptyInlines || isEmptyInline(next)) // Always return EMPTY inlines.
    229240                && next->isRenderInline()))
    230241            break;
     
    266277    if (o->isRenderInline()) {
    267278        notifyObserverEnteredObject(resolver, o);
    268         if (o->firstChild())
     279        if (!isEmptyInline(o))
    269280            o = bidiNextSkippingEmptyInlines(root, o, resolver);
    270281        else {
  • trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp

    r140570 r140693  
    22132213}
    22142214
    2215 static bool alwaysRequiresLineBox(RenderInline* flow)
     2215static bool alwaysRequiresLineBox(RenderObject* flow)
    22162216{
    22172217    // FIXME: Right now, we only allow line boxes for inlines that are truly empty.
    22182218    // We need to fix this, though, because at the very least, inlines containing only
    22192219    // ignorable whitespace should should also have line boxes.
    2220     return !flow->firstChild() && flow->hasInlineDirectionBordersPaddingOrMargin();
     2220    return isEmptyInline(flow) && toRenderInline(flow)->hasInlineDirectionBordersPaddingOrMargin();
    22212221}
    22222222
     
    22262226        return false;
    22272227
    2228     if (it.m_obj->isRenderInline() && !alwaysRequiresLineBox(toRenderInline(it.m_obj)) && !requiresLineBoxForContent(toRenderInline(it.m_obj), lineInfo))
     2228    if (it.m_obj->isRenderInline() && !alwaysRequiresLineBox(it.m_obj) && !requiresLineBoxForContent(toRenderInline(it.m_obj), lineInfo))
    22292229        return false;
    22302230
     
    22332233
    22342234    UChar current = it.current();
    2235     return current != ' ' && current != '\t' && current != softHyphen && (current != '\n' || it.m_obj->preservesNewline())
    2236     && !skipNonBreakingSpace(it, lineInfo);
     2235    bool notJustWhitespace = current != ' ' && current != '\t' && current != softHyphen && (current != '\n' || it.m_obj->preservesNewline()) && !skipNonBreakingSpace(it, lineInfo);
     2236    return notJustWhitespace || isEmptyInline(it.m_obj);
    22372237}
    22382238
     
    26732673        } else if (current.m_obj->isRenderInline()) {
    26742674            // Right now, we should only encounter empty inlines here.
    2675             ASSERT(!current.m_obj->firstChild());
     2675            ASSERT(isEmptyInline(current.m_obj));
    26762676
    26772677            RenderInline* flowBox = toRenderInline(current.m_obj);
     
    26812681            // If this object is at the start of the line, we need to behave like list markers and
    26822682            // start ignoring spaces.
    2683             bool requiresLineBox = alwaysRequiresLineBox(flowBox);
     2683            bool requiresLineBox = alwaysRequiresLineBox(current.m_obj);
    26842684            if (requiresLineBox || requiresLineBoxForContent(flowBox, lineInfo)) {
    26852685                // An empty inline that only has line-height, vertical-align or font-metrics will only get a
  • trunk/Source/WebCore/rendering/RenderText.cpp

    r140244 r140693  
    16151615}
    16161616
    1617 IntRect RenderText::linesLogicalBoundingBox() const
    1618 {
    1619     IntRect rect = linesBoundingBox();
    1620 
    1621     return style()->isHorizontalWritingMode() ? rect : IntRect(rect.x(), rect.y(), rect.height(), rect.width());
    1622 }
    1623 
    16241617LayoutRect RenderText::linesVisualOverflowBoundingBox() const
    16251618{
  • trunk/Source/WebCore/rendering/RenderText.h

    r140640 r140693  
    9797    virtual IntRect linesBoundingBox() const;
    9898    LayoutRect linesVisualOverflowBoundingBox() const;
    99     IntRect linesLogicalBoundingBox() const;
    10099
    101100    FloatPoint firstRunOrigin() const;
Note: See TracChangeset for help on using the changeset viewer.