Title: [225431] trunk
Revision
225431
Author
[email protected]
Date
2017-12-01 16:28:46 -0800 (Fri, 01 Dec 2017)

Log Message

AlternativePresentationButtonSubstitution::unapply() may not undo substitution
https://bugs.webkit.org/show_bug.cgi?id=180279
<rdar://problem/35800599>

Reviewed by Simon Fraser.

Source/WebCore:

Fixes an issue where removing an alternative presentation button substituted for a non-HTML input
element did not restore the original appearance of the element before the substitution.

To substitute the alternative presentation button for a non-HTML input element we attach a
user-agent shadow root to it. Adding a shadow root, including a user-agent shadow root,
tears down the existing renderers for the element. Currently when we unapply such a substitution
we ultimately just remove the shadow root and do not create new renderers for the subtree
that the shadow root was removed from. We need to create new renderers for this subtree
to restore the original appearance of the element before the substitution.

* editing/cocoa/AlternativePresentationButtonSubstitution.cpp:
(WebCore::AlternativePresentationButtonSubstitution::unapply):

LayoutTests:

Update test to ensure that we undo the alternative presentation button substitution
made to an HTML label element.

* fast/forms/alternative-presentation-button/replace-and-remove-expected.html:
* fast/forms/alternative-presentation-button/replace-and-remove.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (225430 => 225431)


--- trunk/LayoutTests/ChangeLog	2017-12-02 00:20:57 UTC (rev 225430)
+++ trunk/LayoutTests/ChangeLog	2017-12-02 00:28:46 UTC (rev 225431)
@@ -1,5 +1,19 @@
 2017-12-01  Daniel Bates  <[email protected]>
 
+        AlternativePresentationButtonSubstitution::unapply() may not undo substitution
+        https://bugs.webkit.org/show_bug.cgi?id=180279
+        <rdar://problem/35800599>
+
+        Reviewed by Simon Fraser.
+
+        Update test to ensure that we undo the alternative presentation button substitution
+        made to an HTML label element.
+
+        * fast/forms/alternative-presentation-button/replace-and-remove-expected.html:
+        * fast/forms/alternative-presentation-button/replace-and-remove.html:
+
+2017-12-01  Daniel Bates  <[email protected]>
+
         Alternative Presentation Button: Provide a way to query for the replaced elements
         https://bugs.webkit.org/show_bug.cgi?id=180114
         <rdar://problem/35710539>

Modified: trunk/LayoutTests/fast/forms/alternative-presentation-button/replace-and-remove-expected.html (225430 => 225431)


--- trunk/LayoutTests/fast/forms/alternative-presentation-button/replace-and-remove-expected.html	2017-12-02 00:20:57 UTC (rev 225430)
+++ trunk/LayoutTests/fast/forms/alternative-presentation-button/replace-and-remove-expected.html	2017-12-02 00:28:46 UTC (rev 225431)
@@ -39,6 +39,9 @@
                 </tr>
         </table>
     </div>
+    <div>
+        <label>First name <input type="text"></label>
+    </div>
     <p>Name</p>
 </div>
 </body>

Modified: trunk/LayoutTests/fast/forms/alternative-presentation-button/replace-and-remove.html (225430 => 225431)


--- trunk/LayoutTests/fast/forms/alternative-presentation-button/replace-and-remove.html	2017-12-02 00:20:57 UTC (rev 225430)
+++ trunk/LayoutTests/fast/forms/alternative-presentation-button/replace-and-remove.html	2017-12-02 00:28:46 UTC (rev 225431)
@@ -39,6 +39,9 @@
                 </tr>
         </table>
     </div>
+    <div class="test">
+        <label>First name <input type="text"></label>
+    </div>
 </div>
 <script>
 var id = 0;

Modified: trunk/Source/WebCore/ChangeLog (225430 => 225431)


--- trunk/Source/WebCore/ChangeLog	2017-12-02 00:20:57 UTC (rev 225430)
+++ trunk/Source/WebCore/ChangeLog	2017-12-02 00:28:46 UTC (rev 225431)
@@ -1,3 +1,24 @@
+2017-12-01  Daniel Bates  <[email protected]>
+
+        AlternativePresentationButtonSubstitution::unapply() may not undo substitution
+        https://bugs.webkit.org/show_bug.cgi?id=180279
+        <rdar://problem/35800599>
+
+        Reviewed by Simon Fraser.
+
+        Fixes an issue where removing an alternative presentation button substituted for a non-HTML input
+        element did not restore the original appearance of the element before the substitution.
+
+        To substitute the alternative presentation button for a non-HTML input element we attach a
+        user-agent shadow root to it. Adding a shadow root, including a user-agent shadow root,
+        tears down the existing renderers for the element. Currently when we unapply such a substitution
+        we ultimately just remove the shadow root and do not create new renderers for the subtree
+        that the shadow root was removed from. We need to create new renderers for this subtree
+        to restore the original appearance of the element before the substitution.
+
+        * editing/cocoa/AlternativePresentationButtonSubstitution.cpp:
+        (WebCore::AlternativePresentationButtonSubstitution::unapply):
+
 2017-12-01  Christopher Reid  <[email protected]>
 
         Move DateComponents into WTF

Modified: trunk/Source/WebCore/editing/cocoa/AlternativePresentationButtonSubstitution.cpp (225430 => 225431)


--- trunk/Source/WebCore/editing/cocoa/AlternativePresentationButtonSubstitution.cpp	2017-12-02 00:20:57 UTC (rev 225430)
+++ trunk/Source/WebCore/editing/cocoa/AlternativePresentationButtonSubstitution.cpp	2017-12-02 00:28:46 UTC (rev 225431)
@@ -110,6 +110,7 @@
         m_shadowHost->userAgentShadowRoot()->removeChild(*m_alternativePresentationButtonElement);
         ASSERT(!m_shadowHost->userAgentShadowRoot()->countChildNodes());
         m_shadowHost->removeShadowRoot();
+        m_shadowHost->invalidateStyleAndRenderersForSubtree();
     };
     auto restoreStyles = [&] {
         for (auto& savedDisplayStyle : m_savedDisplayStyles) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to