Changeset 157058 in webkit


Ignore:
Timestamp:
Oct 7, 2013 1:34:35 PM (10 years ago)
Author:
commit-queue@webkit.org
Message:

CTTE: Use references in and around DragController
https://bugs.webkit.org/show_bug.cgi?id=122427

Patch by Sam Weinig <sam@webkit.org> on 2013-10-07
Reviewed by Andreas Kling.

Source/WebCore:

Use references to indicate non-nullness of DragController related
objects.

Source/WebKit/efl:

  • WebCoreSupport/DragClientEfl.cpp:

(WebCore::DragClientEfl::willPerformDragDestinationAction):
(WebCore::DragClientEfl::willPerformDragSourceAction):
(WebCore::DragClientEfl::actionMaskForDrag):
(WebCore::DragClientEfl::startDrag):

  • WebCoreSupport/DragClientEfl.h:

Source/WebKit/gtk:

  • WebCoreSupport/DragClientGtk.cpp:

(WebKit::DragClient::willPerformDragDestinationAction):
(WebKit::DragClient::willPerformDragSourceAction):
(WebKit::DragClient::actionMaskForDrag):
(WebKit::DragClient::startDrag):

  • WebCoreSupport/DragClientGtk.h:
  • webkit/webkitwebview.cpp:

(dragExitedCallback):
(webkit_web_view_drag_motion):
(webkit_web_view_drag_data_received):
(webkit_web_view_drag_drop):

Source/WebKit/mac:

  • WebCoreSupport/WebDragClient.h:
  • WebCoreSupport/WebDragClient.mm:

(WebDragClient::actionMaskForDrag):
(WebDragClient::willPerformDragDestinationAction):
(WebDragClient::willPerformDragSourceAction):
(WebDragClient::startDrag):
(WebDragClient::declareAndWriteDragImage):

  • WebView/WebFrame.mm:

(-[WebFrame _replaceSelectionWithText:selectReplacement:smartReplace:]):

  • WebView/WebHTMLView.mm:

(-[WebHTMLView _documentFragmentFromPasteboard:forType:inContext:subresources:]):

  • WebView/WebView.mm:

(-[WebView draggingEntered:]):
(-[WebView draggingUpdated:]):
(-[WebView draggingExited:]):
(-[WebView performDragOperation:]):

Source/WebKit/win:

  • WebCoreSupport/WebDragClient.cpp:

(WebDragClient::actionMaskForDrag):
(WebDragClient::willPerformDragDestinationAction):
(WebDragClient::willPerformDragSourceAction):
(WebDragClient::startDrag):

  • WebCoreSupport/WebDragClient.h:

Source/WebKit2:

  • UIProcess/API/gtk/WebKitWebViewBase.cpp:

(webkitWebViewBaseDragDataReceived):
(webkitWebViewBaseDragMotion):
(dragExitedCallback):
(webkitWebViewBaseDragDrop):

  • UIProcess/API/mac/WKView.mm:

(-[WKView draggingEntered:]):
(-[WKView draggingUpdated:]):
(-[WKView draggingExited:]):
(-[WKView performDragOperation:]):

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::dragEntered):
(WebKit::WebPageProxy::dragUpdated):
(WebKit::WebPageProxy::dragExited):
(WebKit::WebPageProxy::performDrag):
(WebKit::WebPageProxy::performDragControllerAction):

  • UIProcess/WebPageProxy.h:
  • WebProcess/WebCoreSupport/WebDragClient.cpp:

(WebKit::WebDragClient::willPerformDragDestinationAction):
(WebKit::WebDragClient::willPerformDragSourceAction):
(WebKit::WebDragClient::actionMaskForDrag):
(WebKit::WebDragClient::dragSourceActionMaskForPoint):
(WebKit::WebDragClient::startDrag):

  • WebProcess/WebCoreSupport/WebDragClient.h:
  • WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp:

(WebKit::WebDragClient::startDrag):

  • WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:

(WebKit::WebDragClient::startDrag):
(WebKit::cachedImage):
(WebKit::WebDragClient::declareAndWriteDragImage):

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::performDragControllerAction):

Location:
trunk/Source
Files:
61 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r157056 r157058  
     12013-10-07  Sam Weinig  <sam@webkit.org>
     2
     3        CTTE: Use references in and around DragController
     4        https://bugs.webkit.org/show_bug.cgi?id=122427
     5
     6        Reviewed by Andreas Kling.
     7
     8        Use references to indicate non-nullness of DragController related
     9        objects.
     10
    1112013-10-07  Tim Horton  <timothy_horton@apple.com>
    212
  • trunk/Source/WebCore/WebCore.exp.in

    r157056 r157058  
    743743__ZN7WebCore22URLWithUserTypedStringEP8NSStringP5NSURL
    744744__ZN7WebCore22counterValueForElementEPNS_7ElementE
    745 __ZN7WebCore22createFragmentFromTextEPNS_5RangeERKN3WTF6StringE
     745__ZN7WebCore22createFragmentFromTextERNS_5RangeERKN3WTF6StringE
    746746__ZN7WebCore22externalRepresentationEPNS_5FrameEj
    747747__ZN7WebCore22externalRepresentationEPNS_7ElementEj
     
    24572457#if ENABLE(DRAG_SUPPORT)
    24582458__ZN7WebCore12EventHandler17dragSourceEndedAtERKNS_18PlatformMouseEventENS_13DragOperationE
    2459 __ZNK7WebCore12EventHandler17eventMayStartDragERKNS_18PlatformMouseEventE
    2460 __ZN7WebCore14DragController10dragExitedEPNS_8DragDataE
    2461 __ZN7WebCore14DragController11dragEnteredEPNS_8DragDataE
    2462 __ZN7WebCore14DragController11dragUpdatedEPNS_8DragDataE
    2463 __ZN7WebCore14DragController11performDragEPNS_8DragDataE
     2459__ZN7WebCore14DragController10dragExitedERNS_8DragDataE
     2460__ZN7WebCore14DragController11dragEnteredERNS_8DragDataE
     2461__ZN7WebCore14DragController11dragUpdatedERNS_8DragDataE
     2462__ZN7WebCore14DragController11performDragERNS_8DragDataE
    24642463__ZN7WebCore14DragController14placeDragCaretERKNS_8IntPointE
    24652464__ZN7WebCore14DragController9dragEndedEv
    24662465__ZN7WebCore8DragDataC1EP11objc_objectRKNS_8IntPointES5_NS_13DragOperationENS_20DragApplicationFlagsE
    24672466__ZN7WebCore8DragDataC1ERKN3WTF6StringERKNS_8IntPointES7_NS_13DragOperationENS_20DragApplicationFlagsE
     2467__ZNK7WebCore12EventHandler17eventMayStartDragERKNS_18PlatformMouseEventE
    24682468#endif
    24692469
  • trunk/Source/WebCore/bindings/objc/DOMHTML.mm

    r157002 r157058  
    6363{
    6464    // FIXME: Since this is not a contextual fragment, it won't handle whitespace properly.
    65     return kit(createFragmentFromText(core(self)->createRange().get(), text).get());
     65    return kit(createFragmentFromText(*core(self)->createRange().get(), text).get());
    6666}
    6767
  • trunk/Source/WebCore/editing/Editor.cpp

    r157018 r157058  
    441441{
    442442    RefPtr<Range> range = selectedRange();
     443    if (!range)
     444        return;
     445
    443446    bool chosePlainText;
    444     RefPtr<DocumentFragment> fragment = pasteboard->documentFragment(&m_frame, range, allowPlainText, chosePlainText);
     447    RefPtr<DocumentFragment> fragment = pasteboard->documentFragment(m_frame, *range, allowPlainText, chosePlainText);
    445448    if (fragment && shouldInsertFragment(fragment, range, EditorInsertActionPasted))
    446449        pasteAsFragment(fragment, canSmartReplaceWithPasteboard(*pasteboard), chosePlainText);
     
    494497void Editor::replaceSelectionWithText(const String& text, bool selectReplacement, bool smartReplace)
    495498{
    496     replaceSelectionWithFragment(createFragmentFromText(selectedRange().get(), text), selectReplacement, smartReplace, true);
     499    RefPtr<Range> range = selectedRange();
     500    if (!range)
     501        return;
     502
     503    replaceSelectionWithFragment(createFragmentFromText(*range, text), selectReplacement, smartReplace, true);
    497504}
    498505
     
    10621069#else
    10631070            // FIXME: Convert all other platforms to match Mac and delete this.
    1064             Pasteboard::createForCopyAndPaste()->writeSelection(selection.get(), canSmartCopyOrDelete(), &m_frame, IncludeImageAltTextForClipboard);
     1071            Pasteboard::createForCopyAndPaste()->writeSelection(*selection, canSmartCopyOrDelete(), m_frame, IncludeImageAltTextForClipboard);
    10651072#endif
    10661073        }
     
    10881095            writeImageToPasteboard(*Pasteboard::createForCopyAndPaste(), *imageElement, document().url(), document().title());
    10891096#else
    1090             Pasteboard::createForCopyAndPaste()->writeImage(imageElement, document().url(), document().title());
     1097            Pasteboard::createForCopyAndPaste()->writeImage(*imageElement, document().url(), document().title());
    10911098#endif
    10921099        } else {
     
    10951102#else
    10961103            // FIXME: Convert all other platforms to match Mac and delete this.
    1097             Pasteboard::createForCopyAndPaste()->writeSelection(selectedRange().get(), canSmartCopyOrDelete(), &m_frame, IncludeImageAltTextForClipboard);
     1104            Pasteboard::createForCopyAndPaste()->writeSelection(*selectedRange(), canSmartCopyOrDelete(), m_frame, IncludeImageAltTextForClipboard);
    10981105#endif
    10991106        }
     
    11971204    writeImageToPasteboard(*Pasteboard::createForCopyAndPaste(), *element, url, result.altDisplayString());
    11981205#else
    1199     Pasteboard::createForCopyAndPaste()->writeImage(element, url, result.altDisplayString());
     1206    Pasteboard::createForCopyAndPaste()->writeImage(*element, url, result.altDisplayString());
    12001207#endif
    12011208}
  • trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp

    r156289 r157058  
    188188        restoreAndRemoveTestRenderingNodesToFragment(holder.get());
    189189
    190         m_fragment = createFragmentFromText(selection.toNormalizedRange().get(), evt->text());
     190        RefPtr<Range> range = selection.toNormalizedRange();
     191        if (!range)
     192            return;
     193
     194        m_fragment = createFragmentFromText(*range, evt->text());
    191195        if (!m_fragment->firstChild())
    192196            return;
  • trunk/Source/WebCore/editing/SpellingCorrectionCommand.cpp

    r154943 r157058  
    9999        return;
    100100
    101     RefPtr<DocumentFragment> fragment = createFragmentFromText(m_rangeToBeCorrected.get(), m_correction);
     101    if (!m_rangeToBeCorrected)
     102        return;
     103
     104    RefPtr<DocumentFragment> fragment = createFragmentFromText(*m_rangeToBeCorrected, m_correction);
    102105    if (!fragment)
    103106        return;
  • trunk/Source/WebCore/editing/mac/EditorMac.mm

    r157002 r157058  
    565565        return false;
    566566
    567     fragment = createFragmentFromText(&context, [text precomposedStringWithCanonicalMapping]);
     567    fragment = createFragmentFromText(context, [text precomposedStringWithCanonicalMapping]);
    568568    if (!fragment)
    569569        return false;
  • trunk/Source/WebCore/editing/markup.cpp

    r157032 r157058  
    753753}
    754754
    755 PassRefPtr<DocumentFragment> createFragmentFromText(Range* context, const String& text)
    756 {
    757     if (!context)
    758         return 0;
    759 
    760     Document& document = context->ownerDocument();
     755PassRefPtr<DocumentFragment> createFragmentFromText(Range& context, const String& text)
     756{
     757    Document& document = context.ownerDocument();
    761758    RefPtr<DocumentFragment> fragment = document.createDocumentFragment();
    762759   
     
    768765    string.replace('\r', '\n');
    769766
    770     if (contextPreservesNewline(*context)) {
     767    if (contextPreservesNewline(context)) {
    771768        fragment->appendChild(document.createTextNode(string), ASSERT_NO_EXCEPTION);
    772769        if (string.endsWith('\n')) {
     
    785782
    786783    // Break string into paragraphs. Extra line breaks turn into empty paragraphs.
    787     Node* blockNode = enclosingBlock(context->firstNode());
     784    Node* blockNode = enclosingBlock(context.firstNode());
    788785    Element* block = toElement(blockNode);
    789786    bool useClonesOfEnclosingBlock = blockNode
     
    791788        && !block->hasTagName(bodyTag)
    792789        && !block->hasTagName(htmlTag)
    793         && block != editableRootForPosition(context->startPosition());
    794     bool useLineBreak = enclosingTextFormControl(context->startPosition());
     790        && block != editableRootForPosition(context.startPosition());
     791    bool useLineBreak = enclosingTextFormControl(context.startPosition());
    795792
    796793    Vector<String> list;
  • trunk/Source/WebCore/editing/markup.h

    r157002 r157058  
    5050enum EFragmentSerialization { HTMLFragmentSerialization, XMLFragmentSerialization };
    5151
    52 PassRefPtr<DocumentFragment> createFragmentFromText(Range* context, const String& text);
     52PassRefPtr<DocumentFragment> createFragmentFromText(Range& context, const String& text);
    5353PassRefPtr<DocumentFragment> createFragmentFromMarkup(Document&, const String& markup, const String& baseURL, ParserContentPolicy = AllowScriptingContent);
    5454PassRefPtr<DocumentFragment> createFragmentForInnerOuterHTML(const String&, Element*, ParserContentPolicy, ExceptionCode&);
  • trunk/Source/WebCore/html/FileInputType.cpp

    r156932 r157058  
    434434}
    435435
    436 bool FileInputType::receiveDroppedFiles(const DragData* dragData)
     436bool FileInputType::receiveDroppedFiles(const DragData& dragData)
    437437{
    438438    Vector<String> paths;
    439     dragData->asFilenames(paths);
     439    dragData.asFilenames(paths);
    440440    if (paths.isEmpty())
    441441        return false;
  • trunk/Source/WebCore/html/FileInputType.h

    r156692 r157058  
    6868    virtual bool getTypeSpecificValue(String&) OVERRIDE; // Checked first, before internal storage or the value attribute.
    6969    virtual void setValue(const String&, bool valueChanged, TextFieldEventBehavior) OVERRIDE;
    70     virtual bool receiveDroppedFiles(const DragData*) OVERRIDE;
     70    virtual bool receiveDroppedFiles(const DragData&) OVERRIDE;
    7171    virtual Icon* icon() const OVERRIDE;
    7272    virtual bool isFileUpload() const OVERRIDE;
  • trunk/Source/WebCore/html/HTMLInputElement.cpp

    r156981 r157058  
    13581358}
    13591359
    1360 bool HTMLInputElement::receiveDroppedFiles(const DragData* dragData)
     1360bool HTMLInputElement::receiveDroppedFiles(const DragData& dragData)
    13611361{
    13621362    return m_inputType->receiveDroppedFiles(dragData);
  • trunk/Source/WebCore/html/HTMLInputElement.h

    r157044 r157058  
    244244
    245245    // Returns true if the given DragData has more than one dropped files.
    246     bool receiveDroppedFiles(const DragData*);
     246    bool receiveDroppedFiles(const DragData&);
    247247
    248248    Icon* icon() const;
  • trunk/Source/WebCore/html/InputType.cpp

    r156825 r157058  
    706706}
    707707
    708 bool InputType::receiveDroppedFiles(const DragData*)
     708bool InputType::receiveDroppedFiles(const DragData&)
    709709{
    710710    ASSERT_NOT_REACHED();
  • trunk/Source/WebCore/html/InputType.h

    r156825 r157058  
    240240    virtual void setFiles(PassRefPtr<FileList>);
    241241    // Should return true if the given DragData has more than one dropped files.
    242     virtual bool receiveDroppedFiles(const DragData*);
     242    virtual bool receiveDroppedFiles(const DragData&);
    243243    virtual Icon* icon() const;
    244244    // Should return true if the corresponding renderer for a type can display a suggested value.
  • trunk/Source/WebCore/loader/EmptyClients.h

    r157044 r157058  
    534534    EmptyDragClient() { }
    535535    virtual ~EmptyDragClient() {}
    536     virtual void willPerformDragDestinationAction(DragDestinationAction, DragData*) OVERRIDE { }
    537     virtual void willPerformDragSourceAction(DragSourceAction, const IntPoint&, Clipboard*) OVERRIDE { }
    538     virtual DragDestinationAction actionMaskForDrag(DragData*) OVERRIDE { return DragDestinationActionNone; }
     536    virtual void willPerformDragDestinationAction(DragDestinationAction, DragData&) OVERRIDE { }
     537    virtual void willPerformDragSourceAction(DragSourceAction, const IntPoint&, Clipboard&) OVERRIDE { }
     538    virtual DragDestinationAction actionMaskForDrag(DragData&) OVERRIDE { return DragDestinationActionNone; }
    539539    virtual DragSourceAction dragSourceActionMaskForPoint(const IntPoint&) OVERRIDE { return DragSourceActionNone; }
    540     virtual void startDrag(DragImageRef, const IntPoint&, const IntPoint&, Clipboard*, Frame*, bool) OVERRIDE { }
     540    virtual void startDrag(DragImageRef, const IntPoint&, const IntPoint&, Clipboard&, Frame&, bool) OVERRIDE { }
    541541    virtual void dragControllerDestroyed() OVERRIDE { }
    542542};
  • trunk/Source/WebCore/page/DragClient.h

    r109147 r157058  
    3232#include "IntPoint.h"
    3333
     34namespace WebCore {
     35   
     36class Clipboard;
     37class DragData;
     38class Element;
     39class Frame;
     40class Image;
     41
     42class DragClient {
     43public:
     44    virtual void dragControllerDestroyed() = 0;
     45
     46    virtual void willPerformDragDestinationAction(DragDestinationAction, DragData&) = 0;
     47    virtual void willPerformDragSourceAction(DragSourceAction, const IntPoint&, Clipboard&) = 0;
     48    virtual DragDestinationAction actionMaskForDrag(DragData&) = 0;
     49    virtual DragSourceAction dragSourceActionMaskForPoint(const IntPoint& rootViewPoint) = 0;
     50   
     51    virtual void startDrag(DragImageRef, const IntPoint& dragImageOrigin, const IntPoint& eventPos, Clipboard&, Frame&, bool linkDrag = false) = 0;
     52    virtual void dragEnded() { }
     53
    3454#if PLATFORM(MAC)
    35 OBJC_CLASS DOMElement;
    36 OBJC_CLASS NSURL;
    37 OBJC_CLASS NSString;
     55    // Mac-specific helper function to allow access to web archives and NSPasteboard extras in WebKit.
     56    // This is not abstract as that would require another #if PLATFORM(MAC) for the SVGImage client empty implentation.
     57    virtual void declareAndWriteDragImage(const String&, Element&, const URL&, const String&, Frame*) { }
    3858#endif
    3959
    40 namespace WebCore {
     60    virtual ~DragClient() { }
     61};
    4162   
    42     class Clipboard;
    43     class DragData;
    44     class Frame;
    45     class Image;
    46     class HTMLImageElement;
    47    
    48     class DragClient {
    49     public:
    50         virtual void willPerformDragDestinationAction(DragDestinationAction, DragData*) = 0;
    51         virtual void willPerformDragSourceAction(DragSourceAction, const IntPoint&, Clipboard*) = 0;
    52         virtual DragDestinationAction actionMaskForDrag(DragData*) = 0;
     63} // namespace WebCore
    5364
    54         virtual DragSourceAction dragSourceActionMaskForPoint(const IntPoint& rootViewPoint) = 0;
    55        
    56         virtual void startDrag(DragImageRef dragImage, const IntPoint& dragImageOrigin, const IntPoint& eventPos, Clipboard*, Frame*, bool linkDrag = false) = 0;
    57        
    58         virtual void dragControllerDestroyed() = 0;
     65#endif // DragClient_h
    5966
    60 #if PLATFORM(MAC)
    61         // Mac-specific helper function to allow access to web archives and NSPasteboard extras in WebKit.
    62         // This is not abstract as that would require another #if PLATFORM(MAC) for the SVGImage client empty implentation.
    63         virtual void declareAndWriteDragImage(const String&, DOMElement*, NSURL *, NSString *, Frame*) { }
    64 #endif
    65        
    66         virtual void dragEnded() { }
    67 
    68         virtual ~DragClient() { }
    69     };
    70    
    71 }
    72 
    73 #endif // !DragClient_h
    74 
  • trunk/Source/WebCore/page/DragController.cpp

    r156981 r157058  
    8484namespace WebCore {
    8585
    86 static PlatformMouseEvent createMouseEvent(DragData* dragData)
     86static PlatformMouseEvent createMouseEvent(DragData& dragData)
    8787{
    8888    bool shiftKey, ctrlKey, altKey, metaKey;
    8989    shiftKey = ctrlKey = altKey = metaKey = false;
    90     int keyState = dragData->modifierKeyState();
     90    int keyState = dragData.modifierKeyState();
    9191    shiftKey = static_cast<bool>(keyState & PlatformEvent::ShiftKey);
    9292    ctrlKey = static_cast<bool>(keyState & PlatformEvent::CtrlKey);
     
    9494    metaKey = static_cast<bool>(keyState & PlatformEvent::MetaKey);
    9595
    96     return PlatformMouseEvent(dragData->clientPosition(), dragData->globalPosition(),
     96    return PlatformMouseEvent(dragData.clientPosition(), dragData.globalPosition(),
    9797                              LeftButton, PlatformEvent::MouseMoved, 0, shiftKey, ctrlKey, altKey,
    9898                              metaKey, currentTime());
     
    118118}
    119119
    120 static PassRefPtr<DocumentFragment> documentFragmentFromDragData(DragData* dragData, Frame* frame, PassRefPtr<Range> context, bool allowPlainText, bool& chosePlainText)
    121 {
    122     ASSERT(dragData);
     120static PassRefPtr<DocumentFragment> documentFragmentFromDragData(DragData& dragData, Frame* frame, Range& context, bool allowPlainText, bool& chosePlainText)
     121{
    123122    chosePlainText = false;
    124123
    125     Document& document = context->ownerDocument();
    126     if (dragData->containsCompatibleContent()) {
    127         if (PassRefPtr<DocumentFragment> fragment = dragData->asFragment(frame, context.get(), allowPlainText, chosePlainText))
     124    Document& document = context.ownerDocument();
     125    if (dragData.containsCompatibleContent()) {
     126        if (PassRefPtr<DocumentFragment> fragment = dragData.asFragment(frame, context, allowPlainText, chosePlainText))
    128127            return fragment;
    129128
    130         if (dragData->containsURL(frame, DragData::DoNotConvertFilenames)) {
     129        if (dragData.containsURL(frame, DragData::DoNotConvertFilenames)) {
    131130            String title;
    132             String url = dragData->asURL(frame, DragData::DoNotConvertFilenames, &title);
     131            String url = dragData.asURL(frame, DragData::DoNotConvertFilenames, &title);
    133132            if (!url.isEmpty()) {
    134133                RefPtr<HTMLAnchorElement> anchor = HTMLAnchorElement::create(document);
     
    136135                if (title.isEmpty()) {
    137136                    // Try the plain text first because the url might be normalized or escaped.
    138                     if (dragData->containsPlainText())
    139                         title = dragData->asPlainText(frame);
     137                    if (dragData.containsPlainText())
     138                        title = dragData.asPlainText(frame);
    140139                    if (title.isEmpty())
    141140                        title = url;
     
    149148        }
    150149    }
    151     if (allowPlainText && dragData->containsPlainText()) {
     150    if (allowPlainText && dragData.containsPlainText()) {
    152151        chosePlainText = true;
    153         return createFragmentFromText(context.get(), dragData->asPlainText(frame)).get();
     152        return createFragmentFromText(context, dragData.asPlainText(frame)).get();
    154153    }
    155154
     
    157156}
    158157
    159 bool DragController::dragIsMove(FrameSelection& selection, DragData* dragData)
     158bool DragController::dragIsMove(FrameSelection& selection, DragData& dragData)
    160159{
    161160    return m_documentUnderMouse == m_dragInitiator && selection.isContentEditable() && selection.isRange() && !isCopyKeyDown(dragData);
     
    177176}
    178177
    179 DragSession DragController::dragEntered(DragData* dragData)
     178DragSession DragController::dragEntered(DragData& dragData)
    180179{
    181180    return dragEnteredOrUpdated(dragData);
    182181}
    183182
    184 void DragController::dragExited(DragData* dragData)
    185 {
    186     ASSERT(dragData);
    187 
     183void DragController::dragExited(DragData& dragData)
     184{
    188185    if (RefPtr<FrameView> v = m_page.mainFrame().view()) {
    189186        ClipboardAccessPolicy policy = (!m_documentUnderMouse || m_documentUnderMouse->securityOrigin()->isLocal()) ? ClipboardReadable : ClipboardTypesReadable;
    190         RefPtr<Clipboard> clipboard = Clipboard::createForDragAndDrop(policy, *dragData);
    191         clipboard->setSourceOperation(dragData->draggingSourceOperationMask());
     187        RefPtr<Clipboard> clipboard = Clipboard::createForDragAndDrop(policy, dragData);
     188        clipboard->setSourceOperation(dragData.draggingSourceOperationMask());
    192189        m_page.mainFrame().eventHandler().cancelDragAndDrop(createMouseEvent(dragData), clipboard.get());
    193190        clipboard->setAccessPolicy(ClipboardNumb);    // invalidate clipboard here for security
     
    199196}
    200197
    201 DragSession DragController::dragUpdated(DragData* dragData)
     198DragSession DragController::dragUpdated(DragData& dragData)
    202199{
    203200    return dragEnteredOrUpdated(dragData);
    204201}
    205202
    206 bool DragController::performDrag(DragData* dragData)
    207 {
    208     ASSERT(dragData);
    209     m_documentUnderMouse = m_page.mainFrame().documentAtPoint(dragData->clientPosition());
     203bool DragController::performDrag(DragData& dragData)
     204{
     205    m_documentUnderMouse = m_page.mainFrame().documentAtPoint(dragData.clientPosition());
    210206    if ((m_dragDestinationAction & DragDestinationActionDHTML) && m_documentIsHandlingDrag) {
    211207        m_client.willPerformDragDestinationAction(DragDestinationActionDHTML, dragData);
     
    214210        if (mainFrame->view()) {
    215211            // Sending an event can result in the destruction of the view and part.
    216             RefPtr<Clipboard> clipboard = Clipboard::createForDragAndDrop(ClipboardReadable, *dragData);
    217             clipboard->setSourceOperation(dragData->draggingSourceOperationMask());
     212            RefPtr<Clipboard> clipboard = Clipboard::createForDragAndDrop(ClipboardReadable, dragData);
     213            clipboard->setSourceOperation(dragData.draggingSourceOperationMask());
    218214            preventedDefault = mainFrame->eventHandler().performDragAndDrop(createMouseEvent(dragData), clipboard.get());
    219215            clipboard->setAccessPolicy(ClipboardNumb); // Invalidate clipboard here for security
     
    236232
    237233    m_client.willPerformDragDestinationAction(DragDestinationActionLoad, dragData);
    238     m_page.mainFrame().loader().load(FrameLoadRequest(&m_page.mainFrame(), ResourceRequest(dragData->asURL(&m_page.mainFrame()))));
     234    m_page.mainFrame().loader().load(FrameLoadRequest(&m_page.mainFrame(), ResourceRequest(dragData.asURL(&m_page.mainFrame()))));
    239235    return true;
    240236}
     
    251247}
    252248
    253 DragSession DragController::dragEnteredOrUpdated(DragData* dragData)
    254 {
    255     ASSERT(dragData);
    256     mouseMovedIntoDocument(m_page.mainFrame().documentAtPoint(dragData->clientPosition()));
     249DragSession DragController::dragEnteredOrUpdated(DragData& dragData)
     250{
     251    mouseMovedIntoDocument(m_page.mainFrame().documentAtPoint(dragData.clientPosition()));
    257252
    258253    m_dragDestinationAction = m_client.actionMaskForDrag(dragData);
     
    302297}
    303298
    304 bool DragController::tryDocumentDrag(DragData* dragData, DragDestinationAction actionMask, DragSession& dragSession)
    305 {
    306     ASSERT(dragData);
    307 
     299bool DragController::tryDocumentDrag(DragData& dragData, DragDestinationAction actionMask, DragSession& dragSession)
     300{
    308301    if (!m_documentUnderMouse)
    309302        return false;
     
    336329
    337330    if ((actionMask & DragDestinationActionEdit) && canProcessDrag(dragData)) {
    338         if (dragData->containsColor()) {
     331        if (dragData.containsColor()) {
    339332            dragSession.operation = DragOperationGeneric;
    340333            return true;
    341334        }
    342335
    343         IntPoint point = frameView->windowToContents(dragData->clientPosition());
     336        IntPoint point = frameView->windowToContents(dragData.clientPosition());
    344337        Element* element = elementUnderMouse(m_documentUnderMouse.get(), point);
    345338        if (!element)
     
    361354        dragSession.numberOfItemsToBeAccepted = 0;
    362355
    363         unsigned numberOfFiles = dragData->numberOfFiles();
     356        unsigned numberOfFiles = dragData.numberOfFiles();
    364357        if (m_fileInputElementUnderMouse) {
    365358            if (m_fileInputElementUnderMouse->isDisabledFormControl())
     
    398391}
    399392
    400 DragOperation DragController::operationForLoad(DragData* dragData)
    401 {
    402     ASSERT(dragData);
    403     Document* doc = m_page.mainFrame().documentAtPoint(dragData->clientPosition());
     393DragOperation DragController::operationForLoad(DragData& dragData)
     394{
     395    Document* doc = m_page.mainFrame().documentAtPoint(dragData.clientPosition());
    404396
    405397    bool pluginDocumentAcceptsDrags = false;
     
    429421}
    430422
    431 bool DragController::dispatchTextInputEventFor(Frame* innerFrame, DragData* dragData)
     423bool DragController::dispatchTextInputEventFor(Frame* innerFrame, DragData& dragData)
    432424{
    433425    ASSERT(m_page.dragCaretController().hasCaret());
    434     String text = m_page.dragCaretController().isContentRichlyEditable() ? "" : dragData->asPlainText(innerFrame);
     426    String text = m_page.dragCaretController().isContentRichlyEditable() ? emptyString() : dragData.asPlainText(innerFrame);
    435427    Node* target = innerFrame->editor().findEventTargetFrom(m_page.dragCaretController().caretPosition());
    436428    return target->dispatchEvent(TextEvent::createForDrop(innerFrame->document()->domWindow(), text), IGNORE_EXCEPTION);
    437429}
    438430
    439 bool DragController::concludeEditDrag(DragData* dragData)
    440 {
    441     ASSERT(dragData);
    442 
     431bool DragController::concludeEditDrag(DragData& dragData)
     432{
    443433    RefPtr<HTMLInputElement> fileInput = m_fileInputElementUnderMouse;
    444434    if (m_fileInputElementUnderMouse) {
     
    450440        return false;
    451441
    452     IntPoint point = m_documentUnderMouse->view()->windowToContents(dragData->clientPosition());
     442    IntPoint point = m_documentUnderMouse->view()->windowToContents(dragData.clientPosition());
    453443    Element* element = elementUnderMouse(m_documentUnderMouse.get(), point);
    454444    if (!element)
     
    460450        return true;
    461451
    462     if (dragData->containsColor()) {
    463         Color color = dragData->asColor();
     452    if (dragData.containsColor()) {
     453        Color color = dragData.asColor();
    464454        if (!color.isValid())
    465455            return false;
     
    474464    }
    475465
    476     if (dragData->containsFiles() && fileInput) {
     466    if (dragData.containsFiles() && fileInput) {
    477467        // fileInput should be the element we hit tested for, unless it was made
    478468        // display:none in a drop event handler.
     
    498488    if (!range)
    499489        return false;
     490
    500491    CachedResourceLoader* cachedResourceLoader = range->ownerDocument().cachedResourceLoader();
    501492    ResourceCacheValidationSuppressor validationSuppressor(cachedResourceLoader);
    502493    if (dragIsMove(innerFrame->selection(), dragData) || dragCaret.isContentRichlyEditable()) {
    503494        bool chosePlainText = false;
    504         RefPtr<DocumentFragment> fragment = documentFragmentFromDragData(dragData, innerFrame.get(), range, true, chosePlainText);
     495        RefPtr<DocumentFragment> fragment = documentFragmentFromDragData(dragData, innerFrame.get(), *range, true, chosePlainText);
    505496        if (!fragment || !innerFrame->editor().shouldInsertFragment(fragment, range, EditorInsertActionDropped)) {
    506497            return false;
     
    512503            // but only to smart insert if the selection granularity is word granularity.
    513504            bool smartDelete = innerFrame->editor().smartInsertDeleteEnabled();
    514             bool smartInsert = smartDelete && innerFrame->selection().granularity() == WordGranularity && dragData->canSmartReplace();
     505            bool smartInsert = smartDelete && innerFrame->selection().granularity() == WordGranularity && dragData.canSmartReplace();
    515506            applyCommand(MoveSelectionCommand::create(fragment, dragCaret.base(), smartInsert, smartDelete));
    516507        } else {
    517508            if (setSelectionToDragCaret(innerFrame.get(), dragCaret, range, point)) {
    518509                ReplaceSelectionCommand::CommandOptions options = ReplaceSelectionCommand::SelectReplacement | ReplaceSelectionCommand::PreventNesting;
    519                 if (dragData->canSmartReplace())
     510                if (dragData.canSmartReplace())
    520511                    options |= ReplaceSelectionCommand::SmartReplace;
    521512                if (chosePlainText)
     
    525516        }
    526517    } else {
    527         String text = dragData->asPlainText(innerFrame.get());
     518        String text = dragData.asPlainText(innerFrame.get());
    528519        if (text.isEmpty() || !innerFrame->editor().shouldInsertText(text, range.get(), EditorInsertActionDropped)) {
    529520            return false;
     
    532523        m_client.willPerformDragDestinationAction(DragDestinationActionEdit, dragData);
    533524        if (setSelectionToDragCaret(innerFrame.get(), dragCaret, range, point))
    534             applyCommand(ReplaceSelectionCommand::create(*m_documentUnderMouse, createFragmentFromText(range.get(), text),  ReplaceSelectionCommand::SelectReplacement | ReplaceSelectionCommand::MatchStyle | ReplaceSelectionCommand::PreventNesting));
     525            applyCommand(ReplaceSelectionCommand::create(*m_documentUnderMouse, createFragmentFromText(*range, text),  ReplaceSelectionCommand::SelectReplacement | ReplaceSelectionCommand::MatchStyle | ReplaceSelectionCommand::PreventNesting));
    535526    }
    536527
     
    543534}
    544535
    545 bool DragController::canProcessDrag(DragData* dragData)
    546 {
    547     ASSERT(dragData);
    548 
    549     if (!dragData->containsCompatibleContent())
    550         return false;
    551 
    552     IntPoint point = m_page.mainFrame().view()->windowToContents(dragData->clientPosition());
     536bool DragController::canProcessDrag(DragData& dragData)
     537{
     538    if (!dragData.containsCompatibleContent())
     539        return false;
     540
     541    IntPoint point = m_page.mainFrame().view()->windowToContents(dragData.clientPosition());
    553542    HitTestResult result = HitTestResult(point);
    554543    if (!m_page.mainFrame().contentRenderer())
     
    560549        return false;
    561550
    562     if (dragData->containsFiles() && asFileInput(result.innerNonSharedNode()))
     551    if (dragData.containsFiles() && asFileInput(result.innerNonSharedNode()))
    563552        return true;
    564553
     
    595584}
    596585
    597 bool DragController::tryDHTMLDrag(DragData* dragData, DragOperation& operation)
    598 {
    599     ASSERT(dragData);
     586bool DragController::tryDHTMLDrag(DragData& dragData, DragOperation& operation)
     587{
    600588    ASSERT(m_documentUnderMouse);
    601589    Ref<MainFrame> mainFrame(m_page.mainFrame());
     
    605593
    606594    ClipboardAccessPolicy policy = m_documentUnderMouse->securityOrigin()->isLocal() ? ClipboardReadable : ClipboardTypesReadable;
    607     RefPtr<Clipboard> clipboard = Clipboard::createForDragAndDrop(policy, *dragData);
    608     DragOperation srcOpMask = dragData->draggingSourceOperationMask();
     595    RefPtr<Clipboard> clipboard = Clipboard::createForDragAndDrop(policy, dragData);
     596    DragOperation srcOpMask = dragData.draggingSourceOperationMask();
    609597    clipboard->setSourceOperation(srcOpMask);
    610598
     
    665653}
    666654
    667 static CachedImage* getCachedImage(Element* element)
    668 {
    669     ASSERT(element);
    670     RenderObject* renderer = element->renderer();
     655static CachedImage* getCachedImage(Element& element)
     656{
     657    RenderObject* renderer = element.renderer();
    671658    if (!renderer || !renderer->isImage())
    672659        return 0;
     
    675662}
    676663
    677 static Image* getImage(Element* element)
    678 {
    679     ASSERT(element);
     664static Image* getImage(Element& element)
     665{
    680666    CachedImage* cachedImage = getCachedImage(element);
    681667    // Don't use cachedImage->imageForRenderer() here as that may return BitmapImages for cached SVG Images.
     
    686672}
    687673
    688 static void selectElement(Element* element)
    689 {
    690     RefPtr<Range> range = element->document().createRange();
    691     range->selectNode(element);
    692     element->document().frame()->selection().setSelection(VisibleSelection(range.get(), DOWNSTREAM));
     674static void selectElement(Element& element)
     675{
     676    RefPtr<Range> range = element.document().createRange();
     677    range->selectNode(&element);
     678    element.document().frame()->selection().setSelection(VisibleSelection(range.get(), DOWNSTREAM));
    693679}
    694680
     
    709695}
    710696
    711 static IntPoint dragLocForSelectionDrag(Frame* src)
    712 {
    713     IntRect draggingRect = enclosingIntRect(src->selection().bounds());
     697static IntPoint dragLocForSelectionDrag(Frame& src)
     698{
     699    IntRect draggingRect = enclosingIntRect(src.selection().bounds());
    714700    int xpos = draggingRect.maxX();
    715701    xpos = draggingRect.x() < xpos ? draggingRect.x() : xpos;
     
    724710}
    725711
    726 bool DragController::startDrag(Frame* src, const DragState& state, DragOperation srcOp, const PlatformMouseEvent& dragEvent, const IntPoint& dragOrigin)
    727 {
    728     ASSERT(src);
    729 
    730     if (!src->view() || !src->contentRenderer())
    731         return false;
    732 
    733     HitTestResult hitTestResult = src->eventHandler().hitTestResultAtPoint(dragOrigin, HitTestRequest::ReadOnly | HitTestRequest::Active);
     712bool DragController::startDrag(Frame& src, const DragState& state, DragOperation srcOp, const PlatformMouseEvent& dragEvent, const IntPoint& dragOrigin)
     713{
     714    if (!src.view() || !src.contentRenderer())
     715        return false;
     716
     717    HitTestResult hitTestResult = src.eventHandler().hitTestResultAtPoint(dragOrigin, HitTestRequest::ReadOnly | HitTestRequest::Active);
    734718    if (!state.source->contains(hitTestResult.innerNode()))
    735719        // The original node being dragged isn't under the drag origin anymore... maybe it was
     
    740724    URL imageURL = hitTestResult.absoluteImageURL();
    741725
    742     IntPoint mouseDraggedPoint = src->view()->windowToContents(dragEvent.position());
     726    IntPoint mouseDraggedPoint = src.view()->windowToContents(dragEvent.position());
    743727
    744728    m_draggingImageURL = URL();
     
    749733    IntPoint dragImageOffset(0, 0);
    750734
    751     Clipboard* clipboard = state.clipboard.get();
     735    ASSERT(state.clipboard);
     736
     737    Clipboard& clipboard = *state.clipboard;
    752738    if (state.type == DragSourceActionDHTML)
    753         dragImage = clipboard->createDragImage(dragImageOffset);
     739        dragImage = clipboard.createDragImage(dragImageOffset);
    754740    if (state.type == DragSourceActionSelection || !imageURL.isEmpty() || !linkURL.isEmpty())
    755741        // Selection, image, and link drags receive a default set of allowed drag operations that
     
    767753    bool startedDrag = true; // optimism - we almost always manage to start the drag
    768754
    769     Element* element = state.source.get();
     755    ASSERT(state.source);
     756    Element& element = *state.source;
    770757
    771758    Image* image = getImage(element);
    772759    if (state.type == DragSourceActionSelection) {
    773         if (!clipboard->pasteboard().hasData()) {
     760        if (!clipboard.pasteboard().hasData()) {
    774761            // FIXME: This entire block is almost identical to the code in Editor::copy, and the code should be shared.
    775762
    776             RefPtr<Range> selectionRange = src->selection().toNormalizedRange();
     763            RefPtr<Range> selectionRange = src.selection().toNormalizedRange();
    777764            ASSERT(selectionRange);
    778765
    779             src->editor().willWriteSelectionToPasteboard(selectionRange.get());
    780 
    781             if (enclosingTextFormControl(src->selection().start()))
    782                 clipboard->pasteboard().writePlainText(src->editor().selectedTextForClipboard(), Pasteboard::CannotSmartReplace);
     766            src.editor().willWriteSelectionToPasteboard(selectionRange.get());
     767
     768            if (enclosingTextFormControl(src.selection().start()))
     769                clipboard.pasteboard().writePlainText(src.editor().selectedTextForClipboard(), Pasteboard::CannotSmartReplace);
    783770            else {
    784771#if PLATFORM(MAC) || PLATFORM(EFL)
    785                 src->editor().writeSelectionToPasteboard(clipboard->pasteboard());
     772                src.editor().writeSelectionToPasteboard(clipboard.pasteboard());
    786773#else
    787774                // FIXME: Convert all other platforms to match Mac and delete this.
    788                 clipboard->pasteboard().writeSelection(selectionRange.get(), src->editor().canSmartCopyOrDelete(), src, IncludeImageAltTextForClipboard);
     775                clipboard.pasteboard().writeSelection(*selectionRange, src.editor().canSmartCopyOrDelete(), src, IncludeImageAltTextForClipboard);
    789776#endif
    790777            }
    791778
    792             src->editor().didWriteSelectionToPasteboard();
     779            src.editor().didWriteSelectionToPasteboard();
    793780        }
    794781        m_client.willPerformDragSourceAction(DragSourceActionSelection, dragOrigin, clipboard);
    795782        if (!dragImage) {
    796             dragImage = dissolveDragImageToFraction(src->dragImageForSelection(), DragImageAlpha);
     783            dragImage = dissolveDragImageToFraction(src.dragImageForSelection(), DragImageAlpha);
    797784            dragLoc = dragLocForSelectionDrag(src);
    798785            m_dragOffset = IntPoint(dragOrigin.x() - dragLoc.x(), dragOrigin.y() - dragLoc.y());
    799786        }
    800787        doSystemDrag(dragImage, dragLoc, dragOrigin, clipboard, src, false);
    801     } else if (!imageURL.isEmpty() && element && image && !image->isNull() && (m_dragSourceAction & DragSourceActionImage)) {
     788    } else if (!imageURL.isEmpty() && image && !image->isNull() && (m_dragSourceAction & DragSourceActionImage)) {
    802789        // We shouldn't be starting a drag for an image that can't provide an extension.
    803790        // This is an early detection for problems encountered later upon drop.
    804791        ASSERT(!image->filenameExtension().isEmpty());
    805         if (!clipboard->pasteboard().hasData()) {
     792        if (!clipboard.pasteboard().hasData()) {
    806793            m_draggingImageURL = imageURL;
    807             if (element->isContentRichlyEditable())
     794            if (element.isContentRichlyEditable())
    808795                selectElement(element);
    809796            declareAndWriteDragImage(clipboard, element, !linkURL.isEmpty() ? linkURL : imageURL, hitTestResult.altDisplayString());
     
    814801        if (!dragImage) {
    815802            IntRect imageRect = hitTestResult.imageRect();
    816             imageRect.setLocation(m_page.mainFrame().view()->rootViewToContents(src->view()->contentsToRootView(imageRect.location())));
     803            imageRect.setLocation(m_page.mainFrame().view()->rootViewToContents(src.view()->contentsToRootView(imageRect.location())));
    817804            doImageDrag(element, dragOrigin, hitTestResult.imageRect(), clipboard, src, m_dragOffset);
    818         } else
     805        } else {
    819806            // DHTML defined drag image
    820807            doSystemDrag(dragImage, dragLoc, dragOrigin, clipboard, src, false);
    821 
     808        }
    822809    } else if (!linkURL.isEmpty() && (m_dragSourceAction & DragSourceActionLink)) {
    823         if (!clipboard->pasteboard().hasData())
     810        if (!clipboard.pasteboard().hasData())
    824811            // Simplify whitespace so the title put on the clipboard resembles what the user sees
    825812            // on the web page. This includes replacing newlines with spaces.
    826             src->editor().copyURL(linkURL, hitTestResult.textContent().simplifyWhiteSpace(), clipboard->pasteboard());
    827 
    828         if (src->selection().isCaret() && src->selection().isContentEditable()) {
     813            src.editor().copyURL(linkURL, hitTestResult.textContent().simplifyWhiteSpace(), clipboard.pasteboard());
     814
     815        if (src.selection().isCaret() && src.selection().isContentEditable()) {
    829816            // a user can initiate a drag on a link without having any text
    830817            // selected.  In this case, we should expand the selection to
    831818            // the enclosing anchor element
    832             Position pos = src->selection().base();
     819            Position pos = src.selection().base();
    833820            Node* node = enclosingAnchorElement(pos);
    834821            if (node)
    835                 src->selection().setSelection(VisibleSelection::selectionFromContentsOfNode(node));
     822                src.selection().setSelection(VisibleSelection::selectionFromContentsOfNode(node));
    836823        }
    837824
    838825        m_client.willPerformDragSourceAction(DragSourceActionLink, dragOrigin, clipboard);
    839826        if (!dragImage) {
    840             dragImage = createDragImageForLink(linkURL, hitTestResult.textContent(), src->settings().fontRenderingMode());
     827            dragImage = createDragImageForLink(linkURL, hitTestResult.textContent(), src.settings().fontRenderingMode());
    841828            IntSize size = dragImageSize(dragImage);
    842829            m_dragOffset = IntPoint(-size.width() / 2, -LinkDragBorderInset);
     
    862849}
    863850
    864 void DragController::doImageDrag(Element* element, const IntPoint& dragOrigin, const IntRect& rect, Clipboard* clipboard, Frame* frame, IntPoint& dragImageOffset)
     851void DragController::doImageDrag(Element& element, const IntPoint& dragOrigin, const IntRect& rect, Clipboard& clipboard, Frame& frame, IntPoint& dragImageOffset)
    865852{
    866853    IntPoint mouseDownPoint = dragOrigin;
     
    870857    Image* image = getImage(element);
    871858    if (image && image->size().height() * image->size().width() <= MaxOriginalImageArea
    872         && (dragImage = createDragImageFromImage(image, element->renderer() ? ImageOrientationDescription(element->renderer()->shouldRespectImageOrientation()) : ImageOrientationDescription()))) {
     859        && (dragImage = createDragImageFromImage(image, element.renderer() ? ImageOrientationDescription(element.renderer()->shouldRespectImageOrientation()) : ImageOrientationDescription()))) {
    873860        IntSize originalSize = rect.size();
    874861        origin = rect.location();
     
    904891}
    905892
    906 void DragController::doSystemDrag(DragImageRef image, const IntPoint& dragLoc, const IntPoint& eventPos, Clipboard* clipboard, Frame* frame, bool forLink)
     893void DragController::doSystemDrag(DragImageRef image, const IntPoint& dragLoc, const IntPoint& eventPos, Clipboard& clipboard, Frame& frame, bool forLink)
    907894{
    908895    m_didInitiateDrag = true;
    909     m_dragInitiator = frame->document();
     896    m_dragInitiator = frame.document();
    910897    // Protect this frame and view, as a load may occur mid drag and attempt to unload this frame
    911898    Ref<MainFrame> frameProtector(m_page.mainFrame());
    912899    RefPtr<FrameView> viewProtector = frameProtector->view();
    913     m_client.startDrag(image, viewProtector->rootViewToContents(frame->view()->contentsToRootView(dragLoc)),
    914         viewProtector->rootViewToContents(frame->view()->contentsToRootView(eventPos)), clipboard, &frameProtector.get(), forLink);
     900    m_client.startDrag(image, viewProtector->rootViewToContents(frame.view()->contentsToRootView(dragLoc)),
     901        viewProtector->rootViewToContents(frame.view()->contentsToRootView(eventPos)), clipboard, frameProtector.get(), forLink);
    915902    // DragClient::startDrag can cause our Page to dispear, deallocating |this|.
    916903    if (!frameProtector->page())
  • trunk/Source/WebCore/page/DragController.h

    r156550 r157058  
    5959        DragClient& client() const { return m_client; }
    6060
    61         DragSession dragEntered(DragData*);
    62         void dragExited(DragData*);
    63         DragSession dragUpdated(DragData*);
    64         bool performDrag(DragData*);
     61        DragSession dragEntered(DragData&);
     62        void dragExited(DragData&);
     63        DragSession dragUpdated(DragData&);
     64        bool performDrag(DragData&);
    6565       
    6666        // FIXME: It should be possible to remove a number of these accessors once all
     
    8383        void placeDragCaret(const IntPoint&);
    8484       
    85         bool startDrag(Frame* src, const DragState&, DragOperation srcOp, const PlatformMouseEvent& dragEvent, const IntPoint& dragOrigin);
     85        bool startDrag(Frame& src, const DragState&, DragOperation srcOp, const PlatformMouseEvent& dragEvent, const IntPoint& dragOrigin);
    8686        static const IntSize& maxDragImageSize();
    8787       
     
    9393
    9494    private:
    95         bool dispatchTextInputEventFor(Frame*, DragData*);
    96         bool canProcessDrag(DragData*);
    97         bool concludeEditDrag(DragData*);
    98         DragSession dragEnteredOrUpdated(DragData*);
    99         DragOperation operationForLoad(DragData*);
    100         bool tryDocumentDrag(DragData*, DragDestinationAction, DragSession&);
    101         bool tryDHTMLDrag(DragData*, DragOperation&);
    102         DragOperation dragOperation(DragData*);
     95        bool dispatchTextInputEventFor(Frame*, DragData&);
     96        bool canProcessDrag(DragData&);
     97        bool concludeEditDrag(DragData&);
     98        DragSession dragEnteredOrUpdated(DragData&);
     99        DragOperation operationForLoad(DragData&);
     100        bool tryDocumentDrag(DragData&, DragDestinationAction, DragSession&);
     101        bool tryDHTMLDrag(DragData&, DragOperation&);
     102        DragOperation dragOperation(DragData&);
    103103        void cancelDrag();
    104         bool dragIsMove(FrameSelection&, DragData*);
    105         bool isCopyKeyDown(DragData*);
     104        bool dragIsMove(FrameSelection&, DragData&);
     105        bool isCopyKeyDown(DragData&);
    106106
    107107        void mouseMovedIntoDocument(Document*);
    108108
    109         void doImageDrag(Element*, const IntPoint&, const IntRect&, Clipboard*, Frame*, IntPoint&);
    110         void doSystemDrag(DragImageRef, const IntPoint&, const IntPoint&, Clipboard*, Frame*, bool forLink);
     109        void doImageDrag(Element&, const IntPoint&, const IntRect&, Clipboard&, Frame&, IntPoint&);
     110        void doSystemDrag(DragImageRef, const IntPoint&, const IntPoint&, Clipboard&, Frame&, bool forLink);
    111111        void cleanupAfterSystemDrag();
    112         void declareAndWriteDragImage(Clipboard*, Element*, const URL&, const String& label);
     112        void declareAndWriteDragImage(Clipboard&, Element&, const URL&, const String& label);
    113113
    114114        Page& m_page;
  • trunk/Source/WebCore/page/EventHandler.cpp

    r157018 r157058  
    36693669    if (m_mouseDownMayStartDrag) {
    36703670        Page* page = m_frame.page();
    3671         m_didStartDrag = page && page->dragController().startDrag(&m_frame, dragState(), srcOp, event.event(), m_mouseDownPos);
     3671        m_didStartDrag = page && page->dragController().startDrag(m_frame, dragState(), srcOp, event.event(), m_mouseDownPos);
    36723672        // In WebKit2 we could re-enter this code and start another drag.
    36733673        // On OS X this causes problems with the ownership of the pasteboard and the promised types.
  • trunk/Source/WebCore/page/efl/DragControllerEfl.cpp

    r156550 r157058  
    4444const float DragController::DragImageAlpha = 0.75f;
    4545
    46 bool DragController::isCopyKeyDown(DragData*)
     46bool DragController::isCopyKeyDown(DragData&)
    4747{
    4848    return false;
    4949}
    5050
    51 DragOperation DragController::dragOperation(DragData* dragData)
     51DragOperation DragController::dragOperation(DragData& dragData)
    5252{
    53     if (dragData->containsURL(0))
     53    if (dragData.containsURL(0))
    5454        return DragOperationCopy;
    5555
     
    6868}
    6969
    70 void DragController::declareAndWriteDragImage(Clipboard*, Element*, const URL&, const String&)
     70void DragController::declareAndWriteDragImage(Clipboard&, Element&, const URL&, const String&)
    7171{
    7272}
  • trunk/Source/WebCore/page/gtk/DragControllerGtk.cpp

    r156550 r157058  
    4646const float DragController::DragImageAlpha = 0.75f;
    4747
    48 bool DragController::isCopyKeyDown(DragData*)
     48bool DragController::isCopyKeyDown(DragData&)
    4949{
    5050    return false;
    5151}
    5252
    53 DragOperation DragController::dragOperation(DragData* dragData)
     53DragOperation DragController::dragOperation(DragData& dragData)
    5454{
    55     //FIXME: This logic is incomplete
    56      if (dragData->containsURL(0))
     55    // FIXME: This logic is incomplete
     56    if (dragData.containsURL(0))
    5757        return DragOperationCopy;
    5858
     
    7070}
    7171
    72 void DragController::declareAndWriteDragImage(Clipboard* clipboard, Element* element, const URL& url, const String& label)
     72void DragController::declareAndWriteDragImage(Clipboard& clipboard, Element& element, const URL& url, const String& label)
    7373{
    74     clipboard->pasteboard().writeImage(element, url, label);
     74    clipboard.pasteboard().writeImage(element, url, label);
    7575}
    7676
  • trunk/Source/WebCore/page/mac/DragControllerMac.mm

    r156550 r157058  
    3030
    3131#import "Clipboard.h"
    32 #import "DOMElementInternal.h"
    3332#import "DragClient.h"
    3433#import "DragData.h"
     
    4948const float DragController::DragImageAlpha = 0.75f;
    5049
    51 bool DragController::isCopyKeyDown(DragData* dragData)
     50bool DragController::isCopyKeyDown(DragData& dragData)
    5251{
    53     return dragData->flags() & DragApplicationIsCopyKeyDown;
     52    return dragData.flags() & DragApplicationIsCopyKeyDown;
    5453}
    5554   
    56 DragOperation DragController::dragOperation(DragData* dragData)
     55DragOperation DragController::dragOperation(DragData& dragData)
    5756{
    58     ASSERT(dragData);
    59 
    60     if ((dragData->flags() & DragApplicationIsModal) || !dragData->containsURL(&m_page.mainFrame()))
     57    if ((dragData.flags() & DragApplicationIsModal) || !dragData.containsURL(&m_page.mainFrame()))
    6158        return DragOperationNone;
    6259
    63     if (!m_documentUnderMouse || (!(dragData->flags() & (DragApplicationHasAttachedSheet | DragApplicationIsSource))))
     60    if (!m_documentUnderMouse || (!(dragData.flags() & (DragApplicationHasAttachedSheet | DragApplicationIsSource))))
    6461        return DragOperationCopy;
    6562
     
    8683}
    8784
    88 void DragController::declareAndWriteDragImage(Clipboard* clipboard, Element* element, const URL& url, const String& label)
     85void DragController::declareAndWriteDragImage(Clipboard& clipboard, Element& element, const URL& url, const String& label)
    8986{
    90     m_client.declareAndWriteDragImage(clipboard->pasteboard().name(), kit(element), url, label, element->document().frame());
     87    m_client.declareAndWriteDragImage(clipboard.pasteboard().name(), element, url, label, element.document().frame());
    9188}
    9289
  • trunk/Source/WebCore/page/win/DragControllerWin.cpp

    r157012 r157058  
    4545const float DragController::DragImageAlpha = 0.75f;
    4646
    47 DragOperation DragController::dragOperation(DragData* dragData)
     47DragOperation DragController::dragOperation(DragData& dragData)
    4848{
    4949    //FIXME: to match the macos behaviour we should return DragOperationNone
     
    5151    //If this can be determined from within WebCore operationForDrag can be pulled into
    5252    //WebCore itself
    53     ASSERT(dragData);
    54     return dragData->containsURL(0) && !m_didInitiateDrag ? DragOperationCopy : DragOperationNone;
     53    return dragData.containsURL(0) && !m_didInitiateDrag ? DragOperationCopy : DragOperationNone;
    5554}
    5655
    57 bool DragController::isCopyKeyDown(DragData*)
     56bool DragController::isCopyKeyDown(DragData&)
    5857{
    5958    return ::GetAsyncKeyState(VK_CONTROL);
     
    7170}
    7271
    73 void DragController::declareAndWriteDragImage(Clipboard* clipboard, Element* element, const URL& url, const String& label)
     72void DragController::declareAndWriteDragImage(Clipboard& clipboard, Element& element, const URL& url, const String& label)
    7473{
    75     Pasteboard& pasteboard = clipboard->pasteboard();
     74    Pasteboard& pasteboard = clipboard.pasteboard();
    7675
    7776    // FIXME: Do we really need this check?
     
    8281    pasteboard.writeURLToWritableDataObject(url, label);
    8382    pasteboard.writeImageToDataObject(element, url);
    84     pasteboard.writeMarkup(createMarkup(*element, IncludeNode, 0, ResolveAllURLs));
     83    pasteboard.writeMarkup(createMarkup(element, IncludeNode, 0, ResolveAllURLs));
    8584}
    8685
  • trunk/Source/WebCore/platform/DragData.h

    r156795 r157058  
    105105    void asFilenames(Vector<String>&) const;
    106106    Color asColor() const;
    107     PassRefPtr<DocumentFragment> asFragment(Frame*, PassRefPtr<Range> context,
    108                                             bool allowPlainText, bool& chosePlainText) const;
     107    PassRefPtr<DocumentFragment> asFragment(Frame*, Range& context, bool allowPlainText, bool& chosePlainText) const;
    109108    bool canSmartReplace() const;
    110109    bool containsColor() const;
  • trunk/Source/WebCore/platform/Pasteboard.h

    r156795 r157058  
    165165
    166166#if PLATFORM(GTK) || PLATFORM(WIN)
    167     PassRefPtr<DocumentFragment> documentFragment(Frame*, PassRefPtr<Range>, bool allowPlainText, bool& chosePlainText); // FIXME: Layering violation.
    168 #endif
    169 
    170 #if PLATFORM(GTK) || PLATFORM(WIN)
    171     void writeImage(Node*, const URL&, const String& title); // FIXME: Layering violation.
    172     void writeSelection(Range*, bool canSmartCopyOrDelete, Frame*, ShouldSerializeSelectedTextForClipboard = DefaultSelectedTextType); // FIXME: Layering violation.
     167    PassRefPtr<DocumentFragment> documentFragment(Frame&, Range&, bool allowPlainText, bool& chosePlainText); // FIXME: Layering violation.
     168    void writeImage(Element&, const URL&, const String& title); // FIXME: Layering violation.
     169    void writeSelection(Range&, bool canSmartCopyOrDelete, Frame&, ShouldSerializeSelectedTextForClipboard = DefaultSelectedTextType); // FIXME: Layering violation.
    173170#endif
    174171
     
    177174    static PassOwnPtr<Pasteboard> create(GtkClipboard*);
    178175    PassRefPtr<DataObjectGtk> dataObject() const;
    179 #endif
    180 
    181 #if PLATFORM(GTK)
    182176    static PassOwnPtr<Pasteboard> createForGlobalSelection();
    183177#endif
     
    200194    void writeURLToWritableDataObject(const URL&, const String&);
    201195    COMPtr<WCDataObject> writableDataObject() const { return m_writableDataObject; }
    202     void writeImageToDataObject(Element*, const URL&); // FIXME: Layering violation.
     196    void writeImageToDataObject(Element&, const URL&); // FIXME: Layering violation.
    203197#endif
    204198
     
    217211
    218212    void finishCreatingPasteboard();
    219     void writeRangeToDataObject(Range*, Frame*); // FIXME: Layering violation.
     213    void writeRangeToDataObject(Range&, Frame&); // FIXME: Layering violation.
    220214    void writeURLToDataObject(const URL&, const String&);
    221215    void writePlainTextToDataObject(const String&, SmartReplaceOption);
  • trunk/Source/WebCore/platform/efl/DragDataEfl.cpp

    r128570 r157058  
    8181}
    8282
    83 PassRefPtr<DocumentFragment> DragData::asFragment(Frame*, PassRefPtr<Range>, bool, bool&) const
     83PassRefPtr<DocumentFragment> DragData::asFragment(Frame*, Range&, bool, bool&) const
    8484{
    8585    return 0;
  • trunk/Source/WebCore/platform/gtk/DragDataGtk.cpp

    r157002 r157058  
    9393
    9494
    95 PassRefPtr<DocumentFragment> DragData::asFragment(Frame* frame, PassRefPtr<Range>, bool, bool&) const
     95PassRefPtr<DocumentFragment> DragData::asFragment(Frame* frame, Range&, bool, bool&) const
    9696{
    9797    if (!m_platformDragData->hasMarkup())
  • trunk/Source/WebCore/platform/gtk/GtkDragAndDropHelper.cpp

    r157013 r157058  
    9696                      convertWidgetPointToScreenPoint(m_widget, position),
    9797                      DragOperationNone);
    98     context->exitedCallback(m_widget, &dragData, context->dropHappened);
     98    context->exitedCallback(m_widget, dragData, context->dropHappened);
    9999
    100100    m_droppingContexts.remove(iterator);
  • trunk/Source/WebCore/platform/gtk/GtkDragAndDropHelper.h

    r157013 r157058  
    2929class DragData;
    3030
    31 typedef void (*DragExitedCallback)(GtkWidget*, DragData*, bool dropHappened);
     31typedef void (*DragExitedCallback)(GtkWidget*, DragData&, bool dropHappened);
    3232
    3333class GtkDragAndDropHelper {
  • trunk/Source/WebCore/platform/gtk/PasteboardGtk.cpp

    r157002 r157058  
    158158}
    159159
    160 void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete, Frame* frame, ShouldSerializeSelectedTextForClipboard shouldSerializeSelectedTextForClipboard)
     160void Pasteboard::writeSelection(Range& selectedRange, bool canSmartCopyOrDelete, Frame& frame, ShouldSerializeSelectedTextForClipboard shouldSerializeSelectedTextForClipboard)
    161161{
    162162    m_dataObject->clearAll();
    163     m_dataObject->setText(shouldSerializeSelectedTextForClipboard == IncludeImageAltTextForClipboard ? frame->editor().selectedTextForClipboard() : frame->editor().selectedText());
    164     m_dataObject->setMarkup(createMarkup(*selectedRange, 0, AnnotateForInterchange, false, ResolveNonLocalURLs));
     163    m_dataObject->setText(shouldSerializeSelectedTextForClipboard == IncludeImageAltTextForClipboard ? frame.editor().selectedTextForClipboard() : frame.editor().selectedText());
     164    m_dataObject->setMarkup(createMarkup(selectedRange, 0, AnnotateForInterchange, false, ResolveNonLocalURLs));
    165165
    166166    if (m_gtkClipboard)
     
    188188}
    189189
    190 static URL getURLForImageNode(Node* node)
     190static URL getURLForImageElement(Element& element)
    191191{
    192192    // FIXME: Later this code should be shared with Chromium somehow. Chances are all platforms want it.
    193193    AtomicString urlString;
    194     if (isHTMLImageElement(node) || isHTMLInputElement(node))
    195         urlString = toElement(node)->getAttribute(HTMLNames::srcAttr);
     194    if (isHTMLImageElement(element) || isHTMLInputElement(element))
     195        urlString = element.getAttribute(HTMLNames::srcAttr);
    196196#if ENABLE(SVG)
    197     else if (node->hasTagName(SVGNames::imageTag))
    198         urlString = toElement(node)->getAttribute(XLinkNames::hrefAttr);
     197    else if (element.hasTagName(SVGNames::imageTag))
     198        urlString = element.getAttribute(XLinkNames::hrefAttr);
    199199#endif
    200     else if (node->hasTagName(HTMLNames::embedTag) || isHTMLObjectElement(node)) {
    201         Element* element = toElement(node);
    202         urlString = element->imageSourceURL();
    203     }
    204     return urlString.isEmpty() ? URL() : node->document().completeURL(stripLeadingAndTrailingHTMLSpaces(urlString));
    205 }
    206 
    207 void Pasteboard::writeImage(Node* node, const URL&, const String& title)
    208 {
    209     ASSERT(node);
    210 
    211     if (!(node->renderer() && node->renderer()->isImage()))
     200    else if (element.hasTagName(HTMLNames::embedTag) || isHTMLObjectElement(element))
     201        urlString = element.imageSourceURL();
     202
     203    return urlString.isEmpty() ? URL() : element.document().completeURL(stripLeadingAndTrailingHTMLSpaces(urlString));
     204}
     205
     206void Pasteboard::writeImage(Element& element, const URL&, const String& title)
     207{
     208    if (!(element.renderer() && element.renderer()->isImage()))
    212209        return;
    213210
    214     RenderImage* renderer = toRenderImage(node->renderer());
     211    RenderImage* renderer = toRenderImage(element.renderer());
    215212    CachedImage* cachedImage = renderer->cachedImage();
    216213    if (!cachedImage || cachedImage->errorOccurred())
     
    221218    m_dataObject->clearAll();
    222219
    223     URL url = getURLForImageNode(node);
     220    URL url = getURLForImageElement(element);
    224221    if (!url.isEmpty()) {
    225222        m_dataObject->setURL(url, title);
    226223
    227         m_dataObject->setMarkup(createMarkup(*toElement(node), IncludeNode, 0, ResolveAllURLs));
     224        m_dataObject->setMarkup(createMarkup(element, IncludeNode, 0, ResolveAllURLs));
    228225    }
    229226
     
    303300#endif
    304301
    305 PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefPtr<Range> context,
    306                                                           bool allowPlainText, bool& chosePlainText)
     302PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame& frame, Range& context, bool allowPlainText, bool& chosePlainText)
    307303{
    308304    if (m_gtkClipboard)
     
    312308
    313309    if (m_dataObject->hasMarkup()) {
    314         if (frame->document()) {
    315             RefPtr<DocumentFragment> fragment = createFragmentFromMarkup(*frame->document(), m_dataObject->markup(), emptyString(), DisallowScriptingAndPluginContent);
     310        if (frame.document()) {
     311            RefPtr<DocumentFragment> fragment = createFragmentFromMarkup(*frame.document(), m_dataObject->markup(), emptyString(), DisallowScriptingAndPluginContent);
    316312            if (fragment)
    317313                return fragment.release();
     
    324320    if (m_dataObject->hasText()) {
    325321        chosePlainText = true;
    326         RefPtr<DocumentFragment> fragment = createFragmentFromText(context.get(), m_dataObject->text());
     322        RefPtr<DocumentFragment> fragment = createFragmentFromText(context, m_dataObject->text());
    327323        if (fragment)
    328324            return fragment.release();
  • trunk/Source/WebCore/platform/mac/DragDataMac.mm

    r155700 r157058  
    190190}
    191191
    192 PassRefPtr<DocumentFragment> DragData::asFragment(Frame* frame, PassRefPtr<Range> range, bool allowPlainText, bool& chosePlainText) const
     192PassRefPtr<DocumentFragment> DragData::asFragment(Frame* frame, Range& range, bool allowPlainText, bool& chosePlainText) const
    193193{
    194194    Pasteboard pasteboard(m_pasteboardName);
    195     return frame->editor().webContentFromPasteboard(pasteboard, *range, allowPlainText, chosePlainText);
     195    return frame->editor().webContentFromPasteboard(pasteboard, range, allowPlainText, chosePlainText);
    196196}
    197197   
  • trunk/Source/WebCore/platform/win/DragDataWin.cpp

    r149280 r157058  
    207207}
    208208
    209 PassRefPtr<DocumentFragment> DragData::asFragment(Frame* frame, PassRefPtr<Range>, bool, bool&) const
     209PassRefPtr<DocumentFragment> DragData::asFragment(Frame* frame, Range&, bool, bool&) const
    210210{     
    211211    /*
  • trunk/Source/WebCore/platform/win/PasteboardWin.cpp

    r157003 r157058  
    423423#endif
    424424
    425 void Pasteboard::writeRangeToDataObject(Range* selectedRange, Frame* frame)
    426 {
    427     ASSERT(selectedRange);
     425void Pasteboard::writeRangeToDataObject(Range& selectedRange, Frame& frame)
     426{
    428427    if (!m_writableDataObject)
    429428        return;
     
    433432
    434433    Vector<char> data;
    435     markupToCFHTML(createMarkup(*selectedRange, 0, AnnotateForInterchange),
    436         selectedRange->startContainer()->document().url().string(), data);
     434    markupToCFHTML(createMarkup(selectedRange, 0, AnnotateForInterchange),
     435        selectedRange.startContainer()->document().url().string(), data);
    437436    medium.hGlobal = createGlobalData(data);
    438437    if (medium.hGlobal && FAILED(m_writableDataObject->SetData(htmlFormat(), &medium, TRUE)))
    439438        ::GlobalFree(medium.hGlobal);
    440439
    441     String str = frame->editor().selectedTextForClipboard();
     440    String str = frame.editor().selectedTextForClipboard();
    442441    replaceNewlinesWithWindowsStyleNewlines(str);
    443442    replaceNBSPWithSpace(str);
     
    447446
    448447    medium.hGlobal = 0;
    449     if (frame->editor().canSmartCopyOrDelete())
     448    if (frame.editor().canSmartCopyOrDelete())
    450449        m_writableDataObject->SetData(smartPasteFormat(), &medium, TRUE);
    451450}
    452451
    453 void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete, Frame* frame, ShouldSerializeSelectedTextForClipboard shouldSerializeSelectedTextForClipboard)
     452void Pasteboard::writeSelection(Range& selectedRange, bool canSmartCopyOrDelete, Frame& frame, ShouldSerializeSelectedTextForClipboard shouldSerializeSelectedTextForClipboard)
    454453{
    455454    clear();
     
    458457    if (::OpenClipboard(m_owner)) {
    459458        Vector<char> data;
    460         markupToCFHTML(createMarkup(*selectedRange, 0, AnnotateForInterchange),
    461             selectedRange->startContainer()->document().url().string(), data);
     459        markupToCFHTML(createMarkup(selectedRange, 0, AnnotateForInterchange),
     460            selectedRange.startContainer()->document().url().string(), data);
    462461        HGLOBAL cbData = createGlobalData(data);
    463462        if (!::SetClipboardData(HTMLClipboardFormat, cbData))
     
    467466   
    468467    // Put plain string on the pasteboard. CF_UNICODETEXT covers CF_TEXT as well
    469     String str = shouldSerializeSelectedTextForClipboard == IncludeImageAltTextForClipboard ? frame->editor().selectedTextForClipboard() : frame->editor().selectedText();
     468    String str = shouldSerializeSelectedTextForClipboard == IncludeImageAltTextForClipboard ? frame.editor().selectedTextForClipboard() : frame.editor().selectedText();
    470469    replaceNewlinesWithWindowsStyleNewlines(str);
    471470    replaceNBSPWithSpace(str);
     
    726725}
    727726
    728 void Pasteboard::writeImage(Node* node, const URL&, const String&)
    729 {
    730     ASSERT(node);
    731 
    732     if (!(node->renderer() && node->renderer()->isImage()))
    733         return;
    734 
    735     RenderImage* renderer = toRenderImage(node->renderer());
     727void Pasteboard::writeImage(Element& element, const URL&, const String&)
     728{
     729    if (!(element.renderer() && element.renderer()->isImage()))
     730        return;
     731
     732    RenderImage* renderer = toRenderImage(element.renderer());
    736733    CachedImage* cachedImage = renderer->cachedImage();
    737734    if (!cachedImage || cachedImage->errorOccurred())
     
    799796}
    800797
    801 PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefPtr<Range> context, bool allowPlainText, bool& chosePlainText)
     798PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame& frame, Range& context, bool allowPlainText, bool& chosePlainText)
    802799{
    803800    chosePlainText = false;
     
    812809            ::CloseClipboard();
    813810
    814             PassRefPtr<DocumentFragment> fragment = fragmentFromCFHTML(frame->document(), cfhtml);
     811            RefPtr<DocumentFragment> fragment = fragmentFromCFHTML(frame.document(), cfhtml);
    815812            if (fragment)
    816                 return fragment;
     813                return fragment.release();
    817814        } else
    818815            ::CloseClipboard();
     
    828825                GlobalUnlock(cbData);
    829826                ::CloseClipboard();
    830                 RefPtr<DocumentFragment> fragment = createFragmentFromText(context.get(), str);
     827                RefPtr<DocumentFragment> fragment = createFragmentFromText(context, str);
    831828                if (fragment)
    832829                    return fragment.release();
     
    845842                GlobalUnlock(cbData);
    846843                ::CloseClipboard();
    847                 RefPtr<DocumentFragment> fragment = createFragmentFromText(context.get(), str);
     844                RefPtr<DocumentFragment> fragment = createFragmentFromText(context, str);
    848845                if (fragment)
    849846                    return fragment.release();
     
    862859}
    863860
    864 static CachedImage* getCachedImage(Element* element)
     861static CachedImage* getCachedImage(Element& element)
    865862{
    866863    // Attempt to pull CachedImage from element
    867     ASSERT(element);
    868     RenderObject* renderer = element->renderer();
     864    RenderObject* renderer = element.renderer();
    869865    if (!renderer || !renderer->isImage())
    870866        return 0;
     
    1002998}
    1003999
    1004 void Pasteboard::writeImageToDataObject(Element* element, const URL& url)
     1000void Pasteboard::writeImageToDataObject(Element& element, const URL& url)
    10051001{
    10061002    // Shove image data into a DataObject for use as a file
    10071003    CachedImage* cachedImage = getCachedImage(element);
    1008     if (!cachedImage || !cachedImage->imageForRenderer(element->renderer()) || !cachedImage->isLoaded())
    1009         return;
    1010 
    1011     SharedBuffer* imageBuffer = cachedImage->imageForRenderer(element->renderer())->data();
     1004    if (!cachedImage || !cachedImage->imageForRenderer(element.renderer()) || !cachedImage->isLoaded())
     1005        return;
     1006
     1007    SharedBuffer* imageBuffer = cachedImage->imageForRenderer(element.renderer())->data();
    10121008    if (!imageBuffer || !imageBuffer->size())
    10131009        return;
    10141010
    1015     HGLOBAL imageFileDescriptor = createGlobalImageFileDescriptor(url.string(), element->getAttribute(HTMLNames::altAttr), cachedImage);
     1011    HGLOBAL imageFileDescriptor = createGlobalImageFileDescriptor(url.string(), element.getAttribute(HTMLNames::altAttr), cachedImage);
    10161012    if (!imageFileDescriptor)
    10171013        return;
  • trunk/Source/WebKit/efl/ChangeLog

    r156946 r157058  
     12013-10-07  Sam Weinig  <sam@webkit.org>
     2
     3        CTTE: Use references in and around DragController
     4        https://bugs.webkit.org/show_bug.cgi?id=122427
     5
     6        Reviewed by Andreas Kling.
     7
     8        * WebCoreSupport/DragClientEfl.cpp:
     9        (WebCore::DragClientEfl::willPerformDragDestinationAction):
     10        (WebCore::DragClientEfl::willPerformDragSourceAction):
     11        (WebCore::DragClientEfl::actionMaskForDrag):
     12        (WebCore::DragClientEfl::startDrag):
     13        * WebCoreSupport/DragClientEfl.h:
     14
    1152013-10-04  Anders Carlsson  <andersca@apple.com>
    216
  • trunk/Source/WebKit/efl/WebCoreSupport/DragClientEfl.cpp

    r95901 r157058  
    3636namespace WebCore {
    3737
    38 void DragClientEfl::willPerformDragDestinationAction(DragDestinationAction, DragData*)
     38void DragClientEfl::willPerformDragDestinationAction(DragDestinationAction, DragData&)
    3939{
    4040    notImplemented();
    4141}
    4242
    43 void DragClientEfl::willPerformDragSourceAction(DragSourceAction, const IntPoint&, Clipboard*)
     43void DragClientEfl::willPerformDragSourceAction(DragSourceAction, const IntPoint&, Clipboard&)
    4444{
    4545    notImplemented();
    4646}
    4747
    48 DragDestinationAction DragClientEfl::actionMaskForDrag(DragData*)
     48DragDestinationAction DragClientEfl::actionMaskForDrag(DragData&)
    4949{
    5050    return DragDestinationActionAny;
     
    5656}
    5757
    58 void DragClientEfl::startDrag(DragImageRef, const IntPoint&, const IntPoint&, Clipboard*, Frame*, bool)
     58void DragClientEfl::startDrag(DragImageRef, const IntPoint&, const IntPoint&, Clipboard&, Frame&, bool)
    5959{
    6060    notImplemented();
  • trunk/Source/WebKit/efl/WebCoreSupport/DragClientEfl.h

    r95901 r157058  
    3737
    3838namespace WebCore {
     39
    3940class DragClientEfl : public WebCore::DragClient {
    4041public:
    41     virtual void willPerformDragDestinationAction(WebCore::DragDestinationAction, WebCore::DragData*);
    42     virtual void willPerformDragSourceAction(WebCore::DragSourceAction, const WebCore::IntPoint&, WebCore::Clipboard*);
    43     virtual WebCore::DragDestinationAction actionMaskForDrag(WebCore::DragData*);
     42    virtual void dragControllerDestroyed();
    4443
     44    virtual void willPerformDragDestinationAction(WebCore::DragDestinationAction, WebCore::DragData&);
     45    virtual void willPerformDragSourceAction(WebCore::DragSourceAction, const WebCore::IntPoint&, WebCore::Clipboard&);
     46    virtual WebCore::DragDestinationAction actionMaskForDrag(WebCore::DragData&);
    4547    virtual WebCore::DragSourceAction dragSourceActionMaskForPoint(const WebCore::IntPoint& windowPoint);
     48    virtual void startDrag(WebCore::DragImageRef, const WebCore::IntPoint& dragImageOrigin, const WebCore::IntPoint& eventPos, WebCore::Clipboard&, WebCore::Frame&, bool linkDrag = false);
     49};
    4650
    47     virtual void startDrag(WebCore::DragImageRef, const WebCore::IntPoint& dragImageOrigin, const WebCore::IntPoint& eventPos, WebCore::Clipboard*, WebCore::Frame*, bool linkDrag = false);
    48 
    49     virtual void dragControllerDestroyed();
    50 };
    5151}
    5252
  • trunk/Source/WebKit/gtk/ChangeLog

    r157042 r157058  
     12013-10-07  Sam Weinig  <sam@webkit.org>
     2
     3        CTTE: Use references in and around DragController
     4        https://bugs.webkit.org/show_bug.cgi?id=122427
     5
     6        Reviewed by Andreas Kling.
     7
     8        * WebCoreSupport/DragClientGtk.cpp:
     9        (WebKit::DragClient::willPerformDragDestinationAction):
     10        (WebKit::DragClient::willPerformDragSourceAction):
     11        (WebKit::DragClient::actionMaskForDrag):
     12        (WebKit::DragClient::startDrag):
     13        * WebCoreSupport/DragClientGtk.h:
     14        * webkit/webkitwebview.cpp:
     15        (dragExitedCallback):
     16        (webkit_web_view_drag_motion):
     17        (webkit_web_view_drag_data_received):
     18        (webkit_web_view_drag_drop):
     19
    1202013-10-04  Philippe Normand  <pnormand@igalia.com>
    221
  • trunk/Source/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp

    r156345 r157058  
    5656}
    5757
    58 void DragClient::willPerformDragDestinationAction(DragDestinationAction, DragData*)
     58void DragClient::willPerformDragDestinationAction(DragDestinationAction, DragData&)
    5959{
    6060}
    6161
    62 void DragClient::willPerformDragSourceAction(DragSourceAction, const IntPoint& startPos, Clipboard*)
     62void DragClient::willPerformDragSourceAction(DragSourceAction, const IntPoint& startPos, Clipboard&)
    6363{
    6464    m_startPos = startPos;
    6565}
    6666
    67 DragDestinationAction DragClient::actionMaskForDrag(DragData*)
     67DragDestinationAction DragClient::actionMaskForDrag(DragData&)
    6868{
    6969    notImplemented();
     
    7777}
    7878
    79 void DragClient::startDrag(DragImageRef image, const IntPoint& dragImageOrigin, const IntPoint& eventPos, Clipboard* clipboard, Frame* frame, bool linkDrag)
     79void DragClient::startDrag(DragImageRef image, const IntPoint& dragImageOrigin, const IntPoint& eventPos, Clipboard& clipboard, Frame& frame, bool linkDrag)
    8080{
    81     WebKitWebView* webView = webkit_web_frame_get_web_view(kit(frame));
    82     RefPtr<DataObjectGtk> dataObject = clipboard->pasteboard().dataObject();
     81    WebKitWebView* webView = webkit_web_frame_get_web_view(kit(&frame));
     82    RefPtr<DataObjectGtk> dataObject = clipboard.pasteboard().dataObject();
    8383    GRefPtr<GtkTargetList> targetList = adoptGRef(PasteboardHelper::defaultPasteboardHelper()->targetListForDataObject(dataObject.get()));
    8484    GOwnPtr<GdkEvent> currentEvent(gtk_get_current_event());
    8585
    86     GdkDragContext* context = gtk_drag_begin(GTK_WIDGET(m_webView), targetList.get(), dragOperationToGdkDragActions(clipboard->sourceOperation()), 1, currentEvent.get());
     86    GdkDragContext* context = gtk_drag_begin(GTK_WIDGET(m_webView), targetList.get(), dragOperationToGdkDragActions(clipboard.sourceOperation()), 1, currentEvent.get());
    8787    webView->priv->dragAndDropHelper.startedDrag(context, dataObject.get());
    8888
  • trunk/Source/WebKit/gtk/WebCoreSupport/DragClientGtk.h

    r156345 r157058  
    4141namespace WebKit {
    4242
    43     class DragClient : public WebCore::DragClient {
    44     public:
    45         DragClient(WebKitWebView*);
    46         ~DragClient();
     43class DragClient : public WebCore::DragClient {
     44public:
     45    DragClient(WebKitWebView*);
     46    ~DragClient();
    4747
    48         virtual void willPerformDragDestinationAction(WebCore::DragDestinationAction, WebCore::DragData*);
    49         virtual void willPerformDragSourceAction(WebCore::DragSourceAction, const WebCore::IntPoint&, WebCore::Clipboard*);
    50         virtual WebCore::DragDestinationAction actionMaskForDrag(WebCore::DragData*);
     48    virtual void dragControllerDestroyed();
    5149
    52         virtual WebCore::DragSourceAction dragSourceActionMaskForPoint(const WebCore::IntPoint& windowPoint);
     50    virtual void willPerformDragDestinationAction(WebCore::DragDestinationAction, WebCore::DragData&);
     51    virtual void willPerformDragSourceAction(WebCore::DragSourceAction, const WebCore::IntPoint&, WebCore::Clipboard&);
     52    virtual WebCore::DragDestinationAction actionMaskForDrag(WebCore::DragData&);
     53    virtual WebCore::DragSourceAction dragSourceActionMaskForPoint(const WebCore::IntPoint& windowPoint);
     54    virtual void startDrag(WebCore::DragImageRef, const WebCore::IntPoint& dragImageOrigin, const WebCore::IntPoint& eventPos, WebCore::Clipboard&, WebCore::Frame&, bool linkDrag = false);
    5355
    54         virtual void startDrag(WebCore::DragImageRef dragImage, const WebCore::IntPoint& dragImageOrigin, const WebCore::IntPoint& eventPos, WebCore::Clipboard*, WebCore::Frame*, bool linkDrag = false);
    55 
    56         virtual void dragControllerDestroyed();
    57 
    58     private:
    59         WebKitWebView* m_webView;
    60         WebCore::IntPoint m_startPos;
    61         WebCore::DragIcon m_dragIcon;
    62     };
     56private:
     57    WebKitWebView* m_webView;
     58    WebCore::IntPoint m_startPos;
     59    WebCore::DragIcon m_dragIcon;
     60};
    6361}
    6462
  • trunk/Source/WebKit/gtk/webkit/webkitwebview.cpp

    r156550 r157058  
    15301530}
    15311531
    1532 static void dragExitedCallback(GtkWidget* widget, DragData* dragData, bool dropHappened)
     1532static void dragExitedCallback(GtkWidget* widget, DragData& dragData, bool dropHappened)
    15331533{
    15341534    // Don't call dragExited if we have just received a drag-drop signal. This
     
    15531553
    15541554    DragData dragData(dataObject, position, convertWidgetPointToScreenPoint(widget, position), gdkDragActionToDragOperation(gdk_drag_context_get_actions(context)));
    1555     DragOperation operation = core(webView)->dragController().dragUpdated(&dragData).operation;
     1555    DragOperation operation = core(webView)->dragController().dragUpdated(dragData).operation;
    15561556    gdk_drag_status(context, dragOperationToSingleGdkDragAction(operation), time);
    15571557    return TRUE;
     
    15671567
    15681568    DragData dragData(dataObject, position, convertWidgetPointToScreenPoint(widget, position), gdkDragActionToDragOperation(gdk_drag_context_get_actions(context)));
    1569     DragOperation operation = core(webView)->dragController().dragEntered(&dragData).operation;
     1569    DragOperation operation = core(webView)->dragController().dragEntered(dragData).operation;
    15701570    gdk_drag_status(context, dragOperationToSingleGdkDragAction(operation), time);
    15711571}
     
    15801580    IntPoint position(x, y);
    15811581    DragData dragData(dataObject, position, convertWidgetPointToScreenPoint(widget, position), gdkDragActionToDragOperation(gdk_drag_context_get_actions(context)));
    1582     core(webView)->dragController().performDrag(&dragData);
     1582    core(webView)->dragController().performDrag(dragData);
    15831583    gtk_drag_finish(context, TRUE, FALSE, time);
    15841584    return TRUE;
  • trunk/Source/WebKit/mac/ChangeLog

    r157002 r157058  
     12013-10-07  Sam Weinig  <sam@webkit.org>
     2
     3        CTTE: Use references in and around DragController
     4        https://bugs.webkit.org/show_bug.cgi?id=122427
     5
     6        Reviewed by Andreas Kling.
     7
     8        * WebCoreSupport/WebDragClient.h:
     9        * WebCoreSupport/WebDragClient.mm:
     10        (WebDragClient::actionMaskForDrag):
     11        (WebDragClient::willPerformDragDestinationAction):
     12        (WebDragClient::willPerformDragSourceAction):
     13        (WebDragClient::startDrag):
     14        (WebDragClient::declareAndWriteDragImage):
     15        * WebView/WebFrame.mm:
     16        (-[WebFrame _replaceSelectionWithText:selectReplacement:smartReplace:]):
     17        * WebView/WebHTMLView.mm:
     18        (-[WebHTMLView _documentFragmentFromPasteboard:forType:inContext:subresources:]):
     19        * WebView/WebView.mm:
     20        (-[WebView draggingEntered:]):
     21        (-[WebView draggingUpdated:]):
     22        (-[WebView draggingExited:]):
     23        (-[WebView performDragOperation:]):
     24
    1252013-10-05  Sam Weinig  <sam@webkit.org>
    226
  • trunk/Source/WebKit/mac/WebCoreSupport/WebDragClient.h

    r117695 r157058  
    3333public:
    3434    WebDragClient(WebView*);
    35     virtual void willPerformDragDestinationAction(WebCore::DragDestinationAction, WebCore::DragData*) OVERRIDE;
    36     virtual void willPerformDragSourceAction(WebCore::DragSourceAction, const WebCore::IntPoint&, WebCore::Clipboard*) OVERRIDE;
    37     virtual WebCore::DragDestinationAction actionMaskForDrag(WebCore::DragData*) OVERRIDE;
     35    virtual void willPerformDragDestinationAction(WebCore::DragDestinationAction, WebCore::DragData&) OVERRIDE;
     36    virtual void willPerformDragSourceAction(WebCore::DragSourceAction, const WebCore::IntPoint&, WebCore::Clipboard&) OVERRIDE;
     37    virtual WebCore::DragDestinationAction actionMaskForDrag(WebCore::DragData&) OVERRIDE;
    3838    virtual void dragControllerDestroyed() OVERRIDE;
    3939    virtual WebCore::DragSourceAction dragSourceActionMaskForPoint(const WebCore::IntPoint& windowPoint) OVERRIDE;
    40     virtual void startDrag(WebCore::DragImageRef, const WebCore::IntPoint& dragPos, const WebCore::IntPoint& eventPos, WebCore::Clipboard*, WebCore::Frame*, bool linkDrag) OVERRIDE;
    41     virtual void declareAndWriteDragImage(const String& pasteboardName, DOMElement*, NSURL*, NSString*, WebCore::Frame*) OVERRIDE;
     40    virtual void startDrag(WebCore::DragImageRef, const WebCore::IntPoint& dragPos, const WebCore::IntPoint& eventPos, WebCore::Clipboard&, WebCore::Frame&, bool linkDrag) OVERRIDE;
     41    virtual void declareAndWriteDragImage(const String& pasteboardName, WebCore::Element&, const WebCore::URL&, const String&, WebCore::Frame*) OVERRIDE;
    4242private:
    4343    WebView* m_webView;
  • trunk/Source/WebKit/mac/WebCoreSupport/WebDragClient.mm

    r156860 r157058  
    2828#if ENABLE(DRAG_SUPPORT)
    2929
     30#import "DOMElementInternal.h"
    3031#import "WebArchive.h"
    3132#import "WebDOMOperations.h"
     
    6768}
    6869
    69 WebCore::DragDestinationAction WebDragClient::actionMaskForDrag(WebCore::DragData* dragData)
     70WebCore::DragDestinationAction WebDragClient::actionMaskForDrag(WebCore::DragData& dragData)
    7071{
    71     return (WebCore::DragDestinationAction)[[m_webView _UIDelegateForwarder] webView:m_webView dragDestinationActionMaskForDraggingInfo:dragData->platformData()];
     72    return (WebCore::DragDestinationAction)[[m_webView _UIDelegateForwarder] webView:m_webView dragDestinationActionMaskForDraggingInfo:dragData.platformData()];
    7273}
    7374
    74 void WebDragClient::willPerformDragDestinationAction(WebCore::DragDestinationAction action, WebCore::DragData* dragData)
     75void WebDragClient::willPerformDragDestinationAction(WebCore::DragDestinationAction action, WebCore::DragData& dragData)
    7576{
    76     [[m_webView _UIDelegateForwarder] webView:m_webView willPerformDragDestinationAction:(WebDragDestinationAction)action forDraggingInfo:dragData->platformData()];
     77    [[m_webView _UIDelegateForwarder] webView:m_webView willPerformDragDestinationAction:(WebDragDestinationAction)action forDraggingInfo:dragData.platformData()];
    7778}
    7879
     
    8485}
    8586
    86 void WebDragClient::willPerformDragSourceAction(WebCore::DragSourceAction action, const WebCore::IntPoint& mouseDownPoint, WebCore::Clipboard* clipboard)
     87void WebDragClient::willPerformDragSourceAction(WebCore::DragSourceAction action, const WebCore::IntPoint& mouseDownPoint, WebCore::Clipboard& clipboard)
    8788{
    88     ASSERT(clipboard);
    89     [[m_webView _UIDelegateForwarder] webView:m_webView willPerformDragSourceAction:(WebDragSourceAction)action fromPoint:mouseDownPoint withPasteboard:[NSPasteboard pasteboardWithName:clipboard->pasteboard().name()]];
     89    [[m_webView _UIDelegateForwarder] webView:m_webView willPerformDragSourceAction:(WebDragSourceAction)action fromPoint:mouseDownPoint withPasteboard:[NSPasteboard pasteboardWithName:clipboard.pasteboard().name()]];
    9090}
    9191
    92 void WebDragClient::startDrag(DragImageRef dragImage, const IntPoint& at, const IntPoint& eventPos, Clipboard* clipboard, Frame* frame, bool linkDrag)
     92void WebDragClient::startDrag(DragImageRef dragImage, const IntPoint& at, const IntPoint& eventPos, Clipboard& clipboard, Frame& frame, bool linkDrag)
    9393{
    94     if (!frame)
    95         return;
    96     ASSERT(clipboard);
    97     RetainPtr<WebHTMLView> htmlView = (WebHTMLView*)[[kit(frame) frameView] documentView];
     94    RetainPtr<WebHTMLView> htmlView = (WebHTMLView*)[[kit(&frame) frameView] documentView];
    9895    if (![htmlView.get() isKindOfClass:[WebHTMLView class]])
    9996        return;
    10097   
    101     NSEvent *event = linkDrag ? frame->eventHandler().currentNSEvent() : [htmlView.get() _mouseDownEvent];
    102     WebHTMLView* topHTMLView = getTopHTMLView(frame);
     98    NSEvent *event = linkDrag ? frame.eventHandler().currentNSEvent() : [htmlView.get() _mouseDownEvent];
     99    WebHTMLView* topHTMLView = getTopHTMLView(&frame);
    103100    RetainPtr<WebHTMLView> topViewProtector = topHTMLView;
    104101   
    105102    [topHTMLView _stopAutoscrollTimer];
    106     NSPasteboard *pasteboard = [NSPasteboard pasteboardWithName:clipboard->pasteboard().name()];
     103    NSPasteboard *pasteboard = [NSPasteboard pasteboardWithName:clipboard.pasteboard().name()];
    107104
    108105    NSImage *dragNSImage = dragImage.get();
     
    124121}
    125122
    126 void WebDragClient::declareAndWriteDragImage(const String& pasteboardName, DOMElement* element, NSURL* URL, NSString* title, WebCore::Frame* frame)
     123void WebDragClient::declareAndWriteDragImage(const String& pasteboardName, Element& element, const URL& url, const String& title, WebCore::Frame* frame)
    127124{
    128125    ASSERT(pasteboardName);
    129     ASSERT(element);
    130     WebHTMLView *source = getTopHTMLView(frame);     
    131     WebArchive *archive = [element webArchive];
     126    WebHTMLView *source = getTopHTMLView(frame);
     127    WebArchive *archive = [kit(&element) webArchive];
    132128   
    133     [[NSPasteboard pasteboardWithName:pasteboardName] _web_declareAndWriteDragImageForElement:element URL:URL title:title archive:archive source:source];
     129    [[NSPasteboard pasteboardWithName:pasteboardName] _web_declareAndWriteDragImageForElement:kit(&element) URL:url title:title archive:archive source:source];
    134130}
    135131
  • trunk/Source/WebKit/mac/WebView/WebFrame.mm

    r157002 r157058  
    999999
    10001000- (void)_replaceSelectionWithText:(NSString *)text selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace
    1001 {   
    1002     DOMDocumentFragment* fragment = kit(createFragmentFromText(_private->coreFrame->selection().toNormalizedRange().get(), text).get());
     1001{
     1002    RefPtr<Range> range = _private->coreFrame->selection().toNormalizedRange();
     1003   
     1004    DOMDocumentFragment* fragment = range ? kit(createFragmentFromText(*range, text).get()) : nil;
    10031005    [self _replaceSelectionWithFragment:fragment selectReplacement:selectReplacement smartReplace:smartReplace matchStyle:YES];
    10041006}
  • trunk/Source/WebKit/mac/WebView/WebHTMLView.mm

    r157018 r157058  
    20662066        return fragment;
    20672067    }
    2068     if (pboardType == NSStringPboardType)
    2069         return kit(createFragmentFromText(core(context), [[pasteboard stringForType:NSStringPboardType] precomposedStringWithCanonicalMapping]).get());
     2068    if (pboardType == NSStringPboardType) {
     2069        if (!context)
     2070            return nil;
     2071        return kit(createFragmentFromText(*core(context), [[pasteboard stringForType:NSStringPboardType] precomposedStringWithCanonicalMapping]).get());
     2072    }
    20702073    return nil;
    20712074}
  • trunk/Source/WebKit/mac/WebView/WebView.mm

    r156949 r157058  
    43334333    IntPoint global(globalPoint([draggingInfo draggingLocation], [self window]));
    43344334    DragData dragData(draggingInfo, client, global, static_cast<DragOperation>([draggingInfo draggingSourceOperationMask]), [self applicationFlags:draggingInfo]);
    4335     return core(self)->dragController().dragEntered(&dragData).operation;
     4335    return core(self)->dragController().dragEntered(dragData).operation;
    43364336}
    43374337
     
    43454345    IntPoint global(globalPoint([draggingInfo draggingLocation], [self window]));
    43464346    DragData dragData(draggingInfo, client, global, static_cast<DragOperation>([draggingInfo draggingSourceOperationMask]), [self applicationFlags:draggingInfo]);
    4347     return page->dragController().dragUpdated(&dragData).operation;
     4347    return page->dragController().dragUpdated(dragData).operation;
    43484348}
    43494349
     
    43574357    IntPoint global(globalPoint([draggingInfo draggingLocation], [self window]));
    43584358    DragData dragData(draggingInfo, client, global, static_cast<DragOperation>([draggingInfo draggingSourceOperationMask]), [self applicationFlags:draggingInfo]);
    4359     page->dragController().dragExited(&dragData);
     4359    page->dragController().dragExited(dragData);
    43604360}
    43614361
     
    43704370    IntPoint global(globalPoint([draggingInfo draggingLocation], [self window]));
    43714371    DragData dragData(draggingInfo, client, global, static_cast<DragOperation>([draggingInfo draggingSourceOperationMask]), [self applicationFlags:draggingInfo]);
    4372     return core(self)->dragController().performDrag(&dragData);
     4372    return core(self)->dragController().performDrag(dragData);
    43734373}
    43744374
  • trunk/Source/WebKit/win/ChangeLog

    r156946 r157058  
     12013-10-07  Sam Weinig  <sam@webkit.org>
     2
     3        CTTE: Use references in and around DragController
     4        https://bugs.webkit.org/show_bug.cgi?id=122427
     5
     6        Reviewed by Andreas Kling.
     7
     8        * WebCoreSupport/WebDragClient.cpp:
     9        (WebDragClient::actionMaskForDrag):
     10        (WebDragClient::willPerformDragDestinationAction):
     11        (WebDragClient::willPerformDragSourceAction):
     12        (WebDragClient::startDrag):
     13        * WebCoreSupport/WebDragClient.h:
     14
    1152013-10-04  Anders Carlsson  <andersca@apple.com>
    216
  • trunk/Source/WebKit/win/WebCoreSupport/WebDragClient.cpp

    r156543 r157058  
    6666}
    6767
    68 DragDestinationAction WebDragClient::actionMaskForDrag(DragData* dragData)
     68DragDestinationAction WebDragClient::actionMaskForDrag(DragData& dragData)
    6969{
    7070    COMPtr<IWebUIDelegate> delegateRef = 0;
     
    7373    WebDragDestinationAction mask = WebDragDestinationActionAny;
    7474    if (SUCCEEDED(m_webView->uiDelegate(&delegateRef)))
    75         delegateRef->dragDestinationActionMaskForDraggingInfo(m_webView, dragData->platformData(), &mask);
     75        delegateRef->dragDestinationActionMaskForDraggingInfo(m_webView, dragData.platformData(), &mask);
    7676
    7777    return (DragDestinationAction)mask;
    7878}
    7979
    80 void WebDragClient::willPerformDragDestinationAction(DragDestinationAction action, DragData* dragData)
     80void WebDragClient::willPerformDragDestinationAction(DragDestinationAction action, DragData& dragData)
    8181{
    8282    //Default delegate for willPerformDragDestinationAction has no side effects
     
    8484    COMPtr<IWebUIDelegate> delegateRef = 0;
    8585    if (SUCCEEDED(m_webView->uiDelegate(&delegateRef)))
    86         delegateRef->willPerformDragDestinationAction(m_webView, (WebDragDestinationAction)action, dragData->platformData());
     86        delegateRef->willPerformDragDestinationAction(m_webView, (WebDragDestinationAction)action, dragData.platformData());
    8787}
    8888
     
    9797}
    9898
    99 void WebDragClient::willPerformDragSourceAction(DragSourceAction action, const IntPoint& intPoint, Clipboard* clipboard)
     99void WebDragClient::willPerformDragSourceAction(DragSourceAction action, const IntPoint& intPoint, Clipboard& clipboard)
    100100{
    101101    COMPtr<IWebUIDelegate> uiDelegate;
     
    104104
    105105    POINT point = intPoint;
    106     COMPtr<IDataObject> dataObject = clipboard->pasteboard().dataObject();
     106    COMPtr<IDataObject> dataObject = clipboard.pasteboard().dataObject();
    107107
    108108    COMPtr<IDataObject> newDataObject;
    109109    HRESULT result = uiDelegate->willPerformDragSourceAction(m_webView, static_cast<WebDragSourceAction>(action), &point, dataObject.get(), &newDataObject);
    110110    if (result == S_OK && newDataObject != dataObject)
    111         const_cast<Pasteboard&>(clipboard->pasteboard()).setExternalDataObject(newDataObject.get());
     111        const_cast<Pasteboard&>(clipboard.pasteboard()).setExternalDataObject(newDataObject.get());
    112112}
    113113
    114 void WebDragClient::startDrag(DragImageRef image, const IntPoint& imageOrigin, const IntPoint& dragPoint, Clipboard* clipboard, Frame* frame, bool isLink)
     114void WebDragClient::startDrag(DragImageRef image, const IntPoint& imageOrigin, const IntPoint& dragPoint, Clipboard& clipboard, Frame& frame, bool isLink)
    115115{
    116116    //FIXME: Allow UIDelegate to override behaviour <rdar://problem/5015953>
    117117
    118118    //We liberally protect everything, to protect against a load occurring mid-drag
    119     RefPtr<Frame> frameProtector = frame;
     119    RefPtr<Frame> frameProtector = &frame;
    120120    COMPtr<IDragSourceHelper> helper;
    121121    COMPtr<IDataObject> dataObject;
     
    125125        return;
    126126
    127     dataObject = clipboard->pasteboard().dataObject();
     127    dataObject = clipboard.pasteboard().dataObject();
    128128    if (source && (image || dataObject)) {
    129129        if (image) {
     
    167167                operation = DragOperationMove;
    168168        }
    169         frame->eventHandler().dragSourceEndedAt(generateMouseEvent(m_webView, false), operation);
     169        frame.eventHandler().dragSourceEndedAt(generateMouseEvent(m_webView, false), operation);
    170170    }
    171171}
  • trunk/Source/WebKit/win/WebCoreSupport/WebDragClient.h

    r77870 r157058  
    3434public:
    3535    WebDragClient(WebView*);
    36     virtual WebCore::DragDestinationAction actionMaskForDrag(WebCore::DragData*);
    37     virtual void willPerformDragDestinationAction(WebCore::DragDestinationAction, WebCore::DragData*);
    3836    virtual void dragControllerDestroyed();
     37
     38    virtual WebCore::DragDestinationAction actionMaskForDrag(WebCore::DragData&);
    3939    virtual WebCore::DragSourceAction dragSourceActionMaskForPoint(const WebCore::IntPoint&);
    40     virtual void willPerformDragSourceAction(WebCore::DragSourceAction, const WebCore::IntPoint&, WebCore::Clipboard*);
    41     virtual void startDrag(WebCore::DragImageRef, const WebCore::IntPoint&, const WebCore::IntPoint&, WebCore::Clipboard*, WebCore::Frame*, bool);
     40    virtual void willPerformDragDestinationAction(WebCore::DragDestinationAction, WebCore::DragData&);
     41    virtual void willPerformDragSourceAction(WebCore::DragSourceAction, const WebCore::IntPoint&, WebCore::Clipboard&);
     42    virtual void startDrag(WebCore::DragImageRef, const WebCore::IntPoint&, const WebCore::IntPoint&, WebCore::Clipboard&, WebCore::Frame&, bool);
     43
    4244private:
    4345    WebView* m_webView;
  • trunk/Source/WebKit/win/WebView.cpp

    r156550 r157058  
    52565256    DragData data(pDataObject, IntPoint(localpt.x, localpt.y),
    52575257        IntPoint(pt.x, pt.y), keyStateToDragOperation(grfKeyState));
    5258     *pdwEffect = dragOperationToDragCursor(m_page->dragController().dragEntered(&data).operation);
     5258    *pdwEffect = dragOperationToDragCursor(m_page->dragController().dragEntered(data).operation);
    52595259
    52605260    m_lastDropEffect = *pdwEffect;
     
    52755275        DragData data(m_dragData.get(), IntPoint(localpt.x, localpt.y),
    52765276            IntPoint(pt.x, pt.y), keyStateToDragOperation(grfKeyState));
    5277         *pdwEffect = dragOperationToDragCursor(m_page->dragController().dragUpdated(&data).operation);
     5277        *pdwEffect = dragOperationToDragCursor(m_page->dragController().dragUpdated(data).operation);
    52785278    } else
    52795279        *pdwEffect = DROPEFFECT_NONE;
     
    52915291        DragData data(m_dragData.get(), IntPoint(), IntPoint(),
    52925292            DragOperationNone);
    5293         m_page->dragController().dragExited(&data);
     5293        m_page->dragController().dragExited(data);
    52945294        m_dragData = 0;
    52955295    }
     
    53095309    DragData data(pDataObject, IntPoint(localpt.x, localpt.y),
    53105310        IntPoint(pt.x, pt.y), keyStateToDragOperation(grfKeyState));
    5311     m_page->dragController().performDrag(&data);
     5311    m_page->dragController().performDrag(data);
    53125312    return S_OK;
    53135313}
  • trunk/Source/WebKit2/ChangeLog

    r157056 r157058  
     12013-10-07  Sam Weinig  <sam@webkit.org>
     2
     3        CTTE: Use references in and around DragController
     4        https://bugs.webkit.org/show_bug.cgi?id=122427
     5
     6        Reviewed by Andreas Kling.
     7
     8        * UIProcess/API/gtk/WebKitWebViewBase.cpp:
     9        (webkitWebViewBaseDragDataReceived):
     10        (webkitWebViewBaseDragMotion):
     11        (dragExitedCallback):
     12        (webkitWebViewBaseDragDrop):
     13        * UIProcess/API/mac/WKView.mm:
     14        (-[WKView draggingEntered:]):
     15        (-[WKView draggingUpdated:]):
     16        (-[WKView draggingExited:]):
     17        (-[WKView performDragOperation:]):
     18        * UIProcess/WebPageProxy.cpp:
     19        (WebKit::WebPageProxy::dragEntered):
     20        (WebKit::WebPageProxy::dragUpdated):
     21        (WebKit::WebPageProxy::dragExited):
     22        (WebKit::WebPageProxy::performDrag):
     23        (WebKit::WebPageProxy::performDragControllerAction):
     24        * UIProcess/WebPageProxy.h:
     25        * WebProcess/WebCoreSupport/WebDragClient.cpp:
     26        (WebKit::WebDragClient::willPerformDragDestinationAction):
     27        (WebKit::WebDragClient::willPerformDragSourceAction):
     28        (WebKit::WebDragClient::actionMaskForDrag):
     29        (WebKit::WebDragClient::dragSourceActionMaskForPoint):
     30        (WebKit::WebDragClient::startDrag):
     31        * WebProcess/WebCoreSupport/WebDragClient.h:
     32        * WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp:
     33        (WebKit::WebDragClient::startDrag):
     34        * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
     35        (WebKit::WebDragClient::startDrag):
     36        (WebKit::cachedImage):
     37        (WebKit::WebDragClient::declareAndWriteDragImage):
     38        * WebProcess/WebPage/WebPage.cpp:
     39        (WebKit::WebPage::performDragControllerAction):
     40
    1412013-10-07  Tim Horton  <timothy_horton@apple.com>
    242
  • trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp

    r156345 r157058  
    724724    DragData dragData(dataObject, position, convertWidgetPointToScreenPoint(widget, position), gdkDragActionToDragOperation(gdk_drag_context_get_actions(context)));
    725725    webViewBase->priv->pageProxy->resetDragOperation();
    726     webViewBase->priv->pageProxy->dragEntered(&dragData);
     726    webViewBase->priv->pageProxy->dragEntered(dragData);
    727727    DragOperation operation = webViewBase->priv->pageProxy->dragSession().operation;
    728728    gdk_drag_status(context, dragOperationToSingleGdkDragAction(operation), time);
     
    768768
    769769    DragData dragData(dataObject, position, convertWidgetPointToScreenPoint(widget, position), gdkDragActionToDragOperation(gdk_drag_context_get_actions(context)));
    770     webViewBase->priv->pageProxy->dragUpdated(&dragData);
     770    webViewBase->priv->pageProxy->dragUpdated(dragData);
    771771    DragOperation operation = webViewBase->priv->pageProxy->dragSession().operation;
    772772    gdk_drag_status(context, dragOperationToSingleGdkDragAction(operation), time);
     
    774774}
    775775
    776 static void dragExitedCallback(GtkWidget* widget, DragData* dragData, bool dropHappened)
     776static void dragExitedCallback(GtkWidget* widget, DragData& dragData, bool dropHappened)
    777777{
    778778    // Don't call dragExited if we have just received a drag-drop signal. This
     
    802802    SandboxExtension::Handle handle;
    803803    SandboxExtension::HandleArray sandboxExtensionForUpload;
    804     webViewBase->priv->pageProxy->performDrag(&dragData, String(), handle, sandboxExtensionForUpload);
     804    webViewBase->priv->pageProxy->performDrag(dragData, String(), handle, sandboxExtensionForUpload);
    805805    gtk_drag_finish(context, TRUE, FALSE, time);
    806806    return TRUE;
  • trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm

    r156968 r157058  
    17741774
    17751775    _data->_page->resetDragOperation();
    1776     _data->_page->dragEntered(&dragData, [[draggingInfo draggingPasteboard] name]);
     1776    _data->_page->dragEntered(dragData, [[draggingInfo draggingPasteboard] name]);
    17771777    return NSDragOperationCopy;
    17781778}
     
    17831783    IntPoint global(globalPoint([draggingInfo draggingLocation], [self window]));
    17841784    DragData dragData(draggingInfo, client, global, static_cast<DragOperation>([draggingInfo draggingSourceOperationMask]), [self applicationFlags:draggingInfo]);
    1785     _data->_page->dragUpdated(&dragData, [[draggingInfo draggingPasteboard] name]);
     1785    _data->_page->dragUpdated(dragData, [[draggingInfo draggingPasteboard] name]);
    17861786   
    17871787    WebCore::DragSession dragSession = _data->_page->dragSession();
     
    18041804    IntPoint global(globalPoint([draggingInfo draggingLocation], [self window]));
    18051805    DragData dragData(draggingInfo, client, global, static_cast<DragOperation>([draggingInfo draggingSourceOperationMask]), [self applicationFlags:draggingInfo]);
    1806     _data->_page->dragExited(&dragData, [[draggingInfo draggingPasteboard] name]);
     1806    _data->_page->dragExited(dragData, [[draggingInfo draggingPasteboard] name]);
    18071807    _data->_page->resetDragOperation();
    18081808}
     
    18681868    createSandboxExtensionsForFileUpload([draggingInfo draggingPasteboard], sandboxExtensionForUpload);
    18691869
    1870     _data->_page->performDrag(&dragData, [[draggingInfo draggingPasteboard] name], sandboxExtensionHandle, sandboxExtensionForUpload);
     1870    _data->_page->performDrag(dragData, [[draggingInfo draggingPasteboard] name], sandboxExtensionHandle, sandboxExtensionForUpload);
    18711871
    18721872    return YES;
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r156924 r157058  
    11951195
    11961196#if ENABLE(DRAG_SUPPORT)
    1197 void WebPageProxy::dragEntered(DragData* dragData, const String& dragStorageName)
     1197void WebPageProxy::dragEntered(DragData& dragData, const String& dragStorageName)
    11981198{
    11991199    SandboxExtension::Handle sandboxExtensionHandle;
     
    12021202}
    12031203
    1204 void WebPageProxy::dragUpdated(DragData* dragData, const String& dragStorageName)
     1204void WebPageProxy::dragUpdated(DragData& dragData, const String& dragStorageName)
    12051205{
    12061206    SandboxExtension::Handle sandboxExtensionHandle;
     
    12091209}
    12101210
    1211 void WebPageProxy::dragExited(DragData* dragData, const String& dragStorageName)
     1211void WebPageProxy::dragExited(DragData& dragData, const String& dragStorageName)
    12121212{
    12131213    SandboxExtension::Handle sandboxExtensionHandle;
     
    12161216}
    12171217
    1218 void WebPageProxy::performDrag(DragData* dragData, const String& dragStorageName, const SandboxExtension::Handle& sandboxExtensionHandle, const SandboxExtension::HandleArray& sandboxExtensionsForUpload)
     1218void WebPageProxy::performDrag(DragData& dragData, const String& dragStorageName, const SandboxExtension::Handle& sandboxExtensionHandle, const SandboxExtension::HandleArray& sandboxExtensionsForUpload)
    12191219{
    12201220    performDragControllerAction(DragControllerActionPerformDrag, dragData, dragStorageName, sandboxExtensionHandle, sandboxExtensionsForUpload);
    12211221}
    12221222
    1223 void WebPageProxy::performDragControllerAction(DragControllerAction action, DragData* dragData, const String& dragStorageName, const SandboxExtension::Handle& sandboxExtensionHandle, const SandboxExtension::HandleArray& sandboxExtensionsForUpload)
     1223void WebPageProxy::performDragControllerAction(DragControllerAction action, DragData& dragData, const String& dragStorageName, const SandboxExtension::Handle& sandboxExtensionHandle, const SandboxExtension::HandleArray& sandboxExtensionsForUpload)
    12241224{
    12251225    if (!isValid())
    12261226        return;
    12271227#if PLATFORM(GTK)
    1228     m_process->send(Messages::WebPage::PerformDragControllerAction(action, *dragData), m_pageID);
     1228    m_process->send(Messages::WebPage::PerformDragControllerAction(action, dragData), m_pageID);
    12291229#else
    1230     m_process->send(Messages::WebPage::PerformDragControllerAction(action, dragData->clientPosition(), dragData->globalPosition(), dragData->draggingSourceOperationMask(), dragStorageName, dragData->flags(), sandboxExtensionHandle, sandboxExtensionsForUpload), m_pageID);
     1230    m_process->send(Messages::WebPage::PerformDragControllerAction(action, dragData.clientPosition(), dragData.globalPosition(), dragData.draggingSourceOperationMask(), dragStorageName, dragData.flags(), sandboxExtensionHandle, sandboxExtensionsForUpload), m_pageID);
    12311231#endif
    12321232}
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.h

    r156924 r157058  
    575575#if ENABLE(DRAG_SUPPORT)   
    576576    // Drag and drop support.
    577     void dragEntered(WebCore::DragData*, const String& dragStorageName = String());
    578     void dragUpdated(WebCore::DragData*, const String& dragStorageName = String());
    579     void dragExited(WebCore::DragData*, const String& dragStorageName = String());
    580     void performDrag(WebCore::DragData*, const String& dragStorageName, const SandboxExtension::Handle&, const SandboxExtension::HandleArray&);
     577    void dragEntered(WebCore::DragData&, const String& dragStorageName = String());
     578    void dragUpdated(WebCore::DragData&, const String& dragStorageName = String());
     579    void dragExited(WebCore::DragData&, const String& dragStorageName = String());
     580    void performDrag(WebCore::DragData&, const String& dragStorageName, const SandboxExtension::Handle&, const SandboxExtension::HandleArray&);
    581581
    582582    void didPerformDragControllerAction(WebCore::DragSession);
     
    10161016    void clearLoadDependentCallbacks();
    10171017
    1018     void performDragControllerAction(DragControllerAction, WebCore::DragData*, const String& dragStorageName, const SandboxExtension::Handle&, const SandboxExtension::HandleArray&);
     1018    void performDragControllerAction(DragControllerAction, WebCore::DragData&, const String& dragStorageName, const SandboxExtension::Handle&, const SandboxExtension::HandleArray&);
    10191019
    10201020    void updateBackingStoreDiscardableState();
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.cpp

    r156847 r157058  
    3535namespace WebKit {
    3636
    37 void WebDragClient::willPerformDragDestinationAction(DragDestinationAction action, DragData*)
     37void WebDragClient::willPerformDragDestinationAction(DragDestinationAction action, DragData&)
    3838{
    3939    if (action == DragDestinationActionLoad)
     
    4343}
    4444
    45 void WebDragClient::willPerformDragSourceAction(DragSourceAction, const IntPoint&, Clipboard*)
     45void WebDragClient::willPerformDragSourceAction(DragSourceAction, const IntPoint&, Clipboard&)
    4646{
    4747}
    4848
    49 DragDestinationAction WebDragClient::actionMaskForDrag(DragData*)
     49DragDestinationAction WebDragClient::actionMaskForDrag(DragData&)
    5050{
    5151    return DragDestinationActionAny;
    5252}
    5353
    54 DragSourceAction WebDragClient::dragSourceActionMaskForPoint(const IntPoint& /*windowPoint*/)
     54DragSourceAction WebDragClient::dragSourceActionMaskForPoint(const IntPoint&)
    5555{
    5656    return DragSourceActionAny;
     
    5858
    5959#if !PLATFORM(MAC) && !PLATFORM(GTK)
    60 void WebDragClient::startDrag(DragImageRef, const IntPoint&, const IntPoint&, Clipboard*, Frame*, bool)
     60void WebDragClient::startDrag(DragImageRef, const IntPoint&, const IntPoint&, Clipboard&, Frame&, bool)
    6161{
    6262}
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h

    r117695 r157058  
    4343
    4444private:
    45     virtual void willPerformDragDestinationAction(WebCore::DragDestinationAction, WebCore::DragData*) OVERRIDE;
    46     virtual void willPerformDragSourceAction(WebCore::DragSourceAction, const WebCore::IntPoint&, WebCore::Clipboard*) OVERRIDE;
    47     virtual WebCore::DragDestinationAction actionMaskForDrag(WebCore::DragData*) OVERRIDE;
     45    virtual void willPerformDragDestinationAction(WebCore::DragDestinationAction, WebCore::DragData&) OVERRIDE;
     46    virtual void willPerformDragSourceAction(WebCore::DragSourceAction, const WebCore::IntPoint&, WebCore::Clipboard&) OVERRIDE;
     47    virtual WebCore::DragDestinationAction actionMaskForDrag(WebCore::DragData&) OVERRIDE;
    4848    virtual WebCore::DragSourceAction dragSourceActionMaskForPoint(const WebCore::IntPoint& windowPoint) OVERRIDE;
    4949
    50     virtual void startDrag(WebCore::DragImageRef, const WebCore::IntPoint& dragImageOrigin, const WebCore::IntPoint& eventPos, WebCore::Clipboard*, WebCore::Frame*, bool linkDrag = false) OVERRIDE;
     50    virtual void startDrag(WebCore::DragImageRef, const WebCore::IntPoint& dragImageOrigin, const WebCore::IntPoint& eventPos, WebCore::Clipboard&, WebCore::Frame&, bool linkDrag = false) OVERRIDE;
    5151
    5252#if PLATFORM(MAC)
    53     virtual void declareAndWriteDragImage(const String& pasteboardName, DOMElement*, NSURL*, NSString*, WebCore::Frame*) OVERRIDE;
     53    virtual void declareAndWriteDragImage(const String& pasteboardName, WebCore::Element&, const WebCore::URL&, const String&, WebCore::Frame*) OVERRIDE;
    5454#endif
    5555
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp

    r156700 r157058  
    5757}
    5858
    59 void WebDragClient::startDrag(DragImageRef dragImage, const IntPoint& clientPosition, const IntPoint& globalPosition, Clipboard* clipboard, Frame*, bool)
     59void WebDragClient::startDrag(DragImageRef dragImage, const IntPoint& clientPosition, const IntPoint& globalPosition, Clipboard& clipboard, Frame&, bool)
    6060{
    6161    RefPtr<ShareableBitmap> bitmap = convertCairoSurfaceToShareableBitmap(dragImage);
     
    6666        return;
    6767
    68     RefPtr<DataObjectGtk> dataObject = clipboard->pasteboard().dataObject();
    69     DragData dragData(dataObject.get(), clientPosition, globalPosition, clipboard->sourceOperation());
     68    RefPtr<DataObjectGtk> dataObject = clipboard.pasteboard().dataObject();
     69    DragData dragData(dataObject.get(), clientPosition, globalPosition, clipboard.sourceOperation());
    7070    m_page->send(Messages::WebPageProxy::StartDrag(dragData, handle));
    7171}
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm

    r156688 r157058  
    7777}
    7878
    79 void WebDragClient::startDrag(RetainPtr<NSImage> image, const IntPoint& point, const IntPoint&, Clipboard*, Frame* frame, bool linkDrag)
     79void WebDragClient::startDrag(RetainPtr<NSImage> image, const IntPoint& point, const IntPoint&, Clipboard&, Frame& frame, bool linkDrag)
    8080{
    8181    IntSize bitmapSize([image.get() size]);
    82     bitmapSize.scale(frame->page()->deviceScaleFactor());
     82    bitmapSize.scale(frame.page()->deviceScaleFactor());
    8383    RefPtr<ShareableBitmap> bitmap = convertImageToBitmap(image.get(), bitmapSize);
    8484    ShareableBitmap::Handle handle;
     
    8787
    8888    // FIXME: Seems this message should be named StartDrag, not SetDragImage.
    89     m_page->send(Messages::WebPageProxy::SetDragImage(frame->view()->contentsToWindow(point), handle, linkDrag));
     89    m_page->send(Messages::WebPageProxy::SetDragImage(frame.view()->contentsToWindow(point), handle, linkDrag));
    9090}
    9191
    92 static WebCore::CachedImage* cachedImage(Element* element)
     92static WebCore::CachedImage* cachedImage(Element& element)
    9393{
    94     RenderObject* renderer = element->renderer();
     94    RenderObject* renderer = element.renderer();
    9595    if (!renderer)
    9696        return 0;
     
    103103}
    104104
    105 void WebDragClient::declareAndWriteDragImage(const String& pasteboardName, DOMElement *element, NSURL *URL, NSString *title, WebCore::Frame*)
     105void WebDragClient::declareAndWriteDragImage(const String& pasteboardName, Element& element, const URL& url, const String& label, Frame*)
    106106{
    107     ASSERT(element);
    108107    ASSERT(pasteboardName == String(NSDragPboard));
    109108
    110     Element* coreElement = core(element);
     109    WebCore::CachedImage* image = cachedImage(element);
    111110
    112     WebCore::CachedImage* image = cachedImage(coreElement);
    113 
    114     NSString *extension = @"";
     111    String extension;
    115112    if (image) {
    116113        extension = image->image()->filenameExtension();
    117         if (![extension length])
     114        if (extension.isEmpty())
    118115            return;
    119116    }
    120117
    121     if (![title length]) {
    122         title = [[URL path] lastPathComponent];
    123         if (![title length])
    124             title = [URL _web_userVisibleString];
     118    String title = label;
     119    if (title.isEmpty()) {
     120        title = url.lastPathComponent();
     121        if (title.isEmpty())
     122            title = [(NSURL *)url _web_userVisibleString];
    125123    }
    126124
    127     RefPtr<LegacyWebArchive> archive = LegacyWebArchive::create(coreElement);
     125    RefPtr<LegacyWebArchive> archive = LegacyWebArchive::create(&element);
    128126
    129127    NSURLResponse *response = image->response().nsURLResponse();
     
    147145        sharedMemoryBuffer->createHandle(archiveHandle, SharedMemory::ReadOnly);           
    148146    }
    149     m_page->send(Messages::WebPageProxy::SetPromisedData(pasteboardName, imageHandle, imageSize, String([response suggestedFilename]), String(extension), String(title), String([[response URL] absoluteString]), String([URL _web_userVisibleString]), archiveHandle, archiveSize));
     147    m_page->send(Messages::WebPageProxy::SetPromisedData(pasteboardName, imageHandle, imageSize, String([response suggestedFilename]), extension, title, String([[response URL] absoluteString]), String([(NSURL *)url _web_userVisibleString]), archiveHandle, archiveSize));
    150148}
    151149
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r156924 r157058  
    25412541    switch (action) {
    25422542    case DragControllerActionEntered:
    2543         send(Messages::WebPageProxy::DidPerformDragControllerAction(m_page->dragController().dragEntered(&dragData)));
     2543        send(Messages::WebPageProxy::DidPerformDragControllerAction(m_page->dragController().dragEntered(dragData)));
    25442544        break;
    25452545
    25462546    case DragControllerActionUpdated:
    2547         send(Messages::WebPageProxy::DidPerformDragControllerAction(m_page->dragController().dragUpdated(&dragData)));
     2547        send(Messages::WebPageProxy::DidPerformDragControllerAction(m_page->dragController().dragUpdated(dragData)));
    25482548        break;
    25492549
    25502550    case DragControllerActionExited:
    2551         m_page->dragController().dragExited(&dragData);
     2551        m_page->dragController().dragExited(dragData);
    25522552        break;
    25532553
    25542554    case DragControllerActionPerformDrag: {
    2555         m_page->dragController().performDrag(&dragData);
     2555        m_page->dragController().performDrag(dragData);
    25562556        break;
    25572557    }
     
    25762576    switch (action) {
    25772577    case DragControllerActionEntered:
    2578         send(Messages::WebPageProxy::DidPerformDragControllerAction(m_page->dragController().dragEntered(&dragData)));
     2578        send(Messages::WebPageProxy::DidPerformDragControllerAction(m_page->dragController().dragEntered(dragData)));
    25792579        break;
    25802580
    25812581    case DragControllerActionUpdated:
    2582         send(Messages::WebPageProxy::DidPerformDragControllerAction(m_page->dragController().dragUpdated(&dragData)));
     2582        send(Messages::WebPageProxy::DidPerformDragControllerAction(m_page->dragController().dragUpdated(dragData)));
    25832583        break;
    25842584       
    25852585    case DragControllerActionExited:
    2586         m_page->dragController().dragExited(&dragData);
     2586        m_page->dragController().dragExited(dragData);
    25872587        break;
    25882588       
     
    25962596        }
    25972597
    2598         m_page->dragController().performDrag(&dragData);
     2598        m_page->dragController().performDrag(dragData);
    25992599
    26002600        // If we started loading a local file, the sandbox extension tracker would have adopted this
Note: See TracChangeset for help on using the changeset viewer.