Changeset 68356 in webkit


Ignore:
Timestamp:
Sep 26, 2010 5:23:21 PM (14 years ago)
Author:
tonikitoo@webkit.org
Message:

[Mac][DRT] Implement LayoutTestController::nodesFromRect
https://bugs.webkit.org/show_bug.cgi?id=46580

Patch by Antonio Gomes <agomes@rim.comg> on 2010-09-26
Reviewed by Kenneth Christiansen.

WebCore:

Symbol files updated.

  • WebCore.exp.in: Added symbols to Document::nodesFromRect and bits of JSDocument now

needed in WebKit/mac.

  • WebCore.xcodeproj/project.pbxproj: Set both JSDocument.h and JSNodeList as private headers

now that they are referred in WebKit/mac.

WebKit/mac:

Implement nodesFromRect as a private method to access non-exposed Document
methods, similarly to computedStyleIncludingVisitedInfo.

  • WebView/WebView.mm: Added JSDocument.h and JSNodeList.h to the include list.

These headers makes it possible to:
1) Get a Document off of a JSDocument;
2) Call toJS function, defined in JSNodeList.cpp|h so we can convert RefPtr<NodeList>
gotten from Document::nodesFromRect to JS bindings.
(-[WebView _nodesFromRect:forDocument:x:y:hPadding:vPadding:ignoreClipping:]):

  • WebView/WebViewPrivate.h: Added nodesFromRect method to access methods of the

Document class not exposed to JavaScript. It works similarly to computedStyleIncludingVisitedInfo.

WebKitTools:

Implements LayoutTestController::nodesFromRect for Mac DRT, and
adding stubs for GTK+ and Windows.

  • DumpRenderTree/LayoutTestController.cpp:

(nodesFromRectCallback):
(LayoutTestController::staticFunctions):

  • DumpRenderTree/LayoutTestController.h:

(LayoutTestController::LayoutTestController::nodesFromRect):

  • DumpRenderTree/mac/LayoutTestControllerMac.mm:

(LayoutTestController::nodesFromRect):

LayoutTests:

Unskipping fast/dom/nodesFromRect-based.html on Mac, and changes it
so that it calls layoutTestController.nodesFromRect() instead of
document.nodesFromRect().

  • fast/dom/resources/nodesFromRect.js:

(check):

  • platform/mac/Skipped:
Location:
trunk
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r68355 r68356  
     12010-09-26  Antonio Gomes  <agomes@rim.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        DRT/Mac nodesFromRect support
     6
     7        [Mac][DRT] Implement LayoutTestController::nodesFromRect
     8        https://bugs.webkit.org/show_bug.cgi?id=46580
     9
     10        Unskipping fast/dom/nodesFromRect-based.html on Mac, and changes it
     11        so that it calls layoutTestController.nodesFromRect() instead of
     12        document.nodesFromRect().
     13
     14        * fast/dom/resources/nodesFromRect.js:
     15        (check):
     16        * platform/mac/Skipped:
     17
    1182010-09-26  Adam Barth  <abarth@webkit.org>
    219
  • trunk/LayoutTests/fast/dom/resources/nodesFromRect.js

    r64272 r68356  
    66function check(x, y, hPadding, vPadding, list)
    77{
    8   /*
    9     NodeList nodesFromRect(in long x,
    10                            in long y,
    11                            in long hPadding,
    12                            in long vPadding,
    13                            in boolean ignoreClipping);
    14   */
    15   var nodes = document.nodesFromRect(x, y, hPadding, vPadding, true /* ignoreClipping */);
     8  if (!window.layoutTestController)
     9    return;
     10
     11  var nodes = layoutTestController.nodesFromRect(document, x, y, hPadding, vPadding, true /* ignoreClipping */);
     12  if (!nodes)
     13    return;
    1614
    1715  if (nodes.length != list.length) {
  • trunk/LayoutTests/platform/mac/Skipped

    r68345 r68356  
    318318# FileSystem API is not supported.
    319319fast/filesystem
    320 
    321 # LayoutTestController::nodesFromRect is not supported.
    322 fast/dom/nodesFromRect-basic.html
  • trunk/WebCore/ChangeLog

    r68354 r68356  
     12010-09-26  Antonio Gomes  <agomes@rim.comg>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        DRT/Mac nodesFromRect support
     6
     7        [Mac][DRT] Implement LayoutTestController::nodesFromRect
     8        https://bugs.webkit.org/show_bug.cgi?id=46580
     9
     10        Symbol files updated.
     11
     12        * WebCore.exp.in: Added symbols to Document::nodesFromRect and bits of JSDocument now
     13        needed in WebKit/mac.
     14        * WebCore.xcodeproj/project.pbxproj: Set both JSDocument.h and JSNodeList as private headers
     15        now that they are referred in WebKit/mac.
     16
    1172010-09-26  Adam Barth  <abarth@webkit.org>
    218
  • trunk/WebCore/WebCore.exp.in

    r68252 r68356  
    493493__ZN7WebCore26usesTestModeFocusRingColorEv
    494494__ZN7WebCore27CSSComputedStyleDeclarationC1EN3WTF10PassRefPtrINS_4NodeEEEbRKNS1_6StringE
     495__ZNK7WebCore8Document13nodesFromRectEiijjb
    495496__ZN7WebCore27DeviceOrientationClientMock14setOrientationEN3WTF10PassRefPtrINS_17DeviceOrientationEEE
    496497__ZN7WebCore27DeviceOrientationClientMockC1Ev
     
    582583__ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_19CSSStyleDeclarationE
    583584__ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_5RangeE
     585__ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_8NodeListE
    584586__ZN7WebCore5Cache11setDisabledEb
    585587__ZN7WebCore5Cache13getStatisticsEv
     
    688690__ZN7WebCore8Document36updateLayoutIgnorePendingStylesheetsEv
    689691__ZN7WebCore8Document4headEv
     692__ZN7WebCore10JSDocument6s_infoE
    690693__ZN7WebCore8FormData6createEPKvm
    691694__ZN7WebCore8FormDataD1Ev
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r68292 r68356  
    13281328                659A7D130B6DB4D9001155B3 /* SubstituteData.h in Headers */ = {isa = PBXBuildFile; fileRef = 659A7D120B6DB4D9001155B3 /* SubstituteData.h */; settings = {ATTRIBUTES = (Private, ); }; };
    13291329                659DDC8209E198BA001BF3C6 /* JSDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 659DDC8009E198BA001BF3C6 /* JSDocument.cpp */; };
    1330                 659DDC8309E198BA001BF3C6 /* JSDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = 659DDC8109E198BA001BF3C6 /* JSDocument.h */; };
     1330                659DDC8309E198BA001BF3C6 /* JSDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = 659DDC8109E198BA001BF3C6 /* JSDocument.h */; settings = {ATTRIBUTES = (Private, ); }; };
    13311331                65A21468097A329100B9050A /* Page.h in Headers */ = {isa = PBXBuildFile; fileRef = 65A21467097A329100B9050A /* Page.h */; settings = {ATTRIBUTES = (Private, ); }; };
    13321332                65A21484097A3F5300B9050A /* FrameTree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65A21482097A3F5300B9050A /* FrameTree.cpp */; };
     
    49644964                BCD9C2C10C17B69E005C90A2 /* JSNamedNodeMap.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD9C2BD0C17B69E005C90A2 /* JSNamedNodeMap.h */; };
    49654965                BCD9C2C20C17B69E005C90A2 /* JSNodeList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD9C2BE0C17B69E005C90A2 /* JSNodeList.cpp */; };
    4966                 BCD9C2C30C17B69E005C90A2 /* JSNodeList.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD9C2BF0C17B69E005C90A2 /* JSNodeList.h */; };
     4966                BCD9C2C30C17B69E005C90A2 /* JSNodeList.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD9C2BF0C17B69E005C90A2 /* JSNodeList.h */; settings = {ATTRIBUTES = (Private, ); }; };
    49674967                BCDD454E1236C95C009A7985 /* ColumnInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = BCDD454D1236C95C009A7985 /* ColumnInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
    49684968                BCDF317B11F8D683003C5BF8 /* UserTypingGestureIndicator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCDF317911F8D683003C5BF8 /* UserTypingGestureIndicator.cpp */; };
  • trunk/WebKit/mac/ChangeLog

    r68280 r68356  
     12010-09-26  Antonio Gomes  <agomes@rim.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        DRT/Mac nodesFromRect support
     6
     7        [Mac][DRT] Implement LayoutTestController::nodesFromRect
     8        https://bugs.webkit.org/show_bug.cgi?id=46580
     9
     10        Implement nodesFromRect as a private method to access non-exposed Document
     11        methods, similarly to computedStyleIncludingVisitedInfo.
     12
     13        * WebView/WebView.mm: Added JSDocument.h and JSNodeList.h to the include list.
     14        These headers makes it possible to:
     15        1) Get a Document off of a JSDocument;
     16        2) Call toJS function, defined in JSNodeList.cpp|h so we can convert RefPtr<NodeList>
     17        gotten from Document::nodesFromRect to JS bindings.
     18        (-[WebView _nodesFromRect:forDocument:x:y:hPadding:vPadding:ignoreClipping:]):
     19        * WebView/WebViewPrivate.h: Added nodesFromRect method to access methods of the
     20        Document class not exposed to JavaScript. It works similarly to computedStyleIncludingVisitedInfo.
     21
    1222010-09-24  Jia Pu  <jpu@apple.com>
    223
  • trunk/WebKit/mac/WebView/WebView.mm

    r68280 r68356  
    134134#import <WebCore/IconDatabase.h>
    135135#import <WebCore/JSCSSStyleDeclaration.h>
     136#import <WebCore/JSDocument.h>
    136137#import <WebCore/JSElement.h>
     138#import <WebCore/JSNodeList.h>
    137139#import <WebCore/Logging.h>
    138140#import <WebCore/MIMETypeRegistry.h>
     141#import <WebCore/NodeList.h>
    139142#import <WebCore/Page.h>
    140143#import <WebCore/PageCache.h>
     
    60536056@end
    60546057
     6058@implementation WebView (WebViewPrivateNodesFromRect)
     6059
     6060- (JSValueRef)_nodesFromRect:(JSContextRef)context forDocument:(JSValueRef)value x:(int)x  y:(int)y hPadding:(unsigned)hPadding vPadding:(unsigned)vPadding ignoreClipping:(BOOL)ignoreClipping
     6061{
     6062    JSLock lock(SilenceAssertionsOnly);
     6063    ExecState* exec = toJS(context);
     6064    if (!value)
     6065        return JSValueMakeUndefined(context);
     6066    JSValue jsValue = toJS(exec, value);
     6067    if (!jsValue.inherits(&JSDocument::s_info))
     6068        return JSValueMakeUndefined(context);
     6069    JSDocument* jsDocument = static_cast<JSDocument*>(asObject(jsValue));
     6070    Document* document = jsDocument->impl();
     6071    RefPtr<NodeList> nodes = document->nodesFromRect(x, y, hPadding, vPadding, ignoreClipping);
     6072    return toRef(exec, toJS(exec, jsDocument->globalObject(), nodes.get()));
     6073}
     6074
     6075@end
     6076
    60556077#ifdef BUILDING_ON_LEOPARD
    60566078
  • trunk/WebKit/mac/WebView/WebViewPrivate.h

    r66685 r68356  
    631631@end
    632632
     633@interface WebView (WebViewPrivateNodesFromRect)
     634- (JSValueRef)_nodesFromRect:(JSContextRef)context forDocument:(JSValueRef)value x:(int)x  y:(int)y hPadding:(unsigned)hPadding vPadding:(unsigned)vPadding ignoreClipping:(BOOL)ignoreClipping;
     635@end
     636
    633637@interface NSObject (WebFrameLoadDelegatePrivate)
    634638- (void)webView:(WebView *)sender didFirstLayoutInFrame:(WebFrame *)frame;
  • trunk/WebKitTools/ChangeLog

    r68329 r68356  
     12010-09-26  Antonio Gomes  <agomes@rim.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        DRT/Mac nodesFromRect support
     6
     7        [Mac][DRT] Implement LayoutTestController::nodesFromRect
     8        https://bugs.webkit.org/show_bug.cgi?id=46580
     9
     10        Implements LayoutTestController::nodesFromRect for Mac DRT, and
     11        adding stubs for GTK+ and Windows.
     12
     13        * DumpRenderTree/LayoutTestController.cpp:
     14        (nodesFromRectCallback):
     15        (LayoutTestController::staticFunctions):
     16        * DumpRenderTree/LayoutTestController.h:
     17        (LayoutTestController::LayoutTestController::nodesFromRect):
     18        * DumpRenderTree/mac/LayoutTestControllerMac.mm:
     19        (LayoutTestController::nodesFromRect):
     20
    1212010-09-25  Nicolas Weber  <thakis@chromium.org>
    222
  • trunk/WebKitTools/DumpRenderTree/LayoutTestController.cpp

    r65666 r68356  
    514514}
    515515
     516static JSValueRef nodesFromRectCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
     517{
     518    if (argumentCount != 6)
     519        return JSValueMakeUndefined(context);
     520
     521    int x = JSValueToNumber(context, arguments[1], NULL);
     522    int y = JSValueToNumber(context, arguments[2], NULL);
     523    int hPadding = static_cast<unsigned>(JSValueToNumber(context, arguments[3], NULL));
     524    int vPadding = static_cast<unsigned>(JSValueToNumber(context, arguments[4], NULL));
     525    bool ignoreClipping = JSValueToBoolean(context, arguments[5]);
     526
     527    // Has mac implementation.
     528    LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
     529    return controller->nodesFromRect(context, arguments[0], x, y, hPadding, vPadding, ignoreClipping);
     530}
     531
    516532static JSValueRef layerTreeAsTextCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
    517533{
     
    18441860        { "closeWebInspector", closeWebInspectorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    18451861        { "computedStyleIncludingVisitedInfo", computedStyleIncludingVisitedInfoCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     1862        { "nodesFromRect", nodesFromRectCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    18461863        { "decodeHostName", decodeHostNameCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    18471864        { "disableImageLoading", disableImageLoadingCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
  • trunk/WebKitTools/DumpRenderTree/LayoutTestController.h

    r65666 r68356  
    6161    void keepWebHistory();
    6262    JSValueRef computedStyleIncludingVisitedInfo(JSContextRef, JSValueRef);
     63    JSValueRef nodesFromRect(JSContextRef, JSValueRef, int x, int y, unsigned hPadding, unsigned vPadding, bool ignoreClipping);
    6364    void notifyDone();
    6465    int numberOfPages(float pageWidthInPixels, float pageHeightInPixels);
  • trunk/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp

    r68211 r68356  
    138138}
    139139
     140JSValueRef LayoutTestController::nodesFromRect(JSContextRef context, JSValueRef value, int , int, unsigned, unsigned, bool)
     141{
     142    // FIXME: Implement this.
     143    return JSValueMakeUndefined(context);
     144}
     145
    140146JSRetainPtr<JSStringRef> LayoutTestController::layerTreeAsText() const
    141147{
  • trunk/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm

    r66685 r68356  
    199199}
    200200
     201JSValueRef LayoutTestController::nodesFromRect(JSContextRef context, JSValueRef value, int x, int y, unsigned hPadding, unsigned vPadding, bool ignoreClipping)
     202{
     203    return [[mainFrame webView] _nodesFromRect:context forDocument:value x:x y:y hPadding:hPadding vPadding:vPadding ignoreClipping:ignoreClipping];
     204}
     205
    201206JSRetainPtr<JSStringRef> LayoutTestController::layerTreeAsText() const
    202207{
  • trunk/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp

    r65666 r68356  
    180180}
    181181
     182JSValueRef LayoutTestController::nodesFromRect(JSContextRef context, JSValueRef value, int , int, unsigned, unsigned, bool)
     183{
     184    // FIXME: Implement this.
     185    return JSValueMakeUndefined(context);
     186}
     187
    182188JSRetainPtr<JSStringRef> LayoutTestController::layerTreeAsText() const
    183189{
  • trunk/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp

    r65666 r68356  
    487487}
    488488
     489JSValueRef LayoutTestController::nodesFromRect(JSContextRef context, JSValueRef value, int , int, unsigned, unsigned, bool)
     490{
     491    // FIXME: Implement this.
     492    return 0;
     493}
     494
    489495void LayoutTestController::authenticateSession(JSStringRef, JSStringRef, JSStringRef)
    490496{
Note: See TracChangeset for help on using the changeset viewer.