Title: [205711] branches/safari-602-branch

Diff

Modified: branches/safari-602-branch/LayoutTests/ChangeLog (205710 => 205711)


--- branches/safari-602-branch/LayoutTests/ChangeLog	2016-09-09 08:42:20 UTC (rev 205710)
+++ branches/safari-602-branch/LayoutTests/ChangeLog	2016-09-09 08:42:27 UTC (rev 205711)
@@ -1,5 +1,22 @@
 2016-09-09  Babak Shafiei  <[email protected]>
 
+        Merge r205381. rdar://problem/27806012
+
+    2016-09-02  Beth Dakin  <[email protected]>
+
+            Need to updateEditorState if an element change edit-ability without changing
+            selection
+            https://bugs.webkit.org/show_bug.cgi?id=161546
+            -and corresponding-
+            rdar://problem/27806012
+
+            Reviewed by Ryosuke Niwa.
+
+            This patch seems to have fixed a bug!
+            * editing/secure-input/removed-password-input-expected.txt:
+
+2016-09-09  Babak Shafiei  <[email protected]>
+
         Merge r205246. rdar://problem/28162589
 
     2016-08-31  Antti Koivisto  <[email protected]>

Modified: branches/safari-602-branch/LayoutTests/editing/secure-input/removed-password-input-expected.txt (205710 => 205711)


--- branches/safari-602-branch/LayoutTests/editing/secure-input/removed-password-input-expected.txt	2016-09-09 08:42:20 UTC (rev 205710)
+++ branches/safari-602-branch/LayoutTests/editing/secure-input/removed-password-input-expected.txt	2016-09-09 08:42:27 UTC (rev 205711)
@@ -7,7 +7,7 @@
 PASS testRunner.secureEventInputIsEnabled is true
 
 After deleting the input:
-FAIL testRunner.secureEventInputIsEnabled should be false. Was true.
+PASS testRunner.secureEventInputIsEnabled is false
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: branches/safari-602-branch/Source/WebCore/ChangeLog (205710 => 205711)


--- branches/safari-602-branch/Source/WebCore/ChangeLog	2016-09-09 08:42:20 UTC (rev 205710)
+++ branches/safari-602-branch/Source/WebCore/ChangeLog	2016-09-09 08:42:27 UTC (rev 205711)
@@ -1,5 +1,25 @@
 2016-09-09  Babak Shafiei  <[email protected]>
 
+        Merge r205381. rdar://problem/27806012
+
+    2016-09-02  Beth Dakin  <[email protected]>
+
+            Need to updateEditorState if an element change edit-ability without changing
+            selection
+            https://bugs.webkit.org/show_bug.cgi?id=161546
+            -and corresponding-
+            rdar://problem/27806012
+
+            Reviewed by Ryosuke Niwa.
+
+            Call into the client in case edited state needs to be updated.
+            * editing/FrameSelection.cpp:
+            (WebCore::FrameSelection::updateAppearanceAfterLayout):
+            * loader/EmptyClients.h:
+            * page/EditorClient.h:
+
+2016-09-09  Babak Shafiei  <[email protected]>
+
         Merge r205365. rdar://problem/28020157
 
     2016-07-08  Jer Noble  <[email protected]>

Modified: branches/safari-602-branch/Source/WebCore/editing/FrameSelection.cpp (205710 => 205711)


--- branches/safari-602-branch/Source/WebCore/editing/FrameSelection.cpp	2016-09-09 08:42:20 UTC (rev 205710)
+++ branches/safari-602-branch/Source/WebCore/editing/FrameSelection.cpp	2016-09-09 08:42:27 UTC (rev 205711)
@@ -2379,6 +2379,9 @@
 
 void FrameSelection::updateAppearanceAfterLayout()
 {
+    if (auto* client = m_frame->editor().client())
+        client->updateEditorStateAfterLayoutIfEditabilityChanged();
+
     setCaretRectNeedsUpdate();
     updateAndRevealSelection(AXTextStateChangeIntent());
     updateDataDetectorsForSelection();

Modified: branches/safari-602-branch/Source/WebCore/loader/EmptyClients.h (205710 => 205711)


--- branches/safari-602-branch/Source/WebCore/loader/EmptyClients.h	2016-09-09 08:42:20 UTC (rev 205710)
+++ branches/safari-602-branch/Source/WebCore/loader/EmptyClients.h	2016-09-09 08:42:27 UTC (rev 205711)
@@ -465,6 +465,7 @@
     void respondToChangedContents() override { }
     void respondToChangedSelection(Frame*) override { }
     void didChangeSelectionAndUpdateLayout() override { }
+    void updateEditorStateAfterLayoutIfEditabilityChanged() override { }
     void discardedComposition(Frame*) override { }
     void didEndEditing() override { }
     void willWriteSelectionToPasteboard(Range*) override { }

Modified: branches/safari-602-branch/Source/WebCore/page/EditorClient.h (205710 => 205711)


--- branches/safari-602-branch/Source/WebCore/page/EditorClient.h	2016-09-09 08:42:20 UTC (rev 205710)
+++ branches/safari-602-branch/Source/WebCore/page/EditorClient.h	2016-09-09 08:42:27 UTC (rev 205711)
@@ -94,6 +94,7 @@
     virtual void respondToChangedContents() = 0;
     virtual void respondToChangedSelection(Frame*) = 0;
     virtual void didChangeSelectionAndUpdateLayout() = 0;
+    virtual void updateEditorStateAfterLayoutIfEditabilityChanged() = 0;
     virtual void didEndEditing() = 0;
     virtual void willWriteSelectionToPasteboard(Range*) = 0;
     virtual void didWriteSelectionToPasteboard() = 0;

Modified: branches/safari-602-branch/Source/WebKit/mac/ChangeLog (205710 => 205711)


--- branches/safari-602-branch/Source/WebKit/mac/ChangeLog	2016-09-09 08:42:20 UTC (rev 205710)
+++ branches/safari-602-branch/Source/WebKit/mac/ChangeLog	2016-09-09 08:42:27 UTC (rev 205711)
@@ -1,5 +1,29 @@
 2016-09-09  Babak Shafiei  <[email protected]>
 
+        Merge r205381. rdar://problem/27806012
+
+    2016-09-02  Beth Dakin  <[email protected]>
+
+            Need to updateEditorState if an element change edit-ability without changing
+            selection
+            https://bugs.webkit.org/show_bug.cgi?id=161546
+            -and corresponding-
+            rdar://problem/27806012
+
+            Reviewed by Ryosuke Niwa.
+
+            Every time WebEditorClient::respondToChangedSelection is called, we now save
+            whether the last state was contentEditable. That way in
+            updateEditorStateAfterLayoutIfNeeded() we can assess whether or not edit-ability
+            has changed.
+
+            * WebCoreSupport/WebEditorClient.h:
+            * WebCoreSupport/WebEditorClient.mm:
+            (WebEditorClient::respondToChangedSelection):
+            (WebEditorClient:: updateEditorStateAfterLayoutIfEditabilityChanged):
+
+2016-09-09  Babak Shafiei  <[email protected]>
+
         Merge r205365. rdar://problem/28020157
 
     2016-07-08  Jer Noble  <[email protected]>

Modified: branches/safari-602-branch/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h (205710 => 205711)


--- branches/safari-602-branch/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h	2016-09-09 08:42:20 UTC (rev 205710)
+++ branches/safari-602-branch/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h	2016-09-09 08:42:27 UTC (rev 205711)
@@ -112,6 +112,7 @@
     void respondToChangedContents() override;
     void respondToChangedSelection(WebCore::Frame*) override;
     void didChangeSelectionAndUpdateLayout() override { }
+    void updateEditorStateAfterLayoutIfEditabilityChanged() override;
     void discardedComposition(WebCore::Frame*) override;
 
     void registerUndoStep(PassRefPtr<WebCore::UndoStep>) override;
@@ -191,6 +192,9 @@
     NSInteger m_lastCandidateRequestSequenceNumber;
 #endif
 
+    enum class EditorStateIsContentEditable { No, Yes, Unset };
+    EditorStateIsContentEditable m_lastEditorStateWasContentEditable { EditorStateIsContentEditable::Unset };
+
     WeakPtrFactory<WebEditorClient> m_weakPtrFactory;
 };
 

Modified: branches/safari-602-branch/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm (205710 => 205711)


--- branches/safari-602-branch/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm	2016-09-09 08:42:20 UTC (rev 205710)
+++ branches/safari-602-branch/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm	2016-09-09 08:42:27 UTC (rev 205711)
@@ -348,6 +348,7 @@
     if ([documentView isKindOfClass:[WebHTMLView class]]) {
         [(WebHTMLView *)documentView _selectionChanged];
         [m_webView updateWebViewAdditions];
+        m_lastEditorStateWasContentEditable = [(WebHTMLView *)documentView _isEditable] ? EditorStateIsContentEditable::Yes : EditorStateIsContentEditable::No;
     }
 
 #if !PLATFORM(IOS)
@@ -627,6 +628,26 @@
     m_haveUndoRedoOperations = YES;
 }
 
+void WebEditorClient::updateEditorStateAfterLayoutIfEditabilityChanged()
+{
+    // FIXME: We should update EditorStateIsContentEditable to track whether the state is richly
+    // editable or plainttext-only.
+    if (m_lastEditorStateWasContentEditable == EditorStateIsContentEditable::Unset)
+        return;
+
+    Frame* frame = core([m_webView _selectedOrMainFrame]);
+    if (!frame)
+        return;
+
+    NSView<WebDocumentView> *documentView = [[kit(frame) frameView] documentView];
+    if (![documentView isKindOfClass:[WebHTMLView class]])
+        return;
+
+    EditorStateIsContentEditable editorStateIsContentEditable = [(WebHTMLView *)documentView _isEditable] ? EditorStateIsContentEditable::Yes : EditorStateIsContentEditable::No;
+    if (m_lastEditorStateWasContentEditable != editorStateIsContentEditable)
+        [m_webView updateWebViewAdditions];
+}
+
 void WebEditorClient::registerUndoStep(PassRefPtr<UndoStep> cmd)
 {
     registerUndoOrRedoStep(cmd, false);

Modified: branches/safari-602-branch/Source/WebKit2/ChangeLog (205710 => 205711)


--- branches/safari-602-branch/Source/WebKit2/ChangeLog	2016-09-09 08:42:20 UTC (rev 205710)
+++ branches/safari-602-branch/Source/WebKit2/ChangeLog	2016-09-09 08:42:27 UTC (rev 205711)
@@ -1,5 +1,32 @@
 2016-09-09  Babak Shafiei  <[email protected]>
 
+        Merge r205381. rdar://problem/27806012
+
+    2016-09-02  Beth Dakin  <[email protected]>
+
+            Need to updateEditorState if an element change edit-ability without changing
+            selection
+            https://bugs.webkit.org/show_bug.cgi?id=161546
+            -and corresponding-
+            rdar://problem/27806012
+
+            Reviewed by Ryosuke Niwa.
+
+            Every time WebPage::editorState() is called, we now save whether the last state
+            was contentEditable. That way in updateEditorStateAfterLayoutIfNeeded() we can
+            assess whether or not edit-ability has changed.
+
+            * WebProcess/WebCoreSupport/WebEditorClient.cpp:
+            (WebKit::WebEditorClient:: updateEditorStateAfterLayoutIfEditabilityChanged):
+            * WebProcess/WebCoreSupport/WebEditorClient.h:
+            * WebProcess/WebPage/WebPage.cpp:
+            (WebKit::WebPage::editorState):
+            (WebKit::WebPage:: updateEditorStateAfterLayoutIfEditabilityChanged):
+            (WebKit::WebPage::didStartPageTransition):
+            * WebProcess/WebPage/WebPage.h:
+
+2016-09-09  Babak Shafiei  <[email protected]>
+
         Merge r205371. rdar://problem/28020157
 
     2016-09-02  Jer Noble  <[email protected]>

Modified: branches/safari-602-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp (205710 => 205711)


--- branches/safari-602-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp	2016-09-09 08:42:20 UTC (rev 205710)
+++ branches/safari-602-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp	2016-09-09 08:42:27 UTC (rev 205711)
@@ -201,6 +201,11 @@
     m_page->sendPostLayoutEditorStateIfNeeded();
 }
 
+void WebEditorClient::updateEditorStateAfterLayoutIfEditabilityChanged()
+{
+    m_page->updateEditorStateAfterLayoutIfEditabilityChanged();
+}
+
 void WebEditorClient::discardedComposition(Frame*)
 {
     m_page->discardedComposition();

Modified: branches/safari-602-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h (205710 => 205711)


--- branches/safari-602-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h	2016-09-09 08:42:20 UTC (rev 205710)
+++ branches/safari-602-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h	2016-09-09 08:42:27 UTC (rev 205711)
@@ -64,6 +64,7 @@
     void respondToChangedContents() override;
     void respondToChangedSelection(WebCore::Frame*) override;
     void didChangeSelectionAndUpdateLayout() override;
+    void updateEditorStateAfterLayoutIfEditabilityChanged() override;
     void discardedComposition(WebCore::Frame*) override;
     void didEndEditing() override;
     void willWriteSelectionToPasteboard(WebCore::Range*) override;

Modified: branches/safari-602-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (205710 => 205711)


--- branches/safari-602-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2016-09-09 08:42:20 UTC (rev 205710)
+++ branches/safari-602-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2016-09-09 08:42:27 UTC (rev 205711)
@@ -894,9 +894,24 @@
 
     platformEditorState(frame, result, shouldIncludePostLayoutData);
 
+    m_lastEditorStateWasContentEditable = result.isContentEditable ? EditorStateIsContentEditable::Yes : EditorStateIsContentEditable::No;
+
     return result;
 }
 
+void WebPage::updateEditorStateAfterLayoutIfEditabilityChanged()
+{
+    // FIXME: We should update EditorStateIsContentEditable to track whether the state is richly
+    // editable or plainttext-only.
+    if (m_lastEditorStateWasContentEditable == EditorStateIsContentEditable::Unset)
+        return;
+
+    Frame& frame = m_page->focusController().focusedOrMainFrame();
+    EditorStateIsContentEditable editorStateIsContentEditable = frame.selection().selection().isContentEditable() ? EditorStateIsContentEditable::Yes : EditorStateIsContentEditable::No;
+    if (m_lastEditorStateWasContentEditable != editorStateIsContentEditable)
+        send(Messages::WebPageProxy::EditorStateChanged(editorState()));
+}
+
 String WebPage::renderTreeExternalRepresentation() const
 {
     return externalRepresentation(m_mainFrame->coreFrame(), RenderAsTextBehaviorNormal);
@@ -2612,6 +2627,7 @@
 #endif
     m_hasEverFocusedElementDueToUserInteractionSincePageTransition = false;
     m_isAssistingNodeDueToUserInteraction = false;
+    m_lastEditorStateWasContentEditable = EditorStateIsContentEditable::Unset;
 #if PLATFORM(MAC)
     if (hasPreviouslyFocusedDueToUserInteraction)
         send(Messages::WebPageProxy::SetHasHadSelectionChangesFromUserInteraction(m_hasEverFocusedElementDueToUserInteractionSincePageTransition));

Modified: branches/safari-602-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h (205710 => 205711)


--- branches/safari-602-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h	2016-09-09 08:42:20 UTC (rev 205710)
+++ branches/safari-602-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h	2016-09-09 08:42:27 UTC (rev 205711)
@@ -362,6 +362,7 @@
     enum class IncludePostLayoutDataHint { No, Yes };
     EditorState editorState(IncludePostLayoutDataHint = IncludePostLayoutDataHint::Yes) const;
     void sendPostLayoutEditorStateIfNeeded();
+    void updateEditorStateAfterLayoutIfEditabilityChanged();
 
     String renderTreeExternalRepresentation() const;
     String renderTreeExternalRepresentationForPrinting() const;
@@ -1470,6 +1471,9 @@
     bool m_shouldDispatchFakeMouseMoveEvents;
     bool m_isEditorStateMissingPostLayoutData { false };
 
+    enum class EditorStateIsContentEditable { No, Yes, Unset };
+    mutable EditorStateIsContentEditable m_lastEditorStateWasContentEditable { EditorStateIsContentEditable::Unset };
+
 #if PLATFORM(GTK)
     bool m_inputMethodEnabled { false };
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to