<!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>[186956] 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/186956">186956</a></dd>
<dt>Author</dt> <dd>timothy_horton@apple.com</dd>
<dt>Date</dt> <dd>2015-07-17 11:24:49 -0700 (Fri, 17 Jul 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>iOS TextIndicators include text that is not supposed to be indicated
https://bugs.webkit.org/show_bug.cgi?id=147028
&lt;rdar://problem/21643094&gt;

Reviewed by Sam Weinig.

Paint the selection and background, but not other foregrounds, for iOS TextIndicators.

* page/FrameSnapshotting.cpp:
(WebCore::snapshotFrameRect):
* page/FrameSnapshotting.h:
Add a new snapshot option where we'll paint backgrounds and the selected
foreground and nothing else.
Pass the new snapshot option through as a paint behavior.

* page/TextIndicator.cpp:
(WebCore::TextIndicator::createWithRange):
Implement the incantations necessary to make a temporary selection
change not get sent to the UI process and actually have WebCore know about it
and accurately respond to questions about it.

(WebCore::TextIndicator::createWithSelectionInFrame):
Paint selection and backgrounds on iOS.

* rendering/PaintPhase.h:
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::paintLayerContents):
* rendering/RenderElement.cpp:
(WebCore::RenderElement::selectionColor):
Add a new paint behavior, SelectionAndBackgroundsOnly, which behaves
the same as selection only except it allows backgrounds to paint.

* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::shouldCreateTransientPaintingSnapshot):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepageFrameSnapshottingcpp">trunk/Source/WebCore/page/FrameSnapshotting.cpp</a></li>
<li><a href="#trunkSourceWebCorepageFrameSnapshottingh">trunk/Source/WebCore/page/FrameSnapshotting.h</a></li>
<li><a href="#trunkSourceWebCorepageTextIndicatorcpp">trunk/Source/WebCore/page/TextIndicator.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingPaintPhaseh">trunk/Source/WebCore/rendering/PaintPhase.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderElementcpp">trunk/Source/WebCore/rendering/RenderElement.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayercpp">trunk/Source/WebCore/rendering/RenderLayer.cpp</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessPluginsPluginViewcpp">trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (186955 => 186956)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-07-17 18:11:40 UTC (rev 186955)
+++ trunk/Source/WebCore/ChangeLog        2015-07-17 18:24:49 UTC (rev 186956)
</span><span class="lines">@@ -1,3 +1,37 @@
</span><ins>+2015-07-17  Tim Horton  &lt;timothy_horton@apple.com&gt;
+
+        iOS TextIndicators include text that is not supposed to be indicated
+        https://bugs.webkit.org/show_bug.cgi?id=147028
+        &lt;rdar://problem/21643094&gt;
+
+        Reviewed by Sam Weinig.
+
+        Paint the selection and background, but not other foregrounds, for iOS TextIndicators.
+
+        * page/FrameSnapshotting.cpp:
+        (WebCore::snapshotFrameRect):
+        * page/FrameSnapshotting.h:
+        Add a new snapshot option where we'll paint backgrounds and the selected
+        foreground and nothing else.
+        Pass the new snapshot option through as a paint behavior.
+
+        * page/TextIndicator.cpp:
+        (WebCore::TextIndicator::createWithRange):
+        Implement the incantations necessary to make a temporary selection
+        change not get sent to the UI process and actually have WebCore know about it
+        and accurately respond to questions about it.
+
+        (WebCore::TextIndicator::createWithSelectionInFrame):
+        Paint selection and backgrounds on iOS.
+
+        * rendering/PaintPhase.h:
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::paintLayerContents):
+        * rendering/RenderElement.cpp:
+        (WebCore::RenderElement::selectionColor):
+        Add a new paint behavior, SelectionAndBackgroundsOnly, which behaves
+        the same as selection only except it allows backgrounds to paint.
+
</ins><span class="cx"> 2015-07-17  Mark Lam  &lt;mark.lam@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove leak of objects between isolated worlds on custom events, message events, and pop state events.
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameSnapshottingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameSnapshotting.cpp (186955 => 186956)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameSnapshotting.cpp        2015-07-17 18:11:40 UTC (rev 186955)
+++ trunk/Source/WebCore/page/FrameSnapshotting.cpp        2015-07-17 18:24:49 UTC (rev 186956)
</span><span class="lines">@@ -87,6 +87,8 @@
</span><span class="cx">         paintBehavior |= PaintBehaviorForceBlackText;
</span><span class="cx">     if (options &amp; SnapshotOptionsPaintSelectionOnly)
</span><span class="cx">         paintBehavior |= PaintBehaviorSelectionOnly;
</span><ins>+    if (options &amp; SnapshotOptionsPaintSelectionAndBackgroundsOnly)
+        paintBehavior |= PaintBehaviorSelectionAndBackgroundsOnly;
</ins><span class="cx"> 
</span><span class="cx">     // Other paint behaviors are set by paintContentsForSnapshot.
</span><span class="cx">     frame.view()-&gt;setPaintBehavior(paintBehavior);
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameSnapshottingh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameSnapshotting.h (186955 => 186956)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameSnapshotting.h        2015-07-17 18:11:40 UTC (rev 186955)
+++ trunk/Source/WebCore/page/FrameSnapshotting.h        2015-07-17 18:24:49 UTC (rev 186956)
</span><span class="lines">@@ -45,6 +45,7 @@
</span><span class="cx">     SnapshotOptionsPaintSelectionOnly = 1 &lt;&lt; 1,
</span><span class="cx">     SnapshotOptionsInViewCoordinates = 1 &lt;&lt; 2,
</span><span class="cx">     SnapshotOptionsForceBlackText = 1 &lt;&lt; 3,
</span><ins>+    SnapshotOptionsPaintSelectionAndBackgroundsOnly = 1 &lt;&lt; 4,
</ins><span class="cx"> };
</span><span class="cx"> typedef unsigned SnapshotOptions;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepageTextIndicatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/TextIndicator.cpp (186955 => 186956)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/TextIndicator.cpp        2015-07-17 18:11:40 UTC (rev 186955)
+++ trunk/Source/WebCore/page/TextIndicator.cpp        2015-07-17 18:24:49 UTC (rev 186956)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> #include &quot;TextIndicator.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;Document.h&quot;
</span><ins>+#include &quot;Editor.h&quot;
</ins><span class="cx"> #include &quot;Frame.h&quot;
</span><span class="cx"> #include &quot;FrameSelection.h&quot;
</span><span class="cx"> #include &quot;FrameSnapshotting.h&quot;
</span><span class="lines">@@ -54,6 +55,11 @@
</span><span class="cx">     if (!frame)
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+    frame-&gt;editor().setIgnoreCompositionSelectionChange(true);
+    frame-&gt;selection().setUpdateAppearanceEnabled(true);
+#endif
+
</ins><span class="cx">     VisibleSelection oldSelection = frame-&gt;selection().selection();
</span><span class="cx">     frame-&gt;selection().setSelection(range);
</span><span class="cx"> 
</span><span class="lines">@@ -63,7 +69,12 @@
</span><span class="cx"> 
</span><span class="cx">     if (indicator)
</span><span class="cx">         indicator-&gt;setWantsMargin(!areRangesEqual(&amp;range, oldSelection.toNormalizedRange().get()));
</span><del>-    
</del><ins>+
+#if PLATFORM(IOS)
+    frame-&gt;editor().setIgnoreCompositionSelectionChange(false);
+    frame-&gt;selection().setUpdateAppearanceEnabled(false);
+#endif
+
</ins><span class="cx">     return indicator.release();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -120,7 +131,7 @@
</span><span class="cx"> 
</span><span class="cx">     // FIXME: We should have TextIndicator options instead of this being platform-specific.
</span><span class="cx"> #if PLATFORM(IOS)
</span><del>-    SnapshotOptions snapshotOptions = SnapshotOptionsNone;
</del><ins>+    SnapshotOptions snapshotOptions = SnapshotOptionsPaintSelectionAndBackgroundsOnly;
</ins><span class="cx"> #else
</span><span class="cx">     SnapshotOptions snapshotOptions = SnapshotOptionsForceBlackText | SnapshotOptionsPaintSelectionOnly;
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingPaintPhaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/PaintPhase.h (186955 => 186956)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/PaintPhase.h        2015-07-17 18:11:40 UTC (rev 186955)
+++ trunk/Source/WebCore/rendering/PaintPhase.h        2015-07-17 18:24:49 UTC (rev 186956)
</span><span class="lines">@@ -62,6 +62,7 @@
</span><span class="cx">     PaintBehaviorRenderingSVGMask = 1 &lt;&lt; 4,
</span><span class="cx">     PaintBehaviorSkipRootBackground = 1 &lt;&lt; 5,
</span><span class="cx">     PaintBehaviorRootBackgroundOnly = 1 &lt;&lt; 6,
</span><ins>+    PaintBehaviorSelectionAndBackgroundsOnly = 1 &lt;&lt; 7,
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> typedef unsigned PaintBehavior;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (186955 => 186956)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderElement.cpp        2015-07-17 18:11:40 UTC (rev 186955)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp        2015-07-17 18:24:49 UTC (rev 186956)
</span><span class="lines">@@ -1575,7 +1575,7 @@
</span><span class="cx">     // If the element is unselectable, or we are only painting the selection,
</span><span class="cx">     // don't override the foreground color with the selection foreground color.
</span><span class="cx">     if (style().userSelect() == SELECT_NONE
</span><del>-        || (view().frameView().paintBehavior() &amp; PaintBehaviorSelectionOnly))
</del><ins>+        || (view().frameView().paintBehavior() &amp; (PaintBehaviorSelectionOnly | PaintBehaviorSelectionAndBackgroundsOnly)))
</ins><span class="cx">         return Color();
</span><span class="cx"> 
</span><span class="cx">     if (RefPtr&lt;RenderStyle&gt; pseudoStyle = selectionPseudoStyle()) {
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (186955 => 186956)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayer.cpp        2015-07-17 18:11:40 UTC (rev 186955)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp        2015-07-17 18:24:49 UTC (rev 186956)
</span><span class="lines">@@ -4275,7 +4275,8 @@
</span><span class="cx">     if (localPaintingInfo.overlapTestRequests &amp;&amp; isSelfPaintingLayer)
</span><span class="cx">         performOverlapTests(*localPaintingInfo.overlapTestRequests, localPaintingInfo.rootLayer, this);
</span><span class="cx"> 
</span><del>-    bool selectionOnly  = localPaintingInfo.paintBehavior &amp; PaintBehaviorSelectionOnly;
</del><ins>+    bool selectionAndBackgroundsOnly = localPaintingInfo.paintBehavior &amp; PaintBehaviorSelectionAndBackgroundsOnly;
+    bool selectionOnly = localPaintingInfo.paintBehavior &amp; PaintBehaviorSelectionOnly;
</ins><span class="cx">     
</span><span class="cx">     PaintBehavior paintBehavior = PaintBehaviorNormal;
</span><span class="cx">     if (localPaintFlags &amp; PaintLayerPaintingSkipRootBackground)
</span><span class="lines">@@ -4314,7 +4315,7 @@
</span><span class="cx">     if (isPaintingCompositedForeground) {
</span><span class="cx">         if (shouldPaintContent)
</span><span class="cx">             paintForegroundForFragments(layerFragments, context, transparencyLayerContext, paintingInfo.paintDirtyRect, haveTransparency,
</span><del>-                localPaintingInfo, paintBehavior, subtreePaintRootForRenderer, selectionOnly);
</del><ins>+                localPaintingInfo, paintBehavior, subtreePaintRootForRenderer, selectionOnly || selectionAndBackgroundsOnly);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (shouldPaintOutline)
</span><span class="lines">@@ -4346,7 +4347,7 @@
</span><span class="cx">     // Make sure that we now use the original transparency context.
</span><span class="cx">     ASSERT(transparencyLayerContext == context);
</span><span class="cx"> 
</span><del>-    if (shouldPaintContent &amp;&amp; !selectionOnly) {
</del><ins>+    if (shouldPaintContent &amp;&amp; !(selectionOnly || selectionAndBackgroundsOnly)) {
</ins><span class="cx">         if (shouldPaintMask(paintingInfo.paintBehavior, localPaintFlags)) {
</span><span class="cx">             // Paint the mask for the fragments.
</span><span class="cx">             paintMaskForFragments(layerFragments, context, localPaintingInfo, subtreePaintRootForRenderer);
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (186955 => 186956)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-07-17 18:11:40 UTC (rev 186955)
+++ trunk/Source/WebKit2/ChangeLog        2015-07-17 18:24:49 UTC (rev 186956)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2015-07-17  Tim Horton  &lt;timothy_horton@apple.com&gt;
+
+        iOS TextIndicators include text that is not supposed to be indicated
+        https://bugs.webkit.org/show_bug.cgi?id=147028
+        &lt;rdar://problem/21643094&gt;
+
+        Reviewed by Sam Weinig.
+
+        * WebProcess/Plugins/PluginView.cpp:
+        (WebKit::PluginView::shouldCreateTransientPaintingSnapshot):
+
</ins><span class="cx"> 2015-07-17  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GTK] Cleanup PasteboardHelper
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessPluginsPluginViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp (186955 => 186956)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp        2015-07-17 18:11:40 UTC (rev 186955)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp        2015-07-17 18:24:49 UTC (rev 186956)
</span><span class="lines">@@ -1826,7 +1826,7 @@
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     if (FrameView* frameView = frame()-&gt;view()) {
</span><del>-        if (frameView-&gt;paintBehavior() &amp; (PaintBehaviorSelectionOnly | PaintBehaviorForceBlackText)) {
</del><ins>+        if (frameView-&gt;paintBehavior() &amp; (PaintBehaviorSelectionOnly | PaintBehaviorSelectionAndBackgroundsOnly | PaintBehaviorForceBlackText)) {
</ins><span class="cx">             // This paint behavior is used when drawing the find indicator and there's no need to
</span><span class="cx">             // snapshot plug-ins, because they can never be painted as part of the find indicator.
</span><span class="cx">             return false;
</span></span></pre>
</div>
</div>

</body>
</html>