Changeset 140931 in webkit


Ignore:
Timestamp:
Jan 27, 2013 5:55:04 PM (11 years ago)
Author:
falken@chromium.org
Message:

Elements must be reattached when inserted/removed from top layer
https://bugs.webkit.org/show_bug.cgi?id=105489

Relanding r139402 as the apparent perf regression has been explained as not real (bug 106726).

Reviewed by Julien Chaffraix.

Source/WebCore:

Ensure a reattach occurs when an element is inserted/removed from top layer, so its renderer can be inserted correctly:
as a child of RenderView in top layer sibling order if it's in the top layer, and in the usual place otherwise.

We previously relied on style recalc to catch when an element is inserted/removed from the top layer, because it
only happens on dialog.show/close which toggle display: none. But that is incorrect because, for example, close()
followed immediately by show() results in no style change.

Tests: fast/dom/HTMLDialogElement/removed-element-is-removed-from-top-layer.html

fast/dom/HTMLDialogElement/top-layer-stacking-correct-order-remove-readd.html

  • dom/Element.cpp:

(WebCore::Element::removedFrom): Call Document::removeFromTopLayer to let the element be removed from the top layer vector.
removeFromTopLayer calls Element::setIsInTopLayer(false) itself if needed.
(WebCore::Element::setIsInTopLayer): Ensure a reattach occurs if the element is already attached.

LayoutTests:

  • fast/dom/HTMLDialogElement/removed-element-is-removed-from-top-layer-expected.html: Added.
  • fast/dom/HTMLDialogElement/removed-element-is-removed-from-top-layer.html: Added.

This tests that a top layer element removed from the document does not reappear in the top layer if readded.
This test actually would pass before this patch, but just by good fortune (see bug).

  • fast/dom/HTMLDialogElement/top-layer-stacking-correct-order-remove-readd-expected.html: Added.
  • fast/dom/HTMLDialogElement/top-layer-stacking-correct-order-remove-readd.html: Added.

This tests that top layer ordering is correct after removing and readding an element to the top layer.

Location:
trunk
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r140928 r140931  
     12013-01-27  Matt Falkenhagen  <falken@chromium.org>
     2
     3        Elements must be reattached when inserted/removed from top layer
     4        https://bugs.webkit.org/show_bug.cgi?id=105489
     5
     6        Relanding r139402 as the apparent perf regression has been explained as not real (bug 106726).
     7
     8        Reviewed by Julien Chaffraix.
     9
     10        * fast/dom/HTMLDialogElement/removed-element-is-removed-from-top-layer-expected.html: Added.
     11        * fast/dom/HTMLDialogElement/removed-element-is-removed-from-top-layer.html: Added.
     12        This tests that a top layer element removed from the document does not reappear in the top layer if readded.
     13        This test actually would pass before this patch, but just by good fortune (see bug).
     14        * fast/dom/HTMLDialogElement/top-layer-stacking-correct-order-remove-readd-expected.html: Added.
     15        * fast/dom/HTMLDialogElement/top-layer-stacking-correct-order-remove-readd.html: Added.
     16        This tests that top layer ordering is correct after removing and readding an element to the top layer.
     17
    1182013-01-27  Jochen Eisinger  <jochen@chromium.org>
    219
  • trunk/Source/WebCore/ChangeLog

    r140930 r140931  
     12013-01-27  Matt Falkenhagen  <falken@chromium.org>
     2
     3        Elements must be reattached when inserted/removed from top layer
     4        https://bugs.webkit.org/show_bug.cgi?id=105489
     5
     6        Relanding r139402 as the apparent perf regression has been explained as not real (bug 106726).
     7
     8        Reviewed by Julien Chaffraix.
     9
     10        Ensure a reattach occurs when an element is inserted/removed from top layer, so its renderer can be inserted correctly:
     11        as a child of RenderView in top layer sibling order if it's in the top layer, and in the usual place otherwise.
     12
     13        We previously relied on style recalc to catch when an element is inserted/removed from the top layer, because it
     14        only happens on dialog.show/close which toggle display: none. But that is incorrect because, for example, close()
     15        followed immediately by show() results in no style change.
     16
     17        Tests: fast/dom/HTMLDialogElement/removed-element-is-removed-from-top-layer.html
     18               fast/dom/HTMLDialogElement/top-layer-stacking-correct-order-remove-readd.html
     19
     20        * dom/Element.cpp:
     21        (WebCore::Element::removedFrom): Call Document::removeFromTopLayer to let the element be removed from the top layer vector.
     22        removeFromTopLayer calls Element::setIsInTopLayer(false) itself if needed.
     23        (WebCore::Element::setIsInTopLayer): Ensure a reattach occurs if the element is already attached.
     24
    1252013-01-27  Zoltan Arvai  <zarvai@inf.u-szeged.hu>
    226
  • trunk/Source/WebCore/dom/Element.cpp

    r140638 r140931  
    11841184
    11851185#if ENABLE(DIALOG_ELEMENT)
    1186     setIsInTopLayer(false);
     1186    document()->removeFromTopLayer(this);
    11871187#endif
    11881188#if ENABLE(FULLSCREEN_API)
     
    24052405        return;
    24062406    ensureElementRareData()->setIsInTopLayer(inTopLayer);
    2407     setNeedsStyleRecalc(SyntheticStyleChange);
     2407
     2408    // We must ensure a reattach occurs so the renderer is inserted in the correct sibling order under RenderView according to its
     2409    // top layer position, or in its usual place if not in the top layer.
     2410    reattachIfAttached();
    24082411}
    24092412#endif
Note: See TracChangeset for help on using the changeset viewer.