Add needsPlainTextQuirk and send it to the UIProcess
authorbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Sep 2016 23:00:46 +0000 (23:00 +0000)
committerbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Sep 2016 23:00:46 +0000 (23:00 +0000)
https://bugs.webkit.org/show_bug.cgi?id=161996
-and corresponding-
rdar://problem/26013388

Reviewed by Anders Carlsson.

WebPageProxy should keep track of m_needsPlainTextQuirk.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setNeedsPlainTextQuirk):
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::needsPlainTextQuirk):
(WebKit::WebPageProxy::needsHiddenContentEditableQuirk): Deleted.
* UIProcess/WebPageProxy.messages.in:

If m_needsPlainTextQuirk is true, set it back to false on page transition.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didStartPageTransition):

The sites that need this quirk.
(WebKit::needsPlainTextQuirk):
(WebKit::WebPage::didChangeSelection):
* WebProcess/WebPage/WebPage.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205934 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/WebPageProxy.messages.in
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h

index 4199013..2236288 100644 (file)
@@ -1,3 +1,29 @@
+2016-09-14  Beth Dakin  <bdakin@apple.com>
+
+        Add needsPlainTextQuirk and send it to the UIProcess
+        https://bugs.webkit.org/show_bug.cgi?id=161996
+        -and corresponding-
+        rdar://problem/26013388
+
+        Reviewed by Anders Carlsson.
+
+        WebPageProxy should keep track of m_needsPlainTextQuirk.
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::setNeedsPlainTextQuirk):
+        * UIProcess/WebPageProxy.h:
+        (WebKit::WebPageProxy::needsPlainTextQuirk):
+        (WebKit::WebPageProxy::needsHiddenContentEditableQuirk): Deleted.
+        * UIProcess/WebPageProxy.messages.in:
+
+        If m_needsPlainTextQuirk is true, set it back to false on page transition.
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::didStartPageTransition):
+
+        The sites that need this quirk.
+        (WebKit::needsPlainTextQuirk):
+        (WebKit::WebPage::didChangeSelection):
+        * WebProcess/WebPage/WebPage.h:
+
 2016-09-14  Eric Carlson  <eric.carlson@apple.com>
 
         [MediaStream] Minor cleanup
index 0c8d054..5463fbf 100644 (file)
@@ -4294,6 +4294,11 @@ void WebPageProxy::setNeedsHiddenContentEditableQuirk(bool needsHiddenContentEdi
     m_needsHiddenContentEditableQuirk = needsHiddenContentEditableQuirk;
 }
 
+void WebPageProxy::setNeedsPlainTextQuirk(bool needsPlainTextQuirk)
+{
+    m_needsPlainTextQuirk = needsPlainTextQuirk;
+}
+
 // BackForwardList
 
 void WebPageProxy::backForwardAddItem(uint64_t itemID)
index c265369..6fa5975 100644 (file)
@@ -1119,6 +1119,7 @@ public:
 
     bool hasHadSelectionChangesFromUserInteraction() const { return m_hasHadSelectionChangesFromUserInteraction; }
     bool needsHiddenContentEditableQuirk() const { return m_needsHiddenContentEditableQuirk; }
+    bool needsPlainTextQuirk() const { return m_needsPlainTextQuirk; }
 
     bool isAlwaysOnLoggingAllowed() const;
 
@@ -1288,6 +1289,7 @@ private:
     void compositionWasCanceled(const EditorState&);
     void setHasHadSelectionChangesFromUserInteraction(bool);
     void setNeedsHiddenContentEditableQuirk(bool);
+    void setNeedsPlainTextQuirk(bool);
 
     // Back/Forward list management
     void backForwardAddItem(uint64_t itemID);
@@ -1857,6 +1859,7 @@ private:
 
     bool m_hasHadSelectionChangesFromUserInteraction { false };
     bool m_needsHiddenContentEditableQuirk { false };
+    bool m_needsPlainTextQuirk { false };
 
 #if ENABLE(MEDIA_SESSION)
     bool m_hasMediaSessionWithActiveMediaElements { false };
index e54b552..0dbb14c 100644 (file)
@@ -236,6 +236,7 @@ messages -> WebPageProxy {
     CompositionWasCanceled(struct WebKit::EditorState editorState)
     SetHasHadSelectionChangesFromUserInteraction(bool hasHadUserSelectionChanges)
     SetNeedsHiddenContentEditableQuirk(bool needsHiddenContentEditableQuirk)
+    SetNeedsPlainTextQuirk(bool needsPlainTextQuirk)
 
     # Find messages
     DidCountStringMatches(String string, uint32_t matchCount)
index b18bfcc..1a02850 100644 (file)
@@ -2650,6 +2650,10 @@ void WebPage::didStartPageTransition()
         m_needsHiddenContentEditableQuirk = false;
         send(Messages::WebPageProxy::SetNeedsHiddenContentEditableQuirk(m_needsHiddenContentEditableQuirk));
     }
+    if (m_needsPlainTextQuirk) {
+        m_needsPlainTextQuirk = false;
+        send(Messages::WebPageProxy::SetNeedsPlainTextQuirk(m_needsPlainTextQuirk));
+    }
 #endif
 }
 
@@ -4805,6 +4809,30 @@ static bool needsHiddenContentEditableQuirk(bool needsQuirks, const URL& url)
     String path = url.path();
     return equalLettersIgnoringASCIICase(host, "docs.google.com") || (equalLettersIgnoringASCIICase(host, "www.icloud.com") && path.contains("/pages/"));
 }
+
+static bool needsPlainTextQuirk(bool needsQuirks, const URL& url)
+{
+    if (!needsQuirks)
+        return false;
+
+    String host = url.host();
+    String path = url.path();
+    String fragmentIdentifier = url.fragmentIdentifier();
+
+    if (equalLettersIgnoringASCIICase(host, "twitter.com"))
+        return true;
+
+    if (equalLettersIgnoringASCIICase(host, "onedrive.live.com"))
+        return true;
+
+    if (equalLettersIgnoringASCIICase(host, "www.icloud.com") && (path.contains("notes") || fragmentIdentifier.contains("notes") || path.contains("/keynote/")))
+        return true;
+
+    if (equalLettersIgnoringASCIICase(host, "trix-editor.org"))
+        return true;
+
+    return false;
+}
 #endif
 
 void WebPage::didChangeSelection()
@@ -4827,6 +4855,12 @@ void WebPage::didChangeSelection()
             m_needsHiddenContentEditableQuirk = true;
             send(Messages::WebPageProxy::SetNeedsHiddenContentEditableQuirk(m_needsHiddenContentEditableQuirk));
         }
+
+        if (needsPlainTextQuirk(m_page->settings().needsSiteSpecificQuirks(), m_page->mainFrame().document()->url())) {
+            m_needsPlainTextQuirk = true;
+            send(Messages::WebPageProxy::SetNeedsPlainTextQuirk(m_needsPlainTextQuirk));
+        }
+
         send(Messages::WebPageProxy::SetHasHadSelectionChangesFromUserInteraction(m_hasEverFocusedElementDueToUserInteractionSincePageTransition));
     }
 
index e07b7a3..d49eca4 100644 (file)
@@ -1408,6 +1408,7 @@ private:
     bool m_isAssistingNodeDueToUserInteraction { false };
     bool m_hasEverFocusedElementDueToUserInteractionSincePageTransition { false };
     bool m_needsHiddenContentEditableQuirk { false };
+    bool m_needsPlainTextQuirk { false };
 
 #if ENABLE(CONTEXT_MENUS)
     bool m_isShowingContextMenu;