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

Changeset 243331 in webkit


Ignore:
Timestamp:
Mar 21, 2019, 2:43:14 PM (7 years ago)
Author:
Alan Bujtas
Message:

Do not insert the first-letter anonymous container until after we've constructed the first-letter renderer.
https://bugs.webkit.org/show_bug.cgi?id=195919
<rdar://problem/48573434>

Reviewed by Brent Fulgham.

Source/WebCore:

When the container is injected too early, we might end up removing it as part of the collapsing logic
while the text renderer is being removed (replaced with the first letter + remaining text).

Test: fast/css/first-letter-and-float-crash.html

  • rendering/updating/RenderTreeBuilderFirstLetter.cpp:

(WebCore::RenderTreeBuilder::FirstLetter::createRenderers):

LayoutTests:

  • fast/css/first-letter-and-float-crash-expected.txt: Added.
  • fast/css/first-letter-and-float-crash.html: Added.
  • platform/mac/TestExpectations:
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r243328 r243331  
     12019-03-21  Zalan Bujtas  <zalan@apple.com>
     2
     3        Do not insert the first-letter anonymous container until after we've constructed the first-letter renderer.
     4        https://bugs.webkit.org/show_bug.cgi?id=195919
     5        <rdar://problem/48573434>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        * fast/css/first-letter-and-float-crash-expected.txt: Added.
     10        * fast/css/first-letter-and-float-crash.html: Added.
     11        * platform/mac/TestExpectations:
     12
    1132019-03-21  Eric Carlson  <eric.carlson@apple.com>
    214
  • trunk/LayoutTests/TestExpectations

    r243201 r243331  
    30603060imported/w3c/web-platform-tests/css/css-lists/list-marker-with-lineheight-and-overflow-hidden-001.html [ ImageOnlyFailure ]
    30613061imported/w3c/web-platform-tests/css/css-lists/list-with-image-display-changed-001.html [ ImageOnlyFailure ]
     3062
     3063[ Debug ] fast/css/first-letter-and-float-crash.html [ Skip ]
  • trunk/Source/WebCore/ChangeLog

    r243328 r243331  
     12019-03-21  Zalan Bujtas  <zalan@apple.com>
     2
     3        Do not insert the first-letter anonymous container until after we've constructed the first-letter renderer.
     4        https://bugs.webkit.org/show_bug.cgi?id=195919
     5        <rdar://problem/48573434>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        When the container is injected too early, we might end up removing it as part of the collapsing logic
     10        while the text renderer is being removed (replaced with the first letter + remaining text).
     11
     12        Test: fast/css/first-letter-and-float-crash.html
     13
     14        * rendering/updating/RenderTreeBuilderFirstLetter.cpp:
     15        (WebCore::RenderTreeBuilder::FirstLetter::createRenderers):
     16
    1172019-03-21  Eric Carlson  <eric.carlson@apple.com>
    218
  • trunk/Source/WebCore/rendering/updating/RenderTreeBuilderFirstLetter.cpp

    r233055 r243331  
    218218    newFirstLetter->setIsFirstLetter();
    219219
    220     auto& firstLetter = *newFirstLetter;
    221     m_builder.attach(*firstLetterContainer, WTFMove(newFirstLetter), &currentTextChild);
    222 
    223220    // The original string is going to be either a generated content string or a DOM node's
    224221    // string. We want the original string before it got transformed in case first-letter has
     
    254251        auto* textNode = currentTextChild.textNode();
    255252        auto* beforeChild = currentTextChild.nextSibling();
     253        auto inlineWrapperForDisplayContents = makeWeakPtr(currentTextChild.inlineWrapperForDisplayContents());
     254        auto hasInlineWrapperForDisplayContents = inlineWrapperForDisplayContents.get();
    256255        m_builder.destroy(currentTextChild);
    257256
     
    266265
    267266        RenderTextFragment& remainingText = *newRemainingText;
     267        ASSERT_UNUSED(hasInlineWrapperForDisplayContents, hasInlineWrapperForDisplayContents == inlineWrapperForDisplayContents.get());
     268        remainingText.setInlineWrapperForDisplayContents(inlineWrapperForDisplayContents.get());
    268269        m_builder.attach(*textContentParent, WTFMove(newRemainingText), beforeChild);
     270
     271        // FIXME: Make attach the final step so that we don't need to keep firstLetter around.
     272        auto& firstLetter = *newFirstLetter;
    269273        remainingText.setFirstLetter(firstLetter);
    270274        firstLetter.setFirstLetterRemainingText(remainingText);
    271 
    272         // construct text fragment for the first letter
     275        m_builder.attach(*firstLetterContainer, WTFMove(newFirstLetter), &remainingText);
     276
     277        // Construct text fragment for the first letter.
    273278        auto letter = createRenderer<RenderTextFragment>(firstLetterBlock.document(), oldText, 0, length);
    274 
    275279        m_builder.attach(firstLetter, WTFMove(letter));
    276280    }
Note: See TracChangeset for help on using the changeset viewer.