Consolidate various frame snapshot capabilities.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Nov 2013 22:10:33 +0000 (22:10 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Nov 2013 22:10:33 +0000 (22:10 +0000)
commit6d64b60f8e6650d114ea47483e06a63c3794ffe7
tree66bda7fc41c232be891394427e1956b3dba67d0a
parentce21c126136340febaee1d1854b4b36e8233ccbd
Consolidate various frame snapshot capabilities.
https://bugs.webkit.org/show_bug.cgi?id=124325

Patch by Brian J. Burg <burg@cs.washington.edu> on 2013-11-18
Reviewed by Timothy Hatcher.

Source/WebCore:

Various snapshot creation methods had duplicated code and were split
between Frame, DragImage, and platform-specific implementationss.
This patch puts WebCore snapshot methods into FrameSnapshotting
and removes platform implementations where possible.

DragImage methods reuse snapshot methods where possible. Inspector
will be able to take snapshots without using drag images.

No new tests, this is a refactoring.

* CMakeLists.txt:
* GNUmakefile.list.am:
* WebCore.exp.in:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* bindings/objc/DOM.mm:
(-[DOMNode renderedImage]):
(-[DOMRange renderedImageForcingBlackText:]):
* dom/Clipboard.cpp:
(WebCore::Clipboard::createDragImage):
* dom/ClipboardMac.mm:
(WebCore::Clipboard::createDragImage):
* page/DragController.cpp:
(WebCore::DragController::startDrag):
* page/Frame.cpp:
* page/Frame.h:
* page/FrameSnapshotting.cpp: Added.
(WebCore::ScopedFramePaintingState::ScopedFramePaintingState):
(WebCore::ScopedFramePaintingState::~ScopedFramePaintingState):
(WebCore::snapshotFrameRect): Move most buffer logic to here.
(WebCore::snapshotSelection): Moved from Frame.
(WebCore::snapshotNode): Moved from Frame.
* page/FrameSnapshotting.h: Added.
* page/mac/FrameMac.mm: Removed.
* page/mac/FrameSnapshottingMac.h: Removed.
* page/mac/FrameSnapshottingMac.mm: Removed.
* page/win/FrameWin.cpp: remove duplicate implementation.
* page/win/FrameWin.h: Fix an incorrect parameter name.
* platform/DragImage.cpp:
(WebCore::ScopedNodeDragState::ScopedNodeDragState):
(WebCore::ScopedNodeDragState::~ScopedNodeDragState):
(WebCore::createDragImageFromSnapshot): Boilerplate buffer conversion.
(WebCore::createDragImageForNode):
(WebCore::createDragImageForSelection):
(WebCore::ScopedFrameSelectionState::ScopedFrameSelectionState):
(WebCore::ScopedFrameSelectionState::~ScopedFrameSelectionState):
(WebCore::createDragImageForRange): Moved from Frame.
(WebCore::createDragImageForImage): Moved from FrameSnapshottingMac.
(WebCore::createDragImageForLink): use nullptr.

Source/WebKit/ios:

* WebCoreSupport/WebFrameIOS.mm: use new header file.

Source/WebKit/mac:

Use new platform-independent methods instead of Mac methods.

* WebView/WebHTMLView.mm:
(-[WebHTMLView _selectionDraggingImage]):
(-[WebHTMLView selectionImageForcingBlackText:]):

Source/WebKit/win:

* DOMCoreClasses.cpp:
(DOMElement::renderedImage): use createDragImageForNode.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@159455 268f45cc-cd09-0410-ab3c-d52691b4dbfc
28 files changed:
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/WebCore.exp.in
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/objc/DOM.mm
Source/WebCore/dom/Clipboard.cpp
Source/WebCore/dom/ClipboardMac.mm
Source/WebCore/page/DragController.cpp
Source/WebCore/page/Frame.cpp
Source/WebCore/page/Frame.h
Source/WebCore/page/FrameSnapshotting.cpp [new file with mode: 0644]
Source/WebCore/page/FrameSnapshotting.h [new file with mode: 0644]
Source/WebCore/page/mac/FrameMac.mm [deleted file]
Source/WebCore/page/mac/FrameSnapshottingMac.h [deleted file]
Source/WebCore/page/mac/FrameSnapshottingMac.mm [deleted file]
Source/WebCore/page/win/FrameWin.cpp
Source/WebCore/page/win/FrameWin.h
Source/WebCore/platform/DragImage.cpp
Source/WebCore/platform/DragImage.h
Source/WebKit/ios/ChangeLog
Source/WebKit/ios/WebCoreSupport/WebFrameIOS.mm
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebHTMLView.mm
Source/WebKit/win/ChangeLog
Source/WebKit/win/DOMCoreClasses.cpp