Changeset 224773 in webkit


Ignore:
Timestamp:
Nov 13, 2017 1:14:46 PM (6 years ago)
Author:
Antti Koivisto
Message:

Don't eliminate whitespace renderer if the previous sibling is a text renderer
https://bugs.webkit.org/show_bug.cgi?id=179620

Reviewed by Zalan Bujtas.

Source/WebCore:

Currently whitespace elimination code doesn't consider runs of text renderers. We should always make whitespace
renderer if the previous renderer is a text renderer. The behavior should be the same as if those were a single
renderer with merged text. This situation can happen easily with display:contents.

This fixes the remaining flexbox failures in display:contents tests.

  • style/RenderTreeUpdater.cpp:

(WebCore::RenderTreeUpdater::textRendererIsNeeded):

We need a renderer if the previous rendere is RenderText.

LayoutTests:

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r224772 r224773  
     12017-11-13  Antti Koivisto  <antti@apple.com>
     2
     3        Don't eliminate whitespace renderer if the previous sibling is a text renderer
     4        https://bugs.webkit.org/show_bug.cgi?id=179620
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        * TestExpectations:
     9
    1102017-11-13  Chris Dumez  <cdumez@apple.com>
    211
  • trunk/LayoutTests/TestExpectations

    r224730 r224773  
    13791379### START OF display: contents failures
    13801380
    1381 webkit.org/b/157477 imported/w3c/web-platform-tests/css/css-display-3/display-contents-flex-003.html [ ImageOnlyFailure ]
    13821381webkit.org/b/157477 imported/w3c/web-platform-tests/css/css-display-3/display-contents-dynamic-table-001-inline.html [ ImageOnlyFailure ]
    1383 webkit.org/b/157477 imported/w3c/web-platform-tests/css/css-display-3/display-contents-dynamic-flex-002-none.html [ ImageOnlyFailure ]
    1384 webkit.org/b/157477 imported/w3c/web-platform-tests/css/css-display-3/display-contents-flex-002.html [ ImageOnlyFailure ]
    13851382webkit.org/b/157477 imported/w3c/web-platform-tests/css/css-display-3/display-flow-root-001.html [ ImageOnlyFailure ]
    1386 webkit.org/b/157477 imported/w3c/web-platform-tests/css/css-display-3/display-contents-dynamic-flex-003-none.html [ ImageOnlyFailure ]
    1387 webkit.org/b/157477 imported/w3c/web-platform-tests/css/css-display-3/display-contents-dynamic-flex-002-inline.html [ ImageOnlyFailure ]
    1388 webkit.org/b/157477 imported/w3c/web-platform-tests/css/css-display-3/display-contents-dynamic-flex-003-inline.html [ ImageOnlyFailure ]
    13891383
    13901384### END OF display: contents failures
  • trunk/Source/WebCore/ChangeLog

    r224772 r224773  
     12017-11-13  Antti Koivisto  <antti@apple.com>
     2
     3        Don't eliminate whitespace renderer if the previous sibling is a text renderer
     4        https://bugs.webkit.org/show_bug.cgi?id=179620
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        Currently whitespace elimination code doesn't consider runs of text renderers. We should always make whitespace
     9        renderer if the previous renderer is a text renderer. The behavior should be the same as if those were a single
     10        renderer with merged text. This situation can happen easily with display:contents.
     11
     12        This fixes the remaining flexbox failures in display:contents tests.
     13
     14        * style/RenderTreeUpdater.cpp:
     15        (WebCore::RenderTreeUpdater::textRendererIsNeeded):
     16
     17        We need a renderer if the previous rendere is RenderText.
     18
    1192017-11-13  Chris Dumez  <cdumez@apple.com>
    220
  • trunk/Source/WebCore/style/RenderTreeUpdater.cpp

    r224360 r224773  
    399399bool RenderTreeUpdater::textRendererIsNeeded(const Text& textNode)
    400400{
    401     const RenderElement& parentRenderer = renderTreePosition().parent();
     401    auto& renderingParent = this->renderingParent();
     402    auto& parentRenderer = renderingParent.renderTreePosition->parent();
    402403    if (!parentRenderer.canHaveChildren())
    403404        return false;
     
    410411    if (!textNode.containsOnlyWhitespace())
    411412        return true;
     413    if (is<RenderText>(renderingParent.previousChildRenderer))
     414        return true;
    412415    // This text node has nothing but white space. We may still need a renderer in some cases.
    413     if (parentRenderer.isTable() || parentRenderer.isTableRow() || parentRenderer.isTableSection() || parentRenderer.isRenderTableCol() || parentRenderer.isFrameSet() || (parentRenderer.isFlexibleBox() && !parentRenderer.isRenderButton()))
     416    if (parentRenderer.isTable() || parentRenderer.isTableRow() || parentRenderer.isTableSection() || parentRenderer.isRenderTableCol() || parentRenderer.isFrameSet())
     417        return false;
     418    if (parentRenderer.isFlexibleBox() && !parentRenderer.isRenderButton())
    414419        return false;
    415420    if (parentRenderer.style().preserveNewline()) // pre/pre-wrap/pre-line always make renderers.
    416421        return true;
    417422
    418     auto* previousRenderer = renderingParent().previousChildRenderer;
     423    auto* previousRenderer = renderingParent.previousChildRenderer;
    419424    if (previousRenderer && previousRenderer->isBR()) // <span><br/> <br/></span>
    420425        return false;
Note: See TracChangeset for help on using the changeset viewer.