diff options
author | Steve Block <steveblock@google.com> | 2011-05-18 13:36:51 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2011-05-24 15:38:28 +0100 |
commit | 2fc2651226baac27029e38c9d6ef883fa32084db (patch) | |
tree | e396d4bf89dcce6ed02071be66212495b1df1dec /Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp | |
parent | b3725cedeb43722b3b175aaeff70552e562d2c94 (diff) | |
download | external_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.zip external_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.tar.gz external_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.tar.bz2 |
Merge WebKit at r78450: Initial merge by git.
Change-Id: I6d3e5f1f868ec266a0aafdef66182ddc3f265dc1
Diffstat (limited to 'Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp')
-rw-r--r-- | Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp | 83 |
1 files changed, 42 insertions, 41 deletions
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp index f02044c..82f616a 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp @@ -23,6 +23,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "WKBundleFrame.h" #include "WKBundleFramePrivate.h" @@ -55,6 +56,29 @@ WKURLRef WKBundleFrameCopyProvisionalURL(WKBundleFrameRef frameRef) return toCopiedURLAPI(toImpl(frameRef)->provisionalURL()); } +WKFrameLoadState WKBundleFrameGetFrameLoadState(WKBundleFrameRef frameRef) +{ + Frame* coreFrame = toImpl(frameRef)->coreFrame(); + if (!coreFrame) + return kWKFrameLoadStateFinished; + + FrameLoader* loader = coreFrame->loader(); + if (!loader) + return kWKFrameLoadStateFinished; + + switch (loader->state()) { + case FrameStateProvisional: + return kWKFrameLoadStateProvisional; + case FrameStateCommittedPage: + return kWKFrameLoadStateCommitted; + case FrameStateComplete: + return kWKFrameLoadStateFinished; + } + + ASSERT_NOT_REACHED(); + return kWKFrameLoadStateFinished; +} + WKArrayRef WKBundleFrameCopyChildFrames(WKBundleFrameRef frameRef) { return toAPI(toImpl(frameRef)->childFrames().releaseRef()); @@ -152,58 +176,35 @@ bool WKBundleFrameAllowsFollowingLink(WKBundleFrameRef frameRef, WKURLRef urlRef WKRect WKBundleFrameGetContentBounds(WKBundleFrameRef frameRef) { - WKRect contentBounds = { { 0, 0 }, { 0, 0 } }; - - Frame* coreFrame = toImpl(frameRef)->coreFrame(); - if (!coreFrame) - return contentBounds; - - FrameView* view = coreFrame->view(); - if (!view) - return contentBounds; - - contentBounds.size.width = view->contentsWidth(); - contentBounds.size.height = view->contentsHeight(); - - return contentBounds; + return toAPI(toImpl(frameRef)->contentBounds()); } WKRect WKBundleFrameGetVisibleContentBounds(WKBundleFrameRef frameRef) { - WKRect visibleContentBounds = { { 0, 0 }, { 0, 0 } }; - - Frame* coreFrame = toImpl(frameRef)->coreFrame(); - if (!coreFrame) - return visibleContentBounds; - - FrameView* view = coreFrame->view(); - if (!view) - return visibleContentBounds; - - FloatRect bounds = view->visibleContentRect(true); + return toAPI(toImpl(frameRef)->visibleContentBounds()); +} - visibleContentBounds.size.width = bounds.width(); - visibleContentBounds.size.height = bounds.height(); - - return visibleContentBounds; +WKRect WKBundleFrameGetVisibleContentBoundsExcludingScrollbars(WKBundleFrameRef frameRef) +{ + return toAPI(toImpl(frameRef)->visibleContentBoundsExcludingScrollbars()); } -WK_EXPORT WKSize WKBundleFrameGetScrollOffset(WKBundleFrameRef frameRef) +WKSize WKBundleFrameGetScrollOffset(WKBundleFrameRef frameRef) { - WKSize scrollOffset = { 0, 0 }; - - Frame* coreFrame = toImpl(frameRef)->coreFrame(); - if (!coreFrame) - return scrollOffset; - - FrameView* view = coreFrame->view(); - if (!view) - return scrollOffset; - - return toAPI(view->scrollOffset()); + return toAPI(toImpl(frameRef)->scrollOffset()); +} + +bool WKBundleFrameGetDocumentBackgroundColor(WKBundleFrameRef frameRef, double* red, double* green, double* blue, double* alpha) +{ + return toImpl(frameRef)->getDocumentBackgroundColor(red, green, blue, alpha); } WKStringRef WKBundleFrameCopySuggestedFilenameForResourceWithURL(WKBundleFrameRef frameRef, WKURLRef urlRef) { return toCopiedAPI(toImpl(frameRef)->suggestedFilenameForResourceWithURL(WebCore::KURL(WebCore::KURL(), toImpl(urlRef)->string()))); } + +WKStringRef WKBundleFrameCopyMIMETypeForResourceWithURL(WKBundleFrameRef frameRef, WKURLRef urlRef) +{ + return toCopiedAPI(toImpl(frameRef)->mimeTypeForResourceWithURL(WebCore::KURL(WebCore::KURL(), toImpl(urlRef)->string()))); +} |