Title: [227983] trunk
Revision
227983
Author
[email protected]
Date
2018-02-01 15:11:13 -0800 (Thu, 01 Feb 2018)

Log Message

Some test cases in accessibility/mac/selection-notification-focus-change.html fail
https://bugs.webkit.org/show_bug.cgi?id=182212
<rdar://problem/36937147>

Reviewed by Antti Koivisto and Wenson Hsieh.

Source/WebCore:

The failure was caused by the async update of the selection appearance not preserving selection reveal intent.
Fixed the bug by storing the intent in a member variable and using it later.

* dom/Element.cpp:
(WebCore::Element::focus): Removed an unnecessary synchronous layout update.
* editing/FrameSelection.cpp:
(WebCore::FrameSelection::setNeedsSelectionUpdate): Use the default intent to preserve the old behavior.
(WebCore::FrameSelection::respondToNodeModification): Ditto.
(WebCore::FrameSelection::setSelection): Save the selection reveal intent.
(WebCore::FrameSelection::updateAppearanceAfterLayoutOrStyleChange): Use the saved intent.
* editing/FrameSelection.h:
* page/FocusController.cpp:
(WebCore::FocusController::advanceFocusDirectionally): Always update the layout before invoking
nodeRectInAbsoluteCoordinates.

LayoutTests:

Updated and rebaselined the tests.

* accessibility/ios-simulator/header-elements.html: Force the layout after each call to element.focus
now that element.focus no longer updates the layout synchronously. Ordinarily, this will happen next time
the layout is updated for paint, by JS API, etc... but we have to force the accessibility tree to be
up-to-date for testing purposes.
* accessibility/ios-simulator/table-cell-for-row-col.html: Ditto.
* accessibility/mac/selection-notification-focus-change-expected.txt: Now all the test cases are passing.
* accessibility/mac/table-with-row-col-of-headers.html: Force the layout after each call to element.focus.
* accessibility/mac/table-with-zebra-rows.html: Ditto.
* accessibility/scroll-to-global-point-main-window.html: Ditto.
* accessibility/scroll-to-make-visible-with-subfocus.html: Ditto.
* editing/input/caret-at-the-edge-of-input.html: Wait for the focused element to reveal itself by a timer.
* fast/forms/input-text-scroll-left-on-blur.html: Ditto.
* fast/forms/textarea-no-scroll-on-blur.html: Ditto.
* fast/forms/textarea-scrolled-type.html: Ditto.
* platform/mac-wk2/accessibility/mac/selection-notification-focus-change-expected.txt: Rebaselined. We now
get one less AXTextSelectionChangedFocus notification because selection updates are now coalesced as expected.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (227982 => 227983)


--- trunk/LayoutTests/ChangeLog	2018-02-01 23:03:27 UTC (rev 227982)
+++ trunk/LayoutTests/ChangeLog	2018-02-01 23:11:13 UTC (rev 227983)
@@ -1,3 +1,30 @@
+2018-02-01  Ryosuke Niwa  <[email protected]>
+
+        Some test cases in accessibility/mac/selection-notification-focus-change.html fail
+        https://bugs.webkit.org/show_bug.cgi?id=182212
+        <rdar://problem/36937147>
+
+        Reviewed by Antti Koivisto and Wenson Hsieh.
+
+        Updated and rebaselined the tests.
+
+        * accessibility/ios-simulator/header-elements.html: Force the layout after each call to element.focus
+        now that element.focus no longer updates the layout synchronously. Ordinarily, this will happen next time
+        the layout is updated for paint, by JS API, etc... but we have to force the accessibility tree to be
+        up-to-date for testing purposes.
+        * accessibility/ios-simulator/table-cell-for-row-col.html: Ditto.
+        * accessibility/mac/selection-notification-focus-change-expected.txt: Now all the test cases are passing.
+        * accessibility/mac/table-with-row-col-of-headers.html: Force the layout after each call to element.focus.
+        * accessibility/mac/table-with-zebra-rows.html: Ditto.
+        * accessibility/scroll-to-global-point-main-window.html: Ditto.
+        * accessibility/scroll-to-make-visible-with-subfocus.html: Ditto.
+        * editing/input/caret-at-the-edge-of-input.html: Wait for the focused element to reveal itself by a timer.
+        * fast/forms/input-text-scroll-left-on-blur.html: Ditto.
+        * fast/forms/textarea-no-scroll-on-blur.html: Ditto.
+        * fast/forms/textarea-scrolled-type.html: Ditto.
+        * platform/mac-wk2/accessibility/mac/selection-notification-focus-change-expected.txt: Rebaselined. We now
+        get one less AXTextSelectionChangedFocus notification because selection updates are now coalesced as expected.
+
 2018-02-01  Antoine Quint  <[email protected]>
 
         [Modern Media Controls] Turn media/modern-media-controls/ios-inline-media-controls back on

Modified: trunk/LayoutTests/accessibility/ios-simulator/header-elements.html (227982 => 227983)


--- trunk/LayoutTests/accessibility/ios-simulator/header-elements.html	2018-02-01 23:03:27 UTC (rev 227982)
+++ trunk/LayoutTests/accessibility/ios-simulator/header-elements.html	2018-02-01 23:11:13 UTC (rev 227983)
@@ -25,9 +25,11 @@
     if (window.accessibilityController) {
 
         document.getElementById("button").focus();
+        internals.updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks();
         var button = accessibilityController.focusedElement;
 
         document.getElementById("header").focus();
+        internals.updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks();
         var header = accessibilityController.focusedElement;
         shouldBeTrue("button.headerElementAtIndex(0).isEqual(header)");
     }

Modified: trunk/LayoutTests/accessibility/ios-simulator/table-cell-for-row-col.html (227982 => 227983)


--- trunk/LayoutTests/accessibility/ios-simulator/table-cell-for-row-col.html	2018-02-01 23:03:27 UTC (rev 227982)
+++ trunk/LayoutTests/accessibility/ios-simulator/table-cell-for-row-col.html	2018-02-01 23:11:13 UTC (rev 227983)
@@ -25,14 +25,17 @@
     if (window.accessibilityController) {
 
         document.getElementById("cell2").focus();
+        internals.updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks();
         var cell2 = accessibilityController.focusedElement;
 
         document.getElementById("header").focus();
+        internals.updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks();
         var header = accessibilityController.focusedElement;
 
         shouldBeTrue("cell2.cellForColumnAndRow(2, 0).isEqual(header)");
 
         document.getElementById("cell5").focus();
+        internals.updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks();
         var cell6 = accessibilityController.focusedElement;
         shouldBeTrue("header.cellForColumnAndRow(1, 2).isEqual(cell6)");
 

Modified: trunk/LayoutTests/accessibility/mac/selection-notification-focus-change-expected.txt (227982 => 227983)


--- trunk/LayoutTests/accessibility/mac/selection-notification-focus-change-expected.txt	2018-02-01 23:03:27 UTC (rev 227982)
+++ trunk/LayoutTests/accessibility/mac/selection-notification-focus-change-expected.txt	2018-02-01 23:11:13 UTC (rev 227983)
@@ -18,7 +18,7 @@
 eventSender.keyDown(tabCharacter)
 Received AXFocusChanged
 Received AXSelectedTextChanged
-FAIL userInfo["AXTextSelectionChangedFocus"] should be true (of type boolean). Was undefined (of type undefined).
+PASS userInfo["AXTextSelectionChangedFocus"] is true
 Received AXSelectedTextChanged
 PASS userInfo["AXTextSelectionChangedFocus"] is true
 PASS successfullyParsed is true

Modified: trunk/LayoutTests/accessibility/mac/table-with-row-col-of-headers.html (227982 => 227983)


--- trunk/LayoutTests/accessibility/mac/table-with-row-col-of-headers.html	2018-02-01 23:03:27 UTC (rev 227982)
+++ trunk/LayoutTests/accessibility/mac/table-with-row-col-of-headers.html	2018-02-01 23:11:13 UTC (rev 227983)
@@ -58,18 +58,21 @@
     description("This tests that tables that have THs in the first row or first column will be exposed as AXTables.");
 
     if (window.accessibilityController) {
+        document.getElementById("table1").focus();
+        internals.updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks();
+        shouldBe("accessibilityController.focusedElement.role", "'AXRole: AXTable'");
 
-          document.getElementById("table1").focus();
-          shouldBe("accessibilityController.focusedElement.role", "'AXRole: AXTable'");
+        document.getElementById("table2").focus();
+        internals.updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks();
+        shouldBe("accessibilityController.focusedElement.role", "'AXRole: AXTable'");
 
-          document.getElementById("table2").focus();
-          shouldBe("accessibilityController.focusedElement.role", "'AXRole: AXTable'");
+        document.getElementById("table3").focus();
+        internals.updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks();
+        shouldBe("accessibilityController.focusedElement.role", "'AXRole: AXGroup'");
 
-          document.getElementById("table3").focus();
-          shouldBe("accessibilityController.focusedElement.role", "'AXRole: AXGroup'");
-
-          document.getElementById("table4").focus();
-          shouldBe("accessibilityController.focusedElement.role", "'AXRole: AXGroup'");
+        document.getElementById("table4").focus();
+        internals.updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks();
+        shouldBe("accessibilityController.focusedElement.role", "'AXRole: AXGroup'");
     }
 
 </script>

Modified: trunk/LayoutTests/accessibility/mac/table-with-zebra-rows.html (227982 => 227983)


--- trunk/LayoutTests/accessibility/mac/table-with-zebra-rows.html	2018-02-01 23:03:27 UTC (rev 227982)
+++ trunk/LayoutTests/accessibility/mac/table-with-zebra-rows.html	2018-02-01 23:11:13 UTC (rev 227983)
@@ -24,9 +24,9 @@
     description("This tests that tables with zebra striped rows are exposed as AXTables.");
 
     if (window.accessibilityController) {
-
-          document.getElementById("table1").focus();
-          shouldBe("accessibilityController.focusedElement.role", "'AXRole: AXTable'");
+        document.getElementById("table1").focus();
+        internals.updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks();
+        shouldBe("accessibilityController.focusedElement.role", "'AXRole: AXTable'");
     }
 
 </script>

Modified: trunk/LayoutTests/accessibility/scroll-to-global-point-main-window.html (227982 => 227983)


--- trunk/LayoutTests/accessibility/scroll-to-global-point-main-window.html	2018-02-01 23:03:27 UTC (rev 227982)
+++ trunk/LayoutTests/accessibility/scroll-to-global-point-main-window.html	2018-02-01 23:11:13 UTC (rev 227983)
@@ -25,6 +25,7 @@
 
     if (window.accessibilityController) {
         target.focus();
+        internals.updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks();
         var targetAccessibleObject = accessibilityController.focusedElement;
     }
 

Modified: trunk/LayoutTests/accessibility/scroll-to-make-visible-with-subfocus.html (227982 => 227983)


--- trunk/LayoutTests/accessibility/scroll-to-make-visible-with-subfocus.html	2018-02-01 23:03:27 UTC (rev 227982)
+++ trunk/LayoutTests/accessibility/scroll-to-make-visible-with-subfocus.html	2018-02-01 23:11:13 UTC (rev 227983)
@@ -20,6 +20,7 @@
     var targetAccessibleObject;
     if (window.accessibilityController) {
         target.focus();
+        internals.updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks();
         targetAccessibleObject = accessibilityController.focusedElement;
     }
 

Modified: trunk/LayoutTests/editing/input/caret-at-the-edge-of-input.html (227982 => 227983)


--- trunk/LayoutTests/editing/input/caret-at-the-edge-of-input.html	2018-02-01 23:03:27 UTC (rev 227982)
+++ trunk/LayoutTests/editing/input/caret-at-the-edge-of-input.html	2018-02-01 23:11:13 UTC (rev 227983)
@@ -6,14 +6,21 @@
 <input type="text" name="input-edit" id="input-edit" size="10" value="012345678901234567890123456789" />
 <script>
 
+if (window.testRunner)
+    testRunner.waitUntilDone();
+
 var inputEdit = document.getElementById("input-edit");
 inputEdit.focus();
-var inputEditContent = inputEdit.value;
-inputEdit.setSelectionRange(0, 0);
-if (window.eventSender) {
-    for (var i = 0; i < inputEdit.size * 1.2; ++i)
-        eventSender.keyDown(inputEditContent[i]);
-}
+setTimeout(() => {
+    var inputEditContent = inputEdit.value;
+    inputEdit.setSelectionRange(0, 0);
 
+    if (window.eventSender) {
+        for (var i = 0; i < inputEdit.size * 1.2; ++i)
+            eventSender.keyDown(inputEditContent[i]);
+        testRunner.notifyDone();
+    }
+}, 0);
+
 </script>
 </body>

Modified: trunk/LayoutTests/fast/forms/input-text-scroll-left-on-blur.html (227982 => 227983)


--- trunk/LayoutTests/fast/forms/input-text-scroll-left-on-blur.html	2018-02-01 23:03:27 UTC (rev 227982)
+++ trunk/LayoutTests/fast/forms/input-text-scroll-left-on-blur.html	2018-02-01 23:11:13 UTC (rev 227983)
@@ -3,22 +3,46 @@
 <input id="c" type="text" value="this text field has a lot of text in it so that it needs to scrol">
 <p>Tests scrolling back to the beginning when a text field blurs. The first field should be scrolled to the left, the second and third scrolled to the right.</p>
 <script>
-var a = document.getElementById("a");
-a.focus();
-a.setSelectionRange(66, 66);
-if (window.eventSender) {
-    eventSender.keyDown("l");
+if (window.testRunner)
+    testRunner.waitUntilDone();
+
+function wait(seconds)
+{
+    return new Promise((resolve) => setTimeout(resolve, seconds))
 }
-var b = document.getElementById("b");
-b.focus();
-b.setSelectionRange(66, 66);
-if (window.eventSender) {
-    eventSender.keyDown("l");
+
+async function runTest()
+{
+    if (!window.eventSender) {
+        document.body.innerHTML += 'This test requires eventSender.keyDown';
+        return;
+    }
+
+    var a = document.getElementById("a");
+    a.focus();
+    await wait(0);
+    a.setSelectionRange(66, 66);
+    if (window.eventSender)
+        eventSender.keyDown("l");
+
+    var b = document.getElementById("b");
+    b.focus();
+    await wait(0);
+    b.setSelectionRange(66, 66);
+    if (window.eventSender)
+        eventSender.keyDown("l");
+
+    var c = document.getElementById("c");
+    c.focus();
+    await wait(0);
+    c.setSelectionRange(66, 66);
+    if (window.eventSender)
+        eventSender.keyDown("l");
+
+    if (window.testRunner)
+        testRunner.notifyDone();
 }
-var c = document.getElementById("c");
-c.focus();
-c.setSelectionRange(66, 66);
-if (window.eventSender) {
-    eventSender.keyDown("l");
-}
+
+window._onload_ = runTest;
+
 </script>

Modified: trunk/LayoutTests/fast/forms/textarea-no-scroll-on-blur.html (227982 => 227983)


--- trunk/LayoutTests/fast/forms/textarea-no-scroll-on-blur.html	2018-02-01 23:03:27 UTC (rev 227982)
+++ trunk/LayoutTests/fast/forms/textarea-no-scroll-on-blur.html	2018-02-01 23:11:13 UTC (rev 227983)
@@ -1,9 +1,15 @@
 <html>
 <head>
 <script>
-    function test() {
-        if (window.testRunner)
+    function wait(seconds) {
+        return new Promise((resolve) => setTimeout(resolve, 0), seconds);
+    }
+
+    async function test() {
+        if (window.testRunner) {
             testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
 
         var ta = document.getElementById('ta');
 
@@ -10,12 +16,19 @@
         // Send caret to bottom of textarea
         ta.focus();
         ta.setSelectionRange(ta.value.length, ta.value.length);
+        await wait(0);
         ta.blur();
 
+        await wait(0);
         ta.focus();
+        await wait(0);
         ta.blur();
-        if (ta.scrollTop != 0)
-            document.getElementById('res').innerHTML = "Test Passed";
+        await wait(0);
+
+        document.getElementById('res').innerHTML = ta.scrollTop != 0 ? "Test Passed" : "Test Failed";
+
+        if (window.testRunner)
+            testRunner.notifyDone();
     }
 </script>
 </head>
@@ -29,6 +42,6 @@
 4
 5
 </textarea>
-<div id="res">Test Failed</div>
+<div id="res"></div>
 </body>
 </html>

Modified: trunk/LayoutTests/fast/forms/textarea-scrolled-type.html (227982 => 227983)


--- trunk/LayoutTests/fast/forms/textarea-scrolled-type.html	2018-02-01 23:03:27 UTC (rev 227982)
+++ trunk/LayoutTests/fast/forms/textarea-scrolled-type.html	2018-02-01 23:11:13 UTC (rev 227983)
@@ -2,17 +2,29 @@
 <head>
 <script src="" language="_javascript_" type="text/_javascript_" ></script>
 <script>
-function test()
+function wait(seconds)
 {
+    return new Promise((resolve) => setTimeout(resolve, 0), seconds);
+}
+
+async function test()
+{
+    if (window.testRunner)
+        testRunner.waitUntilDone();
+
     var res = document.getElementById('res');
     var ta = document.getElementById('ta');
 
     // Send caret to bottom of textarea
     ta.focus();
+    await wait(0);
     ta.setSelectionRange(ta.value.length, ta.value.length);
+    await wait(0);
     ta.blur();
+    await wait(0);
 
     ta.focus();
+    await wait(0);
     ta.setSelectionRange(44, 44);
     typeCharacterCommand(' ');
     typeCharacterCommand('P');
@@ -20,6 +32,8 @@
     typeCharacterCommand('s');
     typeCharacterCommand('s');
 
+    if (window.testRunner)
+        testRunner.notifyDone();
 }
 </script>
 </head>

Modified: trunk/LayoutTests/platform/mac-wk2/accessibility/mac/selection-notification-focus-change-expected.txt (227982 => 227983)


--- trunk/LayoutTests/platform/mac-wk2/accessibility/mac/selection-notification-focus-change-expected.txt	2018-02-01 23:03:27 UTC (rev 227982)
+++ trunk/LayoutTests/platform/mac-wk2/accessibility/mac/selection-notification-focus-change-expected.txt	2018-02-01 23:11:13 UTC (rev 227983)
@@ -18,9 +18,7 @@
 eventSender.keyDown(tabCharacter)
 Received AXFocusChanged
 Received AXSelectedTextChanged
-FAIL userInfo["AXTextSelectionChangedFocus"] should be true (of type boolean). Was undefined (of type undefined).
-Received AXSelectedTextChanged
-FAIL userInfo["AXTextSelectionChangedFocus"] should be true (of type boolean). Was undefined (of type undefined).
+PASS userInfo["AXTextSelectionChangedFocus"] is true
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/Source/WebCore/ChangeLog (227982 => 227983)


--- trunk/Source/WebCore/ChangeLog	2018-02-01 23:03:27 UTC (rev 227982)
+++ trunk/Source/WebCore/ChangeLog	2018-02-01 23:11:13 UTC (rev 227983)
@@ -1,3 +1,26 @@
+2018-02-01  Ryosuke Niwa  <[email protected]>
+
+        Some test cases in accessibility/mac/selection-notification-focus-change.html fail
+        https://bugs.webkit.org/show_bug.cgi?id=182212
+        <rdar://problem/36937147>
+
+        Reviewed by Antti Koivisto and Wenson Hsieh.
+
+        The failure was caused by the async update of the selection appearance not preserving selection reveal intent.
+        Fixed the bug by storing the intent in a member variable and using it later.
+
+        * dom/Element.cpp:
+        (WebCore::Element::focus): Removed an unnecessary synchronous layout update.
+        * editing/FrameSelection.cpp:
+        (WebCore::FrameSelection::setNeedsSelectionUpdate): Use the default intent to preserve the old behavior.
+        (WebCore::FrameSelection::respondToNodeModification): Ditto.
+        (WebCore::FrameSelection::setSelection): Save the selection reveal intent.
+        (WebCore::FrameSelection::updateAppearanceAfterLayoutOrStyleChange): Use the saved intent.
+        * editing/FrameSelection.h:
+        * page/FocusController.cpp:
+        (WebCore::FocusController::advanceFocusDirectionally): Always update the layout before invoking
+        nodeRectInAbsoluteCoordinates.
+
 2018-02-01  Zalan Bujtas  <[email protected]>
 
         [RenderTreeBuilder] Move RenderRubyRun::rubyBaseSafe to RenderTreeBuilder::Ruby

Modified: trunk/Source/WebCore/dom/Element.cpp (227982 => 227983)


--- trunk/Source/WebCore/dom/Element.cpp	2018-02-01 23:03:27 UTC (rev 227982)
+++ trunk/Source/WebCore/dom/Element.cpp	2018-02-01 23:11:13 UTC (rev 227983)
@@ -2423,9 +2423,6 @@
             return;
     }
 
-    // Setting the focused node above might have invalidated the layout due to scripts.
-    document().updateLayoutIgnorePendingStylesheets();
-
     SelectionRevealMode revealMode = SelectionRevealMode::Reveal;
 #if PLATFORM(IOS)
     // Focusing a form element triggers animation in UIKit to scroll to the right position.

Modified: trunk/Source/WebCore/editing/FrameSelection.cpp (227982 => 227983)


--- trunk/Source/WebCore/editing/FrameSelection.cpp	2018-02-01 23:03:27 UTC (rev 227982)
+++ trunk/Source/WebCore/editing/FrameSelection.cpp	2018-02-01 23:11:13 UTC (rev 227983)
@@ -374,6 +374,7 @@
         m_selectionRevealMode = SelectionRevealMode::DoNotReveal;
     m_alwaysAlignCursorOnScrollWhenRevealingSelection = align == AlignCursorOnScrollAlways;
 
+    m_selectionRevealIntent = intent;
     m_pendingSelectionUpdate = true;
 
     if (document->hasPendingStyleRecalc())
@@ -402,6 +403,7 @@
 
 void FrameSelection::setNeedsSelectionUpdate()
 {
+    m_selectionRevealIntent = AXTextStateChangeIntent();
     m_pendingSelectionUpdate = true;
     if (RenderView* view = m_frame->contentRenderer())
         view->selection().clear();
@@ -526,6 +528,7 @@
             renderView->selection().clear();
 
             // Trigger a selection update so the selection will be set again.
+            m_selectionRevealIntent = AXTextStateChangeIntent();
             m_pendingSelectionUpdate = true;
             renderView->frameView().scheduleSelectionUpdate();
         }
@@ -2447,7 +2450,7 @@
         client->updateEditorStateAfterLayoutIfEditabilityChanged();
 
     setCaretRectNeedsUpdate();
-    updateAndRevealSelection(AXTextStateChangeIntent());
+    updateAndRevealSelection(m_selectionRevealIntent);
     updateDataDetectorsForSelection();
 }
 

Modified: trunk/Source/WebCore/editing/FrameSelection.h (227982 => 227983)


--- trunk/Source/WebCore/editing/FrameSelection.h	2018-02-01 23:03:27 UTC (rev 227982)
+++ trunk/Source/WebCore/editing/FrameSelection.h	2018-02-01 23:11:13 UTC (rev 227983)
@@ -347,6 +347,7 @@
     IntRect m_absCaretBounds;
 
     SelectionRevealMode m_selectionRevealMode { SelectionRevealMode::DoNotReveal };
+    AXTextStateChangeIntent m_selectionRevealIntent;
 
     bool m_caretInsidePositionFixed : 1;
     bool m_absCaretBoundsDirty : 1;

Modified: trunk/Source/WebCore/page/FocusController.cpp (227982 => 227983)


--- trunk/Source/WebCore/page/FocusController.cpp	2018-02-01 23:03:27 UTC (rev 227982)
+++ trunk/Source/WebCore/page/FocusController.cpp	2018-02-01 23:11:13 UTC (rev 227983)
@@ -1081,8 +1081,7 @@
     Element* focusedElement = focusedDocument->focusedElement();
     Node* container = focusedDocument;
 
-    if (is<Document>(*container))
-        downcast<Document>(*container).updateLayoutIgnorePendingStylesheets();
+    focusedDocument->updateLayoutIgnorePendingStylesheets();
 
     // Figure out the starting rect.
     LayoutRect startingRect;
@@ -1103,10 +1102,9 @@
     bool consumed = false;
     do {
         consumed = advanceFocusDirectionallyInContainer(container, startingRect, direction, event);
+        focusedDocument->updateLayoutIgnorePendingStylesheets();
         startingRect = nodeRectInAbsoluteCoordinates(container, true /* ignore border */);
         container = scrollableEnclosingBoxOrParentFrameForNodeInDirection(direction, container);
-        if (is<Document>(container))
-            downcast<Document>(*container).updateLayoutIgnorePendingStylesheets();
     } while (!consumed && container);
 
     return consumed;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to