Title: [86714] trunk/Source/WebKit2
- Revision
- 86714
- Author
- [email protected]
- Date
- 2011-05-17 15:49:36 -0700 (Tue, 17 May 2011)
Log Message
2011-05-17 Sam Weinig <[email protected]>
Reviewed by Dan Bernstein.
Add API to determine if a frame has any form elements without going to _javascript_
https://bugs.webkit.org/show_bug.cgi?id=60999
* WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
(WKBundleFrameContainsAnyFormElements):
* WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h:
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::containsAnyFormElements):
* WebProcess/WebPage/WebFrame.h:
Add WKBundleFrameContainsAnyFormElements which does a walk of the document to determine
if there are any form elements.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (86713 => 86714)
--- trunk/Source/WebKit2/ChangeLog 2011-05-17 22:34:22 UTC (rev 86713)
+++ trunk/Source/WebKit2/ChangeLog 2011-05-17 22:49:36 UTC (rev 86714)
@@ -1,3 +1,19 @@
+2011-05-17 Sam Weinig <[email protected]>
+
+ Reviewed by Dan Bernstein.
+
+ Add API to determine if a frame has any form elements without going to _javascript_
+ https://bugs.webkit.org/show_bug.cgi?id=60999
+
+ * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
+ (WKBundleFrameContainsAnyFormElements):
+ * WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h:
+ * WebProcess/WebPage/WebFrame.cpp:
+ (WebKit::WebFrame::containsAnyFormElements):
+ * WebProcess/WebPage/WebFrame.h:
+ Add WKBundleFrameContainsAnyFormElements which does a walk of the document to determine
+ if there are any form elements.
+
2011-05-17 Andreas Kling <[email protected]>
Reviewed by Kenneth Rohde Christiansen.
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp (86713 => 86714)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp 2011-05-17 22:34:22 UTC (rev 86713)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp 2011-05-17 22:49:36 UTC (rev 86714)
@@ -225,3 +225,8 @@
{
return toCopiedAPI(toImpl(frameRef)->mimeTypeForResourceWithURL(WebCore::KURL(WebCore::KURL(), toImpl(urlRef)->string())));
}
+
+bool WKBundleFrameContainsAnyFormElements(WKBundleFrameRef frameRef)
+{
+ return toImpl(frameRef)->containsAnyFormElements();
+}
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h (86713 => 86714)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h 2011-05-17 22:34:22 UTC (rev 86713)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h 2011-05-17 22:49:36 UTC (rev 86714)
@@ -49,6 +49,8 @@
WK_EXPORT WKStringRef WKBundleFrameCopyLayerTreeAsText(WKBundleFrameRef frame);
WK_EXPORT void WKBundleFrameClearOpener(WKBundleFrameRef frame);
+WK_EXPORT bool WKBundleFrameContainsAnyFormElements(WKBundleFrameRef frame);
+
#ifdef __cplusplus
}
#endif
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp (86713 => 86714)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp 2011-05-17 22:34:22 UTC (rev 86713)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp 2011-05-17 22:49:36 UTC (rev 86714)
@@ -46,6 +46,7 @@
#include <WebCore/Frame.h>
#include <WebCore/FrameView.h>
#include <WebCore/HTMLFrameOwnerElement.h>
+#include <WebCore/HTMLNames.h>
#include <WebCore/JSCSSStyleDeclaration.h>
#include <WebCore/JSElement.h>
#include <WebCore/JSRange.h>
@@ -549,6 +550,24 @@
return true;
}
+bool WebFrame::containsAnyFormElements() const
+{
+ if (!m_coreFrame)
+ return false;
+
+ Document* document = m_coreFrame->document();
+ if (!document)
+ return false;
+
+ for (Node* node = document->documentElement(); node; node = node->traverseNextNode()) {
+ if (!node->isElementNode())
+ continue;
+ if (static_cast<Element*>(node)->hasTagName(HTMLNames::formTag))
+ return true;
+ }
+ return false;
+}
+
WebFrame* WebFrame::frameForContext(JSContextRef context)
{
JSObjectRef globalObjectRef = JSContextGetGlobalObject(context);
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.h (86713 => 86714)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.h 2011-05-17 22:34:22 UTC (rev 86713)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.h 2011-05-17 22:49:36 UTC (rev 86714)
@@ -96,6 +96,7 @@
bool hasHorizontalScrollbar() const;
bool hasVerticalScrollbar() const;
bool getDocumentBackgroundColor(double* red, double* green, double* blue, double* alpha);
+ bool containsAnyFormElements() const;
static WebFrame* frameForContext(JSContextRef);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes