Title: [281014] trunk/Source/WebCore
- Revision
- 281014
- Author
- n...@apple.com
- Date
- 2021-08-13 07:16:31 -0700 (Fri, 13 Aug 2021)
Log 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):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (281013 => 281014)
--- trunk/Source/WebCore/ChangeLog 2021-08-13 11:57:19 UTC (rev 281013)
+++ trunk/Source/WebCore/ChangeLog 2021-08-13 14:16:31 UTC (rev 281014)
@@ -1,3 +1,21 @@
+2021-08-13 Tim Nguyen <n...@apple.com>
+
+ 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):
+
2021-08-13 Jean-Yves Avenard <j...@apple.com>
nexttrack and previoustrack MediaSession handlers not working
Modified: trunk/Source/WebCore/dom/Element.h (281013 => 281014)
--- trunk/Source/WebCore/dom/Element.h 2021-08-13 11:57:19 UTC (rev 281013)
+++ trunk/Source/WebCore/dom/Element.h 2021-08-13 14:16:31 UTC (rev 281014)
@@ -511,6 +511,8 @@
const RenderStyle* lastStyleChangeEventStyle(PseudoId) const;
void setLastStyleChangeEventStyle(PseudoId, std::unique_ptr<const RenderStyle>&&);
+ bool isInTopLayer() const { return document().topLayerElements().contains(makeRef(*const_cast<Element*>(this))); }
+
#if ENABLE(FULLSCREEN_API)
bool containsFullScreenElement() const { return hasNodeFlag(NodeFlag::ContainsFullScreenElement); }
void setContainsFullScreenElement(bool);
Modified: trunk/Source/WebCore/html/HTMLDialogElement.cpp (281013 => 281014)
--- trunk/Source/WebCore/html/HTMLDialogElement.cpp 2021-08-13 11:57:19 UTC (rev 281013)
+++ trunk/Source/WebCore/html/HTMLDialogElement.cpp 2021-08-13 14:16:31 UTC (rev 281014)
@@ -65,8 +65,8 @@
m_isModal = true;
- // FIXME: Only add dialog to top layer if it's not already in it. (webkit.org/b/227907)
- document().addToTopLayer(*this);
+ if (!isInTopLayer())
+ document().addToTopLayer(*this);
// FIXME: Add steps 8 & 9 from spec. (webkit.org/b/227537)
@@ -85,8 +85,8 @@
if (!result.isNull())
m_returnValue = result;
- // FIXME: Only remove dialog from top layer if it's inside it. (webkit.org/b/227907)
- document().removeFromTopLayer(*this);
+ if (isInTopLayer())
+ document().removeFromTopLayer(*this);
// FIXME: Add step 6 from spec. (webkit.org/b/227537)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes