diff options
Diffstat (limited to 'Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp')
-rw-r--r-- | Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp | 47 |
1 files changed, 30 insertions, 17 deletions
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp index ef92d9b68..3eecf511a 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp @@ -41,9 +41,9 @@ using namespace WebCore; namespace WebKit { -PassRefPtr<InjectedBundleHitTestResult> InjectedBundleHitTestResult::create(const WebCore::HitTestResult& hitTestResult) +Ref<InjectedBundleHitTestResult> InjectedBundleHitTestResult::create(const HitTestResult& hitTestResult) { - return adoptRef(new InjectedBundleHitTestResult(hitTestResult)); + return adoptRef(*new InjectedBundleHitTestResult(hitTestResult)); } PassRefPtr<InjectedBundleNodeHandle> InjectedBundleHitTestResult::nodeHandle() const @@ -51,28 +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; + return nullptr; 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 @@ -105,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()) + Node* node = m_hitTestResult.innerNonSharedNode(); + if (!is<Element>(*node)) return BundleHitTestResultMediaTypeNone; - if (!toElement(node)->isMediaElement()) + if (!downcast<Element>(*node).isMediaElement()) return BundleHitTestResultMediaTypeNone; return m_hitTestResult.mediaIsVideo() ? BundleHitTestResultMediaTypeVideo : BundleHitTestResultMediaTypeAudio; @@ -131,23 +139,28 @@ String InjectedBundleHitTestResult::linkTitle() const return m_hitTestResult.titleDisplayString(); } -WebCore::IntRect InjectedBundleHitTestResult::imageRect() const +String InjectedBundleHitTestResult::linkSuggestedFilename() const +{ + return m_hitTestResult.URLElementDownloadAttribute(); +} + +IntRect InjectedBundleHitTestResult::imageRect() const { - WebCore::IntRect imageRect = m_hitTestResult.imageRect(); + IntRect imageRect = m_hitTestResult.imageRect(); if (imageRect.isEmpty()) return imageRect; - // The image rect in WebCore::HitTestResult is in frame coordinates, but we need it in WKView + // The image rect in HitTestResult is in frame coordinates, but we need it in WKView // coordinates since WebKit2 clients don't have enough context to do the conversion themselves. WebFrame* webFrame = frame(); if (!webFrame) return imageRect; - WebCore::Frame* coreFrame = webFrame->coreFrame(); + Frame* coreFrame = webFrame->coreFrame(); if (!coreFrame) return imageRect; - WebCore::FrameView* view = coreFrame->view(); + FrameView* view = coreFrame->view(); if (!view) return imageRect; |