Changeset 193773 in webkit


Ignore:
Timestamp:
Dec 8, 2015, 12:44:51 PM (10 years ago)
Author:
Alan Bujtas
Message:

Do not insert positioned renderers to multiple gPositionedDescendantsMap.
https://bugs.webkit.org/show_bug.cgi?id=151878
rdar://problem/22229889

Reviewed by Simon Fraser.

We insert positioned renderers into a static map (RenderBlock::gPositionedDescendantsMap) to keep track of them.
This static map is at block level. A particular absolute positioned object is added to its closest ancestor that
returns true for RenderElement::canContainAbsolutelyPositionedObjects().
canContainAbsolutelyPositionedObjects() returns true if the ancestor is either positioned or has transform.
If this container's style changes so that it's no longer positioned and it has no transform anymore,
we need to clear its static map of positioned objects (they'll get re-inserted to another ancestor at next layout).

This patch addresses the case when the renderer does not have transforms anymore.

Source/WebCore:

Test: fast/block/positioning/crash-when-transform-is-removed.html

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::styleWillChange):

LayoutTests:

  • fast/block/positioning/crash-when-transform-is-removed-expected.txt: Added.
  • fast/block/positioning/crash-when-transform-is-removed.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r193770 r193773  
     12015-12-08  Zalan Bujtas  <zalan@apple.com>
     2
     3        Do not insert positioned renderers to multiple gPositionedDescendantsMap.
     4        https://bugs.webkit.org/show_bug.cgi?id=151878
     5        rdar://problem/22229889
     6
     7        Reviewed by Simon Fraser.
     8
     9        We insert positioned renderers into a static map (RenderBlock::gPositionedDescendantsMap) to keep track of them.
     10        This static map is at block level. A particular absolute positioned object is added to its closest ancestor that
     11        returns true for RenderElement::canContainAbsolutelyPositionedObjects().
     12        canContainAbsolutelyPositionedObjects() returns true if the ancestor is either positioned or has transform.
     13        If this container's style changes so that it's no longer positioned and it has no transform anymore,
     14        we need to clear its static map of positioned objects (they'll get re-inserted to another ancestor at next layout).
     15
     16        This patch addresses the case when the renderer does not have transforms anymore.
     17
     18        * fast/block/positioning/crash-when-transform-is-removed-expected.txt: Added.
     19        * fast/block/positioning/crash-when-transform-is-removed.html: Added.
     20
    1212015-12-08  Ryan Haddad  <ryanhaddad@apple.com>
    222
  • trunk/Source/WebCore/ChangeLog

    r193764 r193773  
     12015-12-08  Zalan Bujtas  <zalan@apple.com>
     2
     3        Do not insert positioned renderers to multiple gPositionedDescendantsMap.
     4        https://bugs.webkit.org/show_bug.cgi?id=151878
     5        rdar://problem/22229889
     6
     7        Reviewed by Simon Fraser.
     8
     9        We insert positioned renderers into a static map (RenderBlock::gPositionedDescendantsMap) to keep track of them.
     10        This static map is at block level. A particular absolute positioned object is added to its closest ancestor that
     11        returns true for RenderElement::canContainAbsolutelyPositionedObjects().
     12        canContainAbsolutelyPositionedObjects() returns true if the ancestor is either positioned or has transform.
     13        If this container's style changes so that it's no longer positioned and it has no transform anymore,
     14        we need to clear its static map of positioned objects (they'll get re-inserted to another ancestor at next layout).
     15
     16        This patch addresses the case when the renderer does not have transforms anymore.
     17
     18        Test: fast/block/positioning/crash-when-transform-is-removed.html
     19
     20        * rendering/RenderBlock.cpp:
     21        (WebCore::RenderBlock::styleWillChange):
     22
    1232015-12-08  Eric Carlson  <eric.carlson@apple.com>
    224
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r192854 r193773  
    243243    setReplaced(newStyle.isDisplayInlineType());
    244244
     245    if (oldStyle && oldStyle->hasTransformRelatedProperty() && !newStyle.hasTransformRelatedProperty())
     246        removePositionedObjects(nullptr, NewContainingBlock);
     247
    245248    if (oldStyle && parent() && diff == StyleDifferenceLayout && oldStyle->position() != newStyle.position()) {
    246249        if (newStyle.position() == StaticPosition)
    247250            // Clear our positioned objects list. Our absolutely positioned descendants will be
    248251            // inserted into our containing block's positioned objects list during layout.
    249             removePositionedObjects(0, NewContainingBlock);
     252            removePositionedObjects(nullptr, NewContainingBlock);
    250253        else if (oldStyle->position() == StaticPosition) {
    251254            // Remove our absolutely positioned descendants from their current containing block.
Note: See TracChangeset for help on using the changeset viewer.