Changeset 131979 in webkit


Ignore:
Timestamp:
Oct 19, 2012, 11:05:14 PM (13 years ago)
Author:
mitz@apple.com
Message:

Add bundle API for hit-testing
https://bugs.webkit.org/show_bug.cgi?id=99907

Reviewed by Sam Weinig.

Source/WebKit2:

Test: TestWebKitAPI/Tests/WebKit2/InjectedBundleFrameHitTest.cpp

  • WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:

(WKBundleFrameCreateHitTestResult): Added this wrapper.

  • WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h:
  • WebProcess/WebPage/WebFrame.cpp:

(WebKit::WebFrame::hitTest): Added. Hit tests at the given point, ignoring clipping.

  • WebProcess/WebPage/WebFrame.h:

(WebFrame): Declared hitTest.

Tools:

Added an API test for WKBundleFrameCreateHitTest().

  • TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: Added InjectedBundleFrameHitTest.cpp,

InjectedBundleFrameHitTest_bundle.cpp, and link-with-title.html.

  • TestWebKitAPI/Tests/WebKit2/InjectedBundleFrameHitTest.cpp: Added.

(TestWebKitAPI::didReceiveMessageFromInjectedBundle): Checks that the message contains the
title of the link in link-with-title.html.
(TestWebKitAPI::setInjectedBundleClient):
(TestWebKitAPI::TEST):

  • TestWebKitAPI/Tests/WebKit2/InjectedBundleFrameHitTest_Bundle.cpp: Added.

(TestWebKitAPI::InjectedBundleFrameHitTestTest::InjectedBundleFrameHitTestTest):
(TestWebKitAPI::didFinishLoadForFrameCallback): Hit tests at (50, 50) and sends the link title
from the result back to the UI process.
(TestWebKitAPI::InjectedBundleFrameHitTestTest::didCreatePage):
(TestWebKitAPI::InjectedBundleFrameHitTestTest::frameLoadFinished):

  • TestWebKitAPI/Tests/WebKit2/link-with-title.html: Added.
Location:
trunk
Files:
3 added
7 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/Source/WebKit2/ChangeLog

    r131978 r131979  
     12012-10-19  Dan Bernstein  <mitz@apple.com>
     2
     3        Add bundle API for hit-testing
     4        https://bugs.webkit.org/show_bug.cgi?id=99907
     5
     6        Reviewed by Sam Weinig.
     7
     8        Test: TestWebKitAPI/Tests/WebKit2/InjectedBundleFrameHitTest.cpp
     9
     10        * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
     11        (WKBundleFrameCreateHitTestResult): Added this wrapper.
     12        * WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h:
     13        * WebProcess/WebPage/WebFrame.cpp:
     14        (WebKit::WebFrame::hitTest): Added. Hit tests at the given point, ignoring clipping.
     15        * WebProcess/WebPage/WebFrame.h:
     16        (WebFrame): Declared hitTest.
     17
    1182012-10-19  Jinwoo Song  <jinwoo7.song@samsung.com>
    219
  • TabularUnified trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp

    r129743 r131979  
    2828#include "WKBundleFramePrivate.h"
    2929
     30#include "InjectedBundleHitTestResult.h"
    3031#include "WKAPICast.h"
    3132#include "WKBundleAPICast.h"
     
    281282    return coreFrame->loader()->shouldClose();
    282283}
     284
     285WKBundleHitTestResultRef WKBundleFrameCreateHitTestResult(WKBundleFrameRef frameRef, WKPoint point)
     286{
     287    return toAPI(toImpl(frameRef)->hitTest(toIntPoint(point)).leakRef());
     288}
  • TabularUnified trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h

    r128612 r131979  
    5656WK_EXPORT bool WKBundleFrameCallShouldCloseOnWebView(WKBundleFrameRef frame);
    5757
     58WK_EXPORT WKBundleHitTestResultRef WKBundleFrameCreateHitTestResult(WKBundleFrameRef frame, WKPoint point);
     59
    5860#ifdef __cplusplus
    5961}
  • TabularUnified trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp

    r131085 r131979  
    2828
    2929#include "DownloadManager.h"
     30#include "InjectedBundleHitTestResult.h"
    3031#include "InjectedBundleNodeHandle.h"
    3132#include "InjectedBundleRangeHandle.h"
     
    618619}
    619620
     621PassRefPtr<InjectedBundleHitTestResult> WebFrame::hitTest(const IntPoint point) const
     622{
     623    if (!m_coreFrame)
     624        return 0;
     625
     626    return InjectedBundleHitTestResult::create(m_coreFrame->eventHandler()->hitTestResultAtPoint(point, false, true));
     627}
     628
    620629bool WebFrame::getDocumentBackgroundColor(double* red, double* green, double* blue, double* alpha)
    621630{
  • TabularUnified trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.h

    r128612 r131979  
    4343class Frame;
    4444class HTMLFrameOwnerElement;
     45class IntPoint;
    4546class IntRect;
    4647#if ENABLE(WEB_INTENTS)
     
    5253namespace WebKit {
    5354
     55class InjectedBundleHitTestResult;
    5456class InjectedBundleNodeHandle;
    5557class InjectedBundleRangeHandle;
     
    112114    bool hasHorizontalScrollbar() const;
    113115    bool hasVerticalScrollbar() const;
     116    PassRefPtr<InjectedBundleHitTestResult> hitTest(const WebCore::IntPoint) const;
    114117    bool getDocumentBackgroundColor(double* red, double* green, double* blue, double* alpha);
    115118    bool containsAnyFormElements() const;
  • TabularUnified trunk/Tools/ChangeLog

    r131962 r131979  
     12012-10-19  Dan Bernstein  <mitz@apple.com>
     2
     3        Add bundle API for hit-testing
     4        https://bugs.webkit.org/show_bug.cgi?id=99907
     5
     6        Reviewed by Sam Weinig.
     7
     8        Added an API test for WKBundleFrameCreateHitTest().
     9
     10        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: Added InjectedBundleFrameHitTest.cpp,
     11        InjectedBundleFrameHitTest_bundle.cpp, and link-with-title.html.
     12
     13        * TestWebKitAPI/Tests/WebKit2/InjectedBundleFrameHitTest.cpp: Added.
     14        (TestWebKitAPI::didReceiveMessageFromInjectedBundle): Checks that the message contains the
     15        title of the link in link-with-title.html.
     16        (TestWebKitAPI::setInjectedBundleClient):
     17        (TestWebKitAPI::TEST):
     18        * TestWebKitAPI/Tests/WebKit2/InjectedBundleFrameHitTest_Bundle.cpp: Added.
     19        (TestWebKitAPI::InjectedBundleFrameHitTestTest::InjectedBundleFrameHitTestTest):
     20        (TestWebKitAPI::didFinishLoadForFrameCallback): Hit tests at (50, 50) and sends the link title
     21        from the result back to the UI process.
     22        (TestWebKitAPI::InjectedBundleFrameHitTestTest::didCreatePage):
     23        (TestWebKitAPI::InjectedBundleFrameHitTestTest::frameLoadFinished):
     24        * TestWebKitAPI/Tests/WebKit2/link-with-title.html: Added.
     25
    1262012-10-19  Sheriff Bot  <webkit.review.bot@gmail.com>
    227
  • TabularUnified trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj

    r131149 r131979  
    4343                3722C8691461E03E00C45D00 /* RenderedImageFromDOMRange.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3722C8681461E03E00C45D00 /* RenderedImageFromDOMRange.mm */; };
    4444                3776BC63150946BC0043A66D /* DeviceScaleFactorInDashboardRegions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3776BC62150946BC0043A66D /* DeviceScaleFactorInDashboardRegions.mm */; };
     45                378E64731632646D00B6C676 /* InjectedBundleFrameHitTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 378E64711632646D00B6C676 /* InjectedBundleFrameHitTest.cpp */; };
     46                378E64771632655E00B6C676 /* InjectedBundleFrameHitTest_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 378E64751632655D00B6C676 /* InjectedBundleFrameHitTest_Bundle.cpp */; };
     47                378E64791632707400B6C676 /* link-with-title.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 378E647816326FDF00B6C676 /* link-with-title.html */; };
    4548                379028B614FABD92007E6B43 /* AcceptsFirstMouse.mm in Sources */ = {isa = PBXBuildFile; fileRef = 379028B514FABD92007E6B43 /* AcceptsFirstMouse.mm */; };
    4649                379028B914FAC24C007E6B43 /* acceptsFirstMouse.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 379028B814FABE49007E6B43 /* acceptsFirstMouse.html */; };
     
    224227                                1A9E52C913E65EF4006917F5 /* 18-characters.html in Copy Resources */,
    225228                                C07E6CB213FD73930038B22B /* devicePixelRatio.html in Copy Resources */,
     229                                378E64791632707400B6C676 /* link-with-title.html in Copy Resources */,
    226230                                9361002914DC95A70061379D /* lots-of-iframes.html in Copy Resources */,
    227231                                93AF4ED11506F130007FD57E /* lots-of-images.html in Copy Resources */,
     
    280284                3722C8681461E03E00C45D00 /* RenderedImageFromDOMRange.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RenderedImageFromDOMRange.mm; sourceTree = "<group>"; };
    281285                3776BC62150946BC0043A66D /* DeviceScaleFactorInDashboardRegions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DeviceScaleFactorInDashboardRegions.mm; sourceTree = "<group>"; };
     286                378E64711632646D00B6C676 /* InjectedBundleFrameHitTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleFrameHitTest.cpp; sourceTree = "<group>"; };
     287                378E64751632655D00B6C676 /* InjectedBundleFrameHitTest_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleFrameHitTest_Bundle.cpp; sourceTree = "<group>"; };
     288                378E647816326FDF00B6C676 /* link-with-title.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "link-with-title.html"; sourceTree = "<group>"; };
    282289                379028B514FABD92007E6B43 /* AcceptsFirstMouse.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AcceptsFirstMouse.mm; sourceTree = "<group>"; };
    283290                379028B814FABE49007E6B43 /* acceptsFirstMouse.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = acceptsFirstMouse.html; sourceTree = "<group>"; };
     
    593600                                BC575AAC126E83B9006F0F12 /* InjectedBundleBasic.cpp */,
    594601                                BC575AAF126E83C8006F0F12 /* InjectedBundleBasic_Bundle.cpp */,
     602                                378E64711632646D00B6C676 /* InjectedBundleFrameHitTest.cpp */,
     603                                378E64751632655D00B6C676 /* InjectedBundleFrameHitTest_Bundle.cpp */,
    595604                                F660AA1215A619C8003A1243 /* InjectedBundleInitializationUserDataCallbackWins.cpp */,
    596605                                F660AA1415A61ABF003A1243 /* InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp */,
     
    671680                        children = (
    672681                                C045F9461385C2F800C0F3CD /* 18-characters.html */,
     682                                76E182DE15475A8300F1FADD /* auto-submitting-form.html */,
    673683                                BC2D004A12A9FEB300E732A3 /* file-with-anchor.html */,
    674684                                1A02C84B125D4A5E00E3F4BD /* find.html */,
    675685                                BCBD372E125ABBE600D2C29F /* icon.png */,
     686                                378E647816326FDF00B6C676 /* link-with-title.html */,
    676687                                9361002814DC957B0061379D /* lots-of-iframes.html */,
    677688                                93AF4ECF1506F123007FD57E /* lots-of-images.html */,
     
    685696                                BC909778125571AB00083756 /* simple.html */,
    686697                                C02B7882126615410026BF0F /* spacebar-scrolling.html */,
    687                                 76E182DE15475A8300F1FADD /* auto-submitting-form.html */,
    688698                        );
    689699                        name = Resources;
     
    9961006                                2943BE86161DFEB800999E3D /* UserContentTest.mm in Sources */,
    9971007                                4F4D2C0E1626FE2700320FE1 /* MemoryInstrumentationTest.cpp in Sources */,
     1008                                378E64731632646D00B6C676 /* InjectedBundleFrameHitTest.cpp in Sources */,
    9981009                        );
    9991010                        runOnlyForDeploymentPostprocessing = 0;
     
    10301041                                F660AA1115A5F631003A1243 /* GetInjectedBundleInitializationUserDataCallback_Bundle.cpp in Sources */,
    10311042                                F660AA1515A61ABF003A1243 /* InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp in Sources */,
     1043                                378E64771632655E00B6C676 /* InjectedBundleFrameHitTest_Bundle.cpp in Sources */,
    10321044                        );
    10331045                        runOnlyForDeploymentPostprocessing = 0;
Note: See TracChangeset for help on using the changeset viewer.