<!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>[176418] trunk/Source/WebKit2</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/176418">176418</a></dd>
<dt>Author</dt> <dd>timothy_horton@apple.com</dd>
<dt>Date</dt> <dd>2014-11-20 14:26:10 -0800 (Thu, 20 Nov 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>TextIndicator should have getters for TextIndicator::Data properties
https://bugs.webkit.org/show_bug.cgi?id=138920

Reviewed by Beth Dakin.

Instead of having clients reach into the data(), add getters.
Remove frameRect(), which is identical to the textBoundingRectInWindowCoordinates getter.
Remove declarations for draw/drawContentImage, which were already removed.

* Shared/TextIndicator.cpp:
(WebKit::TextIndicator::frameRect): Deleted.
* Shared/TextIndicator.h:
(WebKit::TextIndicator::textBoundingRectInWindowCoordinates):
(WebKit::TextIndicator::textRectsInBoundingRectCoordinates):
(WebKit::TextIndicator::contentImageScaleFactor):
(WebKit::TextIndicator::contentImageWithHighlight):
(WebKit::TextIndicator::contentImage):
* UIProcess/mac/TextIndicatorWindow.mm:
(-[WKTextIndicatorView initWithFrame:textIndicator:margin:]):
(-[WKTextIndicatorView presentWithCompletionHandler:]):
(WebKit::TextIndicatorWindow::setTextIndicator):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedTextIndicatorcpp">trunk/Source/WebKit2/Shared/TextIndicator.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedTextIndicatorh">trunk/Source/WebKit2/Shared/TextIndicator.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacTextIndicatorWindowmm">trunk/Source/WebKit2/UIProcess/mac/TextIndicatorWindow.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (176417 => 176418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-11-20 22:23:30 UTC (rev 176417)
+++ trunk/Source/WebKit2/ChangeLog        2014-11-20 22:26:10 UTC (rev 176418)
</span><span class="lines">@@ -1,5 +1,29 @@
</span><span class="cx"> 2014-11-20  Tim Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        TextIndicator should have getters for TextIndicator::Data properties
+        https://bugs.webkit.org/show_bug.cgi?id=138920
+
+        Reviewed by Beth Dakin.
+
+        Instead of having clients reach into the data(), add getters.
+        Remove frameRect(), which is identical to the textBoundingRectInWindowCoordinates getter.
+        Remove declarations for draw/drawContentImage, which were already removed.
+
+        * Shared/TextIndicator.cpp:
+        (WebKit::TextIndicator::frameRect): Deleted.
+        * Shared/TextIndicator.h:
+        (WebKit::TextIndicator::textBoundingRectInWindowCoordinates):
+        (WebKit::TextIndicator::textRectsInBoundingRectCoordinates):
+        (WebKit::TextIndicator::contentImageScaleFactor):
+        (WebKit::TextIndicator::contentImageWithHighlight):
+        (WebKit::TextIndicator::contentImage):
+        * UIProcess/mac/TextIndicatorWindow.mm:
+        (-[WKTextIndicatorView initWithFrame:textIndicator:margin:]):
+        (-[WKTextIndicatorView presentWithCompletionHandler:]):
+        (WebKit::TextIndicatorWindow::setTextIndicator):
+
+2014-11-20  Tim Horton  &lt;timothy_horton@apple.com&gt;
+
</ins><span class="cx">         Cancel DataDetectors menu earlier if we know it can't be presented
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=138922
</span><span class="cx">         &lt;rdar://problem/18950441&gt;
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedTextIndicatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/TextIndicator.cpp (176417 => 176418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/TextIndicator.cpp        2014-11-20 22:23:30 UTC (rev 176417)
+++ trunk/Source/WebKit2/Shared/TextIndicator.cpp        2014-11-20 22:26:10 UTC (rev 176418)
</span><span class="lines">@@ -211,11 +211,6 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-FloatRect TextIndicator::frameRect() const
-{
-    return m_data.textBoundingRectInWindowCoordinates;
-}
-
</del><span class="cx"> void TextIndicator::Data::encode(IPC::ArgumentEncoder&amp; encoder) const
</span><span class="cx"> {
</span><span class="cx">     encoder &lt;&lt; selectionRectInWindowCoordinates;
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedTextIndicatorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/TextIndicator.h (176417 => 176418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/TextIndicator.h        2014-11-20 22:23:30 UTC (rev 176417)
+++ trunk/Source/WebKit2/Shared/TextIndicator.h        2014-11-20 22:26:10 UTC (rev 176418)
</span><span class="lines">@@ -67,7 +67,6 @@
</span><span class="cx">         float contentImageScaleFactor;
</span><span class="cx">         RefPtr&lt;ShareableBitmap&gt; contentImageWithHighlight;
</span><span class="cx">         RefPtr&lt;ShareableBitmap&gt; contentImage;
</span><del>-
</del><span class="cx">         PresentationTransition presentationTransition;
</span><span class="cx"> 
</span><span class="cx">         void encode(IPC::ArgumentEncoder&amp;) const;
</span><span class="lines">@@ -81,20 +80,20 @@
</span><span class="cx">     ~TextIndicator();
</span><span class="cx"> 
</span><span class="cx">     WebCore::FloatRect selectionRectInWindowCoordinates() const { return m_data.selectionRectInWindowCoordinates; }
</span><del>-
</del><ins>+    WebCore::FloatRect textBoundingRectInWindowCoordinates() const { return m_data.textBoundingRectInWindowCoordinates; }
+    const Vector&lt;WebCore::FloatRect&gt;&amp; textRectsInBoundingRectCoordinates() const { return m_data.textRectsInBoundingRectCoordinates; }
+    float contentImageScaleFactor() const { return m_data.contentImageScaleFactor; }
+    ShareableBitmap *contentImageWithHighlight() const { return m_data.contentImageWithHighlight.get(); }
+    ShareableBitmap *contentImage() const { return m_data.contentImage.get(); }
</ins><span class="cx">     PresentationTransition presentationTransition() const { return m_data.presentationTransition; }
</span><ins>+
</ins><span class="cx">     void setPresentationTransition(PresentationTransition transition) { m_data.presentationTransition = transition; }
</span><span class="cx"> 
</span><del>-    WebCore::FloatRect frameRect() const;
</del><span class="cx">     Data data() const { return m_data; }
</span><span class="cx"> 
</span><del>-    void draw(WebCore::GraphicsContext&amp;, const WebCore::IntRect&amp; dirtyRect);
-
</del><span class="cx"> private:
</span><span class="cx">     TextIndicator(const TextIndicator::Data&amp;);
</span><span class="cx"> 
</span><del>-    void drawContentImage(WebCore::GraphicsContext&amp;, WebCore::FloatRect textRect);
-
</del><span class="cx">     Data m_data;
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacTextIndicatorWindowmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/TextIndicatorWindow.mm (176417 => 176418)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/TextIndicatorWindow.mm        2014-11-20 22:23:30 UTC (rev 176417)
+++ trunk/Source/WebKit2/UIProcess/mac/TextIndicatorWindow.mm        2014-11-20 22:26:10 UTC (rev 176418)
</span><span class="lines">@@ -92,15 +92,15 @@
</span><span class="cx">     self.wantsLayer = YES;
</span><span class="cx">     self.layer.anchorPoint = CGPointZero;
</span><span class="cx"> 
</span><del>-    bool wantsCrossfade = _textIndicator-&gt;data().presentationTransition == WebKit::TextIndicator::PresentationTransition::BounceAndCrossfade;
</del><ins>+    bool wantsCrossfade = _textIndicator-&gt;presentationTransition() == WebKit::TextIndicator::PresentationTransition::BounceAndCrossfade;
</ins><span class="cx"> 
</span><del>-    FloatSize contentsImageLogicalSize = _textIndicator-&gt;data().contentImage-&gt;size();
-    contentsImageLogicalSize.scale(1 / _textIndicator-&gt;data().contentImageScaleFactor);
</del><ins>+    FloatSize contentsImageLogicalSize = _textIndicator-&gt;contentImage()-&gt;size();
+    contentsImageLogicalSize.scale(1 / _textIndicator-&gt;contentImageScaleFactor());
</ins><span class="cx">     RetainPtr&lt;CGImageRef&gt; contentsImage;
</span><span class="cx">     if (wantsCrossfade)
</span><del>-        contentsImage = _textIndicator-&gt;data().contentImageWithHighlight-&gt;makeCGImage();
</del><ins>+        contentsImage = _textIndicator-&gt;contentImageWithHighlight()-&gt;makeCGImage();
</ins><span class="cx">     else
</span><del>-        contentsImage = _textIndicator-&gt;data().contentImage-&gt;makeCGImage();
</del><ins>+        contentsImage = _textIndicator-&gt;contentImage()-&gt;makeCGImage();
</ins><span class="cx"> 
</span><span class="cx">     RetainPtr&lt;NSMutableArray&gt; bounceLayers = adoptNS([[NSMutableArray alloc] init]);
</span><span class="cx"> 
</span><span class="lines">@@ -112,7 +112,7 @@
</span><span class="cx">     RetainPtr&lt;CGColorRef&gt; gradientDarkColor = [NSColor colorWithDeviceRed:.929 green:.8 blue:0 alpha:1].CGColor;
</span><span class="cx">     RetainPtr&lt;CGColorRef&gt; gradientLightColor = [NSColor colorWithDeviceRed:.949 green:.937 blue:0 alpha:1].CGColor;
</span><span class="cx"> 
</span><del>-    for (auto&amp; textRect : _textIndicator-&gt;data().textRectsInBoundingRectCoordinates) {
</del><ins>+    for (auto&amp; textRect : _textIndicator-&gt;textRectsInBoundingRectCoordinates()) {
</ins><span class="cx">         FloatRect bounceLayerRect = textRect;
</span><span class="cx">         bounceLayerRect.move(_margin.width, _margin.height);
</span><span class="cx">         bounceLayerRect.inflateX(horizontalBorder);
</span><span class="lines">@@ -172,10 +172,10 @@
</span><span class="cx">         [textLayer setContents:(id)contentsImage.get()];
</span><span class="cx"> 
</span><span class="cx">         FloatRect imageRect = textRect;
</span><del>-        imageRect.move(_textIndicator-&gt;data().textBoundingRectInWindowCoordinates.location() - _textIndicator-&gt;data().selectionRectInWindowCoordinates.location());
</del><ins>+        imageRect.move(_textIndicator-&gt;textBoundingRectInWindowCoordinates().location() - _textIndicator-&gt;selectionRectInWindowCoordinates().location());
</ins><span class="cx">         [textLayer setContentsRect:CGRectMake(imageRect.x() / contentsImageLogicalSize.width(), imageRect.y() / contentsImageLogicalSize.height(), imageRect.width() / contentsImageLogicalSize.width(), imageRect.height() / contentsImageLogicalSize.height())];
</span><span class="cx">         [textLayer setContentsGravity:kCAGravityCenter];
</span><del>-        [textLayer setContentsScale:_textIndicator-&gt;data().contentImageScaleFactor];
</del><ins>+        [textLayer setContentsScale:_textIndicator-&gt;contentImageScaleFactor()];
</ins><span class="cx">         [textLayer setFrame:yellowHighlightRect];
</span><span class="cx">         [textLayer setCornerRadius:cornerRadius];
</span><span class="cx">         [bounceLayer setValue:textLayer.get() forKey:textLayerKey];
</span><span class="lines">@@ -190,7 +190,7 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)presentWithCompletionHandler:(void(^)(void))completionHandler
</span><span class="cx"> {
</span><del>-    bool wantsCrossfade = _textIndicator-&gt;data().presentationTransition == WebKit::TextIndicator::PresentationTransition::BounceAndCrossfade;
</del><ins>+    bool wantsCrossfade = _textIndicator-&gt;presentationTransition() == WebKit::TextIndicator::PresentationTransition::BounceAndCrossfade;
</ins><span class="cx">     double animationDuration = wantsCrossfade ? bounceWithCrossfadeAnimationDuration : bounceAnimationDuration;
</span><span class="cx">     RetainPtr&lt;CAKeyframeAnimation&gt; bounceAnimation = [CAKeyframeAnimation animationWithKeyPath:@&quot;transform&quot;];
</span><span class="cx">     [bounceAnimation setValues:@[
</span><span class="lines">@@ -204,7 +204,7 @@
</span><span class="cx">     RetainPtr&lt;CABasicAnimation&gt; fadeShadowInAnimation;
</span><span class="cx">     if (wantsCrossfade) {
</span><span class="cx">         crossfadeAnimation = [CABasicAnimation animationWithKeyPath:@&quot;contents&quot;];
</span><del>-        RetainPtr&lt;CGImageRef&gt; contentsImage = _textIndicator-&gt;data().contentImage-&gt;makeCGImage();
</del><ins>+        RetainPtr&lt;CGImageRef&gt; contentsImage = _textIndicator-&gt;contentImage()-&gt;makeCGImage();
</ins><span class="cx">         [crossfadeAnimation setToValue:(id)contentsImage.get()];
</span><span class="cx">         [crossfadeAnimation setFillMode:kCAFillModeForwards];
</span><span class="cx">         [crossfadeAnimation setRemovedOnCompletion:NO];
</span><span class="lines">@@ -280,7 +280,7 @@
</span><span class="cx">     if (!m_textIndicator)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    NSRect contentRect = m_textIndicator-&gt;frameRect();
</del><ins>+    NSRect contentRect = m_textIndicator-&gt;textBoundingRectInWindowCoordinates();
</ins><span class="cx"> 
</span><span class="cx">     CGFloat horizontalMargin = std::max(dropShadowBlurRadius * 2 + horizontalBorder, contentRect.size.width * 2);
</span><span class="cx">     CGFloat verticalMargin = std::max(dropShadowBlurRadius * 2 + verticalBorder, contentRect.size.height * 2);
</span><span class="lines">@@ -302,7 +302,7 @@
</span><span class="cx">     [[m_wkView window] addChildWindow:m_textIndicatorWindow.get() ordered:NSWindowAbove];
</span><span class="cx">     [m_textIndicatorWindow setReleasedWhenClosed:NO];
</span><span class="cx"> 
</span><del>-    if (m_textIndicator-&gt;data().presentationTransition != TextIndicator::PresentationTransition::None) {
</del><ins>+    if (m_textIndicator-&gt;presentationTransition() != TextIndicator::PresentationTransition::None) {
</ins><span class="cx">         [m_textIndicatorView presentWithCompletionHandler:[animationCompletionHandler] {
</span><span class="cx">             animationCompletionHandler();
</span><span class="cx">         }];
</span></span></pre>
</div>
</div>

</body>
</html>