summaryrefslogtreecommitdiff
path: root/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@qt.io>2017-05-30 12:48:17 +0200
committerOswald Buddenhagen <oswald.buddenhagen@qt.io>2017-05-30 12:48:17 +0200
commit881da28418d380042aa95a97f0cbd42560a64f7c (patch)
treea794dff3274695e99c651902dde93d934ea7a5af /Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp
parent7e104c57a70fdf551bb3d22a5d637cdcbc69dbea (diff)
parent0fcedcd17cc00d3dd44c718b3cb36c1033319671 (diff)
downloadqtwebkit-881da28418d380042aa95a97f0cbd42560a64f7c.tar.gz
Merge 'wip/next' into dev
Change-Id: Iff9ee5e23bb326c4371ec8ed81d56f2f05d680e9
Diffstat (limited to 'Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp')
-rw-r--r--Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp38
1 files changed, 21 insertions, 17 deletions
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp
index 811c60cdf..c1305ebd8 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp
@@ -34,16 +34,16 @@
#include <WebCore/Frame.h>
#include <WebCore/FrameLoader.h>
#include <WebCore/FrameView.h>
-#include <WebCore/KURL.h>
+#include <WebCore/URL.h>
#include <wtf/text/WTFString.h>
using namespace WebCore;
namespace WebKit {
-PassRefPtr<InjectedBundleHitTestResult> InjectedBundleHitTestResult::create(const WebCore::HitTestResult& hitTestResult)
+Ref<InjectedBundleHitTestResult> InjectedBundleHitTestResult::create(const WebCore::HitTestResult& hitTestResult)
{
- return adoptRef(new InjectedBundleHitTestResult(hitTestResult));
+ return adoptRef(*new InjectedBundleHitTestResult(hitTestResult));
}
PassRefPtr<InjectedBundleNodeHandle> InjectedBundleHitTestResult::nodeHandle() const
@@ -51,32 +51,31 @@ PassRefPtr<InjectedBundleNodeHandle> InjectedBundleHitTestResult::nodeHandle() c
return InjectedBundleNodeHandle::getOrCreate(m_hitTestResult.innerNonSharedNode());
}
+PassRefPtr<InjectedBundleNodeHandle> InjectedBundleHitTestResult::urlElementHandle() const
+{
+ return InjectedBundleNodeHandle::getOrCreate(m_hitTestResult.URLElement());
+}
+
WebFrame* InjectedBundleHitTestResult::frame() const
{
Node* node = m_hitTestResult.innerNonSharedNode();
if (!node)
- return 0;
-
- Document* document = node->document();
- if (!document)
- return 0;
+ return nullptr;
- Frame* frame = document->frame();
+ Frame* frame = node->document().frame();
if (!frame)
- return 0;
+ return nullptr;
- WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(frame->loader()->client());
- return webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0;
+ return WebFrame::fromCoreFrame(*frame);
}
WebFrame* InjectedBundleHitTestResult::targetFrame() const
{
Frame* frame = m_hitTestResult.targetFrame();
if (!frame)
- return 0;
+ return nullptr;
- WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(frame->loader()->client());
- return webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0;
+ return WebFrame::fromCoreFrame(*frame);
}
String InjectedBundleHitTestResult::absoluteImageURL() const
@@ -109,16 +108,21 @@ bool InjectedBundleHitTestResult::mediaHasAudio() const
return m_hitTestResult.mediaHasAudio();
}
+bool InjectedBundleHitTestResult::isDownloadableMedia() const
+{
+ return m_hitTestResult.isDownloadableMedia();
+}
+
BundleHitTestResultMediaType InjectedBundleHitTestResult::mediaType() const
{
#if !ENABLE(VIDEO)
return BundleHitTestResultMediaTypeNone;
#else
WebCore::Node* node = m_hitTestResult.innerNonSharedNode();
- if (!node->isElementNode())
+ if (!is<Element>(*node))
return BundleHitTestResultMediaTypeNone;
- if (!toElement(node)->isMediaElement())
+ if (!downcast<Element>(*node).isMediaElement())
return BundleHitTestResultMediaTypeNone;
return m_hitTestResult.mediaIsVideo() ? BundleHitTestResultMediaTypeVideo : BundleHitTestResultMediaTypeAudio;