<!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>[213614] 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/213614">213614</a></dd>
<dt>Author</dt> <dd>wenson_hsieh@apple.com</dd>
<dt>Date</dt> <dd>2017-03-08 17:44:45 -0800 (Wed, 08 Mar 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add TextIndicator support for providing a snapshot excluding selected content
https://bugs.webkit.org/show_bug.cgi?id=169309
&lt;rdar://problem/30883525&gt;

Reviewed by Tim Horton.

Source/WebCore:

Work towards &lt;rdar://problem/30882974&gt;. Adds support in TextIndicator to include a snapshot of all visible
content, excluding nodes captured in the current selection. This comes in the form of the new
TextIndicatorOptionIncludeSnapshotOfAllVisibleContentWithoutSelection flag -- see per-method changes for more details.

No new tests, since there is no change in behavior yet.

* page/FrameSnapshotting.cpp:
(WebCore::snapshotFrameRectWithClip):
* page/FrameSnapshotting.h:

Introduce a new snapshot option flag, SnapshotOptionsPaintEverythingExcludingSelection.

(WebCore::snapshotFrameRectWithClip):
* page/TextIndicator.cpp:

If TextIndicatorOptionIncludeSnapshotOfAllVisibleContentWithoutSelection is turned on, capture and include a
snapshot of the visible bounds of the frame.

(WebCore::takeSnapshot):
(WebCore::takeSnapshots):
(WebCore::initializeIndicator):
* page/TextIndicator.h:

Introduce TextIndicatorOptionIncludeSnapshotOfAllVisibleContentWithoutSelection.

* platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::widthOfTextRange):
* platform/graphics/FontCascade.h:

Teach FontCascade to retrieve the width of a range in a TextRun, and also compute the widths of the TextRun
before and after the range. This is used by InlineTextBox to compute the painting rect to clip out when skipping
text decorations for the selected region of the TextRun.

* rendering/InlineTextBox.cpp:

Teach InlineTextBox to respect PaintBehaviorExcludeSelection. When painting text, if this paint behavior is
used, we will not paint the portion of the text run that lies inside the range determined by selectionStartEnd().
Similarly, when painting text decorations, we exclude the rect surrounding the selected content.

(WebCore::InlineTextBox::paint):
(WebCore::InlineTextBox::paintDecoration):
* rendering/InlineTextBox.h:
* rendering/PaintPhase.h:

Introduce PaintBehaviorExcludeSelection, used to inform members of the render tree not to paint portions that
lie within the current selection range.

* rendering/RenderLayer.cpp:

Propagate the PaintBehaviorExcludeSelection flag to children when painting.

(WebCore::RenderLayer::paintLayerContents):
(WebCore::RenderLayer::paintForegroundForFragments):
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::shouldPaint):

Teach RenderReplaced to respect PaintBehaviorExcludeSelection by bailing from painting if it is selected and the
paint behavior is enabled.

* rendering/TextDecorationPainter.h:
* rendering/TextPaintStyle.cpp:
(WebCore::computeTextSelectionPaintStyle):
* rendering/TextPaintStyle.h:
* rendering/TextPainter.cpp:
(WebCore::TextPainter::paintText):
* rendering/TextPainter.h:

Source/WebKit2:

Serialize the snapshot excluding the selection and the snapshot's bounds when sending TextIndicatorData over
IPC to the UI process.

* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder&lt;TextIndicatorData&gt;::encode):
(IPC::ArgumentCoder&lt;TextIndicatorData&gt;::decode):</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="#trunkSourceWebCorepageTextIndicatorh">trunk/Source/WebCore/page/TextIndicator.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsFontCascadecpp">trunk/Source/WebCore/platform/graphics/FontCascade.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsFontCascadeh">trunk/Source/WebCore/platform/graphics/FontCascade.h</a></li>
<li><a href="#trunkSourceWebCorerenderingInlineTextBoxcpp">trunk/Source/WebCore/rendering/InlineTextBox.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingInlineTextBoxh">trunk/Source/WebCore/rendering/InlineTextBox.h</a></li>
<li><a href="#trunkSourceWebCorerenderingPaintPhaseh">trunk/Source/WebCore/rendering/PaintPhase.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayercpp">trunk/Source/WebCore/rendering/RenderLayer.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderReplacedcpp">trunk/Source/WebCore/rendering/RenderReplaced.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingTextDecorationPainterh">trunk/Source/WebCore/rendering/TextDecorationPainter.h</a></li>
<li><a href="#trunkSourceWebCorerenderingTextPaintStylecpp">trunk/Source/WebCore/rendering/TextPaintStyle.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingTextPaintStyleh">trunk/Source/WebCore/rendering/TextPaintStyle.h</a></li>
<li><a href="#trunkSourceWebCorerenderingTextPaintercpp">trunk/Source/WebCore/rendering/TextPainter.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingTextPainterh">trunk/Source/WebCore/rendering/TextPainter.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedWebCoreArgumentCoderscpp">trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (213613 => 213614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-03-09 01:35:37 UTC (rev 213613)
+++ trunk/Source/WebCore/ChangeLog        2017-03-09 01:44:45 UTC (rev 213614)
</span><span class="lines">@@ -1,3 +1,78 @@
</span><ins>+2017-03-08  Wenson Hsieh  &lt;wenson_hsieh@apple.com&gt;
+
+        Add TextIndicator support for providing a snapshot excluding selected content
+        https://bugs.webkit.org/show_bug.cgi?id=169309
+        &lt;rdar://problem/30883525&gt;
+
+        Reviewed by Tim Horton.
+
+        Work towards &lt;rdar://problem/30882974&gt;. Adds support in TextIndicator to include a snapshot of all visible
+        content, excluding nodes captured in the current selection. This comes in the form of the new
+        TextIndicatorOptionIncludeSnapshotOfAllVisibleContentWithoutSelection flag -- see per-method changes for more details.
+
+        No new tests, since there is no change in behavior yet.
+
+        * page/FrameSnapshotting.cpp:
+        (WebCore::snapshotFrameRectWithClip):
+        * page/FrameSnapshotting.h:
+
+        Introduce a new snapshot option flag, SnapshotOptionsPaintEverythingExcludingSelection.
+
+        (WebCore::snapshotFrameRectWithClip):
+        * page/TextIndicator.cpp:
+
+        If TextIndicatorOptionIncludeSnapshotOfAllVisibleContentWithoutSelection is turned on, capture and include a
+        snapshot of the visible bounds of the frame.
+
+        (WebCore::takeSnapshot):
+        (WebCore::takeSnapshots):
+        (WebCore::initializeIndicator):
+        * page/TextIndicator.h:
+
+        Introduce TextIndicatorOptionIncludeSnapshotOfAllVisibleContentWithoutSelection.
+
+        * platform/graphics/FontCascade.cpp:
+        (WebCore::FontCascade::widthOfTextRange):
+        * platform/graphics/FontCascade.h:
+
+        Teach FontCascade to retrieve the width of a range in a TextRun, and also compute the widths of the TextRun
+        before and after the range. This is used by InlineTextBox to compute the painting rect to clip out when skipping
+        text decorations for the selected region of the TextRun.
+
+        * rendering/InlineTextBox.cpp:
+
+        Teach InlineTextBox to respect PaintBehaviorExcludeSelection. When painting text, if this paint behavior is
+        used, we will not paint the portion of the text run that lies inside the range determined by selectionStartEnd().
+        Similarly, when painting text decorations, we exclude the rect surrounding the selected content.
+
+        (WebCore::InlineTextBox::paint):
+        (WebCore::InlineTextBox::paintDecoration):
+        * rendering/InlineTextBox.h:
+        * rendering/PaintPhase.h:
+
+        Introduce PaintBehaviorExcludeSelection, used to inform members of the render tree not to paint portions that
+        lie within the current selection range.
+
+        * rendering/RenderLayer.cpp:
+
+        Propagate the PaintBehaviorExcludeSelection flag to children when painting.
+
+        (WebCore::RenderLayer::paintLayerContents):
+        (WebCore::RenderLayer::paintForegroundForFragments):
+        * rendering/RenderReplaced.cpp:
+        (WebCore::RenderReplaced::shouldPaint):
+
+        Teach RenderReplaced to respect PaintBehaviorExcludeSelection by bailing from painting if it is selected and the
+        paint behavior is enabled.
+
+        * rendering/TextDecorationPainter.h:
+        * rendering/TextPaintStyle.cpp:
+        (WebCore::computeTextSelectionPaintStyle):
+        * rendering/TextPaintStyle.h:
+        * rendering/TextPainter.cpp:
+        (WebCore::TextPainter::paintText):
+        * rendering/TextPainter.h:
+
</ins><span class="cx"> 2017-03-08  Youenn Fablet  &lt;youenn@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Support PeerConnectionStates::BundlePolicy::MaxBundle when setting rtc configuration
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameSnapshottingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameSnapshotting.cpp (213613 => 213614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameSnapshotting.cpp        2017-03-09 01:35:37 UTC (rev 213613)
+++ trunk/Source/WebCore/page/FrameSnapshotting.cpp        2017-03-09 01:44:45 UTC (rev 213614)
</span><span class="lines">@@ -73,7 +73,7 @@
</span><span class="cx">     return snapshotFrameRectWithClip(frame, imageRect, clipRects, options);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-std::unique_ptr&lt;ImageBuffer&gt; snapshotFrameRectWithClip(Frame&amp; frame, const IntRect&amp; imageRect, Vector&lt;FloatRect&gt;&amp; clipRects, SnapshotOptions options)
</del><ins>+std::unique_ptr&lt;ImageBuffer&gt; snapshotFrameRectWithClip(Frame&amp; frame, const IntRect&amp; imageRect, const Vector&lt;FloatRect&gt;&amp; clipRects, SnapshotOptions options)
</ins><span class="cx"> {
</span><span class="cx">     if (!frame.page())
</span><span class="cx">         return nullptr;
</span><span class="lines">@@ -97,6 +97,8 @@
</span><span class="cx">         paintBehavior |= PaintBehaviorSelectionOnly;
</span><span class="cx">     if (options &amp; SnapshotOptionsPaintSelectionAndBackgroundsOnly)
</span><span class="cx">         paintBehavior |= PaintBehaviorSelectionAndBackgroundsOnly;
</span><ins>+    if (options &amp; SnapshotOptionsPaintEverythingExcludingSelection)
+        paintBehavior |= PaintBehaviorExcludeSelection;
</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 (213613 => 213614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameSnapshotting.h        2017-03-09 01:35:37 UTC (rev 213613)
+++ trunk/Source/WebCore/page/FrameSnapshotting.h        2017-03-09 01:44:45 UTC (rev 213614)
</span><span class="lines">@@ -47,11 +47,12 @@
</span><span class="cx">     SnapshotOptionsInViewCoordinates = 1 &lt;&lt; 2,
</span><span class="cx">     SnapshotOptionsForceBlackText = 1 &lt;&lt; 3,
</span><span class="cx">     SnapshotOptionsPaintSelectionAndBackgroundsOnly = 1 &lt;&lt; 4,
</span><ins>+    SnapshotOptionsPaintEverythingExcludingSelection = 1 &lt;&lt; 5
</ins><span class="cx"> };
</span><span class="cx"> typedef unsigned SnapshotOptions;
</span><span class="cx"> 
</span><span class="cx"> WEBCORE_EXPORT std::unique_ptr&lt;ImageBuffer&gt; snapshotFrameRect(Frame&amp;, const IntRect&amp;, SnapshotOptions = SnapshotOptionsNone);
</span><del>-std::unique_ptr&lt;ImageBuffer&gt; snapshotFrameRectWithClip(Frame&amp;, const IntRect&amp;, Vector&lt;FloatRect&gt;&amp; clipRects, SnapshotOptions = SnapshotOptionsNone);
</del><ins>+std::unique_ptr&lt;ImageBuffer&gt; snapshotFrameRectWithClip(Frame&amp;, const IntRect&amp;, const Vector&lt;FloatRect&gt;&amp; clipRects = { }, SnapshotOptions = SnapshotOptionsNone);
</ins><span class="cx"> std::unique_ptr&lt;ImageBuffer&gt; snapshotNode(Frame&amp;, Node&amp;);
</span><span class="cx"> WEBCORE_EXPORT std::unique_ptr&lt;ImageBuffer&gt; snapshotSelection(Frame&amp;, SnapshotOptions = SnapshotOptionsNone);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepageTextIndicatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/TextIndicator.cpp (213613 => 213614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/TextIndicator.cpp        2017-03-09 01:35:37 UTC (rev 213613)
+++ trunk/Source/WebCore/page/TextIndicator.cpp        2017-03-09 01:44:45 UTC (rev 213614)
</span><span class="lines">@@ -150,7 +150,7 @@
</span><span class="cx">     return snapshotOptions;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static RefPtr&lt;Image&gt; takeSnapshot(Frame&amp; frame, IntRect rect, SnapshotOptions options, float&amp; scaleFactor, Vector&lt;FloatRect&gt;&amp; clipRectsInDocumentCoordinates)
</del><ins>+static RefPtr&lt;Image&gt; takeSnapshot(Frame&amp; frame, IntRect rect, SnapshotOptions options, float&amp; scaleFactor, const Vector&lt;FloatRect&gt;&amp; clipRectsInDocumentCoordinates)
</ins><span class="cx"> {
</span><span class="cx">     std::unique_ptr&lt;ImageBuffer&gt; buffer = snapshotFrameRectWithClip(frame, rect, clipRectsInDocumentCoordinates, options);
</span><span class="cx">     if (!buffer)
</span><span class="lines">@@ -159,7 +159,7 @@
</span><span class="cx">     return ImageBuffer::sinkIntoImage(WTFMove(buffer), Unscaled);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool takeSnapshots(TextIndicatorData&amp; data, Frame&amp; frame, IntRect snapshotRect, Vector&lt;FloatRect&gt;&amp; clipRectsInDocumentCoordinates)
</del><ins>+static bool takeSnapshots(TextIndicatorData&amp; data, Frame&amp; frame, IntRect snapshotRect, const Vector&lt;FloatRect&gt;&amp; clipRectsInDocumentCoordinates)
</ins><span class="cx"> {
</span><span class="cx">     SnapshotOptions snapshotOptions = snapshotOptionsForTextIndicatorOptions(data.options);
</span><span class="cx"> 
</span><span class="lines">@@ -172,6 +172,13 @@
</span><span class="cx">         data.contentImageWithHighlight = takeSnapshot(frame, snapshotRect, SnapshotOptionsNone, snapshotScaleFactor, clipRectsInDocumentCoordinates);
</span><span class="cx">         ASSERT(!data.contentImageWithHighlight || data.contentImageScaleFactor == snapshotScaleFactor);
</span><span class="cx">     }
</span><ins>+
+    if (data.options &amp; TextIndicatorOptionIncludeSnapshotOfAllVisibleContentWithoutSelection) {
+        float snapshotScaleFactor;
+        auto snapshotRect = enclosingIntRect(frame.view()-&gt;visualViewportRect());
+        data.contentImageWithoutSelection = takeSnapshot(frame, snapshotRect, SnapshotOptionsPaintEverythingExcludingSelection, snapshotScaleFactor, { });
+        data.contentImageWithoutSelectionRectInRootViewCoordinates = frame.view()-&gt;contentsToRootView(snapshotRect);
+    }
</ins><span class="cx">     
</span><span class="cx">     return true;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorepageTextIndicatorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/TextIndicator.h (213613 => 213614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/TextIndicator.h        2017-03-09 01:35:37 UTC (rev 213613)
+++ trunk/Source/WebCore/page/TextIndicator.h        2017-03-09 01:44:45 UTC (rev 213614)
</span><span class="lines">@@ -49,7 +49,7 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> // Make sure to keep these in sync with the ones in Internals.idl.
</span><del>-enum TextIndicatorOption : uint8_t {
</del><ins>+enum TextIndicatorOption : uint16_t {
</ins><span class="cx">     TextIndicatorOptionDefault = 0,
</span><span class="cx"> 
</span><span class="cx">     // Use the styled text color instead of forcing black text (the default)
</span><span class="lines">@@ -80,15 +80,20 @@
</span><span class="cx">     // By default, TextIndicator clips the indicated rects to the visible content rect.
</span><span class="cx">     // If this option is set, do not clip the indicated rects.
</span><span class="cx">     TextIndicatorOptionDoNotClipToVisibleRect = 1 &lt;&lt; 7,
</span><ins>+
+    // Include an additional snapshot of everything in view, with the exception of nodes within the currently selected range.
+    TextIndicatorOptionIncludeSnapshotOfAllVisibleContentWithoutSelection = 1 &lt;&lt; 8,
</ins><span class="cx"> };
</span><del>-typedef uint8_t TextIndicatorOptions;
</del><ins>+typedef uint16_t TextIndicatorOptions;
</ins><span class="cx"> 
</span><span class="cx"> struct TextIndicatorData {
</span><span class="cx">     FloatRect selectionRectInRootViewCoordinates;
</span><span class="cx">     FloatRect textBoundingRectInRootViewCoordinates;
</span><ins>+    FloatRect contentImageWithoutSelectionRectInRootViewCoordinates;
</ins><span class="cx">     Vector&lt;FloatRect&gt; textRectsInBoundingRectCoordinates;
</span><span class="cx">     float contentImageScaleFactor;
</span><span class="cx">     RefPtr&lt;Image&gt; contentImageWithHighlight;
</span><ins>+    RefPtr&lt;Image&gt; contentImageWithoutSelection;
</ins><span class="cx">     RefPtr&lt;Image&gt; contentImage;
</span><span class="cx">     TextIndicatorPresentationTransition presentationTransition;
</span><span class="cx">     TextIndicatorOptions options;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsFontCascadecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/FontCascade.cpp (213613 => 213614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/FontCascade.cpp        2017-03-09 01:35:37 UTC (rev 213613)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.cpp        2017-03-09 01:44:45 UTC (rev 213614)
</span><span class="lines">@@ -25,6 +25,7 @@
</span><span class="cx"> #include &quot;FontCascade.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;CharacterProperties.h&quot;
</span><ins>+#include &quot;ComplexTextController.h&quot;
</ins><span class="cx"> #include &quot;FloatRect.h&quot;
</span><span class="cx"> #include &quot;FontCache.h&quot;
</span><span class="cx"> #include &quot;GlyphBuffer.h&quot;
</span><span class="lines">@@ -348,6 +349,43 @@
</span><span class="cx">         drawEmphasisMarksForComplexText(context, run, mark, point, from, destination);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+float FontCascade::widthOfTextRange(const TextRun&amp; run, unsigned from, unsigned to, HashSet&lt;const Font*&gt;* fallbackFonts, float* outWidthBeforeRange, float* outWidthAfterRange) const
+{
+    ASSERT(from &lt;= to);
+    ASSERT(to &lt;= run.length());
+
+    float offsetBeforeRange = 0;
+    float offsetAfterRange = 0;
+    float totalWidth = 0;
+
+    auto codePathToUse = codePath(run);
+    if (codePathToUse == Complex) {
+        ComplexTextController complexIterator(*this, run, false, fallbackFonts);
+        complexIterator.advance(from, nullptr, IncludePartialGlyphs, fallbackFonts);
+        offsetBeforeRange = complexIterator.runWidthSoFar();
+        complexIterator.advance(to, nullptr, IncludePartialGlyphs, fallbackFonts);
+        offsetAfterRange = complexIterator.runWidthSoFar();
+        complexIterator.advance(run.length(), nullptr, IncludePartialGlyphs, fallbackFonts);
+        totalWidth = complexIterator.runWidthSoFar();
+    } else {
+        WidthIterator simpleIterator(this, run, fallbackFonts);
+        simpleIterator.advance(from, nullptr);
+        offsetBeforeRange = simpleIterator.runWidthSoFar();
+        simpleIterator.advance(to, nullptr);
+        offsetAfterRange = simpleIterator.runWidthSoFar();
+        simpleIterator.advance(run.length(), nullptr);
+        totalWidth = simpleIterator.runWidthSoFar();
+    }
+
+    if (outWidthBeforeRange)
+        *outWidthBeforeRange = offsetBeforeRange;
+
+    if (outWidthAfterRange)
+        *outWidthAfterRange = totalWidth - offsetAfterRange;
+
+    return offsetAfterRange - offsetBeforeRange;
+}
+
</ins><span class="cx"> float FontCascade::width(const TextRun&amp; run, HashSet&lt;const Font*&gt;* fallbackFonts, GlyphOverflow* glyphOverflow) const
</span><span class="cx"> {
</span><span class="cx">     CodePath codePathToUse = codePath(run);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsFontCascadeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/FontCascade.h (213613 => 213614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/FontCascade.h        2017-03-09 01:35:37 UTC (rev 213613)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.h        2017-03-09 01:44:45 UTC (rev 213614)
</span><span class="lines">@@ -138,6 +138,7 @@
</span><span class="cx"> 
</span><span class="cx">     DashArray dashesForIntersectionsWithRect(const TextRun&amp;, const FloatPoint&amp; textOrigin, const FloatRect&amp; lineExtents) const;
</span><span class="cx"> 
</span><ins>+    float widthOfTextRange(const TextRun&amp;, unsigned from, unsigned to, HashSet&lt;const Font*&gt;* fallbackFonts = 0, float* outWidthBeforeRange = nullptr, float* outWidthAfterRange = nullptr) const;
</ins><span class="cx">     WEBCORE_EXPORT float width(const TextRun&amp;, HashSet&lt;const Font*&gt;* fallbackFonts = 0, GlyphOverflow* = 0) const;
</span><span class="cx">     float widthForSimpleText(StringView text) const;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingInlineTextBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (213613 => 213614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/InlineTextBox.cpp        2017-03-09 01:35:37 UTC (rev 213613)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp        2017-03-09 01:44:45 UTC (rev 213614)
</span><span class="lines">@@ -474,10 +474,11 @@
</span><span class="cx"> 
</span><span class="cx">     bool paintSelectedTextOnly = false;
</span><span class="cx">     bool paintSelectedTextSeparately = false;
</span><ins>+    bool paintNonSelectedTextOnly = false;
</ins><span class="cx">     const ShadowData* selectionShadow = nullptr;
</span><span class="cx">     
</span><span class="cx">     // Text with custom underlines does not have selection background painted, so selection paint style is not appropriate for it.
</span><del>-    TextPaintStyle selectionPaintStyle = haveSelection &amp;&amp; !useCustomUnderlines ? computeTextSelectionPaintStyle(textPaintStyle, renderer(), lineStyle, paintInfo, paintSelectedTextOnly, paintSelectedTextSeparately, selectionShadow) : textPaintStyle;
</del><ins>+    TextPaintStyle selectionPaintStyle = haveSelection &amp;&amp; !useCustomUnderlines ? computeTextSelectionPaintStyle(textPaintStyle, renderer(), lineStyle, paintInfo, paintSelectedTextOnly, paintSelectedTextSeparately, paintNonSelectedTextOnly, selectionShadow) : textPaintStyle;
</ins><span class="cx"> 
</span><span class="cx">     // Set our font.
</span><span class="cx">     const FontCascade&amp; font = fontToUse(lineStyle, renderer());
</span><span class="lines">@@ -551,12 +552,32 @@
</span><span class="cx">     textPainter.addTextShadow(textShadow, selectionShadow);
</span><span class="cx">     textPainter.addEmphasis(emphasisMark, emphasisMarkOffset, combinedText);
</span><span class="cx"> 
</span><del>-    textPainter.paintText(textRun, length, boxRect, textOrigin, selectionStart, selectionEnd, paintSelectedTextOnly, paintSelectedTextSeparately);
</del><ins>+    textPainter.paintText(textRun, length, boxRect, textOrigin, selectionStart, selectionEnd, paintSelectedTextOnly, paintSelectedTextSeparately, paintNonSelectedTextOnly);
</ins><span class="cx"> 
</span><span class="cx">     // Paint decorations
</span><span class="cx">     TextDecoration textDecorations = lineStyle.textDecorationsInEffect();
</span><del>-    if (textDecorations != TextDecorationNone &amp;&amp; paintInfo.phase != PaintPhaseSelection)
-        paintDecoration(context, font, combinedText, textRun, textOrigin, boxRect, textDecorations, textPaintStyle, textShadow);
</del><ins>+    if (textDecorations != TextDecorationNone &amp;&amp; paintInfo.phase != PaintPhaseSelection) {
+        FloatRect textDecorationSelectionClipOutRect;
+        if ((paintInfo.paintBehavior &amp; PaintBehaviorExcludeSelection) &amp;&amp; selectionStart &lt; selectionEnd &amp;&amp; selectionEnd &lt;= length) {
+            textDecorationSelectionClipOutRect = logicalOverflowRect();
+            textDecorationSelectionClipOutRect.moveBy(localPaintOffset);
+            float logicalWidthBeforeRange;
+            float logicalWidthAfterRange;
+            float logicalSelectionWidth = font.widthOfTextRange(textRun, selectionStart, selectionEnd, nullptr, &amp;logicalWidthBeforeRange, &amp;logicalWidthAfterRange);
+            // FIXME: Do we need to handle vertical bottom to top text?
+            if (!isHorizontal()) {
+                textDecorationSelectionClipOutRect.move(0, logicalWidthBeforeRange);
+                textDecorationSelectionClipOutRect.setHeight(logicalSelectionWidth);
+            } else if (direction() == RTL) {
+                textDecorationSelectionClipOutRect.move(logicalWidthAfterRange, 0);
+                textDecorationSelectionClipOutRect.setWidth(logicalSelectionWidth);
+            } else {
+                textDecorationSelectionClipOutRect.move(logicalWidthBeforeRange, 0);
+                textDecorationSelectionClipOutRect.setWidth(logicalSelectionWidth);
+            }
+        }
+        paintDecoration(context, font, combinedText, textRun, textOrigin, boxRect, textDecorations, textPaintStyle, textShadow, textDecorationSelectionClipOutRect);
+    }
</ins><span class="cx"> 
</span><span class="cx">     if (paintInfo.phase == PaintPhaseForeground) {
</span><span class="cx">         paintDocumentMarkers(context, boxOrigin, lineStyle, font, false);
</span><span class="lines">@@ -695,7 +716,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InlineTextBox::paintDecoration(GraphicsContext&amp; context, const FontCascade&amp; font, RenderCombineText* combinedText, const TextRun&amp; textRun, const FloatPoint&amp; textOrigin,
</span><del>-    const FloatRect&amp; boxRect, TextDecoration decoration, TextPaintStyle textPaintStyle, const ShadowData* shadow)
</del><ins>+    const FloatRect&amp; boxRect, TextDecoration decoration, TextPaintStyle textPaintStyle, const ShadowData* shadow, const FloatRect&amp; clipOutRect)
</ins><span class="cx"> {
</span><span class="cx">     if (m_truncation == cFullTruncation)
</span><span class="cx">         return;
</span><span class="lines">@@ -721,8 +742,17 @@
</span><span class="cx"> 
</span><span class="cx">     FloatPoint localOrigin = boxRect.location();
</span><span class="cx">     localOrigin.move(start, 0);
</span><ins>+
+    if (!clipOutRect.isEmpty()) {
+        context.save();
+        context.clipOut(clipOutRect);
+    }
+
</ins><span class="cx">     decorationPainter.paintTextDecoration(textRun, textOrigin, localOrigin);
</span><span class="cx"> 
</span><ins>+    if (!clipOutRect.isEmpty())
+        context.restore();
+
</ins><span class="cx">     if (combinedText)
</span><span class="cx">         context.concatCTM(rotation(boxRect, Counterclockwise));
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingInlineTextBoxh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/InlineTextBox.h (213613 => 213614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/InlineTextBox.h        2017-03-09 01:35:37 UTC (rev 213613)
+++ trunk/Source/WebCore/rendering/InlineTextBox.h        2017-03-09 01:44:45 UTC (rev 213614)
</span><span class="lines">@@ -159,7 +159,7 @@
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     void paintDecoration(GraphicsContext&amp;, const FontCascade&amp;, RenderCombineText*, const TextRun&amp;, const FloatPoint&amp; textOrigin, const FloatRect&amp; boxRect,
</span><del>-        TextDecoration, TextPaintStyle, const ShadowData*);
</del><ins>+        TextDecoration, TextPaintStyle, const ShadowData*, const FloatRect&amp; clipOutRect);
</ins><span class="cx">     void paintSelection(GraphicsContext&amp;, const FloatPoint&amp; boxOrigin, const RenderStyle&amp;, const FontCascade&amp;, const Color&amp; textColor);
</span><span class="cx">     void paintDocumentMarker(GraphicsContext&amp;, const FloatPoint&amp; boxOrigin, RenderedDocumentMarker&amp;, const RenderStyle&amp;, const FontCascade&amp;, bool grammar);
</span><span class="cx">     void paintTextMatchMarker(GraphicsContext&amp;, const FloatPoint&amp; boxOrigin, RenderedDocumentMarker&amp;, const RenderStyle&amp;, const FontCascade&amp;);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingPaintPhaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/PaintPhase.h (213613 => 213614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/PaintPhase.h        2017-03-09 01:35:37 UTC (rev 213613)
+++ trunk/Source/WebCore/rendering/PaintPhase.h        2017-03-09 01:44:45 UTC (rev 213614)
</span><span class="lines">@@ -63,6 +63,7 @@
</span><span class="cx">     PaintBehaviorSkipRootBackground          = 1 &lt;&lt; 6,
</span><span class="cx">     PaintBehaviorRootBackgroundOnly          = 1 &lt;&lt; 7,
</span><span class="cx">     PaintBehaviorSelectionAndBackgroundsOnly = 1 &lt;&lt; 8,
</span><ins>+    PaintBehaviorExcludeSelection            = 1 &lt;&lt; 9,
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> typedef unsigned PaintBehavior;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (213613 => 213614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayer.cpp        2017-03-09 01:35:37 UTC (rev 213613)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp        2017-03-09 01:44:45 UTC (rev 213614)
</span><span class="lines">@@ -4375,6 +4375,9 @@
</span><span class="cx">         else if (localPaintFlags &amp; PaintLayerPaintingRootBackgroundOnly)
</span><span class="cx">             paintBehavior |= PaintBehaviorRootBackgroundOnly;
</span><span class="cx"> 
</span><ins>+        if (paintingInfo.paintBehavior &amp; PaintBehaviorExcludeSelection)
+            paintBehavior |= PaintBehaviorExcludeSelection;
+
</ins><span class="cx">         LayoutRect paintDirtyRect = localPaintingInfo.paintDirtyRect;
</span><span class="cx">         if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars) {
</span><span class="cx">             // Collect the fragments. This will compute the clip rectangles and paint offsets for each layer fragment, as well as whether or not the content of each
</span><span class="lines">@@ -4771,6 +4774,9 @@
</span><span class="cx">     else
</span><span class="cx">         localPaintBehavior = paintBehavior;
</span><span class="cx"> 
</span><ins>+    if (localPaintingInfo.paintBehavior &amp; PaintBehaviorExcludeSelection)
+        localPaintBehavior |= PaintBehaviorExcludeSelection;
+
</ins><span class="cx">     // Optimize clipping for the single fragment case.
</span><span class="cx">     bool shouldClip = localPaintingInfo.clipToDirtyRect &amp;&amp; layerFragments.size() == 1 &amp;&amp; layerFragments[0].shouldPaintContent &amp;&amp; !layerFragments[0].foregroundRect.isEmpty();
</span><span class="cx">     ClipRect clippedRect;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderReplacedcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderReplaced.cpp (213613 => 213614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderReplaced.cpp        2017-03-09 01:35:37 UTC (rev 213613)
+++ trunk/Source/WebCore/rendering/RenderReplaced.cpp        2017-03-09 01:44:45 UTC (rev 213614)
</span><span class="lines">@@ -205,6 +205,9 @@
</span><span class="cx"> 
</span><span class="cx"> bool RenderReplaced::shouldPaint(PaintInfo&amp; paintInfo, const LayoutPoint&amp; paintOffset)
</span><span class="cx"> {
</span><ins>+    if ((paintInfo.paintBehavior &amp; PaintBehaviorExcludeSelection) &amp;&amp; isSelected())
+        return false;
+
</ins><span class="cx">     if (paintInfo.phase != PaintPhaseForeground &amp;&amp; paintInfo.phase != PaintPhaseOutline &amp;&amp; paintInfo.phase != PaintPhaseSelfOutline 
</span><span class="cx">             &amp;&amp; paintInfo.phase != PaintPhaseSelection &amp;&amp; paintInfo.phase != PaintPhaseMask)
</span><span class="cx">         return false;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingTextDecorationPainterh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/TextDecorationPainter.h (213613 => 213614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/TextDecorationPainter.h        2017-03-09 01:35:37 UTC (rev 213613)
+++ trunk/Source/WebCore/rendering/TextDecorationPainter.h        2017-03-09 01:44:45 UTC (rev 213614)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> class FontCascade;
</span><ins>+class FloatRect;
</ins><span class="cx"> class GraphicsContext;
</span><span class="cx"> class InlineTextBox;
</span><span class="cx"> class RenderObject;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingTextPaintStylecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/TextPaintStyle.cpp (213613 => 213614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/TextPaintStyle.cpp        2017-03-09 01:35:37 UTC (rev 213613)
+++ trunk/Source/WebCore/rendering/TextPaintStyle.cpp        2017-03-09 01:44:45 UTC (rev 213614)
</span><span class="lines">@@ -116,10 +116,11 @@
</span><span class="cx">     return paintStyle;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-TextPaintStyle computeTextSelectionPaintStyle(const TextPaintStyle&amp; textPaintStyle, const RenderText&amp; renderer, const RenderStyle&amp; lineStyle, const PaintInfo&amp; paintInfo, bool&amp; paintSelectedTextOnly, bool&amp; paintSelectedTextSeparately, const ShadowData*&amp; selectionShadow)
</del><ins>+TextPaintStyle computeTextSelectionPaintStyle(const TextPaintStyle&amp; textPaintStyle, const RenderText&amp; renderer, const RenderStyle&amp; lineStyle, const PaintInfo&amp; paintInfo, bool&amp; paintSelectedTextOnly, bool&amp; paintSelectedTextSeparately, bool&amp; paintNonSelectedTextOnly, const ShadowData*&amp; selectionShadow)
</ins><span class="cx"> {
</span><span class="cx">     paintSelectedTextOnly = (paintInfo.phase == PaintPhaseSelection);
</span><del>-    paintSelectedTextSeparately = false;
</del><ins>+    paintSelectedTextSeparately = paintInfo.paintBehavior &amp; PaintBehaviorExcludeSelection;
+    paintNonSelectedTextOnly = paintInfo.paintBehavior &amp; PaintBehaviorExcludeSelection;
</ins><span class="cx">     selectionShadow = (paintInfo.forceTextColor()) ? nullptr : lineStyle.textShadow();
</span><span class="cx"> 
</span><span class="cx">     TextPaintStyle selectionPaintStyle = textPaintStyle;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingTextPaintStyleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/TextPaintStyle.h (213613 => 213614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/TextPaintStyle.h        2017-03-09 01:35:37 UTC (rev 213613)
+++ trunk/Source/WebCore/rendering/TextPaintStyle.h        2017-03-09 01:44:45 UTC (rev 213614)
</span><span class="lines">@@ -55,7 +55,7 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> TextPaintStyle computeTextPaintStyle(const Frame&amp;, const RenderStyle&amp;, const PaintInfo&amp;);
</span><del>-TextPaintStyle computeTextSelectionPaintStyle(const TextPaintStyle&amp;, const RenderText&amp;, const RenderStyle&amp;, const PaintInfo&amp;, bool&amp; paintSelectedTextOnly, bool&amp; paintSelectedTextSeparately, const ShadowData*&amp; selectionShadow);
</del><ins>+TextPaintStyle computeTextSelectionPaintStyle(const TextPaintStyle&amp;, const RenderText&amp;, const RenderStyle&amp;, const PaintInfo&amp;, bool&amp; paintSelectedTextOnly, bool&amp; paintSelectedTextSeparately, bool&amp; paintNonSelectedTextOnly, const ShadowData*&amp; selectionShadow);
</ins><span class="cx"> 
</span><span class="cx"> enum FillColorType { UseNormalFillColor, UseEmphasisMarkColor };
</span><span class="cx"> void updateGraphicsContext(GraphicsContext&amp;, const TextPaintStyle&amp;, FillColorType = UseNormalFillColor);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingTextPaintercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/TextPainter.cpp (213613 => 213614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/TextPainter.cpp        2017-03-09 01:35:37 UTC (rev 213613)
+++ trunk/Source/WebCore/rendering/TextPainter.cpp        2017-03-09 01:44:45 UTC (rev 213614)
</span><span class="lines">@@ -170,7 +170,7 @@
</span><span class="cx"> }
</span><span class="cx">     
</span><span class="cx"> void TextPainter::paintText(const TextRun&amp; textRun, unsigned length, const FloatRect&amp; boxRect, const FloatPoint&amp; textOrigin, unsigned selectionStart, unsigned selectionEnd,
</span><del>-    bool paintSelectedTextOnly, bool paintSelectedTextSeparately)
</del><ins>+    bool paintSelectedTextOnly, bool paintSelectedTextSeparately, bool paintNonSelectedTextOnly)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(m_font);
</span><span class="cx">     if (!paintSelectedTextOnly) {
</span><span class="lines">@@ -189,6 +189,10 @@
</span><span class="cx">                 paintTextAndEmphasisMarksIfNeeded(textRun, boxRect, textOrigin, selectionEnd, length, m_textPaintStyle, m_textShadow);
</span><span class="cx">         }
</span><span class="cx">     }
</span><ins>+
+    if (paintNonSelectedTextOnly)
+        return;
+
</ins><span class="cx">     // Paint only the text that is selected.
</span><span class="cx">     if ((paintSelectedTextOnly || paintSelectedTextSeparately) &amp;&amp; selectionStart &lt; selectionEnd) {
</span><span class="cx">         GraphicsContextStateSaver stateSaver(m_context, m_selectionPaintStyle.strokeWidth &gt; 0);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingTextPainterh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/TextPainter.h (213613 => 213614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/TextPainter.h        2017-03-09 01:35:37 UTC (rev 213613)
+++ trunk/Source/WebCore/rendering/TextPainter.h        2017-03-09 01:44:45 UTC (rev 213614)
</span><span class="lines">@@ -57,7 +57,7 @@
</span><span class="cx">     void addTextShadow(const ShadowData* textShadow, const ShadowData* selectionShadow);
</span><span class="cx"> 
</span><span class="cx">     void paintText(const TextRun&amp;, unsigned length, const FloatRect&amp; boxRect, const FloatPoint&amp; textOrigin,
</span><del>-        unsigned selectionStart = 0, unsigned selectionEnd = 0, bool paintSelectedTextOnly = false, bool paintSelectedTextSeparately = false);
</del><ins>+        unsigned selectionStart = 0, unsigned selectionEnd = 0, bool paintSelectedTextOnly = false, bool paintSelectedTextSeparately = false, bool paintNonSelectedTextOnly = false);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     void drawTextOrEmphasisMarks(const FontCascade&amp;, const TextRun&amp;, const AtomicString&amp; emphasisMark, float emphasisMarkOffset,
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (213613 => 213614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2017-03-09 01:35:37 UTC (rev 213613)
+++ trunk/Source/WebKit2/ChangeLog        2017-03-09 01:44:45 UTC (rev 213614)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2017-03-08  Wenson Hsieh  &lt;wenson_hsieh@apple.com&gt;
+
+        Add TextIndicator support for providing a snapshot excluding selected content
+        https://bugs.webkit.org/show_bug.cgi?id=169309
+        &lt;rdar://problem/30883525&gt;
+
+        Reviewed by Tim Horton.
+
+        Serialize the snapshot excluding the selection and the snapshot's bounds when sending TextIndicatorData over
+        IPC to the UI process.
+
+        * Shared/WebCoreArgumentCoders.cpp:
+        (IPC::ArgumentCoder&lt;TextIndicatorData&gt;::encode):
+        (IPC::ArgumentCoder&lt;TextIndicatorData&gt;::decode):
+
</ins><span class="cx"> 2017-03-08  Brent Fulgham  &lt;bfulgham@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION(r213564): Netflix does not play content
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebCoreArgumentCoderscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp (213613 => 213614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp        2017-03-09 01:35:37 UTC (rev 213613)
+++ trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp        2017-03-09 01:44:45 UTC (rev 213614)
</span><span class="lines">@@ -2082,6 +2082,7 @@
</span><span class="cx">     encoder &lt;&lt; textIndicatorData.selectionRectInRootViewCoordinates;
</span><span class="cx">     encoder &lt;&lt; textIndicatorData.textBoundingRectInRootViewCoordinates;
</span><span class="cx">     encoder &lt;&lt; textIndicatorData.textRectsInBoundingRectCoordinates;
</span><ins>+    encoder &lt;&lt; textIndicatorData.contentImageWithoutSelectionRectInRootViewCoordinates;
</ins><span class="cx">     encoder &lt;&lt; textIndicatorData.contentImageScaleFactor;
</span><span class="cx">     encoder.encodeEnum(textIndicatorData.presentationTransition);
</span><span class="cx">     encoder &lt;&lt; static_cast&lt;uint64_t&gt;(textIndicatorData.options);
</span><span class="lines">@@ -2088,6 +2089,7 @@
</span><span class="cx"> 
</span><span class="cx">     encodeOptionalImage(encoder, textIndicatorData.contentImage.get());
</span><span class="cx">     encodeOptionalImage(encoder, textIndicatorData.contentImageWithHighlight.get());
</span><ins>+    encodeOptionalImage(encoder, textIndicatorData.contentImageWithoutSelection.get());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool ArgumentCoder&lt;TextIndicatorData&gt;::decode(Decoder&amp; decoder, TextIndicatorData&amp; textIndicatorData)
</span><span class="lines">@@ -2101,6 +2103,9 @@
</span><span class="cx">     if (!decoder.decode(textIndicatorData.textRectsInBoundingRectCoordinates))
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><ins>+    if (!decoder.decode(textIndicatorData.contentImageWithoutSelectionRectInRootViewCoordinates))
+        return false;
+
</ins><span class="cx">     if (!decoder.decode(textIndicatorData.contentImageScaleFactor))
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="lines">@@ -2118,6 +2123,9 @@
</span><span class="cx">     if (!decodeOptionalImage(decoder, textIndicatorData.contentImageWithHighlight))
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><ins>+    if (!decodeOptionalImage(decoder, textIndicatorData.contentImageWithoutSelection))
+        return false;
+
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>