Changeset 140307 in webkit


Ignore:
Timestamp:
Jan 20, 2013 11:59:39 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 rollout due to suspected perf regression did not help (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

    r140306 r140307  
     12013-01-20  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 rollout due to suspected perf regression did not help (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-20  Yury Semikhatsky  <yurys@chromium.org>
    219
  • trunk/Source/WebCore/ChangeLog

    r140306 r140307  
     12013-01-20  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 rollout due to suspected perf regression did not help (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-20  Yury Semikhatsky  <yurys@chromium.org>
    226
  • trunk/Source/WebCore/dom/Element.cpp

    r140231 r140307  
    11721172
    11731173#if ENABLE(DIALOG_ELEMENT)
    1174     setIsInTopLayer(false);
     1174    document()->removeFromTopLayer(this);
    11751175#endif
    11761176#if ENABLE(FULLSCREEN_API)
     
    23912391{
    23922392    ensureElementRareData()->setIsInTopLayer(inTopLayer);
    2393     setNeedsStyleRecalc(SyntheticStyleChange);
     2393
     2394    // We must ensure a reattach occurs so the renderer is inserted in the correct sibling order under RenderView according to its
     2395    // top layer position, or in its usual place if not in the top layer.
     2396    reattachIfAttached();
    23942397}
    23952398#endif
Note: See TracChangeset for help on using the changeset viewer.