Changeset 86714 in webkit


Ignore:
Timestamp:
May 17, 2011 3:49:36 PM (13 years ago)
Author:
weinig@apple.com
Message:

2011-05-17 Sam Weinig <sam@webkit.org>

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.
Location:
trunk/Source/WebKit2
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r86694 r86714  
     12011-05-17  Sam Weinig  <sam@webkit.org>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        Add API to determine if a frame has any form elements without going to javascript
     6        https://bugs.webkit.org/show_bug.cgi?id=60999
     7
     8        * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
     9        (WKBundleFrameContainsAnyFormElements):
     10        * WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h:
     11        * WebProcess/WebPage/WebFrame.cpp:
     12        (WebKit::WebFrame::containsAnyFormElements):
     13        * WebProcess/WebPage/WebFrame.h:
     14        Add WKBundleFrameContainsAnyFormElements which does a walk of the document to determine
     15        if there are any form elements.
     16
    1172011-05-17  Andreas Kling  <kling@webkit.org>
    218
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp

    r82773 r86714  
    226226    return toCopiedAPI(toImpl(frameRef)->mimeTypeForResourceWithURL(WebCore::KURL(WebCore::KURL(), toImpl(urlRef)->string())));
    227227}
     228
     229bool WKBundleFrameContainsAnyFormElements(WKBundleFrameRef frameRef)
     230{
     231    return toImpl(frameRef)->containsAnyFormElements();
     232}
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h

    r79793 r86714  
    5050WK_EXPORT void WKBundleFrameClearOpener(WKBundleFrameRef frame);
    5151
     52WK_EXPORT bool WKBundleFrameContainsAnyFormElements(WKBundleFrameRef frame);
     53
    5254#ifdef __cplusplus
    5355}
  • trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp

    r85783 r86714  
    4747#include <WebCore/FrameView.h>
    4848#include <WebCore/HTMLFrameOwnerElement.h>
     49#include <WebCore/HTMLNames.h>
    4950#include <WebCore/JSCSSStyleDeclaration.h>
    5051#include <WebCore/JSElement.h>
     
    550551}
    551552
     553bool WebFrame::containsAnyFormElements() const
     554{
     555    if (!m_coreFrame)
     556        return false;
     557   
     558    Document* document = m_coreFrame->document();
     559    if (!document)
     560        return false;
     561
     562    for (Node* node = document->documentElement(); node; node = node->traverseNextNode()) {
     563        if (!node->isElementNode())
     564            continue;
     565        if (static_cast<Element*>(node)->hasTagName(HTMLNames::formTag))
     566            return true;
     567    }
     568    return false;
     569}
     570
    552571WebFrame* WebFrame::frameForContext(JSContextRef context)
    553572{
  • trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.h

    r82773 r86714  
    9797    bool hasVerticalScrollbar() const;
    9898    bool getDocumentBackgroundColor(double* red, double* green, double* blue, double* alpha);
     99    bool containsAnyFormElements() const;
    99100
    100101    static WebFrame* frameForContext(JSContextRef);
Note: See TracChangeset for help on using the changeset viewer.