Changeset 64020 in webkit


Ignore:
Timestamp:
Jul 25, 2010 12:56:34 AM (14 years ago)
Author:
ap@apple.com
Message:

2010-07-25 Alexey Proskuryakov <ap@apple.com>

Reviewed by Sam Weinig.

https://bugs.webkit.org/show_bug.cgi?id=42193
Support layoutTestController.dumpEditingDelegates in WebKitTestRunner

Step 2 - add the rest of editing delegates.

  • platform/mac-wk2/Skipped: Changed the bug tracking why the tests are skipped - the delegates are now implemented, but one of them isn't called for some reason.

2010-07-25 Alexey Proskuryakov <ap@apple.com>

Reviewed by Sam Weinig.

https://bugs.webkit.org/show_bug.cgi?id=42193
Support layoutTestController.dumpEditingDelegates in WebKitTestRunner

Step 2 - add the rest of editing delegates.

  • WebProcess/InjectedBundle/API/c/WKBundleAPICast.h:
  • WebProcess/InjectedBundle/API/c/WKBundleBase.h: Added enums for EditorInsertAction and EAffinity. Also added a dummy type for CSSStyleDeclaration - neither DumpRenderTree not WebKitTestRunner actually use that.
  • WebProcess/InjectedBundle/API/c/WKBundlePage.h:
  • WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp: (WebKit::InjectedBundlePageEditorClient::shouldBeginEditing): (WebKit::InjectedBundlePageEditorClient::shouldEndEditing): (WebKit::InjectedBundlePageEditorClient::shouldInsertNode): (WebKit::InjectedBundlePageEditorClient::shouldInsertText): (WebKit::InjectedBundlePageEditorClient::shouldDeleteRange): (WebKit::InjectedBundlePageEditorClient::shouldChangeSelectedRange): (WebKit::InjectedBundlePageEditorClient::shouldApplyStyle): (WebKit::InjectedBundlePageEditorClient::didBeginEditing): (WebKit::InjectedBundlePageEditorClient::didEndEditing): (WebKit::InjectedBundlePageEditorClient::didChange): (WebKit::InjectedBundlePageEditorClient::didChangeSelection):
  • WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h:
  • WebProcess/WebCoreSupport/WebEditorClient.cpp: (WebKit::WebEditorClient::shouldDeleteRange): (WebKit::WebEditorClient::shouldEndEditing): (WebKit::WebEditorClient::shouldInsertNode): (WebKit::WebEditorClient::shouldInsertText): (WebKit::WebEditorClient::shouldChangeSelectedRange): (WebKit::WebEditorClient::shouldApplyStyle): (WebKit::WebEditorClient::didBeginEditing): (WebKit::WebEditorClient::respondToChangedContents): (WebKit::WebEditorClient::respondToChangedSelection): (WebKit::WebEditorClient::didEndEditing): Added remaining delagates that are needed for WebKitTestRunner.

2010-07-25 Alexey Proskuryakov <ap@apple.com>

Reviewed by Sam Weinig.

https://bugs.webkit.org/show_bug.cgi?id=42193
Support layoutTestController.dumpEditingDelegates in WebKitTestRunner

Step 2 - add the rest of editing delegates.

  • WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: (WTR::operator<<): Fixed to not crash when range is null. (WTR::InjectedBundlePage::InjectedBundlePage): (WTR::InjectedBundlePage::_shouldEndEditing): (WTR::InjectedBundlePage::_shouldInsertNode): (WTR::InjectedBundlePage::_shouldInsertText): (WTR::InjectedBundlePage::_shouldDeleteRange): (WTR::InjectedBundlePage::_shouldChangeSelectedRange): (WTR::InjectedBundlePage::_shouldApplyStyle): (WTR::InjectedBundlePage::_didBeginEditing): (WTR::InjectedBundlePage::_didEndEditing): (WTR::InjectedBundlePage::_didChange): (WTR::InjectedBundlePage::_didChangeSelection): (WTR::InjectedBundlePage::shouldEndEditing): (WTR::InjectedBundlePage::shouldInsertNode): (WTR::InjectedBundlePage::shouldInsertText): (WTR::InjectedBundlePage::shouldDeleteRange): (WTR::InjectedBundlePage::shouldChangeSelectedRange): (WTR::InjectedBundlePage::shouldApplyStyle): (WTR::InjectedBundlePage::didBeginEditing): (WTR::InjectedBundlePage::didEndEditing): (WTR::InjectedBundlePage::didChange): (WTR::InjectedBundlePage::didChangeSelection):
  • WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r64014 r64020  
     12010-07-25  Alexey Proskuryakov  <ap@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=42193
     6        Support layoutTestController.dumpEditingDelegates in WebKitTestRunner
     7
     8        Step 2 - add the rest of editing delegates.
     9
     10        * platform/mac-wk2/Skipped: Changed the bug tracking why the tests are skipped - the delegates
     11        are now implemented, but one of them isn't called for some reason.
     12
    1132010-07-24  Chris Fleizach  <cfleizach@apple.com>
    214
  • trunk/LayoutTests/platform/mac-wk2/Skipped

    r63906 r64020  
    9898compositing/animation/animation-compositing.html
    9999
    100 # Support layoutTestController.dumpEditingCallbacks in WebKitTestRunner
    101 # <https://bugs.webkit.org/show_bug.cgi?id=42193>
     100# WebEditorClient::didBeginEditing is never called in WebKit2
     101# <https://bugs.webkit.org/show_bug.cgi?id=42939>
    102102editing/deleting/4845371.html
    103103editing/deleting/5546763.html
  • trunk/WebKit2/ChangeLog

    r63968 r64020  
     12010-07-25  Alexey Proskuryakov  <ap@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=42193
     6        Support layoutTestController.dumpEditingDelegates in WebKitTestRunner
     7
     8        Step 2 - add the rest of editing delegates.
     9
     10        * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h:
     11        * WebProcess/InjectedBundle/API/c/WKBundleBase.h:
     12        Added enums for EditorInsertAction and EAffinity. Also added a dummy type for
     13        CSSStyleDeclaration - neither DumpRenderTree not WebKitTestRunner actually use that.
     14
     15        * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
     16        * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp:
     17        (WebKit::InjectedBundlePageEditorClient::shouldBeginEditing):
     18        (WebKit::InjectedBundlePageEditorClient::shouldEndEditing):
     19        (WebKit::InjectedBundlePageEditorClient::shouldInsertNode):
     20        (WebKit::InjectedBundlePageEditorClient::shouldInsertText):
     21        (WebKit::InjectedBundlePageEditorClient::shouldDeleteRange):
     22        (WebKit::InjectedBundlePageEditorClient::shouldChangeSelectedRange):
     23        (WebKit::InjectedBundlePageEditorClient::shouldApplyStyle):
     24        (WebKit::InjectedBundlePageEditorClient::didBeginEditing):
     25        (WebKit::InjectedBundlePageEditorClient::didEndEditing):
     26        (WebKit::InjectedBundlePageEditorClient::didChange):
     27        (WebKit::InjectedBundlePageEditorClient::didChangeSelection):
     28        * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h:
     29        * WebProcess/WebCoreSupport/WebEditorClient.cpp:
     30        (WebKit::WebEditorClient::shouldDeleteRange):
     31        (WebKit::WebEditorClient::shouldEndEditing):
     32        (WebKit::WebEditorClient::shouldInsertNode):
     33        (WebKit::WebEditorClient::shouldInsertText):
     34        (WebKit::WebEditorClient::shouldChangeSelectedRange):
     35        (WebKit::WebEditorClient::shouldApplyStyle):
     36        (WebKit::WebEditorClient::didBeginEditing):
     37        (WebKit::WebEditorClient::respondToChangedContents):
     38        (WebKit::WebEditorClient::respondToChangedSelection):
     39        (WebKit::WebEditorClient::didEndEditing):
     40        Added remaining delagates that are needed for WebKitTestRunner.
     41
    1422010-07-19 Balazs Kelemen <kb@inf.u-szeged.hu>
    243
  • trunk/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h

    r63930 r64020  
    2828
    2929#include "WKBundleBase.h"
     30#include "WKBundlePage.h"
     31#include <WebCore/EditorInsertAction.h>
     32#include <WebCore/TextAffinity.h>
    3033
    3134namespace WebCore {
     35    class CSSStyleDeclaration;
    3236    class Node;
    3337    class Range;
     
    4145
    4246template<typename APIType> struct BundleAPITypeInfo { };
    43 template<> struct BundleAPITypeInfo<WKBundleFrameRef>           { typedef WebFrame* ImplType; };
    44 template<> struct BundleAPITypeInfo<WKBundleNodeRef>            { typedef WebCore::Node* ImplType; };
    45 template<> struct BundleAPITypeInfo<WKBundlePageRef>            { typedef WebPage* ImplType; };
    46 template<> struct BundleAPITypeInfo<WKBundleRangeRef>           { typedef WebCore::Range* ImplType; };
    47 template<> struct BundleAPITypeInfo<WKBundleRef>                { typedef InjectedBundle* ImplType; };
     47template<> struct BundleAPITypeInfo<WKBundleCSSStyleDeclarationRef>     { typedef WebCore::CSSStyleDeclaration* ImplType; };
     48template<> struct BundleAPITypeInfo<WKBundleFrameRef>                   { typedef WebFrame* ImplType; };
     49template<> struct BundleAPITypeInfo<WKBundleNodeRef>                    { typedef WebCore::Node* ImplType; };
     50template<> struct BundleAPITypeInfo<WKBundlePageRef>                    { typedef WebPage* ImplType; };
     51template<> struct BundleAPITypeInfo<WKBundleRangeRef>                   { typedef WebCore::Range* ImplType; };
     52template<> struct BundleAPITypeInfo<WKBundleRef>                        { typedef InjectedBundle* ImplType; };
    4853
    4954template<typename ImplType> struct BundleImplTypeInfo { };
    50 template<> struct BundleImplTypeInfo<InjectedBundle*>           { typedef WKBundleRef APIType; };
    51 template<> struct BundleImplTypeInfo<WebCore::Node*>            { typedef WKBundleNodeRef APIType; };
    52 template<> struct BundleImplTypeInfo<WebCore::Range*>           { typedef WKBundleRangeRef APIType; };
    53 template<> struct BundleImplTypeInfo<WebFrame*>                 { typedef WKBundleFrameRef APIType; };
    54 template<> struct BundleImplTypeInfo<WebPage*>                  { typedef WKBundlePageRef APIType; };
     55template<> struct BundleImplTypeInfo<InjectedBundle*>                   { typedef WKBundleRef APIType; };
     56template<> struct BundleImplTypeInfo<WebCore::CSSStyleDeclaration*>     { typedef WKBundleCSSStyleDeclarationRef APIType; };
     57template<> struct BundleImplTypeInfo<WebCore::Node*>                    { typedef WKBundleNodeRef APIType; };
     58template<> struct BundleImplTypeInfo<WebCore::Range*>                   { typedef WKBundleRangeRef APIType; };
     59template<> struct BundleImplTypeInfo<WebFrame*>                         { typedef WKBundleFrameRef APIType; };
     60template<> struct BundleImplTypeInfo<WebPage*>                          { typedef WKBundlePageRef APIType; };
    5561
    5662} // namespace WebKit
     
    7076}
    7177
     78inline WKInsertActionType toWK(WebCore::EditorInsertAction action)
     79{
     80    switch (action) {
     81    case WebCore::EditorInsertActionTyped:
     82        return kWKInsertActionTyped;
     83        break;
     84    case WebCore::EditorInsertActionPasted:
     85        return kWKInsertActionPasted;
     86        break;
     87    case WebCore::EditorInsertActionDropped:
     88        return kWKInsertActionDropped;
     89        break;
     90    }
     91    ASSERT_NOT_REACHED();
     92    return kWKInsertActionTyped;
     93}
     94
     95inline WKAffinityType toWK(WebCore::EAffinity affinity)
     96{
     97    switch (affinity) {
     98    case WebCore::UPSTREAM:
     99        return kWKAffinityUpstream;
     100        break;
     101    case WebCore::DOWNSTREAM:
     102        return kWKAffinityDownstream;
     103        break;
     104    }
     105    ASSERT_NOT_REACHED();
     106    return kWKAffinityUpstream;
     107}
     108
    72109#endif // WKBundleAPICast_h
  • trunk/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBase.h

    r63930 r64020  
    2828
    2929typedef struct OpaqueWKBundle* WKBundleRef;
     30typedef struct OpaqueWKBundleDOMCSSStyleDeclaration* WKBundleCSSStyleDeclarationRef;
    3031typedef struct OpaqueWKBundleFrame* WKBundleFrameRef;
    3132typedef struct OpaqueWKBundleNode* WKBundleNodeRef;
  • trunk/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h

    r63930 r64020  
    3535extern "C" {
    3636#endif
     37
     38enum {
     39    kWKInsertActionTyped = 0,
     40    kWKInsertActionPasted = 1,
     41    kWKInsertActionDropped = 2
     42};
     43typedef uint32_t WKInsertActionType;
     44
     45enum {
     46    kWKAffinityUpstream,
     47    kWKAffinityDownstream
     48};
     49typedef uint32_t WKAffinityType;
    3750
    3851// Loader Client
     
    7992
    8093// Editor client
     94// FIXME: Objective-C API provides a WebView pointer in callbacks, what should the injected bundle API do?
    8195typedef bool (*WKBundlePageShouldBeginEditingCallback)(WKBundlePageRef page, WKBundleRangeRef range, const void* clientInfo);
     96typedef bool (*WKBundlePageShouldEndEditingCallback)(WKBundlePageRef page, WKBundleRangeRef range, const void* clientInfo);
     97typedef bool (*WKBundlePageShouldInsertNodeCallback)(WKBundlePageRef page, WKBundleNodeRef node, WKBundleRangeRef rangeToReplace, WKInsertActionType action, const void* clientInfo);
     98typedef bool (*WKBundlePageShouldInsertTextCallback)(WKBundlePageRef page, WKStringRef string, WKBundleRangeRef rangeToReplace, WKInsertActionType action, const void* clientInfo);
     99typedef bool (*WKBundlePageShouldDeleteRangeCallback)(WKBundlePageRef page, WKBundleRangeRef range, const void* clientInfo);
     100typedef bool (*WKBundlePageShouldChangeSelectedRange)(WKBundlePageRef page, WKBundleRangeRef fromRange, WKBundleRangeRef toRange, WKAffinityType affinity, bool stillSelecting, const void* clientInfo);
     101typedef bool (*WKBundlePageShouldApplyStyle)(WKBundlePageRef page, WKBundleCSSStyleDeclarationRef style, WKBundleRangeRef range, const void* clientInfo);
     102typedef void (*WKBundlePageEditingNotification)(WKBundlePageRef page, WKStringRef notificationName, const void* clientInfo);
     103
    82104struct WKBundlePageEditorClient {
    83105    int                                                                 version;
    84106    const void *                                                        clientInfo;
    85107    WKBundlePageShouldBeginEditingCallback                              shouldBeginEditing;
     108    WKBundlePageShouldEndEditingCallback                                shouldEndEditing;
     109    WKBundlePageShouldInsertNodeCallback                                shouldInsertNode;
     110    WKBundlePageShouldInsertTextCallback                                shouldInsertText;
     111    WKBundlePageShouldDeleteRangeCallback                               shouldDeleteRange;
     112    WKBundlePageShouldChangeSelectedRange                               shouldChangeSelectedRange;
     113    WKBundlePageShouldApplyStyle                                        shouldApplyStyle;
     114    WKBundlePageEditingNotification                                     didBeginEditing;
     115    WKBundlePageEditingNotification                                     didEndEditing;
     116    WKBundlePageEditingNotification                                     didChange;
     117    WKBundlePageEditingNotification                                     didChangeSelection;
    86118};
    87119typedef struct WKBundlePageEditorClient WKBundlePageEditorClient;
  • trunk/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp

    r63930 r64020  
    4747}
    4848
    49 bool InjectedBundlePageEditorClient::shouldBeginEditing(WebPage* page, WebCore::Range* range)
     49bool InjectedBundlePageEditorClient::shouldBeginEditing(WebPage* page, Range* range)
    5050{
    5151    if (m_client.shouldBeginEditing)
     
    5454}
    5555
     56bool InjectedBundlePageEditorClient::shouldEndEditing(WebPage* page, Range* range)
     57{
     58    if (m_client.shouldEndEditing)
     59        return m_client.shouldEndEditing(toRef(page), toRef(range), m_client.clientInfo);
     60    return true;
     61}
     62
     63bool InjectedBundlePageEditorClient::shouldInsertNode(WebPage* page, Node* node, Range* rangeToReplace, EditorInsertAction action)
     64{
     65    if (m_client.shouldInsertNode)
     66        return m_client.shouldInsertNode(toRef(page), toRef(node), toRef(rangeToReplace), toWK(action), m_client.clientInfo);
     67    return true;
     68}
     69
     70bool InjectedBundlePageEditorClient::shouldInsertText(WebPage* page, StringImpl* text, Range* rangeToReplace, EditorInsertAction action)
     71{
     72    if (m_client.shouldInsertText)
     73        return m_client.shouldInsertText(toRef(page), toRef(text), toRef(rangeToReplace), toWK(action), m_client.clientInfo);
     74    return true;
     75}
     76
     77bool InjectedBundlePageEditorClient::shouldDeleteRange(WebPage* page, Range* range)
     78{
     79    if (m_client.shouldDeleteRange)
     80        return m_client.shouldDeleteRange(toRef(page), toRef(range), m_client.clientInfo);
     81    return true;
     82}
     83
     84bool InjectedBundlePageEditorClient::shouldChangeSelectedRange(WebPage* page, Range* fromRange, Range* toRange, EAffinity affinity, bool stillSelecting)
     85{
     86    if (m_client.shouldChangeSelectedRange)
     87        return m_client.shouldChangeSelectedRange(toRef(page), toRef(fromRange), toRef(toRange), toWK(affinity), stillSelecting, m_client.clientInfo);
     88    return true;
     89}
     90
     91bool InjectedBundlePageEditorClient::shouldApplyStyle(WebPage* page, CSSStyleDeclaration* style, Range* range)
     92{
     93    if (m_client.shouldApplyStyle)
     94        return m_client.shouldApplyStyle(toRef(page), toRef(style), toRef(range), m_client.clientInfo);
     95    return true;
     96}
     97
     98void InjectedBundlePageEditorClient::didBeginEditing(WebPage* page, StringImpl* notificationName)
     99{
     100    if (m_client.didBeginEditing)
     101        m_client.didBeginEditing(toRef(page), toRef(notificationName), m_client.clientInfo);
     102}
     103
     104void InjectedBundlePageEditorClient::didEndEditing(WebPage* page, StringImpl* notificationName)
     105{
     106    if (m_client.didEndEditing)
     107        m_client.didEndEditing(toRef(page), toRef(notificationName), m_client.clientInfo);
     108}
     109
     110void InjectedBundlePageEditorClient::didChange(WebPage* page, StringImpl* notificationName)
     111{
     112    if (m_client.didChange)
     113        m_client.didChange(toRef(page), toRef(notificationName), m_client.clientInfo);
     114}
     115
     116void InjectedBundlePageEditorClient::didChangeSelection(WebPage* page, StringImpl* notificationName)
     117{
     118    if (m_client.didChangeSelection)
     119        m_client.didChangeSelection(toRef(page), toRef(notificationName), m_client.clientInfo);
     120}
     121
    56122} // namespace WebKit
  • trunk/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h

    r63930 r64020  
    2828
    2929#include "WKBundlePage.h"
     30#include <WebCore/EditorInsertAction.h>
     31#include <WebCore/TextAffinity.h>
    3032
    3133namespace WebCore {
     34    class CSSStyleDeclaration;
     35    class Node;
    3236    class Range;
     37    class StringImpl;
    3338}
    3439
     
    4449
    4550    bool shouldBeginEditing(WebPage*, WebCore::Range*);
     51    bool shouldEndEditing(WebPage*, WebCore::Range*);
     52    bool shouldInsertNode(WebPage*, WebCore::Node*, WebCore::Range* rangeToReplace, WebCore::EditorInsertAction);
     53    bool shouldInsertText(WebPage*, WebCore::StringImpl*, WebCore::Range* rangeToReplace, WebCore::EditorInsertAction);
     54    bool shouldDeleteRange(WebPage*, WebCore::Range*);
     55    bool shouldChangeSelectedRange(WebPage*, WebCore::Range* fromRange, WebCore::Range* toRange, WebCore::EAffinity affinity, bool stillSelecting);
     56    bool shouldApplyStyle(WebPage*, WebCore::CSSStyleDeclaration*, WebCore::Range*);
     57    void didBeginEditing(WebPage*, WebCore::StringImpl* notificationName);
     58    void didEndEditing(WebPage*, WebCore::StringImpl* notificationName);
     59    void didChange(WebPage*, WebCore::StringImpl* notificationName);
     60    void didChangeSelection(WebPage*, WebCore::StringImpl* notificationName);
    4661
    4762private:
  • trunk/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp

    r63930 r64020  
    4343}
    4444
    45 bool WebEditorClient::shouldDeleteRange(Range*)
    46 {
    47     notImplemented();
    48     return true;
     45bool WebEditorClient::shouldDeleteRange(Range* range)
     46{
     47    bool result = m_page->injectedBundleEditorClient().shouldDeleteRange(m_page, range);
     48    notImplemented();
     49    return result;
    4950}
    5051
     
    110111}
    111112
    112 bool WebEditorClient::shouldEndEditing(Range*)
     113bool WebEditorClient::shouldEndEditing(Range* range)
     114{
     115    bool result = m_page->injectedBundleEditorClient().shouldEndEditing(m_page, range);
     116    notImplemented();
     117    return result;
     118}
     119
     120bool WebEditorClient::shouldInsertNode(Node* node, Range* rangeToReplace, EditorInsertAction action)
     121{
     122    bool result = m_page->injectedBundleEditorClient().shouldInsertNode(m_page, node, rangeToReplace, action);
     123    notImplemented();
     124    return result;
     125}
     126
     127bool WebEditorClient::shouldInsertText(const String& text, Range* rangeToReplace, EditorInsertAction action)
     128{
     129    bool result = m_page->injectedBundleEditorClient().shouldInsertText(m_page, text.impl(), rangeToReplace, action);
     130    notImplemented();
     131    return result;
     132}
     133
     134bool WebEditorClient::shouldChangeSelectedRange(Range* fromRange, Range* toRange, EAffinity affinity, bool stillSelecting)
     135{
     136    bool result = m_page->injectedBundleEditorClient().shouldChangeSelectedRange(m_page, fromRange, toRange, affinity, stillSelecting);
     137    notImplemented();
     138    return result;
     139}
     140   
     141bool WebEditorClient::shouldApplyStyle(CSSStyleDeclaration* style, Range* range)
     142{
     143    bool result = m_page->injectedBundleEditorClient().shouldApplyStyle(m_page, style, range);
     144    notImplemented();
     145    return result;
     146}
     147
     148bool WebEditorClient::shouldMoveRangeAfterDelete(Range*, Range*)
    113149{
    114150    notImplemented();
     
    116152}
    117153
    118 bool WebEditorClient::shouldInsertNode(Node*, Range*, EditorInsertAction)
    119 {
    120     notImplemented();
    121     return true;
    122 }
    123 
    124 bool WebEditorClient::shouldInsertText(const String&, Range*, EditorInsertAction)
    125 {
    126     return true;
    127 }
    128 
    129 bool WebEditorClient::shouldChangeSelectedRange(Range* fromRange, Range* toRange, EAffinity, bool stillSelecting)
    130 {
    131     return true;
    132 }
    133    
    134 bool WebEditorClient::shouldApplyStyle(CSSStyleDeclaration*, Range*)
    135 {
    136     notImplemented();
    137     return true;
    138 }
    139 
    140 bool WebEditorClient::shouldMoveRangeAfterDelete(Range*, Range*)
    141 {
    142     notImplemented();
    143     return true;
    144 }
    145 
    146154void WebEditorClient::didBeginEditing()
    147155{
     156    // FIXME: What good is a notification name, if it's always the same?
     157    static const String WebViewDidBeginEditingNotification = "WebViewDidBeginEditingNotification";
     158    m_page->injectedBundleEditorClient().didBeginEditing(m_page, WebViewDidBeginEditingNotification.impl());
    148159    notImplemented();
    149160}
     
    151162void WebEditorClient::respondToChangedContents()
    152163{
     164    static const String WebViewDidChangeNotification = "WebViewDidChangeNotification";
     165    m_page->injectedBundleEditorClient().didChange(m_page, WebViewDidChangeNotification.impl());
    153166    notImplemented();
    154167}
     
    156169void WebEditorClient::respondToChangedSelection()
    157170{
     171    static const String WebViewDidChangeSelectionNotification = "WebViewDidChangeSelectionNotification";
     172    m_page->injectedBundleEditorClient().didChangeSelection(m_page, WebViewDidChangeSelectionNotification.impl());
    158173    notImplemented();
    159174}
     
    161176void WebEditorClient::didEndEditing()
    162177{
     178    static const String WebViewDidEndEditingNotification = "WebViewDidEndEditingNotification";
     179    m_page->injectedBundleEditorClient().didEndEditing(m_page, WebViewDidEndEditingNotification.impl());
    163180    notImplemented();
    164181}
  • trunk/WebKitTools/ChangeLog

    r64014 r64020  
     12010-07-25  Alexey Proskuryakov  <ap@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=42193
     6        Support layoutTestController.dumpEditingDelegates in WebKitTestRunner
     7
     8        Step 2 - add the rest of editing delegates.
     9
     10        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
     11        (WTR::operator<<): Fixed to not crash when range is null.
     12        (WTR::InjectedBundlePage::InjectedBundlePage):
     13        (WTR::InjectedBundlePage::_shouldEndEditing):
     14        (WTR::InjectedBundlePage::_shouldInsertNode):
     15        (WTR::InjectedBundlePage::_shouldInsertText):
     16        (WTR::InjectedBundlePage::_shouldDeleteRange):
     17        (WTR::InjectedBundlePage::_shouldChangeSelectedRange):
     18        (WTR::InjectedBundlePage::_shouldApplyStyle):
     19        (WTR::InjectedBundlePage::_didBeginEditing):
     20        (WTR::InjectedBundlePage::_didEndEditing):
     21        (WTR::InjectedBundlePage::_didChange):
     22        (WTR::InjectedBundlePage::_didChangeSelection):
     23        (WTR::InjectedBundlePage::shouldEndEditing):
     24        (WTR::InjectedBundlePage::shouldInsertNode):
     25        (WTR::InjectedBundlePage::shouldInsertText):
     26        (WTR::InjectedBundlePage::shouldDeleteRange):
     27        (WTR::InjectedBundlePage::shouldChangeSelectedRange):
     28        (WTR::InjectedBundlePage::shouldApplyStyle):
     29        (WTR::InjectedBundlePage::didBeginEditing):
     30        (WTR::InjectedBundlePage::didEndEditing):
     31        (WTR::InjectedBundlePage::didChange):
     32        (WTR::InjectedBundlePage::didChangeSelection):
     33        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
     34
    1352010-07-24  Chris Fleizach  <cfleizach@apple.com>
    236
  • trunk/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp

    r63949 r64020  
    102102static ostream& operator<<(ostream& out, WKBundleRangeRef rangeRef)
    103103{
    104     out << "range from " << WKBundleRangeGetStartOffset(rangeRef) << " of " << dumpPath(WKBundleRangeGetStartContainer(rangeRef)) << " to " << WKBundleRangeGetEndOffset(rangeRef) << " of " << dumpPath(WKBundleRangeGetEndContainer(rangeRef));
     104    if (rangeRef)
     105        out << "range from " << WKBundleRangeGetStartOffset(rangeRef) << " of " << dumpPath(WKBundleRangeGetStartContainer(rangeRef)) << " to " << WKBundleRangeGetEndOffset(rangeRef) << " of " << dumpPath(WKBundleRangeGetEndContainer(rangeRef));
     106    else
     107        out << "(null)";
     108
     109    return out;
     110}
     111
     112static ostream& operator<<(ostream& out, WKBundleCSSStyleDeclarationRef style)
     113{
     114    // DumpRenderTree calls -[DOMCSSStyleDeclaration description], which just dumps class name and object address.
     115    // No existing tests actually hit this code path at the time of this writing, because WebCore doesn't call
     116    // the editing client if the styling operation source is CommandFromDOM or CommandFromDOMWithUserInterface.
     117    out << "<DOMCSSStyleDeclaration ADDRESS>";
    105118    return out;
    106119}
     
    139152        this,
    140153        _shouldBeginEditing,
     154        _shouldEndEditing,
     155        _shouldInsertNode,
     156        _shouldInsertText,
     157        _shouldDeleteRange,
     158        _shouldChangeSelectedRange,
     159        _shouldApplyStyle,
     160        _didBeginEditing,
     161        _didEndEditing,
     162        _didChange,
     163        _didChangeSelection
    141164    };
    142165    WKBundlePageSetEditorClient(m_page, &editorClient);
     
    428451}
    429452
     453bool InjectedBundlePage::_shouldEndEditing(WKBundlePageRef page, WKBundleRangeRef range, const void* clientInfo)
     454{
     455    return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->shouldEndEditing(range);
     456}
     457
     458bool InjectedBundlePage::_shouldInsertNode(WKBundlePageRef page, WKBundleNodeRef node, WKBundleRangeRef rangeToReplace, WKInsertActionType action, const void* clientInfo)
     459{
     460    return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->shouldInsertNode(node, rangeToReplace, action);
     461}
     462
     463bool InjectedBundlePage::_shouldInsertText(WKBundlePageRef page, WKStringRef text, WKBundleRangeRef rangeToReplace, WKInsertActionType action, const void* clientInfo)
     464{
     465    return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->shouldInsertText(text, rangeToReplace, action);
     466}
     467
     468bool InjectedBundlePage::_shouldDeleteRange(WKBundlePageRef page, WKBundleRangeRef range, const void* clientInfo)
     469{
     470    return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->shouldDeleteRange(range);
     471}
     472
     473bool InjectedBundlePage::_shouldChangeSelectedRange(WKBundlePageRef page, WKBundleRangeRef fromRange, WKBundleRangeRef toRange, WKAffinityType affinity, bool stillSelecting, const void* clientInfo)
     474{
     475    return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->shouldChangeSelectedRange(fromRange, toRange, affinity, stillSelecting);
     476}
     477
     478bool InjectedBundlePage::_shouldApplyStyle(WKBundlePageRef page, WKBundleCSSStyleDeclarationRef style, WKBundleRangeRef range, const void* clientInfo)
     479{
     480    return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->shouldApplyStyle(style, range);
     481}
     482
     483void InjectedBundlePage::_didBeginEditing(WKBundlePageRef page, WKStringRef notificationName, const void* clientInfo)
     484{
     485    static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didBeginEditing(notificationName);
     486}
     487
     488void InjectedBundlePage::_didEndEditing(WKBundlePageRef page, WKStringRef notificationName, const void* clientInfo)
     489{
     490    static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didEndEditing(notificationName);
     491}
     492
     493void InjectedBundlePage::_didChange(WKBundlePageRef page, WKStringRef notificationName, const void* clientInfo)
     494{
     495    static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didChange(notificationName);
     496}
     497
     498void InjectedBundlePage::_didChangeSelection(WKBundlePageRef page, WKStringRef notificationName, const void* clientInfo)
     499{
     500    static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didChangeSelection(notificationName);
     501}
     502
    430503bool InjectedBundlePage::shouldBeginEditing(WKBundleRangeRef range)
    431504{
     
    435508}
    436509
     510bool InjectedBundlePage::shouldEndEditing(WKBundleRangeRef range)
     511{
     512    if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks())
     513        InjectedBundle::shared().os() << "EDITING DELEGATE: shouldEndEditingInDOMRange:" << range << "\n";
     514    return InjectedBundle::shared().layoutTestController()->acceptsEditing();
     515}
     516
     517bool InjectedBundlePage::shouldInsertNode(WKBundleNodeRef node, WKBundleRangeRef rangeToReplace, WKInsertActionType action)
     518{
     519    static const char *insertactionstring[] = {
     520        "WebViewInsertActionTyped",
     521        "WebViewInsertActionPasted",
     522        "WebViewInsertActionDropped",
     523    };
     524
     525    if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks())
     526        InjectedBundle::shared().os() << "EDITING DELEGATE: shouldInsertNode:" << dumpPath(node) << " replacingDOMRange:" << rangeToReplace << " givenAction:" << insertactionstring[action] << "\n";
     527    return InjectedBundle::shared().layoutTestController()->acceptsEditing();
     528}
     529
     530bool InjectedBundlePage::shouldInsertText(WKStringRef text, WKBundleRangeRef rangeToReplace, WKInsertActionType action)
     531{
     532    static const char *insertactionstring[] = {
     533        "WebViewInsertActionTyped",
     534        "WebViewInsertActionPasted",
     535        "WebViewInsertActionDropped",
     536    };
     537
     538    if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks())
     539        InjectedBundle::shared().os() << "EDITING DELEGATE: shouldInsertText:" << text << " replacingDOMRange:" << rangeToReplace << " givenAction:" << insertactionstring[action] << "\n";
     540    return InjectedBundle::shared().layoutTestController()->acceptsEditing();
     541}
     542
     543bool InjectedBundlePage::shouldDeleteRange(WKBundleRangeRef range)
     544{
     545    if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks())
     546        InjectedBundle::shared().os() << "EDITING DELEGATE: shouldDeleteDOMRange:" << range << "\n";
     547    return InjectedBundle::shared().layoutTestController()->acceptsEditing();
     548}
     549
     550bool InjectedBundlePage::shouldChangeSelectedRange(WKBundleRangeRef fromRange, WKBundleRangeRef toRange, WKAffinityType affinity, bool stillSelecting)
     551{
     552    static const char *affinitystring[] = {
     553        "NSSelectionAffinityUpstream",
     554        "NSSelectionAffinityDownstream"
     555    };
     556    static const char *boolstring[] = {
     557        "FALSE",
     558        "TRUE"
     559    };
     560
     561    if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks())
     562        InjectedBundle::shared().os() << "EDITING DELEGATE: shouldChangeSelectedDOMRange:" << fromRange << " toDOMRange:" << toRange << " affinity:" << affinitystring[affinity] << " stillSelecting:" << boolstring[stillSelecting] << "\n";
     563    return InjectedBundle::shared().layoutTestController()->acceptsEditing();
     564}
     565
     566bool InjectedBundlePage::shouldApplyStyle(WKBundleCSSStyleDeclarationRef style, WKBundleRangeRef range)
     567{
     568    if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks())
     569        InjectedBundle::shared().os() << "EDITING DELEGATE: shouldApplyStyle:" << style << " toElementsInDOMRange:" << range << "\n";
     570    return InjectedBundle::shared().layoutTestController()->acceptsEditing();
     571}
     572
     573void InjectedBundlePage::didBeginEditing(WKStringRef notificationName)
     574{
     575    if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks())
     576        InjectedBundle::shared().os() << "EDITING DELEGATE: webViewDidBeginEditing:" << notificationName << "\n";
     577}
     578
     579void InjectedBundlePage::didEndEditing(WKStringRef notificationName)
     580{
     581    if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks())
     582        InjectedBundle::shared().os() << "EDITING DELEGATE: webViewDidEndEditing:" << notificationName << "\n";
     583}
     584
     585void InjectedBundlePage::didChange(WKStringRef notificationName)
     586{
     587    if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks())
     588        InjectedBundle::shared().os() << "EDITING DELEGATE: webViewDidChange:" << notificationName << "\n";
     589}
     590
     591void InjectedBundlePage::didChangeSelection(WKStringRef notificationName)
     592{
     593    if (InjectedBundle::shared().layoutTestController()->shouldDumpEditingCallbacks())
     594        InjectedBundle::shared().os() << "EDITING DELEGATE: webViewDidChangeSelection:" << notificationName << "\n";
     595}
     596
     597
    437598} // namespace WTR
  • trunk/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h

    r63930 r64020  
    7474    // Editor client
    7575    static bool _shouldBeginEditing(WKBundlePageRef, WKBundleRangeRef, const void* clientInfo);
     76    static bool _shouldEndEditing(WKBundlePageRef, WKBundleRangeRef, const void* clientInfo);
     77    static bool _shouldInsertNode(WKBundlePageRef, WKBundleNodeRef, WKBundleRangeRef rangeToReplace, WKInsertActionType, const void* clientInfo);
     78    static bool _shouldInsertText(WKBundlePageRef, WKStringRef, WKBundleRangeRef rangeToReplace, WKInsertActionType, const void* clientInfo);
     79    static bool _shouldDeleteRange(WKBundlePageRef, WKBundleRangeRef, const void* clientInfo);
     80    static bool _shouldChangeSelectedRange(WKBundlePageRef, WKBundleRangeRef fromRange, WKBundleRangeRef toRange, WKAffinityType, bool stillSelecting, const void* clientInfo);
     81    static bool _shouldApplyStyle(WKBundlePageRef, WKBundleCSSStyleDeclarationRef style, WKBundleRangeRef range, const void* clientInfo);
     82    static void _didBeginEditing(WKBundlePageRef, WKStringRef notificationName, const void* clientInfo);
     83    static void _didEndEditing(WKBundlePageRef, WKStringRef notificationName, const void* clientInfo);
     84    static void _didChange(WKBundlePageRef, WKStringRef notificationName, const void* clientInfo);
     85    static void _didChangeSelection(WKBundlePageRef, WKStringRef notificationName, const void* clientInfo);
    7686    bool shouldBeginEditing(WKBundleRangeRef);
     87    bool shouldEndEditing(WKBundleRangeRef);
     88    bool shouldInsertNode(WKBundleNodeRef, WKBundleRangeRef rangeToReplace, WKInsertActionType);
     89    bool shouldInsertText(WKStringRef, WKBundleRangeRef rangeToReplace, WKInsertActionType);
     90    bool shouldDeleteRange(WKBundleRangeRef);
     91    bool shouldChangeSelectedRange(WKBundleRangeRef fromRange, WKBundleRangeRef toRange, WKAffinityType, bool stillSelecting);
     92    bool shouldApplyStyle(WKBundleCSSStyleDeclarationRef style, WKBundleRangeRef range);
     93    void didBeginEditing(WKStringRef notificationName);
     94    void didEndEditing(WKStringRef notificationName);
     95    void didChange(WKStringRef notificationName);
     96    void didChangeSelection(WKStringRef notificationName);
    7797
    7898    void dumpAllFramesText();
Note: See TracChangeset for help on using the changeset viewer.