Changeset 63877 in webkit


Ignore:
Timestamp:
Jul 21, 2010 11:52:51 PM (14 years ago)
Author:
Darin Adler
Message:

2010-07-21 Darin Adler <Darin Adler>

Reviewed by Sam Weinig.

WebKitTestRunner needs layoutTestController.dumpChildFrameScrollPositions
https://bugs.webkit.org/show_bug.cgi?id=42548

  • platform/mac-wk2/Skipped: Moved some tests into the correct section now that dumpChildFrameScrollPositions is no longer the reason they fail. Removed now-passing test. Resorted some of the tests.

2010-07-21 Darin Adler <Darin Adler>

Reviewed by Sam Weinig.

WebKitTestRunner needs layoutTestController.dumpChildFrameScrollPositions
https://bugs.webkit.org/show_bug.cgi?id=42548

  • WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl:
  • WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: (WTR::numericWindowPropertyValue): Renamed this and moved it up higher in the file. (WTR::dumpFrameScrollPosition): Added argument telling whether to dump the frame name. Changed to a file-internal function instead of a member function. (WTR::dumpDescendantFrameScrollPositions): Added. (WTR::InjectedBundlePage::dumpAllFrameScrollPositions): Added. (WTR::InjectedBundlePage::dump): Changed to call dumpAllFrameScrollPositions when appropriate. Also streamlined all the WKStringToUTF8 call sites. (WTR::InjectedBundlePage::willAddMessageToConsole): Streamlined use of WKStringToUTF8. (WTR::InjectedBundlePage::willSetStatusbarText): Ditto. (WTR::InjectedBundlePage::willRunJavaScriptAlert): Ditto. (WTR::InjectedBundlePage::willRunJavaScriptConfirm): Ditto. (WTR::InjectedBundlePage::willRunJavaScriptPrompt): Ditto.
  • WebKitTestRunner/InjectedBundle/InjectedBundlePage.h: Updated for above changes.
  • WebKitTestRunner/InjectedBundle/LayoutTestController.cpp: (WTR::LayoutTestController::LayoutTestController): Initialize m_shouldDumpAllFrameScrollPositions. (WTR::LayoutTestController::shouldDumpMainFrameScrollPosition): Renamed from shouldDumpFrameScrollPositions.
  • WebKitTestRunner/InjectedBundle/LayoutTestController.h: Reorganized the file a bit, added dumpChildFrameScrollPositions and shouldDumpAllFrameScrollPositions, and renamed shouldDumpFrameScrollPositions to shouldDumpMainFrameScrollPosition.

2010-07-21 Darin Adler <Darin Adler>

Reviewed by Sam Weinig.

WebKitTestRunner needs layoutTestController.dumpChildFrameScrollPositions
https://bugs.webkit.org/show_bug.cgi?id=42548

Added WKBundleFrameCopyName.

  • WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: (WKBundleFrameCopyName): Added.
  • WebProcess/InjectedBundle/API/c/WKBundleFrame.h: Ditto.
  • WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::name): Added.
  • WebProcess/WebPage/WebFrame.h: Ditto.
Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r63876 r63877  
     12010-07-21  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        WebKitTestRunner needs layoutTestController.dumpChildFrameScrollPositions
     6        https://bugs.webkit.org/show_bug.cgi?id=42548
     7
     8        * platform/mac-wk2/Skipped: Moved some tests into the correct section
     9        now that dumpChildFrameScrollPositions is no longer the reason they
     10        fail. Removed now-passing test. Resorted some of the tests.
     11
    1122010-07-21  Kent Tamura  <tkent@chromium.org>
    213
  • trunk/LayoutTests/platform/mac-wk2/Skipped

    r63866 r63877  
    16621662http/tests/incremental/frame-focus-before-load.html
    16631663http/tests/navigation/anchor-basic.html
     1664http/tests/navigation/anchor-frames.html
    16641665http/tests/navigation/anchor-goback.html
     1666http/tests/navigation/anchor-subframeload.html
    16651667http/tests/navigation/back-to-slow-frame.html
     1668http/tests/navigation/document-location-click-timeout.html
    16661669http/tests/navigation/document-location-click.html
    1667 http/tests/navigation/document-location-click-timeout.html
    16681670http/tests/navigation/document-location-mouseover.html
    16691671http/tests/navigation/document-location-onload.html
     
    16881690http/tests/navigation/multiple-back-forward-entries.html
    16891691http/tests/navigation/onload-navigation-iframe-2.html
     1692http/tests/navigation/onload-navigation-iframe-timeout.html
    16901693http/tests/navigation/onload-navigation-iframe.html
    1691 http/tests/navigation/onload-navigation-iframe-timeout.html
    16921694http/tests/navigation/parsed-iframe-dynamic-form-back-entry.html
    16931695http/tests/navigation/post-basic.html
     
    17071709http/tests/navigation/redirect302-subframeload.html
    17081710http/tests/navigation/relativeanchor-basic.html
     1711http/tests/navigation/relativeanchor-frames.html
    17091712http/tests/navigation/relativeanchor-goback.html
    17101713http/tests/navigation/restore-form-state-https.html
     
    17121715http/tests/navigation/slowtimerredirect-basic.html
    17131716http/tests/navigation/success200-basic.html
     1717http/tests/navigation/success200-frames-loadsame.html
    17141718http/tests/navigation/success200-frames.html
    1715 http/tests/navigation/success200-frames-loadsame.html
    17161719http/tests/navigation/success200-goback.html
    17171720http/tests/navigation/success200-loadsame.html
     
    22382241svg/custom/svg-disallowed-in-dashboard-object.html
    22392242
    2240 # WebKitTestRunner needs layoutTestController.dumpChildFrameScrollPositions
    2241 # <https://bugs.webkit.org/show_bug.cgi?id=42548>
    2242 fast/overflow/scrollRevealButton.html
    2243 http/tests/navigation/anchor-frames.html
    2244 http/tests/navigation/anchor-subframeload.html
    2245 http/tests/navigation/relativeanchor-frames.html
    2246 
    22472243# WebKitTestRunner needs layoutTestController.markerTextForListItem
    22482244# <https://bugs.webkit.org/show_bug.cgi?id=42549>
  • trunk/WebKit2/ChangeLog

    r63866 r63877  
     12010-07-21  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        WebKitTestRunner needs layoutTestController.dumpChildFrameScrollPositions
     6        https://bugs.webkit.org/show_bug.cgi?id=42548
     7
     8        Added WKBundleFrameCopyName.
     9
     10        * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
     11        (WKBundleFrameCopyName): Added.
     12        * WebProcess/InjectedBundle/API/c/WKBundleFrame.h: Ditto.
     13
     14        * WebProcess/WebPage/WebFrame.cpp:
     15        (WebKit::WebFrame::name): Added.
     16        * WebProcess/WebPage/WebFrame.h: Ditto.
     17
    1182010-07-21  Darin Adler  <darin@apple.com>
    219
  • trunk/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp

    r63866 r63877  
    7373    return const_cast<JSGlobalContextRef>(toRef(toWK(frameRef)->coreFrame()->script()->globalObject(mainThreadNormalWorld())->globalExec()));
    7474}
     75
     76WKStringRef WKBundleFrameCopyName(WKBundleFrameRef frameRef)
     77{
     78    WebCore::String string = toWK(frameRef)->name();
     79    string.impl()->ref();
     80    return toRef(string.impl());
     81}
  • trunk/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h

    r63866 r63877  
    5353WK_EXPORT bool WKBundleFramePauseAnimationOnElementWithId(WKBundleFrameRef frame, WKStringRef name, WKStringRef elementID, double time);
    5454
     55WK_EXPORT WKStringRef WKBundleFrameCopyName(WKBundleFrameRef frame);
     56
    5557#ifdef __cplusplus
    5658}
  • trunk/WebKit2/WebProcess/WebPage/WebFrame.cpp

    r63257 r63877  
    164164}
    165165
     166String WebFrame::name() const
     167{
     168    if (!m_coreFrame)
     169        return String();
     170
     171    return m_coreFrame->tree()->name();
     172}
     173
    166174String WebFrame::url() const
    167175{
  • trunk/WebKit2/WebProcess/WebPage/WebFrame.h

    r63257 r63877  
    6666    // WKBundleFrame API functions
    6767    bool isMainFrame() const;
     68    WebCore::String name() const;
    6869    WebCore::String url() const;
    6970    WebCore::String innerText() const;
  • trunk/WebKitTools/ChangeLog

    r63866 r63877  
     12010-07-21  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        WebKitTestRunner needs layoutTestController.dumpChildFrameScrollPositions
     6        https://bugs.webkit.org/show_bug.cgi?id=42548
     7
     8        * WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl:
     9        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
     10        (WTR::numericWindowPropertyValue): Renamed this and moved it up higher in the file.
     11        (WTR::dumpFrameScrollPosition): Added argument telling whether to dump the frame name.
     12        Changed to a file-internal function instead of a member function.
     13        (WTR::dumpDescendantFrameScrollPositions): Added.
     14        (WTR::InjectedBundlePage::dumpAllFrameScrollPositions): Added.
     15        (WTR::InjectedBundlePage::dump): Changed to call dumpAllFrameScrollPositions when
     16        appropriate. Also streamlined all the WKStringToUTF8 call sites.
     17        (WTR::InjectedBundlePage::willAddMessageToConsole): Streamlined use of WKStringToUTF8.
     18        (WTR::InjectedBundlePage::willSetStatusbarText): Ditto.
     19        (WTR::InjectedBundlePage::willRunJavaScriptAlert): Ditto.
     20        (WTR::InjectedBundlePage::willRunJavaScriptConfirm): Ditto.
     21        (WTR::InjectedBundlePage::willRunJavaScriptPrompt): Ditto.
     22
     23        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h: Updated for above changes.
     24
     25        * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
     26        (WTR::LayoutTestController::LayoutTestController): Initialize
     27        m_shouldDumpAllFrameScrollPositions.
     28        (WTR::LayoutTestController::shouldDumpMainFrameScrollPosition): Renamed from
     29        shouldDumpFrameScrollPositions.
     30
     31        * WebKitTestRunner/InjectedBundle/LayoutTestController.h: Reorganized the file a
     32        bit, added dumpChildFrameScrollPositions and shouldDumpAllFrameScrollPositions,
     33        and renamed shouldDumpFrameScrollPositions to shouldDumpMainFrameScrollPosition.
     34
    1352010-07-21  Darin Adler  <darin@apple.com>
    236
  • trunk/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl

    r63693 r63877  
    2727
    2828    interface LayoutTestController {
     29        // The basics.
    2930        void dumpAsText();
    30         void dumpStatusCallbacks();
    31 
    3231        void waitUntilDone();
    3332        void notifyDone();
    3433
    35         // Repaint testing
     34        // Other kinds of dumping.
     35        void dumpChildFrameScrollPositions();
     36        void dumpStatusCallbacks();
     37
     38        // Repaint testing.
    3639        void testRepaint();
    3740        void repaintSweepHorizontally();
    3841        void display();
    3942
    40         // Animation testing
     43        // Animation testing.
    4144        int numberOfActiveAnimations();
    4245        boolean pauseAnimationAtTimeOnElementWithId(in DOMString animationName, in double time, in DOMString elementId);
  • trunk/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp

    r63866 r63877  
    2727
    2828#include "InjectedBundle.h"
     29#include <JavaScriptCore/JSRetainPtr.h>
     30#include <WebKit2/WKArray.h>
    2931#include <WebKit2/WKBundleFrame.h>
    3032#include <WebKit2/WKBundlePagePrivate.h>
     
    145147}
    146148
     149static double numericWindowPropertyValue(WKBundleFrameRef frame, const char* propertyName)
     150{
     151    JSGlobalContextRef context = WKBundleFrameGetJavaScriptContext(frame);
     152    JSObjectRef window = JSContextGetGlobalObject(context);
     153    JSValueRef exception = 0;
     154    JSRetainPtr<JSStringRef> propertyNameString(Adopt, JSStringCreateWithUTF8CString(propertyName));
     155    JSValueRef value = JSObjectGetProperty(context, window, propertyNameString.get(), &exception);
     156    if (exception)
     157        return 0;
     158    return JSValueToNumber(context, value, &exception);
     159}
     160
     161enum FrameNamePolicy { ShouldNotIncludeFrameName, ShouldIncludeFrameName };
     162
     163static void dumpFrameScrollPosition(WKBundleFrameRef frame, FrameNamePolicy shouldIncludeFrameName = ShouldNotIncludeFrameName)
     164{
     165    double x = numericWindowPropertyValue(frame, "pageXOffset");
     166    double y = numericWindowPropertyValue(frame, "pageYOffset");
     167    if (fabs(x) > 0.00000001 || fabs(y) > 0.00000001) {
     168        if (shouldIncludeFrameName) {
     169            WKRetainPtr<WKStringRef> name(AdoptWK, WKBundleFrameCopyName(frame));
     170            InjectedBundle::shared().os() << "frame '" << WKStringToUTF8(name.get())->data() << "' ";
     171        }
     172        InjectedBundle::shared().os() << "scrolled to " << x << "," << y << "\n";
     173    }
     174}
     175
     176static void dumpDescendantFrameScrollPositions(WKBundleFrameRef frame)
     177{
     178    WKRetainPtr<WKArrayRef> childFrames(AdoptWK, WKBundleFrameCopyChildFrames(frame));
     179    size_t size = WKArrayGetSize(childFrames.get());
     180    for (size_t i = 0; i < size; ++i) {
     181        // FIXME: I don't like that we have to const_cast here. Can we change WKArray?
     182        WKBundleFrameRef subframe = static_cast<WKBundleFrameRef>(const_cast<void*>(WKArrayGetItemAtIndex(childFrames.get(), i)));
     183        dumpFrameScrollPosition(subframe, ShouldIncludeFrameName);
     184        dumpDescendantFrameScrollPositions(subframe);
     185    }
     186}
     187
     188void InjectedBundlePage::dumpAllFrameScrollPositions()
     189{
     190    WKBundleFrameRef frame = WKBundlePageGetMainFrame(m_page);
     191    dumpFrameScrollPosition(frame);
     192    dumpDescendantFrameScrollPositions(frame);
     193}
     194
    147195void InjectedBundlePage::dump()
    148196{
     
    152200        // FIXME: Support dumping subframes when layoutTestController()->dumpChildFramesAsText() is true.
    153201        WKRetainPtr<WKStringRef> innerText(AdoptWK, WKBundleFrameCopyInnerText(WKBundlePageGetMainFrame(m_page)));
    154         OwnPtr<Vector<char> > utf8InnerText = WKStringToUTF8(innerText.get());
    155         InjectedBundle::shared().os() << utf8InnerText->data() << "\n";
     202        InjectedBundle::shared().os() << WKStringToUTF8(innerText.get())->data() << "\n";
    156203    } else {
    157204        WKRetainPtr<WKStringRef> externalRepresentation(AdoptWK, WKBundlePageCopyRenderTreeExternalRepresentation(m_page));
    158         OwnPtr<Vector<char> > utf8externalRepresentation = WKStringToUTF8(externalRepresentation.get());
    159         InjectedBundle::shared().os() << utf8externalRepresentation->data();
     205        InjectedBundle::shared().os() << WKStringToUTF8(externalRepresentation.get())->data();
    160206    }
    161207
    162     if (InjectedBundle::shared().layoutTestController()->shouldDumpFrameScrollPositions())
     208    if (InjectedBundle::shared().layoutTestController()->shouldDumpAllFrameScrollPositions())
     209        dumpAllFrameScrollPositions();
     210    else if (InjectedBundle::shared().layoutTestController()->shouldDumpMainFrameScrollPosition())
    163211        dumpFrameScrollPosition(WKBundlePageGetMainFrame(m_page));
    164212
    165213    InjectedBundle::shared().done();
    166 }
    167 
    168 static double numericWindowProperty(WKBundleFrameRef frame, const char* propertyName)
    169 {
    170     JSGlobalContextRef context = WKBundleFrameGetJavaScriptContext(frame);
    171     JSObjectRef window = JSContextGetGlobalObject(context);
    172     JSValueRef exception = 0;
    173     JSStringRef propertyNameString = JSStringCreateWithUTF8CString(propertyName);
    174     JSValueRef value = JSObjectGetProperty(context, window, propertyNameString, &exception);
    175     JSStringRelease(propertyNameString);
    176     if (exception)
    177         return 0;
    178     return JSValueToNumber(context, value, &exception);
    179 }
    180 
    181 void InjectedBundlePage::dumpFrameScrollPosition(WKBundleFrameRef frame)
    182 {
    183     double x = numericWindowProperty(frame, "pageXOffset");
    184     double y = numericWindowProperty(frame, "pageYOffset");
    185     if (fabs(x) > 0.00000001 || fabs(y) > 0.00000001)
    186         InjectedBundle::shared().os() << "scrolled to " << x << "," << y << "\n";
    187214}
    188215
     
    250277{
    251278    // FIXME: Strip file: urls.
    252     OwnPtr<Vector<char> > utf8Message = WKStringToUTF8(message);
    253     InjectedBundle::shared().os() << "CONSOLE MESSAGE: line " << lineNumber << ": " << utf8Message->data() << "\n";
     279    InjectedBundle::shared().os() << "CONSOLE MESSAGE: line " << lineNumber << ": " << WKStringToUTF8(message)->data() << "\n";
    254280}
    255281
     
    259285        return;
    260286
    261     OwnPtr<Vector<char> > utf8StatusbarText = WKStringToUTF8(statusbarText);
    262     InjectedBundle::shared().os() << "UI DELEGATE STATUS CALLBACK: setStatusText:" << utf8StatusbarText->data() << "\n";
     287    InjectedBundle::shared().os() << "UI DELEGATE STATUS CALLBACK: setStatusText:" << WKStringToUTF8(statusbarText)->data() << "\n";
    263288}
    264289
    265290void InjectedBundlePage::willRunJavaScriptAlert(WKStringRef message, WKBundleFrameRef)
    266291{
    267     OwnPtr<Vector<char> > utf8Message = WKStringToUTF8(message);
    268     InjectedBundle::shared().os() << "ALERT: " << utf8Message->data() << "\n";
     292    InjectedBundle::shared().os() << "ALERT: " << WKStringToUTF8(message)->data() << "\n";
    269293}
    270294
    271295void InjectedBundlePage::willRunJavaScriptConfirm(WKStringRef message, WKBundleFrameRef)
    272296{
    273     OwnPtr<Vector<char> > utf8Message = WKStringToUTF8(message);
    274     InjectedBundle::shared().os() << "CONFIRM: " << utf8Message->data() << "\n";
     297    InjectedBundle::shared().os() << "CONFIRM: " << WKStringToUTF8(message)->data() << "\n";
    275298}
    276299
    277300void InjectedBundlePage::willRunJavaScriptPrompt(WKStringRef message, WKStringRef defaultValue, WKBundleFrameRef)
    278301{
    279     OwnPtr<Vector<char> > utf8Message = WKStringToUTF8(message);
    280     OwnPtr<Vector<char> > utf8DefaultValue = WKStringToUTF8(defaultValue);
    281     InjectedBundle::shared().os() << "PROMPT: " << utf8Message->data() << ", default text: " << utf8DefaultValue->data() <<  "\n";
     302    InjectedBundle::shared().os() << "PROMPT: " << WKStringToUTF8(message)->data() << ", default text: " << WKStringToUTF8(defaultValue)->data() <<  "\n";
    282303}
    283304
  • trunk/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h

    r63866 r63877  
    7272    void willRunJavaScriptPrompt(WKStringRef message, WKStringRef defaultValue, WKBundleFrameRef);
    7373
    74     void dumpFrameScrollPosition(WKBundleFrameRef);
     74    void dumpAllFrameScrollPositions();
    7575
    7676    WKBundlePageRef m_page;
  • trunk/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp

    r63866 r63877  
    4444LayoutTestController::LayoutTestController(const std::string& testPathOrURL)
    4545    : m_dumpAsText(false)
     46    , m_shouldDumpAllFrameScrollPositions(false)
    4647    , m_dumpStatusCallbacks(false)
    4748    , m_waitToDump(false)
     
    135136}
    136137
    137 bool LayoutTestController::shouldDumpFrameScrollPositions() const
     138bool LayoutTestController::shouldDumpMainFrameScrollPosition() const
    138139{
    139140    return !shouldDumpAsText() && !shouldDumpDOMAsWebArchive() && !shouldDumpSourceAsWebArchive();
  • trunk/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h

    r63866 r63877  
    3838public:
    3939    static PassRefPtr<LayoutTestController> create(const std::string& testPathOrURL);
    40     ~LayoutTestController();
     40    virtual ~LayoutTestController();
    4141
    4242    // JSWrappable
    43     JSClassRef wrapperClass();
     43    virtual JSClassRef wrapperClass();
    4444
    45     void makeWindowObject(JSContextRef context, JSObjectRef windowObject, JSValueRef* exception);
     45    void makeWindowObject(JSContextRef, JSObjectRef windowObject, JSValueRef* exception);
    4646
     47    // The basics.
    4748    void dumpAsText() { m_dumpAsText = true; }
     49    void waitUntilDone();
     50    void notifyDone();
     51
     52    // Other kinds of dumping.
     53    void dumpChildFrameScrollPositions() { m_shouldDumpAllFrameScrollPositions = true; }
    4854    void dumpStatusCallbacks() { m_dumpStatusCallbacks = true; }
    4955
     56    // Repaint testing.
     57    void testRepaint() { m_testRepaint = true; }
     58    void repaintSweepHorizontally() { m_testRepaintSweepHorizontally = true; }
     59    void display();
     60
     61    // Animation testing.
     62    unsigned numberOfActiveAnimations() const;
     63    bool pauseAnimationAtTimeOnElementWithId(JSStringRef animationName, double time, JSStringRef elementId);
     64
     65    bool shouldDumpAllFrameScrollPositions() const { return m_shouldDumpAllFrameScrollPositions; }
    5066    bool shouldDumpAsText() const { return m_dumpAsText; }
    5167    bool shouldDumpDOMAsWebArchive() const;
    52     bool shouldDumpFrameScrollPositions() const;
     68    bool shouldDumpMainFrameScrollPosition() const;
    5369    bool shouldDumpSourceAsWebArchive() const;
    5470    bool shouldDumpStatusCallbacks() const { return m_dumpStatusCallbacks; }
     
    5773    void waitToDumpWatchdogTimerFired();
    5874    void invalidateWaitToDumpWatchdog();
    59     void waitUntilDone();
    60     void notifyDone();
    61 
    62     void testRepaint() { m_testRepaint = true; }
    63     void repaintSweepHorizontally() { m_testRepaintSweepHorizontally = true; }
    64     void display();
    65 
    66     unsigned numberOfActiveAnimations() const;
    67     bool pauseAnimationAtTimeOnElementWithId(JSStringRef animationName, double time, JSStringRef elementId);
    6875
    6976private:
     
    7178
    7279    bool m_dumpAsText;
     80    bool m_shouldDumpAllFrameScrollPositions;
    7381    bool m_dumpStatusCallbacks;
    7482    bool m_waitToDump; // True if waitUntilDone() has been called, but notifyDone() has not yet been called.
Note: See TracChangeset for help on using the changeset viewer.