summaryrefslogtreecommitdiffstats
path: root/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp')
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp83
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())));
+}