Title: [185398] trunk
Revision
185398
Author
[email protected]
Date
2015-06-09 17:57:30 -0700 (Tue, 09 Jun 2015)

Log Message

REGRESSION(r180867): Tabbing to login field on iCloud.com doesn't have highlight for text
https://bugs.webkit.org/show_bug.cgi?id=145830

Reviewed by Darin Adler.

Source/WebCore:

The bug was caused by setSelection not updating RenderView when there is a style recalc scheduled
that doesn't trigger a layout. Fixed the bug by explicitly updating the selection in
Document::recalcStyle in that case.

Test: editing/selection/update-selection-by-style-change.html

* dom/Document.cpp:
(WebCore::Document::recalcStyle):
* editing/FrameSelection.cpp:
(WebCore::FrameSelection::updateAppearanceAfterLayout): Renamed from didLayout.
* editing/FrameSelection.h:
* page/FrameView.cpp:
(WebCore::FrameView::performPostLayoutTasks):

LayoutTests:

Added a regression test.

* editing/selection/update-selection-by-style-change-expected.html: Added.
* editing/selection/update-selection-by-style-change.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (185397 => 185398)


--- trunk/LayoutTests/ChangeLog	2015-06-10 00:53:13 UTC (rev 185397)
+++ trunk/LayoutTests/ChangeLog	2015-06-10 00:57:30 UTC (rev 185398)
@@ -1,3 +1,15 @@
+2015-06-09  Ryosuke Niwa  <[email protected]>
+
+        REGRESSION(r180867): Tabbing to login field on iCloud.com doesn't have highlight for text
+        https://bugs.webkit.org/show_bug.cgi?id=145830
+
+        Reviewed by Darin Adler.
+
+        Added a regression test.
+
+        * editing/selection/update-selection-by-style-change-expected.html: Added.
+        * editing/selection/update-selection-by-style-change.html: Added.
+
 2015-06-09  Said Abou-Hallawa  <[email protected]>
 
         SVG Fragment is not rendered if it is the css background image of an HTML element

Added: trunk/LayoutTests/editing/selection/update-selection-by-style-change-expected.html (0 => 185398)


--- trunk/LayoutTests/editing/selection/update-selection-by-style-change-expected.html	                        (rev 0)
+++ trunk/LayoutTests/editing/selection/update-selection-by-style-change-expected.html	2015-06-10 00:57:30 UTC (rev 185398)
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p>This tests modifying selection after triggering a style change. Selection should be updated immediately.
+You should see the "hello" selected below as "world" turns red.</p>
+<input type="text" value="hello" autofocus/>
+<input type="text" value="world" style="color: red" />
+<style> * {outline: none} </style>
+<script>
+document.querySelector('input').select();
+</script>
+</body>
+</html>

Added: trunk/LayoutTests/editing/selection/update-selection-by-style-change.html (0 => 185398)


--- trunk/LayoutTests/editing/selection/update-selection-by-style-change.html	                        (rev 0)
+++ trunk/LayoutTests/editing/selection/update-selection-by-style-change.html	2015-06-10 00:57:30 UTC (rev 185398)
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p>This tests modifying selection after triggering a style change. Selection should be updated immediately.
+You should see the "hello" selected below as "world" turns red.</p>
+<input type="text" value="hello"/>
+<input type="text" value="world"/>
+<style> * {outline: none} </style>
+<script>
+
+if (window.testRunner)
+    testRunner.waitUntilDone();
+
+var inputs = document.querySelectorAll('input');
+inputs[0].focus();
+inputs[0].setSelectionRange(0, 0);
+setTimeout(function () {
+    inputs[1].style.color = 'red';
+    inputs[0].select();
+
+    if (window.testRunner)
+        testRunner.notifyDone();
+}, 50);
+
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (185397 => 185398)


--- trunk/Source/WebCore/ChangeLog	2015-06-10 00:53:13 UTC (rev 185397)
+++ trunk/Source/WebCore/ChangeLog	2015-06-10 00:57:30 UTC (rev 185398)
@@ -1,3 +1,24 @@
+2015-06-09  Ryosuke Niwa  <[email protected]>
+
+        REGRESSION(r180867): Tabbing to login field on iCloud.com doesn't have highlight for text
+        https://bugs.webkit.org/show_bug.cgi?id=145830
+
+        Reviewed by Darin Adler.
+
+        The bug was caused by setSelection not updating RenderView when there is a style recalc scheduled
+        that doesn't trigger a layout. Fixed the bug by explicitly updating the selection in
+        Document::recalcStyle in that case.
+
+        Test: editing/selection/update-selection-by-style-change.html
+
+        * dom/Document.cpp:
+        (WebCore::Document::recalcStyle):
+        * editing/FrameSelection.cpp:
+        (WebCore::FrameSelection::updateAppearanceAfterLayout): Renamed from didLayout.
+        * editing/FrameSelection.h:
+        * page/FrameView.cpp:
+        (WebCore::FrameView::performPostLayoutTasks):
+
 2015-06-09  Dean Jackson  <[email protected]>
 
         MediaControls: Reenable resize of controls on pinch zoom

Modified: trunk/Source/WebCore/dom/Document.cpp (185397 => 185398)


--- trunk/Source/WebCore/dom/Document.cpp	2015-06-10 00:53:13 UTC (rev 185397)
+++ trunk/Source/WebCore/dom/Document.cpp	2015-06-10 00:57:30 UTC (rev 185398)
@@ -1811,6 +1811,9 @@
     if (updatedCompositingLayers && !frameView.needsLayout())
         frameView.viewportContentsChanged();
 
+    if (!frameView.needsLayout())
+        frameView.frame().selection().updateAppearanceAfterLayout();
+
     // As a result of the style recalculation, the currently hovered element might have been
     // detached (for example, by setting display:none in the :hover style), schedule another mouseMove event
     // to check if any other elements ended up under the mouse pointer due to re-layout.

Modified: trunk/Source/WebCore/editing/FrameSelection.cpp (185397 => 185398)


--- trunk/Source/WebCore/editing/FrameSelection.cpp	2015-06-10 00:53:13 UTC (rev 185397)
+++ trunk/Source/WebCore/editing/FrameSelection.cpp	2015-06-10 00:57:30 UTC (rev 185398)
@@ -2222,7 +2222,7 @@
     updateAppearance();
 }
 
-void FrameSelection::didLayout()
+void FrameSelection::updateAppearanceAfterLayout()
 {
     setCaretRectNeedsUpdate();
     updateAndRevealSelection(AXTextStateChangeIntent());

Modified: trunk/Source/WebCore/editing/FrameSelection.h (185397 => 185398)


--- trunk/Source/WebCore/editing/FrameSelection.h	2015-06-10 00:53:13 UTC (rev 185397)
+++ trunk/Source/WebCore/editing/FrameSelection.h	2015-06-10 00:57:30 UTC (rev 185398)
@@ -151,7 +151,7 @@
     WEBCORE_EXPORT void clear();
     void prepareForDestruction();
 
-    void didLayout();
+    void updateAppearanceAfterLayout();
     void setNeedsSelectionUpdate();
 
     bool contains(const LayoutPoint&);

Modified: trunk/Source/WebCore/page/FrameView.cpp (185397 => 185398)


--- trunk/Source/WebCore/page/FrameView.cpp	2015-06-10 00:53:13 UTC (rev 185397)
+++ trunk/Source/WebCore/page/FrameView.cpp	2015-06-10 00:57:30 UTC (rev 185398)
@@ -2983,7 +2983,7 @@
 
     m_postLayoutTasksTimer.stop();
 
-    frame().selection().didLayout();
+    frame().selection().updateAppearanceAfterLayout();
 
     if (m_nestedLayoutCount <= 1 && frame().document()->documentElement())
         fireLayoutRelatedMilestonesIfNeeded();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to