Title: [253653] trunk/Source/WebCore
Revision
253653
Author
[email protected]
Date
2019-12-17 15:30:03 -0800 (Tue, 17 Dec 2019)

Log Message

Document::setFocusedElement should not set m_focusedElement to an element in another document
https://bugs.webkit.org/show_bug.cgi?id=205325

Reviewed by Wenson Hsieh.

Added an early exit for when the newly focused element had moved
while blurring the previously focused element.

* dom/Document.cpp:
(WebCore::Document::setFocusedElement):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (253652 => 253653)


--- trunk/Source/WebCore/ChangeLog	2019-12-17 23:17:46 UTC (rev 253652)
+++ trunk/Source/WebCore/ChangeLog	2019-12-17 23:30:03 UTC (rev 253653)
@@ -1,3 +1,16 @@
+2019-12-16  Ryosuke Niwa  <[email protected]>
+
+        Document::setFocusedElement should not set m_focusedElement to an element in another document
+        https://bugs.webkit.org/show_bug.cgi?id=205325
+
+        Reviewed by Wenson Hsieh.
+
+        Added an early exit for when the newly focused element had moved
+        while blurring the previously focused element.
+
+        * dom/Document.cpp:
+        (WebCore::Document::setFocusedElement):
+
 2019-12-17  James Darpinian  <[email protected]>
 
         Fix WebGL conformance test build_177_to_178.html with USE_ANGLE

Modified: trunk/Source/WebCore/dom/Document.cpp (253652 => 253653)


--- trunk/Source/WebCore/dom/Document.cpp	2019-12-17 23:17:46 UTC (rev 253652)
+++ trunk/Source/WebCore/dom/Document.cpp	2019-12-17 23:30:03 UTC (rev 253653)
@@ -4290,6 +4290,11 @@
     }
 
     if (newFocusedElement && newFocusedElement->isFocusable()) {
+        if (&newFocusedElement->document() != this) {
+            // Bluring oldFocusedElement may have moved newFocusedElement across documents.
+            focusChangeBlocked = true;
+            goto SetFocusedNodeDone;
+        }
         if (newFocusedElement->isRootEditableElement() && !acceptsEditingFocus(*newFocusedElement)) {
             // delegate blocks focus change
             focusChangeBlocked = true;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to