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

Changeset 281014 in webkit


Ignore:
Timestamp:
Aug 13, 2021, 7:16:31 AM (5 years ago)
Author:
ntim@apple.com
Message:

Check for dialog existence in top layer in HTMLDialogElement::showModal & close
https://bugs.webkit.org/show_bug.cgi?id=227907

Reviewed by Antti Koivisto.

Test: imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-showModal.html

Test expectations are unchanged because the test uses elementFromPoint, meaning that behaviour difference isn't noticeable
until top layer rendering bits are implemented (which would change elementFromPoint's result by shuffling z-order based on top layer elements).

  • dom/Element.h:

(WebCore::Element::isInTopLayer const):

  • html/HTMLDialogElement.cpp:

(WebCore::HTMLDialogElement::showModal):
(WebCore::HTMLDialogElement::close):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r281013 r281014  
     12021-08-13  Tim Nguyen  <ntim@apple.com>
     2
     3        Check for dialog existence in top layer in HTMLDialogElement::showModal & close
     4        https://bugs.webkit.org/show_bug.cgi?id=227907
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Test: imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-showModal.html
     9
     10        Test expectations are unchanged because the test uses elementFromPoint, meaning that behaviour difference isn't noticeable
     11        until top layer rendering bits are implemented (which would change elementFromPoint's result by shuffling z-order based on top layer elements).
     12
     13        * dom/Element.h:
     14        (WebCore::Element::isInTopLayer const):
     15        * html/HTMLDialogElement.cpp:
     16        (WebCore::HTMLDialogElement::showModal):
     17        (WebCore::HTMLDialogElement::close):
     18
    1192021-08-13  Jean-Yves Avenard  <jya@apple.com>
    220
  • trunk/Source/WebCore/dom/Element.h

    r280718 r281014  
    512512    void setLastStyleChangeEventStyle(PseudoId, std::unique_ptr<const RenderStyle>&&);
    513513
     514    bool isInTopLayer() const { return document().topLayerElements().contains(makeRef(*const_cast<Element*>(this))); }
     515
    514516#if ENABLE(FULLSCREEN_API)
    515517    bool containsFullScreenElement() const { return hasNodeFlag(NodeFlag::ContainsFullScreenElement); }
  • trunk/Source/WebCore/html/HTMLDialogElement.cpp

    r280703 r281014  
    6666    m_isModal = true;
    6767
    68     // FIXME: Only add dialog to top layer if it's not already in it. (webkit.org/b/227907)
    69     document().addToTopLayer(*this);
     68    if (!isInTopLayer())
     69        document().addToTopLayer(*this);
    7070
    7171    // FIXME: Add steps 8 & 9 from spec. (webkit.org/b/227537)
     
    8686        m_returnValue = result;
    8787
    88     // FIXME: Only remove dialog from top layer if it's inside it. (webkit.org/b/227907)
    89     document().removeFromTopLayer(*this);
     88    if (isInTopLayer())
     89        document().removeFromTopLayer(*this);
    9090
    9191    // FIXME: Add step 6 from spec. (webkit.org/b/227537)
Note: See TracChangeset for help on using the changeset viewer.