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

Changeset 274630 in webkit


Ignore:
Timestamp:
Mar 18, 2021, 3:10:14 AM (5 years ago)
Author:
svillar@igalia.com
Message:

Invalidate RenderTreePosition's next sibling with display:contents
https://bugs.webkit.org/show_bug.cgi?id=218578

Reviewed by Antti Koivisto.

When inserting elements in the tree from JS it might happen that the renderTreePosition() in the RenderTreeUpdater
caches a nextSibling() value which is only temporarily correct because we sequentially process the descendants of a
given root node in RenderTreeUpdater::updateRenderTree(). One of those potentially incorrect scenarios is when
using display:contents. We can detect those cases because we would leave a parent element in RenderTreeUpdater::popParent()
without changing renderingParent() and so without changing renderTreePosition(). Once we are in that situation we
must invalidate the cached position so the next sibling is recomputed.

  • rendering/updating/RenderTreeUpdater.cpp:

(WebCore::RenderTreeUpdater::popParent): Invalidate the render tree position's next sibling if the parent element is not
the renderingParent().

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r274627 r274630  
     12021-02-26  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        Invalidate RenderTreePosition's next sibling with display:contents
     4        https://bugs.webkit.org/show_bug.cgi?id=218578
     5
     6        Reviewed by Antti Koivisto.
     7
     8        When inserting elements in the tree from JS it might happen that the renderTreePosition() in the RenderTreeUpdater
     9        caches a nextSibling() value which is only temporarily correct because we sequentially process the descendants of a
     10        given root node in RenderTreeUpdater::updateRenderTree(). One of those potentially incorrect scenarios is when
     11        using display:contents. We can detect those cases because we would leave a parent element in RenderTreeUpdater::popParent()
     12        without changing renderingParent() and so without changing renderTreePosition(). Once we are in that situation we
     13        must invalidate the cached position so the next sibling is recomputed.
     14
     15        * rendering/updating/RenderTreeUpdater.cpp:
     16        (WebCore::RenderTreeUpdater::popParent): Invalidate the render tree position's next sibling if the parent element is not
     17        the renderingParent().
     18
    1192021-03-18  Carlos Garcia Campos  <cgarcia@igalia.com>
    220
  • trunk/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp

    r273621 r274630  
    238238        updateAfterDescendants(*parent.element, parent.updates);
    239239
     240    if (&parent != &renderingParent())
     241        renderTreePosition().invalidateNextSibling();
     242
    240243    m_parentStack.removeLast();
    241244}
Note: See TracChangeset for help on using the changeset viewer.