<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[160152] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/160152">160152</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2013-12-04 19:08:40 -0800 (Wed, 04 Dec 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>Consolidate various frame snapshot capabilities.
https://bugs.webkit.org/show_bug.cgi?id=124325

Patch by Brian J. Burg &lt;burg@cs.washington.edu&gt; on 2013-12-04
Reviewed by Darin Adler.

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.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreGNUmakefilelistam">trunk/Source/WebCore/GNUmakefile.list.am</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCoreWebCorevcxprojWebCorevcxproj">trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj</a></li>
<li><a href="#trunkSourceWebCoreWebCorevcxprojWebCorevcxprojfilters">trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorebindingsobjcDOMmm">trunk/Source/WebCore/bindings/objc/DOM.mm</a></li>
<li><a href="#trunkSourceWebCoredomClipboardcpp">trunk/Source/WebCore/dom/Clipboard.cpp</a></li>
<li><a href="#trunkSourceWebCoredomClipboardMacmm">trunk/Source/WebCore/dom/ClipboardMac.mm</a></li>
<li><a href="#trunkSourceWebCorepageDragControllercpp">trunk/Source/WebCore/page/DragController.cpp</a></li>
<li><a href="#trunkSourceWebCorepageFramecpp">trunk/Source/WebCore/page/Frame.cpp</a></li>
<li><a href="#trunkSourceWebCorepageFrameh">trunk/Source/WebCore/page/Frame.h</a></li>
<li><a href="#trunkSourceWebCorepagewinFrameWincpp">trunk/Source/WebCore/page/win/FrameWin.cpp</a></li>
<li><a href="#trunkSourceWebCorepagewinFrameWinh">trunk/Source/WebCore/page/win/FrameWin.h</a></li>
<li><a href="#trunkSourceWebCoreplatformDragImagecpp">trunk/Source/WebCore/platform/DragImage.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformDragImageh">trunk/Source/WebCore/platform/DragImage.h</a></li>
<li><a href="#trunkSourceWebKitiosChangeLog">trunk/Source/WebKit/ios/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitiosWebCoreSupportWebFrameIOSmm">trunk/Source/WebKit/ios/WebCoreSupport/WebFrameIOS.mm</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebHTMLViewmm">trunk/Source/WebKit/mac/WebView/WebHTMLView.mm</a></li>
<li><a href="#trunkSourceWebKitwinChangeLog">trunk/Source/WebKit/win/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitwinDOMCoreClassescpp">trunk/Source/WebKit/win/DOMCoreClasses.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorepageFrameSnapshottingcpp">trunk/Source/WebCore/page/FrameSnapshotting.cpp</a></li>
<li><a href="#trunkSourceWebCorepageFrameSnapshottingh">trunk/Source/WebCore/page/FrameSnapshotting.h</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorepagemacFrameMacmm">trunk/Source/WebCore/page/mac/FrameMac.mm</a></li>
<li><a href="#trunkSourceWebCorepagemacFrameSnapshottingMach">trunk/Source/WebCore/page/mac/FrameSnapshottingMac.h</a></li>
<li><a href="#trunkSourceWebCorepagemacFrameSnapshottingMacmm">trunk/Source/WebCore/page/mac/FrameSnapshottingMac.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (160151 => 160152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2013-12-05 03:05:40 UTC (rev 160151)
+++ trunk/Source/WebCore/CMakeLists.txt        2013-12-05 03:08:40 UTC (rev 160152)
</span><span class="lines">@@ -1732,6 +1732,7 @@
</span><span class="cx">     page/FocusController.cpp
</span><span class="cx">     page/Frame.cpp
</span><span class="cx">     page/FrameDestructionObserver.cpp
</span><ins>+    page/FrameSnapshotting.cpp
</ins><span class="cx">     page/FrameTree.cpp
</span><span class="cx">     page/FrameView.cpp
</span><span class="cx">     page/GestureTapHighlighter.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (160151 => 160152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2013-12-05 03:05:40 UTC (rev 160151)
+++ trunk/Source/WebCore/ChangeLog        2013-12-05 03:08:40 UTC (rev 160152)
</span><span class="lines">@@ -1,3 +1,61 @@
</span><ins>+2013-12-04  Brian J. Burg  &lt;burg@cs.washington.edu&gt;
+
+        Consolidate various frame snapshot capabilities.
+        https://bugs.webkit.org/show_bug.cgi?id=124325
+
+        Reviewed by Darin Adler.
+
+        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.
+
</ins><span class="cx"> 2013-12-04  Benjamin Poulain  &lt;bpoulain@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove spaces on a blank line to have ResourceHandleCFNet.cpp identical to iOS
</span></span></pre></div>
<a id="trunkSourceWebCoreGNUmakefilelistam"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/GNUmakefile.list.am (160151 => 160152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/GNUmakefile.list.am        2013-12-05 03:05:40 UTC (rev 160151)
+++ trunk/Source/WebCore/GNUmakefile.list.am        2013-12-05 03:08:40 UTC (rev 160152)
</span><span class="lines">@@ -4131,6 +4131,8 @@
</span><span class="cx">         Source/WebCore/page/Frame.h \
</span><span class="cx">         Source/WebCore/page/FrameDestructionObserver.cpp \
</span><span class="cx">         Source/WebCore/page/FrameDestructionObserver.h \
</span><ins>+        Source/WebCore/page/FrameSnapshotting.cpp \
+        Source/WebCore/page/FrameSnapshotting.h \
</ins><span class="cx">         Source/WebCore/page/FrameTree.cpp \
</span><span class="cx">         Source/WebCore/page/FrameTree.h \
</span><span class="cx">         Source/WebCore/page/FrameView.cpp \
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (160151 => 160152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2013-12-05 03:05:40 UTC (rev 160151)
+++ trunk/Source/WebCore/WebCore.exp.in        2013-12-05 03:08:40 UTC (rev 160152)
</span><span class="lines">@@ -428,7 +428,6 @@
</span><span class="cx"> __ZN7WebCore14decodeHostNameEP8NSString
</span><span class="cx"> __ZN7WebCore14encodeHostNameEP8NSString
</span><span class="cx"> __ZN7WebCore14endOfParagraphERKNS_15VisiblePositionENS_27EditingBoundaryCrossingRuleE
</span><del>-__ZN7WebCore14selectionImageEPNS_5FrameEb
</del><span class="cx"> __ZN7WebCore14setMetadataURLERN3WTF6StringERKS1_S4_
</span><span class="cx"> __ZN7WebCore15AffineTransform5flipYEv
</span><span class="cx"> __ZN7WebCore15AffineTransform5scaleEd
</span><span class="lines">@@ -890,6 +889,7 @@
</span><span class="cx"> __ZN7WebCore27CSSComputedStyleDeclarationC1EN3WTF10PassRefPtrINS_4NodeEEEbRKNS1_6StringE
</span><span class="cx"> __ZN7WebCore27DeviceOrientationClientMock14setOrientationEN3WTF10PassRefPtrINS_21DeviceOrientationDataEEE
</span><span class="cx"> __ZN7WebCore27DeviceOrientationClientMockC1Ev
</span><ins>+__ZN7WebCore27createDragImageForSelectionERNS_5FrameEb
</ins><span class="cx"> __ZN7WebCore27protocolHostAndPortAreEqualERKNS_3URLES2_
</span><span class="cx"> __ZN7WebCore27startObservingCookieChangesEPFvvE
</span><span class="cx"> __ZN7WebCore28DocumentStyleSheetCollection12addUserSheetEN3WTF7PassRefINS_18StyleSheetContentsEEE
</span><span class="lines">@@ -2035,7 +2035,6 @@
</span><span class="cx"> __ZN7WebCore42contextMenuItemTagCheckGrammarWithSpellingEv
</span><span class="cx"> __ZN7WebCore42contextMenuItemTagCheckSpellingWhileTypingEv
</span><span class="cx"> __ZN7WebCore46contextMenuItemTagCorrectSpellingAutomaticallyEv
</span><del>-__ZN7WebCore5Frame9nodeImageEPNS_4NodeE
</del><span class="cx"> __ZN7WebCore6Cursor8fromTypeENS0_4TypeE
</span><span class="cx"> __ZN7WebCore6CursorC1EPNS_5ImageERKNS_8IntPointE
</span><span class="cx"> __ZN7WebCore6CursorC1ERKS0_
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorevcxprojWebCorevcxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (160151 => 160152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj        2013-12-05 03:05:40 UTC (rev 160151)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj        2013-12-05 03:08:40 UTC (rev 160152)
</span><span class="lines">@@ -6998,6 +6998,7 @@
</span><span class="cx">     &lt;ClCompile Include=&quot;..\page\FocusController.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\page\Frame.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\page\FrameDestructionObserver.cpp&quot; /&gt;
</span><ins>+    &lt;ClCompile Include=&quot;..\page\FrameSnapshotting.cpp&quot; /&gt;
</ins><span class="cx">     &lt;ClCompile Include=&quot;..\page\FrameTree.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\page\FrameView.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\page\GroupSettings.cpp&quot; /&gt;
</span><span class="lines">@@ -18854,6 +18855,7 @@
</span><span class="cx">     &lt;ClInclude Include=&quot;..\page\FocusDirection.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\page\Frame.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\page\FrameDestructionObserver.h&quot; /&gt;
</span><ins>+    &lt;ClInclude Include=&quot;..\page\FrameSnapshotting.h&quot; /&gt;
</ins><span class="cx">     &lt;ClInclude Include=&quot;..\page\FrameTree.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\page\FrameView.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\page\GroupSettings.h&quot; /&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorevcxprojWebCorevcxprojfilters"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (160151 => 160152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters        2013-12-05 03:05:40 UTC (rev 160151)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters        2013-12-05 03:08:40 UTC (rev 160152)
</span><span class="lines">@@ -720,6 +720,9 @@
</span><span class="cx">     &lt;ClCompile Include=&quot;..\page\FrameDestructionObserver.cpp&quot;&gt;
</span><span class="cx">       &lt;Filter&gt;page&lt;/Filter&gt;
</span><span class="cx">     &lt;/ClCompile&gt;
</span><ins>+    &lt;ClCompile Include=&quot;..\page\FrameSnapshotting.cpp&quot;&gt;
+      &lt;Filter&gt;page&lt;/Filter&gt;
+    &lt;/ClCompile&gt;
</ins><span class="cx">     &lt;ClCompile Include=&quot;..\page\FrameTree.cpp&quot;&gt;
</span><span class="cx">       &lt;Filter&gt;page&lt;/Filter&gt;
</span><span class="cx">     &lt;/ClCompile&gt;
</span><span class="lines">@@ -7641,6 +7644,9 @@
</span><span class="cx">     &lt;ClInclude Include=&quot;..\page\FrameDestructionObserver.h&quot;&gt;
</span><span class="cx">       &lt;Filter&gt;page&lt;/Filter&gt;
</span><span class="cx">     &lt;/ClInclude&gt;
</span><ins>+    &lt;ClInclude Include=&quot;..\page\FrameSnapshotting.h&quot;&gt;
+      &lt;Filter&gt;page&lt;/Filter&gt;
+    &lt;/ClInclude&gt;
</ins><span class="cx">     &lt;ClInclude Include=&quot;..\page\FrameTree.h&quot;&gt;
</span><span class="cx">       &lt;Filter&gt;page&lt;/Filter&gt;
</span><span class="cx">     &lt;/ClInclude&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (160151 => 160152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2013-12-05 03:05:40 UTC (rev 160151)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2013-12-05 03:08:40 UTC (rev 160152)
</span><span class="lines">@@ -2013,7 +2013,6 @@
</span><span class="cx">                 65A21485097A3F5300B9050A /* FrameTree.h in Headers */ = {isa = PBXBuildFile; fileRef = 65A21483097A3F5300B9050A /* FrameTree.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 65BF022E0974816300C43196 /* Frame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65BF02290974816300C43196 /* Frame.cpp */; };
</span><span class="cx">                 65BF022F0974816300C43196 /* Frame.h in Headers */ = {isa = PBXBuildFile; fileRef = 65BF022A0974816300C43196 /* Frame.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><del>-                65BF02450974819000C43196 /* FrameMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 65BF023C0974819000C43196 /* FrameMac.mm */; };
</del><span class="cx">                 65C97AF308EA908800ACD273 /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = 65C97AF208EA908800ACD273 /* config.h */; };
</span><span class="cx">                 65CBFEF90974F607001DAC25 /* FrameView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65CBFEF70974F607001DAC25 /* FrameView.cpp */; };
</span><span class="cx">                 65CBFEFA0974F607001DAC25 /* FrameView.h in Headers */ = {isa = PBXBuildFile; fileRef = 65CBFEF80974F607001DAC25 /* FrameView.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -2218,8 +2217,6 @@
</span><span class="cx">                 7C5343FC17B74B63004232F0 /* JSMediaQueryListListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C5343FA17B74B63004232F0 /* JSMediaQueryListListener.cpp */; };
</span><span class="cx">                 7C5343FD17B74B63004232F0 /* JSMediaQueryListListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C5343FB17B74B63004232F0 /* JSMediaQueryListListener.h */; };
</span><span class="cx">                 7CC7E3D717208C0F003C5277 /* IDNScriptWhiteList.txt in Resources */ = {isa = PBXBuildFile; fileRef = 7CC7E3D617208C0F003C5277 /* IDNScriptWhiteList.txt */; };
</span><del>-                7CE30DA9171B63D200EC33E1 /* FrameSnapshottingMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7CE30DA7171B63D200EC33E1 /* FrameSnapshottingMac.mm */; };
-                7CE30DAA171B63D200EC33E1 /* FrameSnapshottingMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE30DA8171B63D200EC33E1 /* FrameSnapshottingMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
</del><span class="cx">                 7D741BDA177226AA00859170 /* CSSValueKeywords.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 6565814809D13043000E61D7 /* CSSValueKeywords.h */; };
</span><span class="cx">                 7E12E90F15FA5D3A005E4126 /* CustomFilterMeshGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E12E90D15FA5D3A005E4126 /* CustomFilterMeshGenerator.h */; };
</span><span class="cx">                 7E12E91015FA5D3A005E4126 /* CustomFilterMeshGenerator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7E12E90E15FA5D3A005E4126 /* CustomFilterMeshGenerator.cpp */; };
</span><span class="lines">@@ -5255,6 +5252,8 @@
</span><span class="cx">                 C3CF17A515B0063F00276D39 /* IdTargetObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = C3CF17A115B0063F00276D39 /* IdTargetObserver.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 C3CF17A615B0063F00276D39 /* IdTargetObserverRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C3CF17A215B0063F00276D39 /* IdTargetObserverRegistry.cpp */; };
</span><span class="cx">                 C3CF17A715B0063F00276D39 /* IdTargetObserverRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = C3CF17A315B0063F00276D39 /* IdTargetObserverRegistry.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+                C4CD629A18383766007EBAF1 /* FrameSnapshotting.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C4CD629818383766007EBAF1 /* FrameSnapshotting.cpp */; };
+                C4CD629B18383766007EBAF1 /* FrameSnapshotting.h in Headers */ = {isa = PBXBuildFile; fileRef = C4CD629918383766007EBAF1 /* FrameSnapshotting.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 C50B561612119D23008B46E0 /* GroupSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C50B561412119D23008B46E0 /* GroupSettings.cpp */; };
</span><span class="cx">                 C50B561712119D23008B46E0 /* GroupSettings.h in Headers */ = {isa = PBXBuildFile; fileRef = C50B561512119D23008B46E0 /* GroupSettings.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 C50D0E820FF4272900AC2644 /* StorageNamespace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C50D0E800FF4272900AC2644 /* StorageNamespace.cpp */; };
</span><span class="lines">@@ -8781,7 +8780,6 @@
</span><span class="cx">                 65A640F00533BB1F0085E777 /* BlockExceptions.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = BlockExceptions.h; sourceTree = &quot;&lt;group&gt;&quot;; tabWidth = 8; usesTabs = 0; };
</span><span class="cx">                 65BF02290974816300C43196 /* Frame.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Frame.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 65BF022A0974816300C43196 /* Frame.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Frame.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                65BF023C0974819000C43196 /* FrameMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = FrameMac.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 65C97AF208EA908800ACD273 /* config.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = &quot;&lt;group&gt;&quot;; tabWidth = 4; usesTabs = 0; };
</span><span class="cx">                 65CBFEF70974F607001DAC25 /* FrameView.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = FrameView.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 65CBFEF80974F607001DAC25 /* FrameView.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FrameView.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -9013,8 +9011,6 @@
</span><span class="cx">                 7C6136F81710C35200FF4A57 /* InFilesParser.pm */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; name = InFilesParser.pm; path = scripts/InFilesParser.pm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C6136F91710C35200FF4A57 /* StaticString.pm */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; name = StaticString.pm; path = scripts/StaticString.pm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7CC7E3D617208C0F003C5277 /* IDNScriptWhiteList.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDNScriptWhiteList.txt; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                7CE30DA7171B63D200EC33E1 /* FrameSnapshottingMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FrameSnapshottingMac.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
-                7CE30DA8171B63D200EC33E1 /* FrameSnapshottingMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FrameSnapshottingMac.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 7E12E90D15FA5D3A005E4126 /* CustomFilterMeshGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CustomFilterMeshGenerator.h; path = filters/CustomFilterMeshGenerator.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7E12E90E15FA5D3A005E4126 /* CustomFilterMeshGenerator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CustomFilterMeshGenerator.cpp; path = filters/CustomFilterMeshGenerator.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7E33CD00127F340D00BE8F17 /* PurgePriority.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PurgePriority.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -12321,6 +12317,8 @@
</span><span class="cx">                 C3CF17A115B0063F00276D39 /* IdTargetObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IdTargetObserver.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 C3CF17A215B0063F00276D39 /* IdTargetObserverRegistry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IdTargetObserverRegistry.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 C3CF17A315B0063F00276D39 /* IdTargetObserverRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IdTargetObserverRegistry.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                C4CD629818383766007EBAF1 /* FrameSnapshotting.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FrameSnapshotting.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                C4CD629918383766007EBAF1 /* FrameSnapshotting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FrameSnapshotting.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 C50B561412119D23008B46E0 /* GroupSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GroupSettings.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 C50B561512119D23008B46E0 /* GroupSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GroupSettings.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 C50D0E800FF4272900AC2644 /* StorageNamespace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StorageNamespace.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -15695,6 +15693,8 @@
</span><span class="cx">                                 65BF022A0974816300C43196 /* Frame.h */,
</span><span class="cx">                                 974A862014B7ADBB003FDC76 /* FrameDestructionObserver.cpp */,
</span><span class="cx">                                 974A862114B7ADBB003FDC76 /* FrameDestructionObserver.h */,
</span><ins>+                                C4CD629818383766007EBAF1 /* FrameSnapshotting.cpp */,
+                                C4CD629918383766007EBAF1 /* FrameSnapshotting.h */,
</ins><span class="cx">                                 65A21482097A3F5300B9050A /* FrameTree.cpp */,
</span><span class="cx">                                 65A21483097A3F5300B9050A /* FrameTree.h */,
</span><span class="cx">                                 65CBFEF70974F607001DAC25 /* FrameView.cpp */,
</span><span class="lines">@@ -16611,9 +16611,6 @@
</span><span class="cx">                                 ABAF22070C03B1C700B0BCF0 /* ChromeMac.mm */,
</span><span class="cx">                                 A718788F0B2D04AC00A16ECE /* DragControllerMac.mm */,
</span><span class="cx">                                 93C09A7E0B064EEF005ABD4D /* EventHandlerMac.mm */,
</span><del>-                                65BF023C0974819000C43196 /* FrameMac.mm */,
-                                7CE30DA8171B63D200EC33E1 /* FrameSnapshottingMac.h */,
-                                7CE30DA7171B63D200EC33E1 /* FrameSnapshottingMac.mm */,
</del><span class="cx">                                 1C26497B0D7E24EC00BD10F2 /* PageMac.cpp */,
</span><span class="cx">                                 E1C2F2481533A2120083F974 /* SettingsMac.mm */,
</span><span class="cx">                                 F587854C02DE375901EA4122 /* WebCoreFrameView.h */,
</span><span class="lines">@@ -22233,6 +22230,7 @@
</span><span class="cx">                                 1A569CF80D7E2B82007C3983 /* c_class.h in Headers */,
</span><span class="cx">                                 1A569CFA0D7E2B82007C3983 /* c_instance.h in Headers */,
</span><span class="cx">                                 1A569CFC0D7E2B82007C3983 /* c_runtime.h in Headers */,
</span><ins>+                                C4CD629B18383766007EBAF1 /* FrameSnapshotting.h in Headers */,
</ins><span class="cx">                                 1A569CFE0D7E2B82007C3983 /* c_utility.h in Headers */,
</span><span class="cx">                                 BCB16C1A0979C3BD00467741 /* CachedCSSStyleSheet.h in Headers */,
</span><span class="cx">                                 BC64B4CC0CB4295D005F2B62 /* CachedFont.h in Headers */,
</span><span class="lines">@@ -23095,7 +23093,6 @@
</span><span class="cx">                                 628D214E12131EF40055DCFC /* FrameNetworkingContext.h in Headers */,
</span><span class="cx">                                 E172AF70180F289500FBADB9 /* CryptoKeyUsage.h in Headers */,
</span><span class="cx">                                 93309E0E099E64920056E581 /* FrameSelection.h in Headers */,
</span><del>-                                7CE30DAA171B63D200EC33E1 /* FrameSnapshottingMac.h in Headers */,
</del><span class="cx">                                 65A21485097A3F5300B9050A /* FrameTree.h in Headers */,
</span><span class="cx">                                 65CBFEFA0974F607001DAC25 /* FrameView.h in Headers */,
</span><span class="cx">                                 97205AB0123928CA00B17380 /* FTPDirectoryDocument.h in Headers */,
</span><span class="lines">@@ -26385,10 +26382,8 @@
</span><span class="cx">                                 932E16090AF578340025F408 /* FrameLoader.cpp in Sources */,
</span><span class="cx">                                 D000EBA211BDAFD400C47726 /* FrameLoaderStateMachine.cpp in Sources */,
</span><span class="cx">                                 86BA766E166427A8005BE5D1 /* FrameLoadRequest.cpp in Sources */,
</span><del>-                                65BF02450974819000C43196 /* FrameMac.mm in Sources */,
</del><span class="cx">                                 93309E0D099E64920056E581 /* FrameSelection.cpp in Sources */,
</span><span class="cx">                                 4A8C96EB0BE69032004EEFF0 /* FrameSelectionMac.mm in Sources */,
</span><del>-                                7CE30DA9171B63D200EC33E1 /* FrameSnapshottingMac.mm in Sources */,
</del><span class="cx">                                 07969DAD17D14151007FF842 /* JSRTCDataChannelEvent.cpp in Sources */,
</span><span class="cx">                                 65A21484097A3F5300B9050A /* FrameTree.cpp in Sources */,
</span><span class="cx">                                 E4C91A101802343900A17F6D /* TextPaintStyle.cpp in Sources */,
</span><span class="lines">@@ -27900,6 +27895,7 @@
</span><span class="cx">                                 51E0BB390DA5ACB600A9E417 /* StorageMap.cpp in Sources */,
</span><span class="cx">                                 07277E5217D018CC0015534D /* JSMediaStreamTrack.cpp in Sources */,
</span><span class="cx">                                 C50D0E820FF4272900AC2644 /* StorageNamespace.cpp in Sources */,
</span><ins>+                                C4CD629A18383766007EBAF1 /* FrameSnapshotting.cpp in Sources */,
</ins><span class="cx">                                 C55E38C010040D5D00A56BDB /* StorageNamespaceImpl.cpp in Sources */,
</span><span class="cx">                                 1AB09DB416AF5F6C008538E7 /* StorageStrategy.cpp in Sources */,
</span><span class="cx">                                 C5102D950FD9AA2D00FAFF04 /* StorageSyncManager.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsobjcDOMmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/objc/DOM.mm (160151 => 160152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/objc/DOM.mm        2013-12-05 03:05:40 UTC (rev 160151)
+++ trunk/Source/WebCore/bindings/objc/DOM.mm        2013-12-05 03:08:40 UTC (rev 160152)
</span><span class="lines">@@ -36,9 +36,9 @@
</span><span class="cx"> #import &quot;DOMNodeInternal.h&quot;
</span><span class="cx"> #import &quot;DOMPrivate.h&quot;
</span><span class="cx"> #import &quot;DOMRangeInternal.h&quot;
</span><ins>+#import &quot;DragImage.h&quot;
</ins><span class="cx"> #import &quot;Font.h&quot;
</span><span class="cx"> #import &quot;Frame.h&quot;
</span><del>-#import &quot;FrameSnapshottingMac.h&quot;
</del><span class="cx"> #import &quot;HTMLElement.h&quot;
</span><span class="cx"> #import &quot;HTMLNames.h&quot;
</span><span class="cx"> #import &quot;HTMLParserIdioms.h&quot;
</span><span class="lines">@@ -289,7 +289,7 @@
</span><span class="cx">     WebCore::Frame* frame = node-&gt;document().frame();
</span><span class="cx">     if (!frame)
</span><span class="cx">         return nil;
</span><del>-    return frame-&gt;nodeImage(node).get();
</del><ins>+    return [createDragImageForNode(*frame, *node).leakRef() autorelease];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (NSArray *)textRects
</span><span class="lines">@@ -335,7 +335,7 @@
</span><span class="cx">     if (!frame)
</span><span class="cx">         return nil;
</span><span class="cx"> 
</span><del>-    return WebCore::rangeImage(frame, range, forceBlackText);
</del><ins>+    return [createDragImageForRange(*frame, *range, forceBlackText).leakRef() autorelease];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (NSArray *)textRects
</span></span></pre></div>
<a id="trunkSourceWebCoredomClipboardcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Clipboard.cpp (160151 => 160152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Clipboard.cpp        2013-12-05 03:05:40 UTC (rev 160151)
+++ trunk/Source/WebCore/dom/Clipboard.cpp        2013-12-05 03:08:40 UTC (rev 160152)
</span><span class="lines">@@ -277,10 +277,11 @@
</span><span class="cx"> 
</span><span class="cx">     if (m_dragImageElement) {
</span><span class="cx">         if (Frame* frame = m_dragImageElement-&gt;document().frame())
</span><del>-            return frame-&gt;nodeImage(m_dragImageElement.get());
</del><ins>+            return createDragImageForNode(*frame, *m_dragImageElement);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return 0; // We do not have enough information to create a drag image, use the default icon.
</del><ins>+    // We do not have enough information to create a drag image, use the default icon.
+    return nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoredomClipboardMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ClipboardMac.mm (160151 => 160152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ClipboardMac.mm        2013-12-05 03:05:40 UTC (rev 160151)
+++ trunk/Source/WebCore/dom/ClipboardMac.mm        2013-12-05 03:08:40 UTC (rev 160152)
</span><span class="lines">@@ -28,7 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> #import &quot;CachedImage.h&quot;
</span><span class="cx"> #import &quot;Element.h&quot;
</span><del>-#import &quot;FrameSnapshottingMac.h&quot;
</del><ins>+#import &quot;DragImage.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -37,16 +37,16 @@
</span><span class="cx"> // Clipboard::dragImage in Clipboard.cpp does not handle correctly, so must resolve that as well.
</span><span class="cx"> DragImageRef Clipboard::createDragImage(IntPoint&amp; location) const
</span><span class="cx"> {
</span><del>-    NSImage *result = nil;
</del><ins>+    DragImageRef result = nil;
</ins><span class="cx">     if (m_dragImageElement) {
</span><span class="cx">         if (Frame* frame = m_dragImageElement-&gt;document().frame()) {
</span><del>-            NSRect imageRect;
-            NSRect elementRect;
-            result = snapshotDragImage(frame, m_dragImageElement.get(), &amp;imageRect, &amp;elementRect);
</del><ins>+            IntRect imageRect;
+            IntRect elementRect;
+            result = createDragImageForImage(*frame, *m_dragImageElement, imageRect, elementRect);
</ins><span class="cx">             // Client specifies point relative to element, not the whole image, which may include child
</span><span class="cx">             // layers spread out all over the place.
</span><del>-            location.setX(elementRect.origin.x - imageRect.origin.x + m_dragLocation.x());
-            location.setY(imageRect.size.height - (elementRect.origin.y - imageRect.origin.y + m_dragLocation.y()));
</del><ins>+            location.setX(elementRect.x() - imageRect.x() + m_dragLocation.x());
+            location.setY(imageRect.height() - (elementRect.y() - imageRect.y() + m_dragLocation.y()));
</ins><span class="cx">         }
</span><span class="cx">     } else if (m_dragImage) {
</span><span class="cx">         result = m_dragImage-&gt;image()-&gt;getNSImage();
</span></span></pre></div>
<a id="trunkSourceWebCorepageDragControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DragController.cpp (160151 => 160152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DragController.cpp        2013-12-05 03:05:40 UTC (rev 160151)
+++ trunk/Source/WebCore/page/DragController.cpp        2013-12-05 03:08:40 UTC (rev 160152)
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> #include &quot;DragActions.h&quot;
</span><span class="cx"> #include &quot;DragClient.h&quot;
</span><span class="cx"> #include &quot;DragData.h&quot;
</span><ins>+#include &quot;DragImage.h&quot;
</ins><span class="cx"> #include &quot;DragSession.h&quot;
</span><span class="cx"> #include &quot;DragState.h&quot;
</span><span class="cx"> #include &quot;Editor.h&quot;
</span><span class="lines">@@ -779,7 +780,7 @@
</span><span class="cx">         }
</span><span class="cx">         m_client.willPerformDragSourceAction(DragSourceActionSelection, dragOrigin, clipboard);
</span><span class="cx">         if (!dragImage) {
</span><del>-            dragImage = dissolveDragImageToFraction(src.dragImageForSelection(), DragImageAlpha);
</del><ins>+            dragImage = dissolveDragImageToFraction(createDragImageForSelection(src), DragImageAlpha);
</ins><span class="cx">             dragLoc = dragLocForSelectionDrag(src);
</span><span class="cx">             m_dragOffset = IntPoint(dragOrigin.x() - dragLoc.x(), dragOrigin.y() - dragLoc.y());
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkSourceWebCorepageFramecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Frame.cpp (160151 => 160152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Frame.cpp        2013-12-05 03:05:40 UTC (rev 160151)
+++ trunk/Source/WebCore/page/Frame.cpp        2013-12-05 03:08:40 UTC (rev 160152)
</span><span class="lines">@@ -966,108 +966,4 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if !PLATFORM(MAC) &amp;&amp; !PLATFORM(WIN)
-struct ScopedFramePaintingState {
-    ScopedFramePaintingState(Frame* frame, Node* node)
-        : frame(frame)
-        , node(node)
-        , paintBehavior(frame-&gt;view()-&gt;paintBehavior())
-        , backgroundColor(frame-&gt;view()-&gt;baseBackgroundColor())
-    {
-        ASSERT(!node || node-&gt;renderer());
-        if (node)
-            node-&gt;renderer()-&gt;updateDragState(true);
-    }
-
-    ~ScopedFramePaintingState()
-    {
-        if (node &amp;&amp; node-&gt;renderer())
-            node-&gt;renderer()-&gt;updateDragState(false);
-        frame-&gt;view()-&gt;setPaintBehavior(paintBehavior);
-        frame-&gt;view()-&gt;setBaseBackgroundColor(backgroundColor);
-        frame-&gt;view()-&gt;setNodeToDraw(0);
-    }
-
-    Frame* frame;
-    Node* node;
-    PaintBehavior paintBehavior;
-    Color backgroundColor;
-};
-
-DragImageRef Frame::nodeImage(Node* node)
-{
-    if (!node-&gt;renderer())
-        return nullptr;
-
-    const ScopedFramePaintingState state(this, node);
-
-    m_view-&gt;setPaintBehavior(state.paintBehavior | PaintBehaviorFlattenCompositingLayers);
-
-    // When generating the drag image for an element, ignore the document background.
-    m_view-&gt;setBaseBackgroundColor(Color::transparent);
-    m_doc-&gt;updateLayout();
-    m_view-&gt;setNodeToDraw(node); // Enable special sub-tree drawing mode.
-
-    // Document::updateLayout may have blown away the original renderer.
-    auto renderer = node-&gt;renderer();
-    if (!renderer)
-        return nullptr;
-
-    LayoutRect topLevelRect;
-    IntRect paintingRect = pixelSnappedIntRect(renderer-&gt;paintingRootRect(topLevelRect));
-
-    float deviceScaleFactor = 1;
-    if (m_page)
-        deviceScaleFactor = m_page-&gt;deviceScaleFactor();
-    paintingRect.setWidth(paintingRect.width() * deviceScaleFactor);
-    paintingRect.setHeight(paintingRect.height() * deviceScaleFactor);
-
-    std::unique_ptr&lt;ImageBuffer&gt; buffer(ImageBuffer::create(paintingRect.size(), deviceScaleFactor, ColorSpaceDeviceRGB));
-    if (!buffer)
-        return nullptr;
-    buffer-&gt;context()-&gt;translate(-paintingRect.x(), -paintingRect.y());
-    buffer-&gt;context()-&gt;clip(FloatRect(0, 0, paintingRect.maxX(), paintingRect.maxY()));
-
-    m_view-&gt;paintContents(buffer-&gt;context(), paintingRect);
-
-    RefPtr&lt;Image&gt; image = buffer-&gt;copyImage();
-
-    ImageOrientationDescription orientationDescription(renderer-&gt;shouldRespectImageOrientation());
-#if ENABLE(CSS_IMAGE_ORIENTATION)
-    orientationDescription.setImageOrientationEnum(renderer-&gt;style().imageOrientation());
-#endif
-    return createDragImageFromImage(image.get(), orientationDescription);
-}
-
-DragImageRef Frame::dragImageForSelection()
-{
-    if (!selection().isRange())
-        return 0;
-
-    const ScopedFramePaintingState state(this, 0);
-    m_view-&gt;setPaintBehavior(PaintBehaviorSelectionOnly);
-    m_doc-&gt;updateLayout();
-
-    IntRect paintingRect = enclosingIntRect(selection().bounds());
-
-    float deviceScaleFactor = 1;
-    if (m_page)
-        deviceScaleFactor = m_page-&gt;deviceScaleFactor();
-    paintingRect.setWidth(paintingRect.width() * deviceScaleFactor);
-    paintingRect.setHeight(paintingRect.height() * deviceScaleFactor);
-
-    std::unique_ptr&lt;ImageBuffer&gt; buffer(ImageBuffer::create(paintingRect.size(), deviceScaleFactor, ColorSpaceDeviceRGB));
-    if (!buffer)
-        return 0;
-    buffer-&gt;context()-&gt;translate(-paintingRect.x(), -paintingRect.y());
-    buffer-&gt;context()-&gt;clip(FloatRect(0, 0, paintingRect.maxX(), paintingRect.maxY()));
-
-    m_view-&gt;paintContents(buffer-&gt;context(), paintingRect);
-
-    RefPtr&lt;Image&gt; image = buffer-&gt;copyImage();
-    return createDragImageFromImage(image.get(), ImageOrientationDescription());
-}
-
-#endif
-
</del><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Frame.h (160151 => 160152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Frame.h        2013-12-05 03:05:40 UTC (rev 160151)
+++ trunk/Source/WebCore/page/Frame.h        2013-12-05 03:08:40 UTC (rev 160152)
</span><span class="lines">@@ -29,7 +29,6 @@
</span><span class="cx"> #define Frame_h
</span><span class="cx"> 
</span><span class="cx"> #include &quot;AdjustViewSizeOrNot.h&quot;
</span><del>-#include &quot;DragImage.h&quot;
</del><span class="cx"> #include &quot;FrameLoader.h&quot;
</span><span class="cx"> #include &quot;FrameTree.h&quot;
</span><span class="cx"> #include &quot;IntRect.h&quot;
</span><span class="lines">@@ -58,11 +57,13 @@
</span><span class="cx">     class Editor;
</span><span class="cx">     class Element;
</span><span class="cx">     class EventHandler;
</span><ins>+    class FloatSize;
</ins><span class="cx">     class FrameDestructionObserver;
</span><span class="cx">     class FrameSelection;
</span><span class="cx">     class FrameView;
</span><span class="cx">     class HTMLFrameOwnerElement;
</span><span class="cx">     class HTMLTableCellElement;
</span><ins>+    class ImageBuffer;
</ins><span class="cx">     class IntRect;
</span><span class="cx">     class MainFrame;
</span><span class="cx">     class Node;
</span><span class="lines">@@ -177,9 +178,6 @@
</span><span class="cx"> 
</span><span class="cx">         String displayStringModifiedByEncoding(const String&amp;) const;
</span><span class="cx"> 
</span><del>-        DragImageRef nodeImage(Node*);
-        DragImageRef dragImageForSelection();
-
</del><span class="cx">         VisiblePosition visiblePositionForPoint(const IntPoint&amp; framePoint);
</span><span class="cx">         Document* documentAtPoint(const IntPoint&amp; windowPoint);
</span><span class="cx">         PassRefPtr&lt;Range&gt; rangeForPoint(const IntPoint&amp; framePoint);
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameSnapshottingcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/page/FrameSnapshotting.cpp (0 => 160152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameSnapshotting.cpp                                (rev 0)
+++ trunk/Source/WebCore/page/FrameSnapshotting.cpp        2013-12-05 03:08:40 UTC (rev 160152)
</span><span class="lines">@@ -0,0 +1,130 @@
</span><ins>+/*
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2013 University of Washington.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS
+ * IS&quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include &quot;config.h&quot;
+#include &quot;FrameSnapshotting.h&quot;
+
+#include &quot;Document.h&quot;
+#include &quot;Frame.h&quot;
+#include &quot;FrameSelection.h&quot;
+#include &quot;FrameView.h&quot;
+#include &quot;ImageBuffer.h&quot;
+#include &quot;Page.h&quot;
+#include &quot;RenderObject.h&quot;
+
+namespace WebCore {
+
+struct ScopedFramePaintingState {
+    ScopedFramePaintingState(Frame&amp; frame, Node* node)
+        : frame(frame)
+        , node(node)
+        , paintBehavior(frame.view()-&gt;paintBehavior())
+        , backgroundColor(frame.view()-&gt;baseBackgroundColor())
+    {
+        ASSERT(!node || node-&gt;renderer());
+    }
+
+    ~ScopedFramePaintingState()
+    {
+        frame.view()-&gt;setPaintBehavior(paintBehavior);
+        frame.view()-&gt;setBaseBackgroundColor(backgroundColor);
+        frame.view()-&gt;setNodeToDraw(nullptr);
+    }
+
+    const Frame&amp; frame;
+    const Node* node;
+    const PaintBehavior paintBehavior;
+    const Color backgroundColor;
+};
+
+std::unique_ptr&lt;ImageBuffer&gt; snapshotFrameRect(Frame&amp; frame, const IntRect&amp; imageRect, SnapshotOptions options)
+{
+    if (!frame.page())
+        return nullptr;
+
+    frame.document()-&gt;updateLayout();
+
+    FrameView::SelectionInSnapshot shouldIncludeSelection = FrameView::IncludeSelection;
+    if (options &amp; SnapshotOptionsExcludeSelectionHighlighting)
+        shouldIncludeSelection = FrameView::ExcludeSelection;
+
+    FrameView::CoordinateSpaceForSnapshot coordinateSpace = FrameView::DocumentCoordinates;
+    if (options &amp; SnapshotOptionsInViewCoordinates)
+        coordinateSpace = FrameView::ViewCoordinates;
+
+    ScopedFramePaintingState state(frame, nullptr);
+
+    PaintBehavior paintBehavior = state.paintBehavior;
+    if (options &amp; SnapshotOptionsForceBlackText)
+        paintBehavior |= PaintBehaviorForceBlackText;
+    if (options &amp; SnapshotOptionsPaintSelectionOnly)
+        paintBehavior |= PaintBehaviorSelectionOnly;
+
+    // Other paint behaviors are set by paintContentsForSnapshot.
+    frame.view()-&gt;setPaintBehavior(paintBehavior);
+
+    float deviceScaleFactor = frame.page()-&gt;deviceScaleFactor();
+    IntRect usedRect(imageRect);
+    usedRect.scale(deviceScaleFactor);
+
+    std::unique_ptr&lt;ImageBuffer&gt; buffer = ImageBuffer::create(usedRect.size(), deviceScaleFactor, ColorSpaceDeviceRGB);
+    if (!buffer)
+        return nullptr;
+    buffer-&gt;context()-&gt;translate(-usedRect.x(), -usedRect.y());
+    buffer-&gt;context()-&gt;clip(FloatRect(0, 0, usedRect.maxX(), usedRect.maxY()));
+
+    frame.view()-&gt;paintContentsForSnapshot(buffer-&gt;context(), usedRect, shouldIncludeSelection, coordinateSpace);
+    return buffer;
+}
+
+std::unique_ptr&lt;ImageBuffer&gt; snapshotSelection(Frame&amp; frame, SnapshotOptions options)
+{
+    if (!frame.selection().isRange())
+        return nullptr;
+
+    options |= SnapshotOptionsPaintSelectionOnly;
+    return snapshotFrameRect(frame, enclosingIntRect(frame.selection().bounds()), options);
+}
+
+std::unique_ptr&lt;ImageBuffer&gt; snapshotNode(Frame&amp; frame, Node&amp; node)
+{
+    if (!node.renderer())
+        return nullptr;
+
+    ScopedFramePaintingState state(frame, &amp;node);
+
+    frame.view()-&gt;setBaseBackgroundColor(Color::transparent);
+    frame.view()-&gt;setNodeToDraw(&amp;node);
+
+    LayoutRect topLevelRect;
+    return snapshotFrameRect(frame, pixelSnappedIntRect(node.renderer()-&gt;paintingRootRect(topLevelRect)));
+}
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCorepageFrameSnapshottingh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/page/FrameSnapshotting.h (0 => 160152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameSnapshotting.h                                (rev 0)
+++ trunk/Source/WebCore/page/FrameSnapshotting.h        2013-12-05 03:08:40 UTC (rev 160152)
</span><span class="lines">@@ -0,0 +1,57 @@
</span><ins>+/*
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2013 University of Washington.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS
+ * IS&quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef FrameSnapshotting_h
+#define FrameSnapshotting_h
+
+#include &lt;memory&gt;
+
+namespace WebCore {
+
+class Frame;
+class IntRect;
+class ImageBuffer;
+class Node;
+
+enum {
+    SnapshotOptionsNone = 0,
+    SnapshotOptionsExcludeSelectionHighlighting = 1 &lt;&lt; 0,
+    SnapshotOptionsPaintSelectionOnly = 1 &lt;&lt; 1,
+    SnapshotOptionsInViewCoordinates = 1 &lt;&lt; 2,
+    SnapshotOptionsForceBlackText = 1 &lt;&lt; 3,
+};
+typedef unsigned SnapshotOptions;
+
+std::unique_ptr&lt;ImageBuffer&gt; snapshotFrameRect(Frame&amp;, const IntRect&amp;, SnapshotOptions = SnapshotOptionsNone);
+std::unique_ptr&lt;ImageBuffer&gt; snapshotNode(Frame&amp;, Node&amp;);
+std::unique_ptr&lt;ImageBuffer&gt; snapshotSelection(Frame&amp;, SnapshotOptions = SnapshotOptionsNone);
+
+} // namespace WebCore
+
+#endif // FrameSnapshotting_h
</ins></span></pre></div>
<a id="trunkSourceWebCorepagemacFrameMacmm"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/page/mac/FrameMac.mm (160151 => 160152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/mac/FrameMac.mm        2013-12-05 03:05:40 UTC (rev 160151)
+++ trunk/Source/WebCore/page/mac/FrameMac.mm        2013-12-05 03:08:40 UTC (rev 160152)
</span><span class="lines">@@ -1,64 +0,0 @@
</span><del>-/*
- * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
- * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
- * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#import &quot;config.h&quot;
-#import &quot;Frame.h&quot;
-
-#import &quot;Document.h&quot;
-#import &quot;FrameLoaderClient.h&quot;
-#import &quot;FrameSelection.h&quot;
-#import &quot;FrameSnapshottingMac.h&quot;
-#import &quot;FrameView.h&quot;
-#import &quot;RenderObject.h&quot;
-
-namespace WebCore {
-
-DragImageRef Frame::nodeImage(Node* node)
-{
-    m_doc-&gt;updateLayout(); // forces style recalc
-
-    RenderObject* renderer = node-&gt;renderer();
-    if (!renderer)
-        return nil;
-    LayoutRect topLevelRect;
-    NSRect paintingRect = pixelSnappedIntRect(renderer-&gt;paintingRootRect(topLevelRect));
-
-    m_view-&gt;setNodeToDraw(node); // invoke special sub-tree drawing mode
-    NSImage* result = imageFromRect(this, paintingRect);
-    m_view-&gt;setNodeToDraw(0);
-
-    return result;
-}
-
-DragImageRef Frame::dragImageForSelection()
-{
-    if (!selection().isRange())
-        return nil;
-    return selectionImage(this);
-}
-
-} // namespace WebCore
</del></span></pre></div>
<a id="trunkSourceWebCorepagemacFrameSnapshottingMach"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/page/mac/FrameSnapshottingMac.h (160151 => 160152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/mac/FrameSnapshottingMac.h        2013-12-05 03:05:40 UTC (rev 160151)
+++ trunk/Source/WebCore/page/mac/FrameSnapshottingMac.h        2013-12-05 03:08:40 UTC (rev 160152)
</span><span class="lines">@@ -1,44 +0,0 @@
</span><del>-/*
- * Copyright (C) 2013 Apple Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef FrameSnapshottingMac_h
-#define FrameSnapshottingMac_h
-
-OBJC_CLASS NSImage;
-
-namespace WebCore {
-
-class Frame;
-class Range;
-class Node;
-
-NSImage* selectionImage(Frame*, bool forceBlackText = false);
-NSImage* rangeImage(Frame*, Range*, bool forceBlackText = false);
-NSImage* snapshotDragImage(Frame*, Node*, NSRect* imageRect, NSRect* elementRect);
-NSImage* imageFromRect(Frame*, NSRect);
-
-}
-
-#endif // FrameSnapshottingMac_h
</del></span></pre></div>
<a id="trunkSourceWebCorepagemacFrameSnapshottingMacmm"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/page/mac/FrameSnapshottingMac.mm (160151 => 160152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/mac/FrameSnapshottingMac.mm        2013-12-05 03:05:40 UTC (rev 160151)
+++ trunk/Source/WebCore/page/mac/FrameSnapshottingMac.mm        2013-12-05 03:08:40 UTC (rev 160152)
</span><span class="lines">@@ -1,168 +0,0 @@
</span><del>-/*
- * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2013 Apple Inc. All rights reserved.
- * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
- * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#import &quot;config.h&quot;
-#import &quot;FrameSnapshottingMac.h&quot;
-
-#import &quot;BlockExceptions.h&quot;
-#import &quot;Document.h&quot;
-#import &quot;Frame.h&quot;
-#import &quot;FrameSelection.h&quot;
-#import &quot;FrameView.h&quot;
-#import &quot;GraphicsContext.h&quot;
-#import &quot;Range.h&quot;
-#import &quot;RenderView.h&quot;
-
-namespace WebCore {
-
-NSImage* imageFromRect(Frame* frame, NSRect rect)
-{
-    PaintBehavior oldBehavior = frame-&gt;view()-&gt;paintBehavior();
-    frame-&gt;view()-&gt;setPaintBehavior(oldBehavior | PaintBehaviorFlattenCompositingLayers);
-    
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-    
-    NSImage* resultImage = [[[NSImage alloc] initWithSize:rect.size] autorelease];
-    
-    if (rect.size.width != 0 &amp;&amp; rect.size.height != 0) {
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored &quot;-Wdeprecated-declarations&quot;
-        [resultImage setFlipped:YES];
-#pragma clang diagnostic pop
-        [resultImage lockFocus];
-
-        GraphicsContext graphicsContext((CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]);        
-        graphicsContext.save();
-        graphicsContext.translate(-rect.origin.x, -rect.origin.y);
-        frame-&gt;view()-&gt;paintContents(&amp;graphicsContext, IntRect(rect));
-        graphicsContext.restore();
-
-        [resultImage unlockFocus];
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored &quot;-Wdeprecated-declarations&quot;
-        [resultImage setFlipped:NO];
-#pragma clang diagnostic pop
-    }
-    
-    frame-&gt;view()-&gt;setPaintBehavior(oldBehavior);
-    return resultImage;
-    
-    END_BLOCK_OBJC_EXCEPTIONS;
-    
-    frame-&gt;view()-&gt;setPaintBehavior(oldBehavior);
-    return nil;
-}
-
-NSImage* selectionImage(Frame* frame, bool forceBlackText)
-{
-    frame-&gt;view()-&gt;setPaintBehavior(PaintBehaviorSelectionOnly | (forceBlackText ? PaintBehaviorForceBlackText : 0));
-    frame-&gt;document()-&gt;updateLayout();
-    NSImage* result = imageFromRect(frame, frame-&gt;selection().bounds());
-    frame-&gt;view()-&gt;setPaintBehavior(PaintBehaviorNormal);
-    return result;
-}
-
-NSImage *rangeImage(Frame* frame, Range* range, bool forceBlackText)
-{
-    frame-&gt;view()-&gt;setPaintBehavior(PaintBehaviorSelectionOnly | (forceBlackText ? PaintBehaviorForceBlackText : 0));
-    frame-&gt;document()-&gt;updateLayout();
-    RenderView* view = frame-&gt;contentRenderer();
-    if (!view)
-        return nil;
-
-    Position start = range-&gt;startPosition();
-    Position candidate = start.downstream();
-    if (candidate.deprecatedNode() &amp;&amp; candidate.deprecatedNode()-&gt;renderer())
-        start = candidate;
-
-    Position end = range-&gt;endPosition();
-    candidate = end.upstream();
-    if (candidate.deprecatedNode() &amp;&amp; candidate.deprecatedNode()-&gt;renderer())
-        end = candidate;
-
-    if (start.isNull() || end.isNull() || start == end)
-        return nil;
-
-    RenderObject* savedStartRenderer;
-    int savedStartOffset;
-    RenderObject* savedEndRenderer;
-    int savedEndOffset;
-    view-&gt;getSelection(savedStartRenderer, savedStartOffset, savedEndRenderer, savedEndOffset);
-
-    RenderObject* startRenderer = start.deprecatedNode()-&gt;renderer();
-    if (!startRenderer)
-        return nil;
-
-    RenderObject* endRenderer = end.deprecatedNode()-&gt;renderer();
-    if (!endRenderer)
-        return nil;
-
-    view-&gt;setSelection(startRenderer, start.deprecatedEditingOffset(), endRenderer, end.deprecatedEditingOffset(), RenderView::RepaintNothing);
-    NSImage* result = imageFromRect(frame, view-&gt;selectionBounds());
-    view-&gt;setSelection(savedStartRenderer, savedStartOffset, savedEndRenderer, savedEndOffset, RenderView::RepaintNothing);
-
-    frame-&gt;view()-&gt;setPaintBehavior(PaintBehaviorNormal);
-    return result;
-}
-
-
-NSImage* snapshotDragImage(Frame* frame, Node* node, NSRect* imageRect, NSRect* elementRect)
-{
-    RenderObject* renderer = node-&gt;renderer();
-    if (!renderer)
-        return nil;
-    
-    renderer-&gt;updateDragState(true);    // mark dragged nodes (so they pick up the right CSS)
-    frame-&gt;document()-&gt;updateLayout();  // forces style recalc - needed since changing the drag state might
-                                        // imply new styles, plus JS could have changed other things
-
-
-    // Document::updateLayout may have blown away the original RenderElement.
-    renderer = node-&gt;renderer();
-    if (!renderer)
-        return nil;
-
-    LayoutRect topLevelRect;
-    NSRect paintingRect = pixelSnappedIntRect(renderer-&gt;paintingRootRect(topLevelRect));
-
-    if (NSIsEmptyRect(paintingRect))
-        return nil;
-
-    frame-&gt;view()-&gt;setNodeToDraw(node); // invoke special sub-tree drawing mode
-    NSImage* result = imageFromRect(frame, paintingRect);
-    renderer-&gt;updateDragState(false);
-    frame-&gt;document()-&gt;updateLayout();
-    frame-&gt;view()-&gt;setNodeToDraw(0);
-
-    if (elementRect)
-        *elementRect = pixelSnappedIntRect(topLevelRect);
-    if (imageRect)
-        *imageRect = paintingRect;
-    return result;
-}
-
-} // namespace WebCore
</del></span></pre></div>
<a id="trunkSourceWebCorepagewinFrameWincpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/win/FrameWin.cpp (160151 => 160152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/win/FrameWin.cpp        2013-12-05 03:05:40 UTC (rev 160151)
+++ trunk/Source/WebCore/page/win/FrameWin.cpp        2013-12-05 03:08:40 UTC (rev 160152)
</span><span class="lines">@@ -57,30 +57,4 @@
</span><span class="cx">     return image;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-DragImageRef Frame::dragImageForSelection()
-{
-    if (selection().isRange())
-        return imageFromSelection(this, false).leak();
-
-    return 0;
-}
-
-DragImageRef Frame::nodeImage(Node* node)
-{
-    document()-&gt;updateLayout();
-
-    RenderObject* renderer = node-&gt;renderer();
-    if (!renderer)
-        return 0;
-
-    LayoutRect topLevelRect;
-    IntRect paintingRect = pixelSnappedIntRect(renderer-&gt;paintingRootRect(topLevelRect));
-
-    m_view-&gt;setNodeToDraw(node); // invoke special sub-tree drawing mode
-    GDIObject&lt;HBITMAP&gt; result = imageFromRect(this, paintingRect);
-    m_view-&gt;setNodeToDraw(0);
-
-    return result.leak();
-}
-
</del><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorepagewinFrameWinh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/win/FrameWin.h (160151 => 160152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/win/FrameWin.h        2013-12-05 03:05:40 UTC (rev 160151)
+++ trunk/Source/WebCore/page/win/FrameWin.h        2013-12-05 03:08:40 UTC (rev 160152)
</span><span class="lines">@@ -35,7 +35,7 @@
</span><span class="cx"> class IntRect;
</span><span class="cx"> 
</span><span class="cx"> GDIObject&lt;HBITMAP&gt; imageFromRect(const Frame*, IntRect&amp;);
</span><del>-GDIObject&lt;HBITMAP&gt; imageFromSelection(Frame*, bool forceWhiteText);
</del><ins>+GDIObject&lt;HBITMAP&gt; imageFromSelection(Frame*, bool forceBlackText);
</ins><span class="cx"> void computePageRectsForFrame(Frame*, const IntRect&amp; printRect, float headerHeight, float footerHeight, float userScaleFactor, Vector&lt;IntRect&gt;&amp; outPages, int&amp; outPageHeight);
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformDragImagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/DragImage.cpp (160151 => 160152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/DragImage.cpp        2013-12-05 03:05:40 UTC (rev 160151)
+++ trunk/Source/WebCore/platform/DragImage.cpp        2013-12-05 03:08:40 UTC (rev 160152)
</span><span class="lines">@@ -20,7 +20,7 @@
</span><span class="cx">  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
</span><span class="cx">  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
</span><span class="cx">  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
</span><del>- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
</del><ins>+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="lines">@@ -28,29 +28,37 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(DRAG_SUPPORT)
</span><span class="cx"> 
</span><ins>+#include &quot;Frame.h&quot;
+#include &quot;FrameSnapshotting.h&quot;
+#include &quot;FrameView.h&quot;
+#include &quot;ImageBuffer.h&quot;
+#include &quot;Range.h&quot;
+#include &quot;RenderObject.h&quot;
+#include &quot;RenderView.h&quot;
+
</ins><span class="cx"> namespace WebCore {
</span><del>-    
</del><ins>+
</ins><span class="cx"> DragImageRef fitDragImageToMaxSize(DragImageRef image, const IntSize&amp; srcSize, const IntSize&amp; size)
</span><span class="cx"> {
</span><span class="cx">     float heightResizeRatio = 0.0f;
</span><span class="cx">     float widthResizeRatio = 0.0f;
</span><span class="cx">     float resizeRatio = -1.0f;
</span><span class="cx">     IntSize originalSize = dragImageSize(image);
</span><del>-    
</del><ins>+
</ins><span class="cx">     if (srcSize.width() &gt; size.width()) {
</span><span class="cx">         widthResizeRatio = size.width() / (float)srcSize.width();
</span><span class="cx">         resizeRatio = widthResizeRatio;
</span><span class="cx">     }
</span><del>-    
</del><ins>+
</ins><span class="cx">     if (srcSize.height() &gt; size.height()) {
</span><span class="cx">         heightResizeRatio = size.height() / (float)srcSize.height();
</span><span class="cx">         if ((resizeRatio &lt; 0.0f) || (resizeRatio &gt; heightResizeRatio))
</span><span class="cx">             resizeRatio = heightResizeRatio;
</span><span class="cx">     }
</span><del>-    
</del><ins>+
</ins><span class="cx">     if (srcSize == originalSize)
</span><span class="cx">         return resizeRatio &gt; 0.0f ? scaleDragImage(image, FloatSize(resizeRatio, resizeRatio)) : image;
</span><del>-    
</del><ins>+
</ins><span class="cx">     // The image was scaled in the webpage so at minimum we must account for that scaling
</span><span class="cx">     float scalex = srcSize.width() / (float)originalSize.width();
</span><span class="cx">     float scaley = srcSize.height() / (float)originalSize.height();
</span><span class="lines">@@ -58,14 +66,147 @@
</span><span class="cx">         scalex *= resizeRatio;
</span><span class="cx">         scaley *= resizeRatio;
</span><span class="cx">     }
</span><del>-    
</del><ins>+
</ins><span class="cx">     return scaleDragImage(image, FloatSize(scalex, scaley));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+struct ScopedNodeDragEnabler {
+    ScopedNodeDragEnabler(Frame&amp; frame, Node&amp; node)
+        : frame(frame)
+        , node(node)
+    {
+        if (node.renderer())
+            node.renderer()-&gt;updateDragState(true);
+        frame.document()-&gt;updateLayout();
+    }
+
+    ~ScopedNodeDragEnabler()
+    {
+        if (node.renderer())
+            node.renderer()-&gt;updateDragState(false);
+    }
+
+    const Frame&amp; frame;
+    const Node&amp; node;
+};
+
+static DragImageRef createDragImageFromSnapshot(std::unique_ptr&lt;ImageBuffer&gt; snapshot, Node* node)
+{
+    if (!snapshot)
+        return nullptr;
+
+    ImageOrientationDescription orientation;
+#if ENABLE(CSS_IMAGE_ORIENTATION)
+    if (node) {
+        RenderObject* renderer = node-&gt;renderer();
+        if (!renderer)
+            return nullptr;
+
+        orientation.setRespectImageOrientation(renderer-&gt;shouldRespectImageOrientation());
+        orientation.setImageOrientationEnum(renderer-&gt;style().imageOrientation());
+    }
+#else
+    UNUSED_PARAM(node);
+#endif
+    RefPtr&lt;Image&gt; image = snapshot-&gt;copyImage(ImageBuffer::fastCopyImageMode());
+    if (!image)
+        return nullptr;
+    return createDragImageFromImage(image.get(), orientation);
+}
+
+DragImageRef createDragImageForNode(Frame&amp; frame, Node&amp; node)
+{
+    ScopedNodeDragEnabler enableDrag(frame, node);
+    return createDragImageFromSnapshot(snapshotNode(frame, node), &amp;node);
+}
+
+DragImageRef createDragImageForSelection(Frame&amp; frame, bool forceBlackText)
+{
+    SnapshotOptions options = forceBlackText ? SnapshotOptionsForceBlackText : SnapshotOptionsNone;
+    return createDragImageFromSnapshot(snapshotSelection(frame, options), nullptr);
+}
+
+struct ScopedFrameSelectionState {
+    ScopedFrameSelectionState(Frame&amp; frame)
+        : frame(frame)
+    {
+        if (RenderView* root = frame.contentRenderer())
+            root-&gt;getSelection(startRenderer, startOffset, endRenderer, endOffset);
+    }
+
+    ~ScopedFrameSelectionState()
+    {
+        if (RenderView* root = frame.contentRenderer())
+            root-&gt;setSelection(startRenderer, startOffset, endRenderer, endOffset, RenderView::RepaintNothing);
+    }
+
+    const Frame&amp; frame;
+    RenderObject* startRenderer;
+    RenderObject* endRenderer;
+    int startOffset;
+    int endOffset;
+};
+
+DragImageRef createDragImageForRange(Frame&amp; frame, Range&amp; range, bool forceBlackText)
+{
+    frame.document()-&gt;updateLayout();
+    RenderView* view = frame.contentRenderer();
+    if (!view)
+        return nullptr;
+
+    // To snapshot the range, temporarily select it and take selection snapshot.
+    Position start = range.startPosition();
+    Position candidate = start.downstream();
+    if (candidate.deprecatedNode() &amp;&amp; candidate.deprecatedNode()-&gt;renderer())
+        start = candidate;
+
+    Position end = range.endPosition();
+    candidate = end.upstream();
+    if (candidate.deprecatedNode() &amp;&amp; candidate.deprecatedNode()-&gt;renderer())
+        end = candidate;
+
+    if (start.isNull() || end.isNull() || start == end)
+        return nullptr;
+
+    const ScopedFrameSelectionState selectionState(frame);
+
+    RenderObject* startRenderer = start.deprecatedNode()-&gt;renderer();
+    RenderObject* endRenderer = end.deprecatedNode()-&gt;renderer();
+    if (!startRenderer || !endRenderer)
+        return nullptr;
+
+    SnapshotOptions options = SnapshotOptionsPaintSelectionOnly | (forceBlackText ? SnapshotOptionsForceBlackText : SnapshotOptionsNone);
+    view-&gt;setSelection(startRenderer, start.deprecatedEditingOffset(), endRenderer, end.deprecatedEditingOffset(), RenderView::RepaintNothing);
+    // We capture using snapshotFrameRect() because we fake up the selection using
+    // FrameView but snapshotSelection() uses the selection from the Frame itself.
+    return createDragImageFromSnapshot(snapshotFrameRect(frame, view-&gt;selectionBounds(), options), nullptr);
+}
+
+DragImageRef createDragImageForImage(Frame&amp; frame, Node&amp; node, IntRect&amp; imageRect, IntRect&amp; elementRect)
+{
+    ScopedNodeDragEnabler enableDrag(frame, node);
+
+    RenderObject* renderer = node.renderer();
+    if (!renderer)
+        return nullptr;
+
+    // Calculate image and element metrics for the client, then create drag image.
+    LayoutRect topLevelRect;
+    IntRect paintingRect = pixelSnappedIntRect(renderer-&gt;paintingRootRect(topLevelRect));
+
+    if (paintingRect.isEmpty())
+        return nullptr;
+
+    elementRect = pixelSnappedIntRect(topLevelRect);
+    imageRect = paintingRect;
+
+    return createDragImageFromSnapshot(snapshotNode(frame, node), &amp;node);
+}
+
</ins><span class="cx"> #if !PLATFORM(MAC) &amp;&amp; (!PLATFORM(WIN) || OS(WINCE))
</span><span class="cx"> DragImageRef createDragImageForLink(URL&amp;, const String&amp;, FontRenderingMode)
</span><span class="cx"> {
</span><del>-    return 0;
</del><ins>+    return nullptr;
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformDragImageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/DragImage.h (160151 => 160152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/DragImage.h        2013-12-05 03:05:40 UTC (rev 160151)
+++ trunk/Source/WebCore/platform/DragImage.h        2013-12-05 03:08:40 UTC (rev 160152)
</span><span class="lines">@@ -26,10 +26,11 @@
</span><span class="cx"> #ifndef DragImage_h
</span><span class="cx"> #define DragImage_h
</span><span class="cx"> 
</span><ins>+#include &quot;FloatSize.h&quot;
</ins><span class="cx"> #include &quot;FontRenderingMode.h&quot;
</span><ins>+#include &quot;FrameSnapshotting.h&quot;
</ins><span class="cx"> #include &quot;ImageOrientation.h&quot;
</span><span class="cx"> #include &quot;IntSize.h&quot;
</span><del>-#include &quot;FloatSize.h&quot;
</del><span class="cx"> #include &lt;wtf/Forward.h&gt;
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="lines">@@ -41,38 +42,46 @@
</span><span class="cx"> typedef struct _cairo_surface cairo_surface_t;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-//We need to #define YOffset as it needs to be shared with WebKit
</del><ins>+// We need to #define YOffset as it needs to be shared with WebKit
</ins><span class="cx"> #define DragLabelBorderYOffset 2
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-    class Image;
-    class URL;
</del><ins>+class Frame;
+class Image;
+class IntRect;
+class Node;
+class Range;
+class URL;
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(MAC)
</span><del>-    typedef RetainPtr&lt;NSImage&gt; DragImageRef;
</del><ins>+typedef RetainPtr&lt;NSImage&gt; DragImageRef;
</ins><span class="cx"> #elif PLATFORM(WIN)
</span><del>-    typedef HBITMAP DragImageRef;
</del><ins>+typedef HBITMAP DragImageRef;
</ins><span class="cx"> #elif PLATFORM(GTK) || PLATFORM(NIX)
</span><del>-    typedef cairo_surface_t* DragImageRef;
</del><ins>+typedef cairo_surface_t* DragImageRef;
</ins><span class="cx"> #elif PLATFORM(EFL) || PLATFORM(BLACKBERRY)
</span><del>-    typedef void* DragImageRef;
</del><ins>+typedef void* DragImageRef;
</ins><span class="cx"> #endif
</span><del>-    
-    IntSize dragImageSize(DragImageRef);
-    
-    //These functions should be memory neutral, eg. if they return a newly allocated image, 
-    //they should release the input image.  As a corollary these methods don't guarantee
-    //the input image ref will still be valid after they have been called
-    DragImageRef fitDragImageToMaxSize(DragImageRef image, const IntSize&amp; srcSize, const IntSize&amp; size);
-    DragImageRef scaleDragImage(DragImageRef, FloatSize scale);
-    DragImageRef dissolveDragImageToFraction(DragImageRef image, float delta);
-    
-    DragImageRef createDragImageFromImage(Image*, ImageOrientationDescription);
-    DragImageRef createDragImageIconForCachedImageFilename(const String&amp;);
-    DragImageRef createDragImageForLink(URL&amp;, const String&amp; label, FontRenderingMode);
-    void deleteDragImage(DragImageRef);
</del><ins>+
+IntSize dragImageSize(DragImageRef);
+
+// These functions should be memory neutral, eg. if they return a newly allocated image,
+// they should release the input image. As a corollary these methods don't guarantee
+// the input image ref will still be valid after they have been called.
+DragImageRef fitDragImageToMaxSize(DragImageRef, const IntSize&amp; srcSize, const IntSize&amp; dstSize);
+DragImageRef scaleDragImage(DragImageRef, FloatSize scale);
+DragImageRef dissolveDragImageToFraction(DragImageRef, float delta);
+
+DragImageRef createDragImageFromImage(Image*, ImageOrientationDescription);
+DragImageRef createDragImageIconForCachedImageFilename(const String&amp;);
+
+DragImageRef createDragImageForNode(Frame&amp;, Node&amp;);
+DragImageRef createDragImageForSelection(Frame&amp;, bool forceBlackText = false);
+DragImageRef createDragImageForRange(Frame&amp;, Range&amp;, bool forceBlackText = false);
+DragImageRef createDragImageForImage(Frame&amp;, Node&amp;, IntRect&amp; imageRect, IntRect&amp; elementRect);
+DragImageRef createDragImageForLink(URL&amp;, const String&amp; label, FontRenderingMode);
+void deleteDragImage(DragImageRef);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-
-#endif //!DragImage_h
</del><ins>+#endif // DragImage_h
</ins></span></pre></div>
<a id="trunkSourceWebKitiosChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ios/ChangeLog (160151 => 160152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ios/ChangeLog        2013-12-05 03:05:40 UTC (rev 160151)
+++ trunk/Source/WebKit/ios/ChangeLog        2013-12-05 03:08:40 UTC (rev 160152)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2013-12-04  Brian J. Burg  &lt;burg@cs.washington.edu&gt;
+
+        Consolidate various frame snapshot capabilities.
+        https://bugs.webkit.org/show_bug.cgi?id=124325
+
+        Reviewed by Darin Adler.
+
+        * WebCoreSupport/WebFrameIOS.mm: use new header file.
+
</ins><span class="cx"> 2013-12-04  Andy Estes  &lt;aestes@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [iOS] Upstream build fixes in Source/WebKit/ios/
</span></span></pre></div>
<a id="trunkSourceWebKitiosWebCoreSupportWebFrameIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ios/WebCoreSupport/WebFrameIOS.mm (160151 => 160152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ios/WebCoreSupport/WebFrameIOS.mm        2013-12-05 03:05:40 UTC (rev 160151)
+++ trunk/Source/WebKit/ios/WebCoreSupport/WebFrameIOS.mm        2013-12-05 03:08:40 UTC (rev 160152)
</span><span class="lines">@@ -33,7 +33,7 @@
</span><span class="cx"> #import &lt;WebCore/FloatRect.h&gt;
</span><span class="cx"> #import &lt;WebCore/Frame.h&gt;
</span><span class="cx"> #import &lt;WebCore/FrameSelection.h&gt;
</span><del>-#import &lt;WebCore/FrameSnapshottingMac.h&gt;
</del><ins>+#import &lt;WebCore/FrameSnapshotting.h&gt;
</ins><span class="cx"> #import &lt;WebCore/FrameView.h&gt;
</span><span class="cx"> #import &lt;WebCore/HitTestResult.h&gt;
</span><span class="cx"> #import &lt;WebCore/htmlediting.h&gt;
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (160151 => 160152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2013-12-05 03:05:40 UTC (rev 160151)
+++ trunk/Source/WebKit/mac/ChangeLog        2013-12-05 03:08:40 UTC (rev 160152)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2013-12-04  Brian J. Burg  &lt;burg@cs.washington.edu&gt;
+
+        Consolidate various frame snapshot capabilities.
+        https://bugs.webkit.org/show_bug.cgi?id=124325
+
+        Reviewed by Darin Adler.
+
+        Use new platform-independent methods instead of Mac methods.
+
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLView _selectionDraggingImage]):
+        (-[WebHTMLView selectionImageForcingBlackText:]):
+
</ins><span class="cx"> 2013-12-04  Andy Estes  &lt;aestes@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [iOS] Build projects with $(ARCHS_STANDARD_32_64_BIT)
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebHTMLViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebHTMLView.mm (160151 => 160152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebHTMLView.mm        2013-12-05 03:05:40 UTC (rev 160151)
+++ trunk/Source/WebKit/mac/WebView/WebHTMLView.mm        2013-12-05 03:08:40 UTC (rev 160152)
</span><span class="lines">@@ -85,6 +85,7 @@
</span><span class="cx"> #import &lt;WebCore/DocumentFragment.h&gt;
</span><span class="cx"> #import &lt;WebCore/DocumentMarkerController.h&gt;
</span><span class="cx"> #import &lt;WebCore/DragController.h&gt;
</span><ins>+#import &lt;WebCore/DragImage.h&gt;
</ins><span class="cx"> #import &lt;WebCore/Editor.h&gt;
</span><span class="cx"> #import &lt;WebCore/EditorDeleteAction.h&gt;
</span><span class="cx"> #import &lt;WebCore/Element.h&gt;
</span><span class="lines">@@ -95,7 +96,6 @@
</span><span class="cx"> #import &lt;WebCore/Frame.h&gt;
</span><span class="cx"> #import &lt;WebCore/FrameLoader.h&gt;
</span><span class="cx"> #import &lt;WebCore/FrameSelection.h&gt;
</span><del>-#import &lt;WebCore/FrameSnapshottingMac.h&gt;
</del><span class="cx"> #import &lt;WebCore/FrameView.h&gt;
</span><span class="cx"> #import &lt;WebCore/HTMLConverter.h&gt;
</span><span class="cx"> #import &lt;WebCore/HTMLNames.h&gt;
</span><span class="lines">@@ -1820,7 +1820,12 @@
</span><span class="cx"> {
</span><span class="cx">     if (![self _hasSelection])
</span><span class="cx">         return nil;
</span><del>-    NSImage *dragImage = selectionImage(core([self _frame]));
</del><ins>+
+    Frame* coreFrame = core([self _frame]);
+    if (!coreFrame)
+        return nil;
+
+    NSImage *dragImage = [createDragImageForSelection(*coreFrame).leakRef() autorelease];
</ins><span class="cx">     [dragImage _web_dissolveToFraction:WebDragImageAlpha];
</span><span class="cx">     return dragImage;
</span><span class="cx"> }
</span><span class="lines">@@ -5965,7 +5970,11 @@
</span><span class="cx"> {
</span><span class="cx">     if (![self _hasSelection])
</span><span class="cx">         return nil;
</span><del>-    return selectionImage(core([self _frame]), forceBlackText);
</del><ins>+
+    Frame* coreFrame = core([self _frame]);
+    if (!coreFrame)
+        return nil;
+    return [createDragImageForSelection(*coreFrame, forceBlackText).leakRef() autorelease];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (NSRect)selectionImageRect
</span></span></pre></div>
<a id="trunkSourceWebKitwinChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/ChangeLog (160151 => 160152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/ChangeLog        2013-12-05 03:05:40 UTC (rev 160151)
+++ trunk/Source/WebKit/win/ChangeLog        2013-12-05 03:08:40 UTC (rev 160152)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2013-12-04  Brian J. Burg  &lt;burg@cs.washington.edu&gt;
+
+        Consolidate various frame snapshot capabilities.
+        https://bugs.webkit.org/show_bug.cgi?id=124325
+
+        Reviewed by Darin Adler.
+
+        * DOMCoreClasses.cpp:
+        (DOMElement::renderedImage): use createDragImageForNode.
+
</ins><span class="cx"> 2013-12-03  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: Push Remote Inspector debugging connection management into JavaScriptCore
</span></span></pre></div>
<a id="trunkSourceWebKitwinDOMCoreClassescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/DOMCoreClasses.cpp (160151 => 160152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/DOMCoreClasses.cpp        2013-12-05 03:05:40 UTC (rev 160151)
+++ trunk/Source/WebKit/win/DOMCoreClasses.cpp        2013-12-05 03:08:40 UTC (rev 160152)
</span><span class="lines">@@ -36,10 +36,10 @@
</span><span class="cx"> #include &lt;WebCore/COMPtr.h&gt;
</span><span class="cx"> #include &lt;WebCore/DOMWindow.h&gt;
</span><span class="cx"> #include &lt;WebCore/Document.h&gt;
</span><ins>+#include &lt;WebCore/DragImage.h&gt;
</ins><span class="cx"> #include &lt;WebCore/Element.h&gt;
</span><span class="cx"> #include &lt;WebCore/Font.h&gt;
</span><span class="cx"> #include &lt;WebCore/Frame.h&gt;
</span><del>-#include &lt;WebCore/SimpleFontData.h&gt;
</del><span class="cx"> #include &lt;WebCore/HTMLFormElement.h&gt;
</span><span class="cx"> #include &lt;WebCore/HTMLInputElement.h&gt;
</span><span class="cx"> #include &lt;WebCore/HTMLNames.h&gt;
</span><span class="lines">@@ -49,6 +49,7 @@
</span><span class="cx"> #include &lt;WebCore/NodeList.h&gt;
</span><span class="cx"> #include &lt;WebCore/RenderElement.h&gt;
</span><span class="cx"> #include &lt;WebCore/RenderTreeAsText.h&gt;
</span><ins>+#include &lt;WebCore/SimpleFontData.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> #include &lt;initguid.h&gt;
</span><span class="cx"> // {3B0C0EFF-478B-4b0b-8290-D2321E08E23E}
</span><span class="lines">@@ -1279,7 +1280,7 @@
</span><span class="cx">     if (!frame)
</span><span class="cx">         return E_FAIL;
</span><span class="cx"> 
</span><del>-    *image = frame-&gt;nodeImage(m_element);
</del><ins>+    *image = createDragImageForNode(*frame, *m_element);
</ins><span class="cx">     if (!*image)
</span><span class="cx">         return E_FAIL;
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>