<!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>[214111] 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/214111">214111</a></dd>
<dt>Author</dt> <dd>wenson_hsieh@apple.com</dd>
<dt>Date</dt> <dd>2017-03-17 12:30:43 -0700 (Fri, 17 Mar 2017)</dd>
</dl>
<h3>Log Message</h3>
<pre>[WK1] Support animated transitions when performing a data interaction operation
https://bugs.webkit.org/show_bug.cgi?id=169805
<rdar://problem/31045767>
Reviewed by Beth Dakin and Megan Gardner.
Source/WebCore:
When performing a snapshot excluding the current selection, use ScrollableArea::visibleContentRect to compute
the visible content rect rather than FrameView::visualViewportRect. In WebKit1, the latter will return the
entire content view's bounds.
* page/TextIndicator.cpp:
(WebCore::takeSnapshots):
Source/WebKit/mac:
Adds WebKit1 support for animated transitions when performing a data interaction operation. See per-method changes
for more details.
* DOM/DOMElement.h:
* DOM/DOMElement.mm:
(-[DOMElement boundsInRootViewSpace]):
Introduce -[DOMElement boundsInRootViewSpace], which returns the bounds of the element in root view coordinates.
* WebCoreSupport/WebDragClient.h:
(): Deleted.
* WebCoreSupport/WebDragClient.mm:
(WebDragClient::didConcludeEditDrag):
Add boilerplate plumbing.
* WebView/WebView.mm:
(-[WebUITextIndicatorData initWithImage:textIndicatorData:scale:]):
Add contentImageWithoutSelection and contentImageWithoutSelectionRectInRootViewCoordinates to WebUITextIndicatorData.
(floatRectsForCGRectArray):
(-[WebView _createImageWithPlatterForImage:boundingRect:contentScaleFactor:clippingRects:]):
Introduces a SPI helper method in WebView that clients can use to generate an image of a text platter given an
image of some text, as well as clipping rects to apply to the image.
(-[WebView _dataOperationTextIndicator]):
Add SPI to fetch the text indicator used to drive animations for the current data operation.
(-[WebView _didConcludeEditDataInteraction]):
* WebView/WebViewData.h:
* WebView/WebViewInternal.h:
* WebView/WebViewPrivate.h:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepageTextIndicatorcpp">trunk/Source/WebCore/page/TextIndicator.cpp</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacDOMDOMElementh">trunk/Source/WebKit/mac/DOM/DOMElement.h</a></li>
<li><a href="#trunkSourceWebKitmacDOMDOMElementmm">trunk/Source/WebKit/mac/DOM/DOMElement.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebDragClienth">trunk/Source/WebKit/mac/WebCoreSupport/WebDragClient.h</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebDragClientmm">trunk/Source/WebKit/mac/WebCoreSupport/WebDragClient.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebViewmm">trunk/Source/WebKit/mac/WebView/WebView.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebViewDatah">trunk/Source/WebKit/mac/WebView/WebViewData.h</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebViewInternalh">trunk/Source/WebKit/mac/WebView/WebViewInternal.h</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebViewPrivateh">trunk/Source/WebKit/mac/WebView/WebViewPrivate.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (214110 => 214111)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-03-17 18:54:47 UTC (rev 214110)
+++ trunk/Source/WebCore/ChangeLog        2017-03-17 19:30:43 UTC (rev 214111)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2017-03-17 Wenson Hsieh <wenson_hsieh@apple.com>
+
+ [WK1] Support animated transitions when performing a data interaction operation
+ https://bugs.webkit.org/show_bug.cgi?id=169805
+ <rdar://problem/31045767>
+
+ Reviewed by Beth Dakin and Megan Gardner.
+
+ When performing a snapshot excluding the current selection, use ScrollableArea::visibleContentRect to compute
+ the visible content rect rather than FrameView::visualViewportRect. In WebKit1, the latter will return the
+ entire content view's bounds.
+
+ * page/TextIndicator.cpp:
+ (WebCore::takeSnapshots):
+
</ins><span class="cx"> 2017-03-17 Dave Hyatt <hyatt@apple.com>
</span><span class="cx">
</span><span class="cx"> Initial letter does not paginate properly.
</span></span></pre></div>
<a id="trunkSourceWebCorepageTextIndicatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/TextIndicator.cpp (214110 => 214111)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/TextIndicator.cpp        2017-03-17 18:54:47 UTC (rev 214110)
+++ trunk/Source/WebCore/page/TextIndicator.cpp        2017-03-17 19:30:43 UTC (rev 214111)
</span><span class="lines">@@ -175,7 +175,7 @@
</span><span class="cx">
</span><span class="cx"> if (data.options & TextIndicatorOptionIncludeSnapshotOfAllVisibleContentWithoutSelection) {
</span><span class="cx"> float snapshotScaleFactor;
</span><del>- auto snapshotRect = enclosingIntRect(frame.view()->visualViewportRect());
</del><ins>+ auto snapshotRect = frame.view()->visibleContentRect();
</ins><span class="cx"> data.contentImageWithoutSelection = takeSnapshot(frame, snapshotRect, SnapshotOptionsPaintEverythingExcludingSelection, snapshotScaleFactor, { });
</span><span class="cx"> data.contentImageWithoutSelectionRectInRootViewCoordinates = frame.view()->contentsToRootView(snapshotRect);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (214110 => 214111)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2017-03-17 18:54:47 UTC (rev 214110)
+++ trunk/Source/WebKit/mac/ChangeLog        2017-03-17 19:30:43 UTC (rev 214111)
</span><span class="lines">@@ -1,3 +1,47 @@
</span><ins>+2017-03-17 Wenson Hsieh <wenson_hsieh@apple.com>
+
+ [WK1] Support animated transitions when performing a data interaction operation
+ https://bugs.webkit.org/show_bug.cgi?id=169805
+ <rdar://problem/31045767>
+
+ Reviewed by Beth Dakin and Megan Gardner.
+
+ Adds WebKit1 support for animated transitions when performing a data interaction operation. See per-method changes
+ for more details.
+
+ * DOM/DOMElement.h:
+ * DOM/DOMElement.mm:
+ (-[DOMElement boundsInRootViewSpace]):
+
+ Introduce -[DOMElement boundsInRootViewSpace], which returns the bounds of the element in root view coordinates.
+
+ * WebCoreSupport/WebDragClient.h:
+ (): Deleted.
+ * WebCoreSupport/WebDragClient.mm:
+ (WebDragClient::didConcludeEditDrag):
+
+ Add boilerplate plumbing.
+
+ * WebView/WebView.mm:
+ (-[WebUITextIndicatorData initWithImage:textIndicatorData:scale:]):
+
+ Add contentImageWithoutSelection and contentImageWithoutSelectionRectInRootViewCoordinates to WebUITextIndicatorData.
+
+ (floatRectsForCGRectArray):
+ (-[WebView _createImageWithPlatterForImage:boundingRect:contentScaleFactor:clippingRects:]):
+
+ Introduces a SPI helper method in WebView that clients can use to generate an image of a text platter given an
+ image of some text, as well as clipping rects to apply to the image.
+
+ (-[WebView _dataOperationTextIndicator]):
+
+ Add SPI to fetch the text indicator used to drive animations for the current data operation.
+
+ (-[WebView _didConcludeEditDataInteraction]):
+ * WebView/WebViewData.h:
+ * WebView/WebViewInternal.h:
+ * WebView/WebViewPrivate.h:
+
</ins><span class="cx"> 2017-03-16 Simon Fraser <simon.fraser@apple.com>
</span><span class="cx">
</span><span class="cx"> Improve the system tracing points
</span></span></pre></div>
<a id="trunkSourceWebKitmacDOMDOMElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/DOM/DOMElement.h (214110 => 214111)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/DOM/DOMElement.h        2017-03-17 18:54:47 UTC (rev 214110)
+++ trunk/Source/WebKit/mac/DOM/DOMElement.h        2017-03-17 19:30:43 UTC (rev 214111)
</span><span class="lines">@@ -25,6 +25,10 @@
</span><span class="cx">
</span><span class="cx"> #import <WebKitLegacy/DOMNode.h>
</span><span class="cx">
</span><ins>+#if TARGET_OS_IPHONE
+#import <CoreGraphics/CoreGraphics.h>
+#endif
+
</ins><span class="cx"> @class DOMAttr;
</span><span class="cx"> @class DOMCSSStyleDeclaration;
</span><span class="cx"> @class DOMElement;
</span><span class="lines">@@ -62,6 +66,10 @@
</span><span class="cx"> @property (readonly, strong) DOMElement *lastElementChild WEBKIT_AVAILABLE_MAC(10_6);
</span><span class="cx"> @property (readonly) unsigned childElementCount WEBKIT_AVAILABLE_MAC(10_6);
</span><span class="cx">
</span><ins>+#if TARGET_OS_IPHONE
+@property (readonly) CGRect boundsInRootViewSpace;
+#endif
+
</ins><span class="cx"> - (NSString *)getAttribute:(NSString *)name;
</span><span class="cx"> - (void)setAttribute:(NSString *)name value:(NSString *)value WEBKIT_AVAILABLE_MAC(10_5);
</span><span class="cx"> - (void)removeAttribute:(NSString *)name;
</span></span></pre></div>
<a id="trunkSourceWebKitmacDOMDOMElementmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/DOM/DOMElement.mm (214110 => 214111)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/DOM/DOMElement.mm        2017-03-17 18:54:47 UTC (rev 214110)
+++ trunk/Source/WebKit/mac/DOM/DOMElement.mm        2017-03-17 19:30:43 UTC (rev 214111)
</span><span class="lines">@@ -269,6 +269,15 @@
</span><span class="cx"> return unwrap(*self).childElementCount();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+- (CGRect)boundsInRootViewSpace
+{
+ WebCore::JSMainThreadNullState state;
+ auto bounds = unwrap(*self).boundsInRootViewSpace();
+ return CGRectMake(bounds.x(), bounds.y(), bounds.width(), bounds.height());
+}
+#endif
+
</ins><span class="cx"> - (NSString *)getAttribute:(NSString *)name
</span><span class="cx"> {
</span><span class="cx"> WebCore::JSMainThreadNullState state;
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebDragClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebDragClient.h (214110 => 214111)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebDragClient.h        2017-03-17 18:54:47 UTC (rev 214110)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebDragClient.h        2017-03-17 19:30:43 UTC (rev 214111)
</span><span class="lines">@@ -48,7 +48,7 @@
</span><span class="cx"> #if ENABLE(ATTACHMENT_ELEMENT)
</span><span class="cx"> void declareAndWriteAttachment(const String& pasteboardName, WebCore::Element&, const WebCore::URL&, const String& path, WebCore::Frame*) override;
</span><span class="cx"> #endif
</span><del>- void didConcludeEditDrag() override { }
</del><ins>+ void didConcludeEditDrag() override;
</ins><span class="cx"> private:
</span><span class="cx"> WebView* m_webView;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebDragClientmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebDragClient.mm (214110 => 214111)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebDragClient.mm        2017-03-17 18:54:47 UTC (rev 214110)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebDragClient.mm        2017-03-17 19:30:43 UTC (rev 214111)
</span><span class="lines">@@ -76,6 +76,10 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void WebDragClient::didConcludeEditDrag()
+{
+}
+
</ins><span class="cx"> static WebHTMLView *getTopHTMLView(Frame* frame)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(frame);
</span><span class="lines">@@ -185,6 +189,11 @@
</span><span class="cx"> {
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><ins>+
+void WebDragClient::didConcludeEditDrag()
+{
+}
+
</ins><span class="cx"> WebCore::DragDestinationAction WebDragClient::actionMaskForDrag(const WebCore::DragData&)
</span><span class="cx"> {
</span><span class="cx"> return DragDestinationActionNone;
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (214110 => 214111)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebView.mm        2017-03-17 18:54:47 UTC (rev 214110)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm        2017-03-17 19:30:43 UTC (rev 214111)
</span><span class="lines">@@ -176,6 +176,7 @@
</span><span class="cx"> #import <WebCore/PageCache.h>
</span><span class="cx"> #import <WebCore/PageConfiguration.h>
</span><span class="cx"> #import <WebCore/PageGroup.h>
</span><ins>+#import <WebCore/PathUtilities.h>
</ins><span class="cx"> #import <WebCore/PlatformEventFactoryMac.h>
</span><span class="cx"> #import <WebCore/ProgressTracker.h>
</span><span class="cx"> #import <WebCore/RenderView.h>
</span><span class="lines">@@ -320,9 +321,17 @@
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> #if ENABLE(DATA_INTERACTION)
</span><ins>+#import <UIKit/UIBezierPath.h>
+#import <UIKit/UIColor.h>
</ins><span class="cx"> #import <UIKit/UIImage.h>
</span><span class="cx"> SOFT_LINK_FRAMEWORK(UIKit)
</span><ins>+SOFT_LINK_CLASS(UIKit, UIBezierPath)
+SOFT_LINK_CLASS(UIKit, UIColor)
</ins><span class="cx"> SOFT_LINK_CLASS(UIKit, UIImage)
</span><ins>+SOFT_LINK(UIKit, UIGraphicsBeginImageContextWithOptions, void, (CGSize size, BOOL opaque, CGFloat scale), (size, opaque, scale))
+SOFT_LINK(UIKit, UIGraphicsGetCurrentContext, CGContextRef, (void), ())
+SOFT_LINK(UIKit, UIGraphicsGetImageFromCurrentImageContext, UIImage *, (void), ())
+SOFT_LINK(UIKit, UIGraphicsEndImageContext, void, (void), ())
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> #if HAVE(TOUCH_BAR) && ENABLE(WEB_PLAYBACK_CONTROLS_MANAGER)
</span><span class="lines">@@ -626,6 +635,8 @@
</span><span class="cx"> @synthesize textBoundingRectInRootViewCoordinates=_textBoundingRectInRootViewCoordinates;
</span><span class="cx"> @synthesize textRectsInBoundingRectCoordinates=_textRectsInBoundingRectCoordinates;
</span><span class="cx"> @synthesize contentImageWithHighlight=_contentImageWithHighlight;
</span><ins>+@synthesize contentImageWithoutSelection=_contentImageWithoutSelection;
+@synthesize contentImageWithoutSelectionRectInRootViewCoordinates=_contentImageWithoutSelectionRectInRootViewCoordinates;
</ins><span class="cx"> @synthesize contentImage=_contentImage;
</span><span class="cx">
</span><span class="cx"> @end
</span><span class="lines">@@ -632,7 +643,7 @@
</span><span class="cx">
</span><span class="cx"> @implementation WebUITextIndicatorData (WebUITextIndicatorInternal)
</span><span class="cx">
</span><del>-- (WebUITextIndicatorData *)initWithImage:(CGImageRef)image textIndicatorData:(WebCore::TextIndicatorData &)indicatorData scale:(CGFloat)scale
</del><ins>+- (WebUITextIndicatorData *)initWithImage:(CGImageRef)image textIndicatorData:(const TextIndicatorData&)indicatorData scale:(CGFloat)scale
</ins><span class="cx"> {
</span><span class="cx"> if (!(self = [super init]))
</span><span class="cx"> return nil;
</span><span class="lines">@@ -649,8 +660,16 @@
</span><span class="cx"> if (indicatorData.contentImageWithHighlight)
</span><span class="cx"> _contentImageWithHighlight = [[[getUIImageClass() alloc] initWithCGImage:indicatorData.contentImageWithHighlight.get()->nativeImage().get() scale:scale orientation:UIImageOrientationDownMirrored] retain];
</span><span class="cx"> if (indicatorData.contentImage)
</span><del>- _contentImage = [[[getUIImageClass() alloc] initWithCGImage:indicatorData.contentImage.get()->nativeImage().get() scale:scale orientation:UIImageOrientationDownMirrored] retain];
-
</del><ins>+ _contentImage = [[[getUIImageClass() alloc] initWithCGImage:indicatorData.contentImage.get()->nativeImage().get() scale:scale orientation:UIImageOrientationUp] retain];
+
+ if (indicatorData.contentImageWithoutSelection) {
+ auto nativeImage = indicatorData.contentImageWithoutSelection.get()->nativeImage();
+ if (nativeImage) {
+ _contentImageWithoutSelection = [[[getUIImageClass() alloc] initWithCGImage:nativeImage.get() scale:scale orientation:UIImageOrientationUp] retain];
+ _contentImageWithoutSelectionRectInRootViewCoordinates = indicatorData.contentImageWithoutSelectionRectInRootViewCoordinates;
+ }
+ }
+
</ins><span class="cx"> return self;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -669,6 +688,7 @@
</span><span class="cx"> [_dataInteractionImage release];
</span><span class="cx"> [_textRectsInBoundingRectCoordinates release];
</span><span class="cx"> [_contentImageWithHighlight release];
</span><ins>+ [_contentImageWithoutSelection release];
</ins><span class="cx"> [_contentImage release];
</span><span class="cx">
</span><span class="cx"> [super dealloc];
</span><span class="lines">@@ -1795,11 +1815,62 @@
</span><span class="cx"> _private->textIndicatorData = [[[WebUITextIndicatorData alloc] initWithImage:image scale:_private->page->deviceScaleFactor()] retain];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+- (WebUITextIndicatorData *)_dataOperationTextIndicator
+{
+ return _private->dataOperationTextIndicator.get();
+}
+
</ins><span class="cx"> - (WebUITextIndicatorData *)_getDataInteractionData
</span><span class="cx"> {
</span><span class="cx"> return _private->textIndicatorData;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static Vector<FloatRect> floatRectsForCGRectArray(NSArray<NSValue *> *rectValues)
+{
+ Vector<FloatRect> rects;
+ for (NSValue *rectValue in rectValues)
+ rects.append(rectValue.CGRectValue);
+ return rects;
+}
+
+- (UIImage *)_createImageWithPlatterForImage:(UIImage *)image boundingRect:(CGRect)boundingRect contentScaleFactor:(CGFloat)contentScaleFactor clippingRects:(NSArray<NSValue *> *)clippingRects
+{
+ if (!_private->page)
+ return nil;
+
+ if (!image)
+ return nil;
+
+ CGFloat imageScaleFactor = contentScaleFactor / _private->page->deviceScaleFactor();
+ CGRect imagePaintBounds = CGRectMake(0, 0, CGRectGetWidth(boundingRect) * imageScaleFactor, CGRectGetHeight(boundingRect) * imageScaleFactor);
+ UIGraphicsBeginImageContextWithOptions(imagePaintBounds.size, NO, _private->page->deviceScaleFactor());
+ CGContextRef newContext = UIGraphicsGetCurrentContext();
+
+ auto scaledClippingRects = floatRectsForCGRectArray(clippingRects);
+ for (auto& textBoundingRect : scaledClippingRects)
+ textBoundingRect.scale(imageScaleFactor);
+
+ if (!scaledClippingRects.isEmpty()) {
+ auto webcorePath = PathUtilities::pathWithShrinkWrappedRects(scaledClippingRects, 6 * imageScaleFactor);
+ [[getUIBezierPathClass() bezierPathWithCGPath:webcorePath.ensurePlatformPath()] addClip];
+ }
+
+ // FIXME: This should match the background color of the text, or if the background cannot be captured as a single color, we should fall back
+ // to a default representation, e.g. black text on a white background.
+ CGContextSetFillColorWithColor(newContext, [[getUIColorClass() whiteColor] CGColor]);
+ for (auto textBoundingRect : scaledClippingRects)
+ CGContextFillRect(newContext, textBoundingRect);
+
+ CGContextTranslateCTM(newContext, 0, CGRectGetHeight(imagePaintBounds));
+ CGContextScaleCTM(newContext, 1, -1);
+ CGContextDrawImage(newContext, imagePaintBounds, image.CGImage);
+
+ UIImage *previewImage = UIGraphicsGetImageFromCurrentImageContext();
+ UIGraphicsEndImageContext();
+
+ return [previewImage retain];
+}
+
</ins><span class="cx"> #if USE(APPLE_INTERNAL_SDK) && __has_include(<WebKitAdditions/WebViewAdditions.mm>)
</span><span class="cx"> #include <WebKitAdditions/WebViewAdditions.mm>
</span><span class="cx"> #endif
</span><span class="lines">@@ -1834,6 +1905,19 @@
</span><span class="cx"> - (void)_endedDataInteraction:(CGPoint)clientPosition global:(CGPoint)globalPosition
</span><span class="cx"> {
</span><span class="cx"> }
</span><ins>+
+- (WebUITextIndicatorData *)_dataOperationTextIndicator
+{
+ return nil;
+}
+
+#if PLATFORM(IOS)
+- (UIImage *)_createImageWithPlatterForImage:(UIImage *)image boundingRect:(CGRect)boundingRect contentScaleFactor:(CGFloat)contentScaleFactor clippingRects:(NSArray<NSValue *> *)clippingRects
+{
+ return nil;
+}
+#endif
+
</ins><span class="cx"> #endif // ENABLE(DATA_INTERACTION) && defined(__cplusplus)
</span><span class="cx">
</span><span class="cx"> static NSMutableSet *knownPluginMIMETypes()
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebViewData.h (214110 => 214111)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebViewData.h        2017-03-17 18:54:47 UTC (rev 214110)
+++ trunk/Source/WebKit/mac/WebView/WebViewData.h        2017-03-17 19:30:43 UTC (rev 214111)
</span><span class="lines">@@ -288,6 +288,7 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(DATA_INTERACTION)
</span><span class="cx"> WebUITextIndicatorData *textIndicatorData;
</span><ins>+ RetainPtr<WebUITextIndicatorData> dataOperationTextIndicator;
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewInternalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebViewInternal.h (214110 => 214111)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebViewInternal.h        2017-03-17 18:54:47 UTC (rev 214110)
+++ trunk/Source/WebKit/mac/WebView/WebViewInternal.h        2017-03-17 19:30:43 UTC (rev 214111)
</span><span class="lines">@@ -92,7 +92,7 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(DATA_INTERACTION) && defined(__cplusplus)
</span><span class="cx"> @interface WebUITextIndicatorData (WebUITextIndicatorInternal)
</span><del>-- (WebUITextIndicatorData *)initWithImage:(CGImageRef)image textIndicatorData:(WebCore::TextIndicatorData&)indicatorData scale:(CGFloat)scale;
</del><ins>+- (WebUITextIndicatorData *)initWithImage:(CGImageRef)image textIndicatorData:(const WebCore::TextIndicatorData&)indicatorData scale:(CGFloat)scale;
</ins><span class="cx"> - (WebUITextIndicatorData *)initWithImage:(CGImageRef)image scale:(CGFloat)scale;
</span><span class="cx"> @end
</span><span class="cx"> #endif
</span><span class="lines">@@ -258,6 +258,7 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(DATA_INTERACTION) && defined(__cplusplus)
</span><span class="cx"> - (void)_setDataInteractionData:(CGImageRef)image textIndicator:(std::optional<WebCore::TextIndicatorData>)textIndicator atClientPosition:(CGPoint)clientPosition anchorPoint:(CGPoint)anchorPoint action:(uint64_t)action;
</span><ins>+- (void)_didConcludeEditDataInteraction;
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> - (void)_preferencesChanged:(WebPreferences *)preferences;
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebViewPrivate.h (214110 => 214111)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebViewPrivate.h        2017-03-17 18:54:47 UTC (rev 214110)
+++ trunk/Source/WebKit/mac/WebView/WebViewPrivate.h        2017-03-17 19:30:43 UTC (rev 214111)
</span><span class="lines">@@ -191,7 +191,8 @@
</span><span class="cx"> @property (nonatomic, assign) CGFloat contentImageScaleFactor;
</span><span class="cx"> @property (nonatomic, retain) UIImage *contentImageWithHighlight;
</span><span class="cx"> @property (nonatomic, retain) UIImage *contentImage;
</span><del>-
</del><ins>+@property (nonatomic, retain) UIImage *contentImageWithoutSelection;
+@property (nonatomic, assign) CGRect contentImageWithoutSelectionRectInRootViewCoordinates;
</ins><span class="cx"> @end
</span><span class="cx">
</span><span class="cx"> #if !TARGET_OS_IPHONE
</span><span class="lines">@@ -467,6 +468,7 @@
</span><span class="cx">
</span><span class="cx"> - (BOOL)_requestStartDataInteraction:(CGPoint)clientPosition globalPosition:(CGPoint)globalPosition;
</span><span class="cx"> - (WebUITextIndicatorData *)_getDataInteractionData;
</span><ins>+@property (nonatomic, readonly, strong, getter=_dataOperationTextIndicator) WebUITextIndicatorData *dataOperationTextIndicator;
</ins><span class="cx"> - (uint64_t)_enteredDataInteraction:(id)dataInteraction client:(CGPoint)clientPosition global:(CGPoint)globalPosition operation:(uint64_t)operation;
</span><span class="cx"> - (uint64_t)_updatedDataInteraction:(id)dataInteraction client:(CGPoint)clientPosition global:(CGPoint)globalPosition operation:(uint64_t)operation;
</span><span class="cx"> - (void)_exitedDataInteraction:(id)dataInteraction client:(CGPoint)clientPosition global:(CGPoint)globalPosition operation:(uint64_t)operation;
</span><span class="lines">@@ -474,6 +476,7 @@
</span><span class="cx"> - (void)_endedDataInteraction:(CGPoint)clientPosition global:(CGPoint)clientPosition;
</span><span class="cx">
</span><span class="cx"> #if TARGET_OS_IPHONE
</span><ins>+- (UIImage *)_createImageWithPlatterForImage:(UIImage *)image boundingRect:(CGRect)boundingRect contentScaleFactor:(CGFloat)contentScaleFactor clippingRects:(NSArray<NSValue *> *)clippingRects;
</ins><span class="cx"> // Deprecated. Use -[WebDataSource _quickLookContent] instead.
</span><span class="cx"> - (NSDictionary *)quickLookContentForURL:(NSURL *)url;
</span><span class="cx"> #endif
</span></span></pre>
</div>
</div>
</body>
</html>