Title: [148938] trunk/Source/WebKit2
Revision
148938
Author
[email protected]
Date
2013-04-22 18:10:13 -0700 (Mon, 22 Apr 2013)

Log Message

Need WebKit SPI to detect whether a page contains form controls
<rdar://problem/13686661>
https://bugs.webkit.org/show_bug.cgi?id=115003

Reviewed by Beth Dakin.

* WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
(WKBundleFrameContainsAnyFormControls):
* WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h:
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::containsAnyFormControls):
* WebProcess/WebPage/WebFrame.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (148937 => 148938)


--- trunk/Source/WebKit2/ChangeLog	2013-04-23 00:43:25 UTC (rev 148937)
+++ trunk/Source/WebKit2/ChangeLog	2013-04-23 01:10:13 UTC (rev 148938)
@@ -1,3 +1,18 @@
+2013-04-22  Sam Weinig  <[email protected]>
+
+        Need WebKit SPI to detect whether a page contains form controls
+        <rdar://problem/13686661>
+        https://bugs.webkit.org/show_bug.cgi?id=115003
+
+        Reviewed by Beth Dakin.
+
+        * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
+        (WKBundleFrameContainsAnyFormControls):
+        * WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h:
+        * WebProcess/WebPage/WebFrame.cpp:
+        (WebKit::WebFrame::containsAnyFormControls):
+        * WebProcess/WebPage/WebFrame.h:
+
 2013-04-22  Alexey Proskuryakov  <[email protected]>
 
         [Mac] REGRESSION (r142806): "Just Leaking" Console errors on launch

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp (148937 => 148938)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp	2013-04-23 00:43:25 UTC (rev 148937)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp	2013-04-23 01:10:13 UTC (rev 148938)
@@ -221,6 +221,11 @@
     return toImpl(frameRef)->containsAnyFormElements();
 }
 
+bool WKBundleFrameContainsAnyFormControls(WKBundleFrameRef frameRef)
+{
+    return toImpl(frameRef)->containsAnyFormControls();
+}
+
 void WKBundleFrameSetTextDirection(WKBundleFrameRef frameRef, WKStringRef directionRef)
 {
     toImpl(frameRef)->setTextDirection(toWTFString(directionRef));

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h (148937 => 148938)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h	2013-04-23 00:43:25 UTC (rev 148937)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h	2013-04-23 01:10:13 UTC (rev 148938)
@@ -45,6 +45,7 @@
 WK_EXPORT void WKBundleFrameStopLoading(WKBundleFrameRef frame);
 
 WK_EXPORT bool WKBundleFrameContainsAnyFormElements(WKBundleFrameRef frame);
+WK_EXPORT bool WKBundleFrameContainsAnyFormControls(WKBundleFrameRef frame);
 WK_EXPORT void WKBundleFrameSetTextDirection(WKBundleFrameRef frame, WKStringRef);
 WK_EXPORT bool WKBundleFrameCallShouldCloseOnWebView(WKBundleFrameRef frame);
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp (148937 => 148938)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp	2013-04-23 00:43:25 UTC (rev 148937)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp	2013-04-23 01:10:13 UTC (rev 148938)
@@ -579,6 +579,24 @@
     return false;
 }
 
+bool WebFrame::containsAnyFormControls() const
+{
+    if (!m_coreFrame)
+        return false;
+    
+    Document* document = m_coreFrame->document();
+    if (!document)
+        return false;
+
+    for (Node* node = document->documentElement(); node; node = NodeTraversal::next(node)) {
+        if (!node->isElementNode())
+            continue;
+        if (toElement(node)->hasTagName(HTMLNames::inputTag) || toElement(node)->hasTagName(HTMLNames::selectTag) || toElement(node)->hasTagName(HTMLNames::textareaTag))
+            return true;
+    }
+    return false;
+}
+
 void WebFrame::stopLoading()
 {
     if (!m_coreFrame)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.h (148937 => 148938)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.h	2013-04-23 00:43:25 UTC (rev 148937)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.h	2013-04-23 01:10:13 UTC (rev 148938)
@@ -101,6 +101,7 @@
     PassRefPtr<InjectedBundleHitTestResult> hitTest(const WebCore::IntPoint) const;
     bool getDocumentBackgroundColor(double* red, double* green, double* blue, double* alpha);
     bool containsAnyFormElements() const;
+    bool containsAnyFormControls() const;
     void stopLoading();
     bool handlesPageScaleGesture() const;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to