<!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>[204400] trunk/Source/WebCore</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/204400">204400</a></dd>
<dt>Author</dt> <dd>mmaxfield@apple.com</dd>
<dt>Date</dt> <dd>2016-08-11 18:22:55 -0700 (Thu, 11 Aug 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Migrate from ints to unsigneds when referring to indices into strings
https://bugs.webkit.org/show_bug.cgi?id=160735

Reviewed by Simon Fraser.

There are a few cases where we use ints to refer to indices into strings:
- A simple historical accident. These were migrated to unsigneds directly.
- Where we use -1 as a sentinal value. These were migrated to Optional&lt;unsigned&gt;.

This patch only modifies rendering code (rather than DOM code). There are a few
places in DOM code (such as Position and Node::maxCharacterOffset()) which also
erroneously use ints; however, I didn't want this change to be observable from
script and I wanted to keep this patch to a reasonable size.

No new tests because there is no behavior change.

* editing/FrameSelection.cpp:
(WebCore::FrameSelection::updateAppearance):
(WebCore::FrameSelection::setCaretVisibility):
* platform/DragImage.cpp:
(WebCore::createDragImageForRange):
* platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::glyphBufferForTextRun):
(WebCore::FontCascade::drawText):
(WebCore::FontCascade::drawEmphasisMarks):
(WebCore::FontCascade::adjustSelectionRectForText):
(WebCore::computeUnderlineType):
(WebCore::FontCascade::getGlyphsAndAdvancesForSimpleText):
(WebCore::FontCascade::drawEmphasisMarksForSimpleText):
(WebCore::FontCascade::drawGlyphBuffer):
(WebCore::offsetToMiddleOfGlyphAtIndex):
(WebCore::FontCascade::adjustSelectionRectForSimpleText):
* platform/graphics/FontCascade.h:
* platform/graphics/GlyphBuffer.h:
(WebCore::GlyphBuffer::size):
(WebCore::GlyphBuffer::glyphs):
(WebCore::GlyphBuffer::advances):
(WebCore::GlyphBuffer::fontAt):
(WebCore::GlyphBuffer::glyphAt):
(WebCore::GlyphBuffer::advanceAt):
(WebCore::GlyphBuffer::offsetAt):
(WebCore::GlyphBuffer::reverse):
(WebCore::GlyphBuffer::offsetInString):
(WebCore::GlyphBuffer::shrink):
(WebCore::GlyphBuffer::swap):
* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::drawText):
(WebCore::GraphicsContext::drawGlyphs):
(WebCore::GraphicsContext::drawEmphasisMarks):
* platform/graphics/GraphicsContext.h:
* platform/graphics/Latin1TextIterator.h:
(WebCore::Latin1TextIterator::Latin1TextIterator):
(WebCore::Latin1TextIterator::currentCharacter):
* platform/graphics/SurrogatePairAwareTextIterator.cpp:
(WebCore::SurrogatePairAwareTextIterator::SurrogatePairAwareTextIterator):
* platform/graphics/SurrogatePairAwareTextIterator.h:
(WebCore::SurrogatePairAwareTextIterator::currentCharacter):
* platform/graphics/WidthIterator.cpp:
(WebCore::WidthIterator::applyFontTransforms):
(WebCore::WidthIterator::advanceInternal):
(WebCore::WidthIterator::advance):
(WebCore::WidthIterator::advanceOneCharacter):
* platform/graphics/WidthIterator.h:
* platform/graphics/cairo/FontCairo.cpp:
(WebCore::drawGlyphsToContext):
(WebCore::drawGlyphsShadow):
(WebCore::FontCascade::drawGlyphs):
* platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
(WebCore::FontCascade::getGlyphsAndAdvancesForComplexText):
(WebCore::FontCascade::drawEmphasisMarksForComplexText):
(WebCore::FontCascade::adjustSelectionRectForComplexText):
* platform/graphics/cocoa/FontCascadeCocoa.mm:
(WebCore::fillVectorWithHorizontalGlyphPositions):
(WebCore::showLetterpressedGlyphsWithAdvances):
(WebCore::showGlyphsWithAdvances):
(WebCore::FontCascade::drawGlyphs):
(WebCore::FontCascade::dashesForIntersectionsWithRect):
(WebCore::FontCascade::adjustSelectionRectForComplexText):
(WebCore::FontCascade::getGlyphsAndAdvancesForComplexText):
(WebCore::FontCascade::drawEmphasisMarksForComplexText):
* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::drawGlyphs):
* platform/graphics/displaylists/DisplayListRecorder.h:
* platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
(WebCore::HarfBuzzShaper::selectionRect):
* platform/graphics/harfbuzz/HarfBuzzShaper.h:
* platform/graphics/mac/ComplexTextController.h:
* platform/graphics/win/FontCGWin.cpp:
(WebCore::FontCascade::drawGlyphs):
* platform/graphics/win/FontWin.cpp:
(WebCore::FontCascade::adjustSelectionRectForComplexText):
(WebCore::FontCascade::getGlyphsAndAdvancesForComplexText):
(WebCore::FontCascade::drawEmphasisMarksForComplexText):
* rendering/EllipsisBox.cpp:
(WebCore::EllipsisBox::paintSelection):
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::isSelected):
(WebCore::InlineTextBox::selectionState):
(WebCore::InlineTextBox::localSelectionRect):
(WebCore::InlineTextBox::paint):
(WebCore::InlineTextBox::clampedOffset):
(WebCore::InlineTextBox::selectionStartEnd):
(WebCore::InlineTextBox::paintSelection):
(WebCore::InlineTextBox::paintCompositionBackground):
(WebCore::InlineTextBox::paintDocumentMarker):
(WebCore::InlineTextBox::paintTextMatchMarker):
(WebCore::InlineTextBox::positionForOffset):
* rendering/InlineTextBox.h:
(WebCore::InlineTextBox::offsetRun):
(WebCore::InlineTextBox::InlineTextBox): Deleted.
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::localCaretRect):
* rendering/RenderBlock.h:
* rendering/RenderBox.cpp:
(WebCore::RenderBox::localCaretRect):
* rendering/RenderBox.h:
* rendering/RenderInline.cpp:
(WebCore::RenderInline::localCaretRect):
* rendering/RenderInline.h:
* rendering/RenderLineBreak.cpp:
(WebCore::RenderLineBreak::localCaretRect):
* rendering/RenderLineBreak.h:
* rendering/RenderObject.cpp:
(WebCore::RenderObject::selectionStartEnd):
(WebCore::RenderObject::localCaretRect):
* rendering/RenderObject.h:
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::isSelected):
* rendering/RenderText.cpp:
(WebCore::RenderText::localCaretRect):
(WebCore::RenderText::collectSelectionRectsForLineBoxes):
* rendering/RenderText.h:
* rendering/RenderTextLineBoxes.cpp:
(WebCore::RenderTextLineBoxes::setSelectionState):
* rendering/RenderView.cpp:
(WebCore::RenderView::subtreeSelectionBounds):
(WebCore::RenderView::repaintSubtreeSelection):
(WebCore::RenderView::setSelection):
(WebCore::RenderView::splitSelectionBetweenSubtrees):
(WebCore::RenderView::clearSubtreeSelection):
(WebCore::RenderView::applySubtreeSelection):
(WebCore::RenderView::getSelection):
(WebCore::RenderView::clearSelection):
(WebCore::RenderView::RenderView): Deleted.
* rendering/RenderView.h:
* rendering/SelectionSubtreeRoot.cpp:
(WebCore::SelectionSubtreeRoot::adjustForVisibleSelection):
(WebCore::SelectionSubtreeRoot::SelectionSubtreeRoot): Deleted.
* rendering/SelectionSubtreeRoot.h:
(WebCore::SelectionSubtreeRoot::SelectionSubtreeData::SelectionSubtreeData):
(WebCore::SelectionSubtreeRoot::SelectionSubtreeData::selectionStartPos):
(WebCore::SelectionSubtreeRoot::SelectionSubtreeData::selectionEndPos):
(WebCore::SelectionSubtreeRoot::SelectionSubtreeData::selectionClear):
(WebCore::SelectionSubtreeRoot::SelectionSubtreeData::selectionStartEndPositions):
(WebCore::SelectionSubtreeRoot::SelectionSubtreeData::setSelectionStartPos):
(WebCore::SelectionSubtreeRoot::SelectionSubtreeData::setSelectionEndPos):
(WebCore::SelectionSubtreeRoot::SelectionSubtreeData::clearSelection):
(WebCore::SelectionSubtreeRoot::OldSelectionData::OldSelectionData): Deleted.
* rendering/TextPainter.cpp:
(WebCore::TextPainter::drawTextOrEmphasisMarks):
(WebCore::TextPainter::paintTextWithShadows):
(WebCore::TextPainter::paintTextAndEmphasisMarksIfNeeded):
(WebCore::TextPainter::paintText):
* rendering/TextPainter.h:
(WebCore::TextPainter::addEmphasis):
* rendering/svg/RenderSVGInlineText.cpp:
(WebCore::RenderSVGInlineText::localCaretRect):
* rendering/svg/RenderSVGInlineText.h:
* rendering/svg/SVGInlineTextBox.cpp:
(WebCore::SVGInlineTextBox::positionForOffset):
(WebCore::SVGInlineTextBox::selectionRectForTextFragment):
(WebCore::SVGInlineTextBox::localSelectionRect):
(WebCore::SVGInlineTextBox::paintSelectionBackground):
(WebCore::SVGInlineTextBox::mapStartEndPositionsIntoFragmentCoordinates):
(WebCore::SVGInlineTextBox::paintTextWithShadows):
(WebCore::SVGInlineTextBox::paintText):
* rendering/svg/SVGInlineTextBox.h:
* rendering/svg/SVGTextQuery.cpp:
(WebCore::SVGTextQuery::mapStartEndPositionsIntoFragmentCoordinates):
(WebCore::SVGTextQuery::modifyStartEndPositionsRespectingLigatures):
(WebCore::SVGTextQuery::subStringLengthCallback):
(WebCore::SVGTextQuery::startPositionOfCharacterCallback):
(WebCore::SVGTextQuery::endPositionOfCharacterCallback):
(WebCore::SVGTextQuery::rotationOfCharacterCallback):
(WebCore::calculateGlyphBoundaries):
(WebCore::SVGTextQuery::extentOfCharacterCallback):
(WebCore::SVGTextQuery::characterNumberAtPositionCallback):
* rendering/svg/SVGTextQuery.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreeditingFrameSelectioncpp">trunk/Source/WebCore/editing/FrameSelection.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformDragImagecpp">trunk/Source/WebCore/platform/DragImage.cpp</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="#trunkSourceWebCoreplatformgraphicsGlyphBufferh">trunk/Source/WebCore/platform/graphics/GlyphBuffer.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsGraphicsContextcpp">trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsGraphicsContexth">trunk/Source/WebCore/platform/graphics/GraphicsContext.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsLatin1TextIteratorh">trunk/Source/WebCore/platform/graphics/Latin1TextIterator.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsSurrogatePairAwareTextIteratorcpp">trunk/Source/WebCore/platform/graphics/SurrogatePairAwareTextIterator.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsSurrogatePairAwareTextIteratorh">trunk/Source/WebCore/platform/graphics/SurrogatePairAwareTextIterator.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsWidthIteratorcpp">trunk/Source/WebCore/platform/graphics/WidthIterator.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsWidthIteratorh">trunk/Source/WebCore/platform/graphics/WidthIterator.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscairoFontCairocpp">trunk/Source/WebCore/platform/graphics/cairo/FontCairo.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscairoFontCairoHarfbuzzNGcpp">trunk/Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscocoaFontCascadeCocoamm">trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsdisplaylistsDisplayListRecordercpp">trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsdisplaylistsDisplayListRecorderh">trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsharfbuzzHarfBuzzShapercpp">trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsharfbuzzHarfBuzzShaperh">trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsmacComplexTextControllerh">trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicswinFontCGWincpp">trunk/Source/WebCore/platform/graphics/win/FontCGWin.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicswinFontWincpp">trunk/Source/WebCore/platform/graphics/win/FontWin.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingEllipsisBoxcpp">trunk/Source/WebCore/rendering/EllipsisBox.cpp</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="#trunkSourceWebCorerenderingRenderBlockcpp">trunk/Source/WebCore/rendering/RenderBlock.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBlockh">trunk/Source/WebCore/rendering/RenderBlock.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBoxcpp">trunk/Source/WebCore/rendering/RenderBox.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBoxh">trunk/Source/WebCore/rendering/RenderBox.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderInlinecpp">trunk/Source/WebCore/rendering/RenderInline.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderInlineh">trunk/Source/WebCore/rendering/RenderInline.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLineBreakcpp">trunk/Source/WebCore/rendering/RenderLineBreak.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLineBreakh">trunk/Source/WebCore/rendering/RenderLineBreak.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderObjectcpp">trunk/Source/WebCore/rendering/RenderObject.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderObjecth">trunk/Source/WebCore/rendering/RenderObject.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderReplacedcpp">trunk/Source/WebCore/rendering/RenderReplaced.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderTextcpp">trunk/Source/WebCore/rendering/RenderText.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderTexth">trunk/Source/WebCore/rendering/RenderText.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderTextLineBoxescpp">trunk/Source/WebCore/rendering/RenderTextLineBoxes.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderViewcpp">trunk/Source/WebCore/rendering/RenderView.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderViewh">trunk/Source/WebCore/rendering/RenderView.h</a></li>
<li><a href="#trunkSourceWebCorerenderingSelectionSubtreeRootcpp">trunk/Source/WebCore/rendering/SelectionSubtreeRoot.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingSelectionSubtreeRooth">trunk/Source/WebCore/rendering/SelectionSubtreeRoot.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="#trunkSourceWebCorerenderingsvgRenderSVGInlineTextcpp">trunk/Source/WebCore/rendering/svg/RenderSVGInlineText.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingsvgRenderSVGInlineTexth">trunk/Source/WebCore/rendering/svg/RenderSVGInlineText.h</a></li>
<li><a href="#trunkSourceWebCorerenderingsvgSVGInlineTextBoxcpp">trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingsvgSVGInlineTextBoxh">trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.h</a></li>
<li><a href="#trunkSourceWebCorerenderingsvgSVGTextQuerycpp">trunk/Source/WebCore/rendering/svg/SVGTextQuery.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingsvgSVGTextQueryh">trunk/Source/WebCore/rendering/svg/SVGTextQuery.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/ChangeLog        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -1,3 +1,194 @@
</span><ins>+2016-08-11  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
+
+        Migrate from ints to unsigneds when referring to indices into strings
+        https://bugs.webkit.org/show_bug.cgi?id=160735
+
+        Reviewed by Simon Fraser.
+
+        There are a few cases where we use ints to refer to indices into strings:
+        - A simple historical accident. These were migrated to unsigneds directly.
+        - Where we use -1 as a sentinal value. These were migrated to Optional&lt;unsigned&gt;.
+
+        This patch only modifies rendering code (rather than DOM code). There are a few
+        places in DOM code (such as Position and Node::maxCharacterOffset()) which also
+        erroneously use ints; however, I didn't want this change to be observable from
+        script and I wanted to keep this patch to a reasonable size.
+
+        No new tests because there is no behavior change.
+
+        * editing/FrameSelection.cpp:
+        (WebCore::FrameSelection::updateAppearance):
+        (WebCore::FrameSelection::setCaretVisibility):
+        * platform/DragImage.cpp:
+        (WebCore::createDragImageForRange):
+        * platform/graphics/FontCascade.cpp:
+        (WebCore::FontCascade::glyphBufferForTextRun):
+        (WebCore::FontCascade::drawText):
+        (WebCore::FontCascade::drawEmphasisMarks):
+        (WebCore::FontCascade::adjustSelectionRectForText):
+        (WebCore::computeUnderlineType):
+        (WebCore::FontCascade::getGlyphsAndAdvancesForSimpleText):
+        (WebCore::FontCascade::drawEmphasisMarksForSimpleText):
+        (WebCore::FontCascade::drawGlyphBuffer):
+        (WebCore::offsetToMiddleOfGlyphAtIndex):
+        (WebCore::FontCascade::adjustSelectionRectForSimpleText):
+        * platform/graphics/FontCascade.h:
+        * platform/graphics/GlyphBuffer.h:
+        (WebCore::GlyphBuffer::size):
+        (WebCore::GlyphBuffer::glyphs):
+        (WebCore::GlyphBuffer::advances):
+        (WebCore::GlyphBuffer::fontAt):
+        (WebCore::GlyphBuffer::glyphAt):
+        (WebCore::GlyphBuffer::advanceAt):
+        (WebCore::GlyphBuffer::offsetAt):
+        (WebCore::GlyphBuffer::reverse):
+        (WebCore::GlyphBuffer::offsetInString):
+        (WebCore::GlyphBuffer::shrink):
+        (WebCore::GlyphBuffer::swap):
+        * platform/graphics/GraphicsContext.cpp:
+        (WebCore::GraphicsContext::drawText):
+        (WebCore::GraphicsContext::drawGlyphs):
+        (WebCore::GraphicsContext::drawEmphasisMarks):
+        * platform/graphics/GraphicsContext.h:
+        * platform/graphics/Latin1TextIterator.h:
+        (WebCore::Latin1TextIterator::Latin1TextIterator):
+        (WebCore::Latin1TextIterator::currentCharacter):
+        * platform/graphics/SurrogatePairAwareTextIterator.cpp:
+        (WebCore::SurrogatePairAwareTextIterator::SurrogatePairAwareTextIterator):
+        * platform/graphics/SurrogatePairAwareTextIterator.h:
+        (WebCore::SurrogatePairAwareTextIterator::currentCharacter):
+        * platform/graphics/WidthIterator.cpp:
+        (WebCore::WidthIterator::applyFontTransforms):
+        (WebCore::WidthIterator::advanceInternal):
+        (WebCore::WidthIterator::advance):
+        (WebCore::WidthIterator::advanceOneCharacter):
+        * platform/graphics/WidthIterator.h:
+        * platform/graphics/cairo/FontCairo.cpp:
+        (WebCore::drawGlyphsToContext):
+        (WebCore::drawGlyphsShadow):
+        (WebCore::FontCascade::drawGlyphs):
+        * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
+        (WebCore::FontCascade::getGlyphsAndAdvancesForComplexText):
+        (WebCore::FontCascade::drawEmphasisMarksForComplexText):
+        (WebCore::FontCascade::adjustSelectionRectForComplexText):
+        * platform/graphics/cocoa/FontCascadeCocoa.mm:
+        (WebCore::fillVectorWithHorizontalGlyphPositions):
+        (WebCore::showLetterpressedGlyphsWithAdvances):
+        (WebCore::showGlyphsWithAdvances):
+        (WebCore::FontCascade::drawGlyphs):
+        (WebCore::FontCascade::dashesForIntersectionsWithRect):
+        (WebCore::FontCascade::adjustSelectionRectForComplexText):
+        (WebCore::FontCascade::getGlyphsAndAdvancesForComplexText):
+        (WebCore::FontCascade::drawEmphasisMarksForComplexText):
+        * platform/graphics/displaylists/DisplayListRecorder.cpp:
+        (WebCore::DisplayList::Recorder::drawGlyphs):
+        * platform/graphics/displaylists/DisplayListRecorder.h:
+        * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
+        (WebCore::HarfBuzzShaper::selectionRect):
+        * platform/graphics/harfbuzz/HarfBuzzShaper.h:
+        * platform/graphics/mac/ComplexTextController.h:
+        * platform/graphics/win/FontCGWin.cpp:
+        (WebCore::FontCascade::drawGlyphs):
+        * platform/graphics/win/FontWin.cpp:
+        (WebCore::FontCascade::adjustSelectionRectForComplexText):
+        (WebCore::FontCascade::getGlyphsAndAdvancesForComplexText):
+        (WebCore::FontCascade::drawEmphasisMarksForComplexText):
+        * rendering/EllipsisBox.cpp:
+        (WebCore::EllipsisBox::paintSelection):
+        * rendering/InlineTextBox.cpp:
+        (WebCore::InlineTextBox::isSelected):
+        (WebCore::InlineTextBox::selectionState):
+        (WebCore::InlineTextBox::localSelectionRect):
+        (WebCore::InlineTextBox::paint):
+        (WebCore::InlineTextBox::clampedOffset):
+        (WebCore::InlineTextBox::selectionStartEnd):
+        (WebCore::InlineTextBox::paintSelection):
+        (WebCore::InlineTextBox::paintCompositionBackground):
+        (WebCore::InlineTextBox::paintDocumentMarker):
+        (WebCore::InlineTextBox::paintTextMatchMarker):
+        (WebCore::InlineTextBox::positionForOffset):
+        * rendering/InlineTextBox.h:
+        (WebCore::InlineTextBox::offsetRun):
+        (WebCore::InlineTextBox::InlineTextBox): Deleted.
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::localCaretRect):
+        * rendering/RenderBlock.h:
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::localCaretRect):
+        * rendering/RenderBox.h:
+        * rendering/RenderInline.cpp:
+        (WebCore::RenderInline::localCaretRect):
+        * rendering/RenderInline.h:
+        * rendering/RenderLineBreak.cpp:
+        (WebCore::RenderLineBreak::localCaretRect):
+        * rendering/RenderLineBreak.h:
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::selectionStartEnd):
+        (WebCore::RenderObject::localCaretRect):
+        * rendering/RenderObject.h:
+        * rendering/RenderReplaced.cpp:
+        (WebCore::RenderReplaced::isSelected):
+        * rendering/RenderText.cpp:
+        (WebCore::RenderText::localCaretRect):
+        (WebCore::RenderText::collectSelectionRectsForLineBoxes):
+        * rendering/RenderText.h:
+        * rendering/RenderTextLineBoxes.cpp:
+        (WebCore::RenderTextLineBoxes::setSelectionState):
+        * rendering/RenderView.cpp:
+        (WebCore::RenderView::subtreeSelectionBounds):
+        (WebCore::RenderView::repaintSubtreeSelection):
+        (WebCore::RenderView::setSelection):
+        (WebCore::RenderView::splitSelectionBetweenSubtrees):
+        (WebCore::RenderView::clearSubtreeSelection):
+        (WebCore::RenderView::applySubtreeSelection):
+        (WebCore::RenderView::getSelection):
+        (WebCore::RenderView::clearSelection):
+        (WebCore::RenderView::RenderView): Deleted.
+        * rendering/RenderView.h:
+        * rendering/SelectionSubtreeRoot.cpp:
+        (WebCore::SelectionSubtreeRoot::adjustForVisibleSelection):
+        (WebCore::SelectionSubtreeRoot::SelectionSubtreeRoot): Deleted.
+        * rendering/SelectionSubtreeRoot.h:
+        (WebCore::SelectionSubtreeRoot::SelectionSubtreeData::SelectionSubtreeData):
+        (WebCore::SelectionSubtreeRoot::SelectionSubtreeData::selectionStartPos):
+        (WebCore::SelectionSubtreeRoot::SelectionSubtreeData::selectionEndPos):
+        (WebCore::SelectionSubtreeRoot::SelectionSubtreeData::selectionClear):
+        (WebCore::SelectionSubtreeRoot::SelectionSubtreeData::selectionStartEndPositions):
+        (WebCore::SelectionSubtreeRoot::SelectionSubtreeData::setSelectionStartPos):
+        (WebCore::SelectionSubtreeRoot::SelectionSubtreeData::setSelectionEndPos):
+        (WebCore::SelectionSubtreeRoot::SelectionSubtreeData::clearSelection):
+        (WebCore::SelectionSubtreeRoot::OldSelectionData::OldSelectionData): Deleted.
+        * rendering/TextPainter.cpp:
+        (WebCore::TextPainter::drawTextOrEmphasisMarks):
+        (WebCore::TextPainter::paintTextWithShadows):
+        (WebCore::TextPainter::paintTextAndEmphasisMarksIfNeeded):
+        (WebCore::TextPainter::paintText):
+        * rendering/TextPainter.h:
+        (WebCore::TextPainter::addEmphasis):
+        * rendering/svg/RenderSVGInlineText.cpp:
+        (WebCore::RenderSVGInlineText::localCaretRect):
+        * rendering/svg/RenderSVGInlineText.h:
+        * rendering/svg/SVGInlineTextBox.cpp:
+        (WebCore::SVGInlineTextBox::positionForOffset):
+        (WebCore::SVGInlineTextBox::selectionRectForTextFragment):
+        (WebCore::SVGInlineTextBox::localSelectionRect):
+        (WebCore::SVGInlineTextBox::paintSelectionBackground):
+        (WebCore::SVGInlineTextBox::mapStartEndPositionsIntoFragmentCoordinates):
+        (WebCore::SVGInlineTextBox::paintTextWithShadows):
+        (WebCore::SVGInlineTextBox::paintText):
+        * rendering/svg/SVGInlineTextBox.h:
+        * rendering/svg/SVGTextQuery.cpp:
+        (WebCore::SVGTextQuery::mapStartEndPositionsIntoFragmentCoordinates):
+        (WebCore::SVGTextQuery::modifyStartEndPositionsRespectingLigatures):
+        (WebCore::SVGTextQuery::subStringLengthCallback):
+        (WebCore::SVGTextQuery::startPositionOfCharacterCallback):
+        (WebCore::SVGTextQuery::endPositionOfCharacterCallback):
+        (WebCore::SVGTextQuery::rotationOfCharacterCallback):
+        (WebCore::calculateGlyphBoundaries):
+        (WebCore::SVGTextQuery::extentOfCharacterCallback):
+        (WebCore::SVGTextQuery::characterNumberAtPositionCallback):
+        * rendering/svg/SVGTextQuery.h:
+
</ins><span class="cx"> 2016-08-11  Alex Christensen  &lt;achristensen@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Don't use a NetworkingContext when creating SocketStreamHandles
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingFrameSelectioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/FrameSelection.cpp (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/FrameSelection.cpp        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/editing/FrameSelection.cpp        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -2088,8 +2088,11 @@
</span><span class="cx">     // because we don't yet notify the FrameSelection of text removal.
</span><span class="cx">     if (startPos.isNotNull() &amp;&amp; endPos.isNotNull() &amp;&amp; selection.visibleStart() != selection.visibleEnd()) {
</span><span class="cx">         RenderObject* startRenderer = startPos.deprecatedNode()-&gt;renderer();
</span><ins>+        int startOffset = startPos.deprecatedEditingOffset();
</ins><span class="cx">         RenderObject* endRenderer = endPos.deprecatedNode()-&gt;renderer();
</span><del>-        view-&gt;setSelection(startRenderer, startPos.deprecatedEditingOffset(), endRenderer, endPos.deprecatedEditingOffset());
</del><ins>+        int endOffset = endPos.deprecatedEditingOffset();
+        ASSERT(startOffset &gt;= 0 &amp;&amp; endOffset &gt;= 0);
+        view-&gt;setSelection(startRenderer, startOffset, endRenderer, endOffset);
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2098,7 +2101,7 @@
</span><span class="cx">     if (caretVisibility() == visibility)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    // FIXME: We shouldn't trigger a synchrnously layout here.
</del><ins>+    // FIXME: We shouldn't trigger a synchronous layout here.
</ins><span class="cx">     if (m_frame)
</span><span class="cx">         updateSelectionByUpdatingLayoutOrStyle(*m_frame);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformDragImagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/DragImage.cpp (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/DragImage.cpp        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/platform/DragImage.cpp        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -141,8 +141,8 @@
</span><span class="cx">     const Frame&amp; frame;
</span><span class="cx">     RenderObject* startRenderer;
</span><span class="cx">     RenderObject* endRenderer;
</span><del>-    int startOffset;
-    int endOffset;
</del><ins>+    Optional&lt;unsigned&gt; startOffset;
+    Optional&lt;unsigned&gt; endOffset;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> DragImageRef createDragImageForRange(Frame&amp; frame, Range&amp; range, bool forceBlackText)
</span><span class="lines">@@ -174,7 +174,10 @@
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><span class="cx">     SnapshotOptions options = SnapshotOptionsPaintSelectionOnly | (forceBlackText ? SnapshotOptionsForceBlackText : SnapshotOptionsNone);
</span><del>-    view-&gt;setSelection(startRenderer, start.deprecatedEditingOffset(), endRenderer, end.deprecatedEditingOffset(), RenderView::RepaintNothing);
</del><ins>+    int startOffset = start.deprecatedEditingOffset();
+    int endOffset = end.deprecatedEditingOffset();
+    ASSERT(startOffset &gt;= 0 &amp;&amp; endOffset &gt;= 0);
+    view-&gt;setSelection(startRenderer, startOffset, endRenderer, endOffset, RenderView::RepaintNothing);
</ins><span class="cx">     // We capture using snapshotFrameRect() because we fake up the selection using
</span><span class="cx">     // FrameView but snapshotSelection() uses the selection from the Frame itself.
</span><span class="cx">     return createDragImageFromSnapshot(snapshotFrameRect(frame, view-&gt;selectionBounds(), options), nullptr);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsFontCascadecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/FontCascade.cpp (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/FontCascade.cpp        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.cpp        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -294,7 +294,7 @@
</span><span class="cx">     m_requiresShaping = computeRequiresShaping();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-float FontCascade::glyphBufferForTextRun(CodePath codePathToUse, const TextRun&amp; run, int from, int to, GlyphBuffer&amp; glyphBuffer) const
</del><ins>+float FontCascade::glyphBufferForTextRun(CodePath codePathToUse, const TextRun&amp; run, unsigned from, unsigned to, GlyphBuffer&amp; glyphBuffer) const
</ins><span class="cx"> {
</span><span class="cx">     if (codePathToUse != Complex)
</span><span class="cx">         return getGlyphsAndAdvancesForSimpleText(run, from, to, glyphBuffer);
</span><span class="lines">@@ -301,7 +301,7 @@
</span><span class="cx">     return getGlyphsAndAdvancesForComplexText(run, from, to, glyphBuffer);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-float FontCascade::drawText(GraphicsContext&amp; context, const TextRun&amp; run, const FloatPoint&amp; point, int from, int to, CustomFontNotReadyAction customFontNotReadyAction) const
</del><ins>+float FontCascade::drawText(GraphicsContext&amp; context, const TextRun&amp; run, const FloatPoint&amp; point, unsigned from, Optional&lt;unsigned&gt; to, CustomFontNotReadyAction customFontNotReadyAction) const
</ins><span class="cx"> {
</span><span class="cx">     // Don't draw anything while we are using custom fonts that are in the process of loading,
</span><span class="cx">     // except if the 'force' argument is set to true (in which case it will use a fallback
</span><span class="lines">@@ -309,15 +309,15 @@
</span><span class="cx">     if (isLoadingCustomFonts() &amp;&amp; customFontNotReadyAction == DoNotPaintIfFontNotReady)
</span><span class="cx">         return 0;
</span><span class="cx"> 
</span><del>-    to = (to == -1 ? run.length() : to);
</del><ins>+    unsigned destination = to.valueOr(run.length());
</ins><span class="cx"> 
</span><span class="cx">     CodePath codePathToUse = codePath(run);
</span><span class="cx">     // FIXME: Use the fast code path once it handles partial runs with kerning and ligatures. See http://webkit.org/b/100050
</span><del>-    if (codePathToUse != Complex &amp;&amp; (enableKerning() || requiresShaping()) &amp;&amp; (from || static_cast&lt;unsigned&gt;(to) != run.length()))
</del><ins>+    if (codePathToUse != Complex &amp;&amp; (enableKerning() || requiresShaping()) &amp;&amp; (from || destination != run.length()))
</ins><span class="cx">         codePathToUse = Complex;
</span><span class="cx"> 
</span><span class="cx">     GlyphBuffer glyphBuffer;
</span><del>-    float startX = point.x() + glyphBufferForTextRun(codePathToUse, run, from, to, glyphBuffer);
</del><ins>+    float startX = point.x() + glyphBufferForTextRun(codePathToUse, run, from, destination, glyphBuffer);
</ins><span class="cx">     // We couldn't generate any glyphs for the run. Give up.
</span><span class="cx">     if (glyphBuffer.isEmpty())
</span><span class="cx">         return 0;
</span><span class="lines">@@ -327,23 +327,22 @@
</span><span class="cx">     return startPoint.x() - startX;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void FontCascade::drawEmphasisMarks(GraphicsContext&amp; context, const TextRun&amp; run, const AtomicString&amp; mark, const FloatPoint&amp; point, int from, int to) const
</del><ins>+void FontCascade::drawEmphasisMarks(GraphicsContext&amp; context, const TextRun&amp; run, const AtomicString&amp; mark, const FloatPoint&amp; point, unsigned from, Optional&lt;unsigned&gt; to) const
</ins><span class="cx"> {
</span><span class="cx">     if (isLoadingCustomFonts())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    if (to &lt; 0)
-        to = run.length();
</del><ins>+    unsigned destination = to.valueOr(run.length());
</ins><span class="cx"> 
</span><span class="cx">     CodePath codePathToUse = codePath(run);
</span><span class="cx">     // FIXME: Use the fast code path once it handles partial runs with kerning and ligatures. See http://webkit.org/b/100050
</span><del>-    if (codePathToUse != Complex &amp;&amp; (enableKerning() || requiresShaping()) &amp;&amp; (from || static_cast&lt;unsigned&gt;(to) != run.length()))
</del><ins>+    if (codePathToUse != Complex &amp;&amp; (enableKerning() || requiresShaping()) &amp;&amp; (from || destination != run.length()))
</ins><span class="cx">         codePathToUse = Complex;
</span><span class="cx"> 
</span><span class="cx">     if (codePathToUse != Complex)
</span><del>-        drawEmphasisMarksForSimpleText(context, run, mark, point, from, to);
</del><ins>+        drawEmphasisMarksForSimpleText(context, run, mark, point, from, destination);
</ins><span class="cx">     else
</span><del>-        drawEmphasisMarksForComplexText(context, run, mark, point, from, to);
</del><ins>+        drawEmphasisMarksForComplexText(context, run, mark, point, from, destination);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> float FontCascade::width(const TextRun&amp; run, HashSet&lt;const Font*&gt;* fallbackFonts, GlyphOverflow* glyphOverflow) const
</span><span class="lines">@@ -491,19 +490,19 @@
</span><span class="cx">     return success;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void FontCascade::adjustSelectionRectForText(const TextRun&amp; run, LayoutRect&amp; selectionRect, int from, int to) const
</del><ins>+void FontCascade::adjustSelectionRectForText(const TextRun&amp; run, LayoutRect&amp; selectionRect, unsigned from, Optional&lt;unsigned&gt; to) const
</ins><span class="cx"> {
</span><del>-    to = (to == -1 ? run.length() : to);
</del><ins>+    unsigned destination = to.valueOr(run.length());
</ins><span class="cx"> 
</span><span class="cx">     CodePath codePathToUse = codePath(run);
</span><span class="cx">     // FIXME: Use the fast code path once it handles partial runs with kerning and ligatures. See http://webkit.org/b/100050
</span><del>-    if (codePathToUse != Complex &amp;&amp; (enableKerning() || requiresShaping()) &amp;&amp; (from || static_cast&lt;unsigned&gt;(to) != run.length()))
</del><ins>+    if (codePathToUse != Complex &amp;&amp; (enableKerning() || requiresShaping()) &amp;&amp; (from || destination != run.length()))
</ins><span class="cx">         codePathToUse = Complex;
</span><span class="cx"> 
</span><span class="cx">     if (codePathToUse != Complex)
</span><del>-        return adjustSelectionRectForSimpleText(run, selectionRect, from, to);
</del><ins>+        return adjustSelectionRectForSimpleText(run, selectionRect, from, destination);
</ins><span class="cx"> 
</span><del>-    return adjustSelectionRectForComplexText(run, selectionRect, from, to);
</del><ins>+    return adjustSelectionRectForComplexText(run, selectionRect, from, destination);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> int FontCascade::offsetForPosition(const TextRun&amp; run, float x, bool includePartialGlyphs) const
</span><span class="lines">@@ -1123,7 +1122,7 @@
</span><span class="cx">     return m_fonts &amp;&amp; m_fonts-&gt;isLoadingCustomFonts();
</span><span class="cx"> }
</span><span class="cx">     
</span><del>-GlyphToPathTranslator::GlyphUnderlineType computeUnderlineType(const TextRun&amp; textRun, const GlyphBuffer&amp; glyphBuffer, int index)
</del><ins>+GlyphToPathTranslator::GlyphUnderlineType computeUnderlineType(const TextRun&amp; textRun, const GlyphBuffer&amp; glyphBuffer, unsigned index)
</ins><span class="cx"> {
</span><span class="cx">     // In general, we want to skip descenders. However, skipping descenders on CJK characters leads to undesirable renderings,
</span><span class="cx">     // so we want to draw through CJK characters (on a character-by-character basis).
</span><span class="lines">@@ -1238,7 +1237,7 @@
</span><span class="cx">     return markFontData-&gt;fontMetrics().height();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-float FontCascade::getGlyphsAndAdvancesForSimpleText(const TextRun&amp; run, int from, int to, GlyphBuffer&amp; glyphBuffer, ForTextEmphasisOrNot forTextEmphasis) const
</del><ins>+float FontCascade::getGlyphsAndAdvancesForSimpleText(const TextRun&amp; run, unsigned from, unsigned to, GlyphBuffer&amp; glyphBuffer, ForTextEmphasisOrNot forTextEmphasis) const
</ins><span class="cx"> {
</span><span class="cx">     float initialAdvance;
</span><span class="cx"> 
</span><span class="lines">@@ -1268,7 +1267,7 @@
</span><span class="cx">     return initialAdvance;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void FontCascade::drawEmphasisMarksForSimpleText(GraphicsContext&amp; context, const TextRun&amp; run, const AtomicString&amp; mark, const FloatPoint&amp; point, int from, int to) const
</del><ins>+void FontCascade::drawEmphasisMarksForSimpleText(GraphicsContext&amp; context, const TextRun&amp; run, const AtomicString&amp; mark, const FloatPoint&amp; point, unsigned from, unsigned to) const
</ins><span class="cx"> {
</span><span class="cx">     GlyphBuffer glyphBuffer;
</span><span class="cx">     float initialAdvance = getGlyphsAndAdvancesForSimpleText(run, from, to, glyphBuffer, ForTextEmphasis);
</span><span class="lines">@@ -1287,8 +1286,8 @@
</span><span class="cx">     FloatPoint startPoint(point.x(), point.y() - glyphBuffer.initialAdvance().height());
</span><span class="cx">     float nextX = startPoint.x() + glyphBuffer.advanceAt(0).width();
</span><span class="cx">     float nextY = startPoint.y() + glyphBuffer.advanceAt(0).height();
</span><del>-    int lastFrom = 0;
-    int nextGlyph = 1;
</del><ins>+    unsigned lastFrom = 0;
+    unsigned nextGlyph = 1;
</ins><span class="cx">     while (nextGlyph &lt; glyphBuffer.size()) {
</span><span class="cx">         const Font* nextFontData = glyphBuffer.fontAt(nextGlyph);
</span><span class="cx">         FloatSize nextOffset = glyphBuffer.offsetAt(nextGlyph);
</span><span class="lines">@@ -1321,7 +1320,7 @@
</span><span class="cx">     return fontData-&gt;widthForGlyph(glyph) / 2;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline static float offsetToMiddleOfGlyphAtIndex(const GlyphBuffer&amp; glyphBuffer, size_t i)
</del><ins>+inline static float offsetToMiddleOfGlyphAtIndex(const GlyphBuffer&amp; glyphBuffer, unsigned i)
</ins><span class="cx"> {
</span><span class="cx">     return offsetToMiddleOfGlyph(glyphBuffer.fontAt(i), glyphBuffer.glyphAt(i));
</span><span class="cx"> }
</span><span class="lines">@@ -1344,7 +1343,7 @@
</span><span class="cx">     FloatPoint startPoint(point.x() + middleOfLastGlyph - offsetToMiddleOfGlyph(markFontData, markGlyph), point.y());
</span><span class="cx"> 
</span><span class="cx">     GlyphBuffer markBuffer;
</span><del>-    for (int i = 0; i + 1 &lt; glyphBuffer.size(); ++i) {
</del><ins>+    for (unsigned i = 0; i + 1 &lt; glyphBuffer.size(); ++i) {
</ins><span class="cx">         float middleOfNextGlyph = offsetToMiddleOfGlyphAtIndex(glyphBuffer, i + 1);
</span><span class="cx">         float advance = glyphBuffer.advanceAt(i).width() - middleOfLastGlyph + middleOfNextGlyph;
</span><span class="cx">         markBuffer.add(glyphBuffer.glyphAt(i) ? markGlyph : spaceGlyph, markFontData, advance);
</span><span class="lines">@@ -1371,7 +1370,7 @@
</span><span class="cx">     return it.m_runWidthSoFar;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void FontCascade::adjustSelectionRectForSimpleText(const TextRun&amp; run, LayoutRect&amp; selectionRect, int from, int to) const
</del><ins>+void FontCascade::adjustSelectionRectForSimpleText(const TextRun&amp; run, LayoutRect&amp; selectionRect, unsigned from, unsigned to) const
</ins><span class="cx"> {
</span><span class="cx">     GlyphBuffer glyphBuffer;
</span><span class="cx">     WidthIterator it(this, run);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsFontCascadeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/FontCascade.h (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/FontCascade.h        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.h        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -105,7 +105,7 @@
</span><span class="cx">     virtual void advance() = 0;
</span><span class="cx">     virtual ~GlyphToPathTranslator() { }
</span><span class="cx"> };
</span><del>-GlyphToPathTranslator::GlyphUnderlineType computeUnderlineType(const TextRun&amp;, const GlyphBuffer&amp;, int index);
</del><ins>+GlyphToPathTranslator::GlyphUnderlineType computeUnderlineType(const TextRun&amp;, const GlyphBuffer&amp;, unsigned index);
</ins><span class="cx"> 
</span><span class="cx"> class TextLayoutDeleter {
</span><span class="cx"> public:
</span><span class="lines">@@ -133,9 +133,9 @@
</span><span class="cx">     void update(RefPtr&lt;FontSelector&gt;&amp;&amp;) const;
</span><span class="cx"> 
</span><span class="cx">     enum CustomFontNotReadyAction { DoNotPaintIfFontNotReady, UseFallbackIfFontNotReady };
</span><del>-    WEBCORE_EXPORT float drawText(GraphicsContext&amp;, const TextRun&amp;, const FloatPoint&amp;, int from = 0, int to = -1, CustomFontNotReadyAction = DoNotPaintIfFontNotReady) const;
-    static void drawGlyphs(GraphicsContext&amp;, const Font&amp;, const GlyphBuffer&amp;, int from, int numGlyphs, const FloatPoint&amp;, FontSmoothingMode);
-    void drawEmphasisMarks(GraphicsContext&amp;, const TextRun&amp;, const AtomicString&amp; mark, const FloatPoint&amp;, int from = 0, int to = -1) const;
</del><ins>+    WEBCORE_EXPORT float drawText(GraphicsContext&amp;, const TextRun&amp;, const FloatPoint&amp;, unsigned from = 0, Optional&lt;unsigned&gt; to = Nullopt, CustomFontNotReadyAction = DoNotPaintIfFontNotReady) const;
+    static void drawGlyphs(GraphicsContext&amp;, const Font&amp;, const GlyphBuffer&amp;, unsigned from, unsigned numGlyphs, const FloatPoint&amp;, FontSmoothingMode);
+    void drawEmphasisMarks(GraphicsContext&amp;, const TextRun&amp;, const AtomicString&amp; mark, const FloatPoint&amp;, unsigned from = 0, Optional&lt;unsigned&gt; to = Nullopt) const;
</ins><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><span class="lines">@@ -145,7 +145,7 @@
</span><span class="cx">     static float width(TextLayout&amp;, unsigned from, unsigned len, HashSet&lt;const Font*&gt;* fallbackFonts = 0);
</span><span class="cx"> 
</span><span class="cx">     int offsetForPosition(const TextRun&amp;, float position, bool includePartialGlyphs) const;
</span><del>-    void adjustSelectionRectForText(const TextRun&amp;, LayoutRect&amp; selectionRect, int from = 0, int to = -1) const;
</del><ins>+    void adjustSelectionRectForText(const TextRun&amp;, LayoutRect&amp; selectionRect, unsigned from = 0, Optional&lt;unsigned&gt; to = Nullopt) const;
</ins><span class="cx"> 
</span><span class="cx">     bool isSmallCaps() const { return m_fontDescription.variantCaps() == FontVariantCaps::Small; }
</span><span class="cx"> 
</span><span class="lines">@@ -218,15 +218,15 @@
</span><span class="cx"> private:
</span><span class="cx">     enum ForTextEmphasisOrNot { NotForTextEmphasis, ForTextEmphasis };
</span><span class="cx"> 
</span><del>-    float glyphBufferForTextRun(CodePath, const TextRun&amp;, int from, int to, GlyphBuffer&amp;) const;
</del><ins>+    float glyphBufferForTextRun(CodePath, const TextRun&amp;, unsigned from, unsigned to, GlyphBuffer&amp;) const;
</ins><span class="cx">     // Returns the initial in-stream advance.
</span><del>-    float getGlyphsAndAdvancesForSimpleText(const TextRun&amp;, int from, int to, GlyphBuffer&amp;, ForTextEmphasisOrNot = NotForTextEmphasis) const;
-    void drawEmphasisMarksForSimpleText(GraphicsContext&amp;, const TextRun&amp;, const AtomicString&amp; mark, const FloatPoint&amp;, int from, int to) const;
</del><ins>+    float getGlyphsAndAdvancesForSimpleText(const TextRun&amp;, unsigned from, unsigned to, GlyphBuffer&amp;, ForTextEmphasisOrNot = NotForTextEmphasis) const;
+    void drawEmphasisMarksForSimpleText(GraphicsContext&amp;, const TextRun&amp;, const AtomicString&amp; mark, const FloatPoint&amp;, unsigned from, unsigned to) const;
</ins><span class="cx">     void drawGlyphBuffer(GraphicsContext&amp;, const GlyphBuffer&amp;, FloatPoint&amp;) const;
</span><span class="cx">     void drawEmphasisMarks(GraphicsContext&amp;, const GlyphBuffer&amp;, const AtomicString&amp;, const FloatPoint&amp;) const;
</span><span class="cx">     float floatWidthForSimpleText(const TextRun&amp;, HashSet&lt;const Font*&gt;* fallbackFonts = 0, GlyphOverflow* = 0) const;
</span><span class="cx">     int offsetForPositionForSimpleText(const TextRun&amp;, float position, bool includePartialGlyphs) const;
</span><del>-    void adjustSelectionRectForSimpleText(const TextRun&amp;, LayoutRect&amp; selectionRect, int from, int to) const;
</del><ins>+    void adjustSelectionRectForSimpleText(const TextRun&amp;, LayoutRect&amp; selectionRect, unsigned from, unsigned to) const;
</ins><span class="cx"> 
</span><span class="cx">     Optional&lt;GlyphData&gt; getEmphasisMarkGlyphData(const AtomicString&amp;) const;
</span><span class="cx"> 
</span><span class="lines">@@ -234,11 +234,11 @@
</span><span class="cx">     static bool canExpandAroundIdeographsInComplexText();
</span><span class="cx"> 
</span><span class="cx">     // Returns the initial in-stream advance.
</span><del>-    float getGlyphsAndAdvancesForComplexText(const TextRun&amp;, int from, int to, GlyphBuffer&amp;, ForTextEmphasisOrNot = NotForTextEmphasis) const;
-    void drawEmphasisMarksForComplexText(GraphicsContext&amp;, const TextRun&amp;, const AtomicString&amp; mark, const FloatPoint&amp;, int from, int to) const;
</del><ins>+    float getGlyphsAndAdvancesForComplexText(const TextRun&amp;, unsigned from, unsigned to, GlyphBuffer&amp;, ForTextEmphasisOrNot = NotForTextEmphasis) const;
+    void drawEmphasisMarksForComplexText(GraphicsContext&amp;, const TextRun&amp;, const AtomicString&amp; mark, const FloatPoint&amp;, unsigned from, unsigned to) const;
</ins><span class="cx">     float floatWidthForComplexText(const TextRun&amp;, HashSet&lt;const Font*&gt;* fallbackFonts = 0, GlyphOverflow* = 0) const;
</span><span class="cx">     int offsetForPositionForComplexText(const TextRun&amp;, float position, bool includePartialGlyphs) const;
</span><del>-    void adjustSelectionRectForComplexText(const TextRun&amp;, LayoutRect&amp; selectionRect, int from, int to) const;
</del><ins>+    void adjustSelectionRectForComplexText(const TextRun&amp;, LayoutRect&amp; selectionRect, unsigned from, unsigned to) const;
</ins><span class="cx"> 
</span><span class="cx">     static std::pair&lt;unsigned, bool&gt; expansionOpportunityCountInternal(const LChar*, size_t length, TextDirection, ExpansionBehavior);
</span><span class="cx">     static std::pair&lt;unsigned, bool&gt; expansionOpportunityCountInternal(const UChar*, size_t length, TextDirection, ExpansionBehavior);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsGlyphBufferh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/GlyphBuffer.h (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/GlyphBuffer.h        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/platform/graphics/GlyphBuffer.h        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -77,7 +77,7 @@
</span><span class="cx"> class GlyphBuffer {
</span><span class="cx"> public:
</span><span class="cx">     bool isEmpty() const { return m_font.isEmpty(); }
</span><del>-    int size() const { return m_font.size(); }
</del><ins>+    unsigned size() const { return m_font.size(); }
</ins><span class="cx">     
</span><span class="cx">     void clear()
</span><span class="cx">     {
</span><span class="lines">@@ -91,12 +91,12 @@
</span><span class="cx"> #endif
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    GlyphBufferGlyph* glyphs(int from) { return m_glyphs.data() + from; }
-    GlyphBufferAdvance* advances(int from) { return m_advances.data() + from; }
-    const GlyphBufferGlyph* glyphs(int from) const { return m_glyphs.data() + from; }
-    const GlyphBufferAdvance* advances(int from) const { return m_advances.data() + from; }
</del><ins>+    GlyphBufferGlyph* glyphs(unsigned from) { return m_glyphs.data() + from; }
+    GlyphBufferAdvance* advances(unsigned from) { return m_advances.data() + from; }
+    const GlyphBufferGlyph* glyphs(unsigned from) const { return m_glyphs.data() + from; }
+    const GlyphBufferAdvance* advances(unsigned from) const { return m_advances.data() + from; }
</ins><span class="cx"> 
</span><del>-    const Font* fontAt(int index) const { return m_font[index]; }
</del><ins>+    const Font* fontAt(unsigned index) const { return m_font[index]; }
</ins><span class="cx"> 
</span><span class="cx">     void setInitialAdvance(GlyphBufferAdvance initialAdvance) { m_initialAdvance = initialAdvance; }
</span><span class="cx">     const GlyphBufferAdvance&amp; initialAdvance() const { return m_initialAdvance; }
</span><span class="lines">@@ -104,7 +104,7 @@
</span><span class="cx">     void setLeadingExpansion(float leadingExpansion) { m_leadingExpansion = leadingExpansion; }
</span><span class="cx">     float leadingExpansion() const { return m_leadingExpansion; }
</span><span class="cx">     
</span><del>-    Glyph glyphAt(int index) const
</del><ins>+    Glyph glyphAt(unsigned index) const
</ins><span class="cx">     {
</span><span class="cx"> #if USE(CAIRO)
</span><span class="cx">         return m_glyphs[index].index;
</span><span class="lines">@@ -113,12 +113,12 @@
</span><span class="cx"> #endif
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    GlyphBufferAdvance advanceAt(int index) const
</del><ins>+    GlyphBufferAdvance advanceAt(unsigned index) const
</ins><span class="cx">     {
</span><span class="cx">         return m_advances[index];
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    FloatSize offsetAt(int index) const
</del><ins>+    FloatSize offsetAt(unsigned index) const
</ins><span class="cx">     {
</span><span class="cx"> #if PLATFORM(WIN)
</span><span class="cx">         return m_offsets[index];
</span><span class="lines">@@ -180,9 +180,9 @@
</span><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    void reverse(int from, int length)
</del><ins>+    void reverse(unsigned from, unsigned length)
</ins><span class="cx">     {
</span><del>-        for (int i = from, end = from + length - 1; i &lt; end; ++i, --end)
</del><ins>+        for (unsigned i = from, end = from + length - 1; i &lt; end; ++i, --end)
</ins><span class="cx">             swap(i, end);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -198,14 +198,13 @@
</span><span class="cx">         m_offsetsInString.reset(new Vector&lt;unsigned, 2048&gt;());
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    // FIXME: This converts from an unsigned to an int
-    int offsetInString(int index) const
</del><ins>+    int offsetInString(unsigned index) const
</ins><span class="cx">     {
</span><span class="cx">         ASSERT(m_offsetsInString);
</span><span class="cx">         return (*m_offsetsInString)[index];
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    void shrink(int truncationPoint)
</del><ins>+    void shrink(unsigned truncationPoint)
</ins><span class="cx">     {
</span><span class="cx">         m_font.shrink(truncationPoint);
</span><span class="cx">         m_glyphs.shrink(truncationPoint);
</span><span class="lines">@@ -218,7 +217,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    void swap(int index1, int index2)
</del><ins>+    void swap(unsigned index1, unsigned index2)
</ins><span class="cx">     {
</span><span class="cx">         const Font* f = m_font[index1];
</span><span class="cx">         m_font[index1] = m_font[index2];
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsGraphicsContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -636,7 +636,7 @@
</span><span class="cx">     --m_transparencyCount;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-float GraphicsContext::drawText(const FontCascade&amp; font, const TextRun&amp; run, const FloatPoint&amp; point, int from, int to)
</del><ins>+float GraphicsContext::drawText(const FontCascade&amp; font, const TextRun&amp; run, const FloatPoint&amp; point, unsigned from, Optional&lt;unsigned&gt; to)
</ins><span class="cx"> {
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return 0;
</span><span class="lines">@@ -645,7 +645,7 @@
</span><span class="cx">     return font.drawText(*this, run, point, from, to);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void GraphicsContext::drawGlyphs(const FontCascade&amp; fontCascade, const Font&amp; font, const GlyphBuffer&amp; buffer, int from, int numGlyphs, const FloatPoint&amp; point)
</del><ins>+void GraphicsContext::drawGlyphs(const FontCascade&amp; fontCascade, const Font&amp; font, const GlyphBuffer&amp; buffer, unsigned from, unsigned numGlyphs, const FloatPoint&amp; point)
</ins><span class="cx"> {
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="lines">@@ -658,7 +658,7 @@
</span><span class="cx">     fontCascade.drawGlyphs(*this, font, buffer, from, numGlyphs, point, fontCascade.fontDescription().fontSmoothing());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void GraphicsContext::drawEmphasisMarks(const FontCascade&amp; font, const TextRun&amp; run, const AtomicString&amp; mark, const FloatPoint&amp; point, int from, int to)
</del><ins>+void GraphicsContext::drawEmphasisMarks(const FontCascade&amp; font, const TextRun&amp; run, const AtomicString&amp; mark, const FloatPoint&amp; point, unsigned from, Optional&lt;unsigned&gt; to)
</ins><span class="cx"> {
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsGraphicsContexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.h (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/GraphicsContext.h        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.h        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -381,9 +381,9 @@
</span><span class="cx">     void setTextDrawingMode(TextDrawingModeFlags);
</span><span class="cx">     TextDrawingModeFlags textDrawingMode() const { return m_state.textDrawingMode; }
</span><span class="cx"> 
</span><del>-    float drawText(const FontCascade&amp;, const TextRun&amp;, const FloatPoint&amp;, int from = 0, int to = -1);
-    void drawGlyphs(const FontCascade&amp;, const Font&amp;, const GlyphBuffer&amp;, int from, int numGlyphs, const FloatPoint&amp;);
-    void drawEmphasisMarks(const FontCascade&amp;, const TextRun&amp;, const AtomicString&amp; mark, const FloatPoint&amp;, int from = 0, int to = -1);
</del><ins>+    float drawText(const FontCascade&amp;, const TextRun&amp;, const FloatPoint&amp;, unsigned from = 0, Optional&lt;unsigned&gt; to = Nullopt);
+    void drawGlyphs(const FontCascade&amp;, const Font&amp;, const GlyphBuffer&amp;, unsigned from, unsigned numGlyphs, const FloatPoint&amp;);
+    void drawEmphasisMarks(const FontCascade&amp;, const TextRun&amp;, const AtomicString&amp; mark, const FloatPoint&amp;, unsigned from = 0, Optional&lt;unsigned&gt; to = Nullopt);
</ins><span class="cx">     void drawBidiText(const FontCascade&amp;, const TextRun&amp;, const FloatPoint&amp;, FontCascade::CustomFontNotReadyAction = FontCascade::DoNotPaintIfFontNotReady);
</span><span class="cx"> 
</span><span class="cx">     void applyState(const GraphicsContextState&amp;);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsLatin1TextIteratorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/Latin1TextIterator.h (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/Latin1TextIterator.h        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/platform/graphics/Latin1TextIterator.h        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -28,18 +28,18 @@
</span><span class="cx"> 
</span><span class="cx"> class Latin1TextIterator {
</span><span class="cx"> public:
</span><del>-    // The passed in LChar pointer starts at 'currentCharacter'. The iterator operates on the range [currentCharacter, lastCharacter].
-    // 'endCharacter' denotes the maximum length of the UChar array, which might exceed 'lastCharacter'.
-    Latin1TextIterator(const LChar* characters, int currentCharacter, int lastCharacter, int /*endCharacter*/)
</del><ins>+    // The passed in LChar pointer starts at 'currentIndex'. The iterator operates on the range [currentIndex, lastIndex].
+    // 'endCharacter' denotes the maximum length of the UChar array, which might exceed 'lastIndex'.
+    Latin1TextIterator(const LChar* characters, unsigned currentIndex, unsigned lastIndex, unsigned /*endCharacter*/)
</ins><span class="cx">         : m_characters(characters)
</span><del>-        , m_currentCharacter(currentCharacter)
-        , m_lastCharacter(lastCharacter)
</del><ins>+        , m_currentIndex(currentIndex)
+        , m_lastIndex(lastIndex)
</ins><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     bool consume(UChar32&amp; character, unsigned&amp; clusterLength)
</span><span class="cx">     {
</span><del>-        if (m_currentCharacter &gt;= m_lastCharacter)
</del><ins>+        if (m_currentIndex &gt;= m_lastIndex)
</ins><span class="cx">             return false;
</span><span class="cx"> 
</span><span class="cx">         character = *m_characters;
</span><span class="lines">@@ -50,16 +50,16 @@
</span><span class="cx">     void advance(unsigned advanceLength)
</span><span class="cx">     {
</span><span class="cx">         m_characters += advanceLength;
</span><del>-        m_currentCharacter += advanceLength;
</del><ins>+        m_currentIndex += advanceLength;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    int currentCharacter() const { return m_currentCharacter; }
</del><ins>+    unsigned currentIndex() const { return m_currentIndex; }
</ins><span class="cx">     const LChar* characters() const { return m_characters; }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     const LChar* m_characters;
</span><del>-    int m_currentCharacter;
-    int m_lastCharacter;
</del><ins>+    unsigned m_currentIndex;
+    unsigned m_lastIndex;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsSurrogatePairAwareTextIteratorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/SurrogatePairAwareTextIterator.cpp (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/SurrogatePairAwareTextIterator.cpp        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/platform/graphics/SurrogatePairAwareTextIterator.cpp        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -27,11 +27,11 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-SurrogatePairAwareTextIterator::SurrogatePairAwareTextIterator(const UChar* characters, int currentCharacter, int lastCharacter, int endCharacter)
</del><ins>+SurrogatePairAwareTextIterator::SurrogatePairAwareTextIterator(const UChar* characters, unsigned currentIndex, unsigned lastIndex, unsigned endIndex)
</ins><span class="cx">     : m_characters(characters)
</span><del>-    , m_currentCharacter(currentCharacter)
-    , m_lastCharacter(lastCharacter)
-    , m_endCharacter(endCharacter)
</del><ins>+    , m_currentIndex(currentIndex)
+    , m_lastIndex(lastIndex)
+    , m_endIndex(endIndex)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -57,7 +57,7 @@
</span><span class="cx"> 
</span><span class="cx">     // Do we have a surrogate pair? If so, determine the full Unicode (32 bit) code point before glyph lookup.
</span><span class="cx">     // Make sure we have another character and it's a low surrogate.
</span><del>-    if (m_currentCharacter + 1 &gt;= m_endCharacter)
</del><ins>+    if (m_currentIndex + 1 &gt;= m_endIndex)
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     UChar low = m_characters[1];
</span><span class="lines">@@ -74,7 +74,7 @@
</span><span class="cx">     // According to http://www.unicode.org/Public/UNIDATA/UCD.html#Canonical_Combining_Class_Values
</span><span class="cx">     static const uint8_t hiraganaKatakanaVoicingMarksCombiningClass = 8;
</span><span class="cx"> 
</span><del>-    if (m_currentCharacter + 1 &gt;= m_endCharacter)
</del><ins>+    if (m_currentIndex + 1 &gt;= m_endIndex)
</ins><span class="cx">         return 0;
</span><span class="cx"> 
</span><span class="cx">     if (u_getCombiningClass(m_characters[1]) == hiraganaKatakanaVoicingMarksCombiningClass) {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsSurrogatePairAwareTextIteratorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/SurrogatePairAwareTextIterator.h (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/SurrogatePairAwareTextIterator.h        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/platform/graphics/SurrogatePairAwareTextIterator.h        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -28,13 +28,13 @@
</span><span class="cx"> 
</span><span class="cx"> class SurrogatePairAwareTextIterator {
</span><span class="cx"> public:
</span><del>-    // The passed in UChar pointer starts at 'currentCharacter'. The iterator operatoes on the range [currentCharacter, lastCharacter].
-    // 'endCharacter' denotes the maximum length of the UChar array, which might exceed 'lastCharacter'.
-    SurrogatePairAwareTextIterator(const UChar*, int currentCharacter, int lastCharacter, int endCharacter);
</del><ins>+    // The passed in UChar pointer starts at 'currentIndex'. The iterator operatoes on the range [currentIndex, lastIndex].
+    // 'endIndex' denotes the maximum length of the UChar array, which might exceed 'lastIndex'.
+    SurrogatePairAwareTextIterator(const UChar*, unsigned currentIndex, unsigned lastIndex, unsigned endIndex);
</ins><span class="cx"> 
</span><span class="cx">     inline bool consume(UChar32&amp; character, unsigned&amp; clusterLength)
</span><span class="cx">     {
</span><del>-        if (m_currentCharacter &gt;= m_lastCharacter)
</del><ins>+        if (m_currentIndex &gt;= m_lastIndex)
</ins><span class="cx">             return false;
</span><span class="cx"> 
</span><span class="cx">         character = *m_characters;
</span><span class="lines">@@ -49,10 +49,10 @@
</span><span class="cx">     void advance(unsigned advanceLength)
</span><span class="cx">     {
</span><span class="cx">         m_characters += advanceLength;
</span><del>-        m_currentCharacter += advanceLength;
</del><ins>+        m_currentIndex += advanceLength;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    int currentCharacter() const { return m_currentCharacter; }
</del><ins>+    unsigned currentIndex() const { return m_currentIndex; }
</ins><span class="cx">     const UChar* characters() const { return m_characters; }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="lines">@@ -60,9 +60,9 @@
</span><span class="cx">     UChar32 normalizeVoicingMarks();
</span><span class="cx"> 
</span><span class="cx">     const UChar* m_characters;
</span><del>-    int m_currentCharacter;
-    int m_lastCharacter;
-    int m_endCharacter;
</del><ins>+    unsigned m_currentIndex;
+    unsigned m_lastIndex;
+    unsigned m_endIndex;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsWidthIteratorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/WidthIterator.cpp (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/WidthIterator.cpp        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/platform/graphics/WidthIterator.cpp        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -81,7 +81,7 @@
</span><span class="cx">     return codepoint &gt;= 0xE001 &amp;&amp; codepoint &lt;= 0xE537;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline auto WidthIterator::shouldApplyFontTransforms(const GlyphBuffer* glyphBuffer, int lastGlyphCount, UChar32 previousCharacter) const -&gt; TransformsType
</del><ins>+inline auto WidthIterator::shouldApplyFontTransforms(const GlyphBuffer* glyphBuffer, unsigned lastGlyphCount, UChar32 previousCharacter) const -&gt; TransformsType
</ins><span class="cx"> {
</span><span class="cx">     if (glyphBuffer &amp;&amp; glyphBuffer-&gt;size() == (lastGlyphCount + 1) &amp;&amp; isSoftBankEmoji(previousCharacter))
</span><span class="cx">         return TransformsType::Forced;
</span><span class="lines">@@ -90,7 +90,7 @@
</span><span class="cx">     return TransformsType::NotForced;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline float WidthIterator::applyFontTransforms(GlyphBuffer* glyphBuffer, bool ltr, int&amp; lastGlyphCount, const Font* font, UChar32 previousCharacter, bool force, CharactersTreatedAsSpace&amp; charactersTreatedAsSpace)
</del><ins>+inline float WidthIterator::applyFontTransforms(GlyphBuffer* glyphBuffer, bool ltr, unsigned&amp; lastGlyphCount, const Font* font, UChar32 previousCharacter, bool force, CharactersTreatedAsSpace&amp; charactersTreatedAsSpace)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT_UNUSED(previousCharacter, shouldApplyFontTransforms(glyphBuffer, lastGlyphCount, previousCharacter) != WidthIterator::TransformsType::None);
</span><span class="cx"> 
</span><span class="lines">@@ -97,7 +97,7 @@
</span><span class="cx">     if (!glyphBuffer)
</span><span class="cx">         return 0;
</span><span class="cx"> 
</span><del>-    int glyphBufferSize = glyphBuffer-&gt;size();
</del><ins>+    unsigned glyphBufferSize = glyphBuffer-&gt;size();
</ins><span class="cx">     if (!force &amp;&amp; glyphBufferSize &lt;= lastGlyphCount + 1) {
</span><span class="cx">         lastGlyphCount = glyphBufferSize;
</span><span class="cx">         return 0;
</span><span class="lines">@@ -105,9 +105,10 @@
</span><span class="cx"> 
</span><span class="cx">     GlyphBufferAdvance* advances = glyphBuffer-&gt;advances(0);
</span><span class="cx">     float widthDifference = 0;
</span><del>-    for (int i = lastGlyphCount; i &lt; glyphBufferSize; ++i)
</del><ins>+    for (unsigned i = lastGlyphCount; i &lt; glyphBufferSize; ++i)
</ins><span class="cx">         widthDifference -= advances[i].width();
</span><span class="cx"> 
</span><ins>+    ASSERT(lastGlyphCount &lt;= glyphBufferSize);
</ins><span class="cx">     if (!ltr)
</span><span class="cx">         glyphBuffer-&gt;reverse(lastGlyphCount, glyphBufferSize - lastGlyphCount);
</span><span class="cx"> 
</span><span class="lines">@@ -125,7 +126,7 @@
</span><span class="cx">     }
</span><span class="cx">     charactersTreatedAsSpace.clear();
</span><span class="cx"> 
</span><del>-    for (int i = lastGlyphCount; i &lt; glyphBufferSize; ++i)
</del><ins>+    for (unsigned i = lastGlyphCount; i &lt; glyphBufferSize; ++i)
</ins><span class="cx">         widthDifference += advances[i].width();
</span><span class="cx"> 
</span><span class="cx">     lastGlyphCount = glyphBufferSize;
</span><span class="lines">@@ -181,7 +182,7 @@
</span><span class="cx"> 
</span><span class="cx">     const Font&amp; primaryFont = m_font-&gt;primaryFont();
</span><span class="cx">     const Font* lastFontData = &amp;primaryFont;
</span><del>-    int lastGlyphCount = glyphBuffer ? glyphBuffer-&gt;size() : 0;
</del><ins>+    unsigned lastGlyphCount = glyphBuffer ? glyphBuffer-&gt;size() : 0;
</ins><span class="cx"> 
</span><span class="cx">     UChar32 character = 0;
</span><span class="cx">     UChar32 previousCharacter = 0;
</span><span class="lines">@@ -191,7 +192,7 @@
</span><span class="cx">     // We are iterating in string order, not glyph order. Compare this to ComplexTextController::adjustGlyphsAndAdvances()
</span><span class="cx">     while (textIterator.consume(character, clusterLength)) {
</span><span class="cx">         unsigned advanceLength = clusterLength;
</span><del>-        int currentCharacter = textIterator.currentCharacter();
</del><ins>+        int currentCharacter = textIterator.currentIndex();
</ins><span class="cx">         const GlyphData&amp; glyphData = m_font-&gt;glyphDataForCharacter(character, rtl);
</span><span class="cx">         Glyph glyph = glyphData.glyph;
</span><span class="cx">         if (!glyph) {
</span><span class="lines">@@ -349,21 +350,21 @@
</span><span class="cx">             glyphBuffer-&gt;shrink(lastGlyphCount);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    unsigned consumedCharacters = textIterator.currentCharacter() - m_currentCharacter;
-    m_currentCharacter = textIterator.currentCharacter();
</del><ins>+    unsigned consumedCharacters = textIterator.currentIndex() - m_currentCharacter;
+    m_currentCharacter = textIterator.currentIndex();
</ins><span class="cx">     m_runWidthSoFar += widthSinceLastRounding;
</span><span class="cx">     m_finalRoundingWidth = lastRoundingWidth;
</span><span class="cx">     return consumedCharacters;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-unsigned WidthIterator::advance(int offset, GlyphBuffer* glyphBuffer)
</del><ins>+unsigned WidthIterator::advance(unsigned offset, GlyphBuffer* glyphBuffer)
</ins><span class="cx"> {
</span><del>-    int length = m_run.length();
</del><ins>+    unsigned length = m_run.length();
</ins><span class="cx"> 
</span><span class="cx">     if (offset &gt; length)
</span><span class="cx">         offset = length;
</span><span class="cx"> 
</span><del>-    if (m_currentCharacter &gt;= static_cast&lt;unsigned&gt;(offset))
</del><ins>+    if (m_currentCharacter &gt;= offset)
</ins><span class="cx">         return 0;
</span><span class="cx"> 
</span><span class="cx">     if (m_run.is8Bit()) {
</span><span class="lines">@@ -377,10 +378,10 @@
</span><span class="cx"> 
</span><span class="cx"> bool WidthIterator::advanceOneCharacter(float&amp; width, GlyphBuffer&amp; glyphBuffer)
</span><span class="cx"> {
</span><del>-    int oldSize = glyphBuffer.size();
</del><ins>+    unsigned oldSize = glyphBuffer.size();
</ins><span class="cx">     advance(m_currentCharacter + 1, &amp;glyphBuffer);
</span><span class="cx">     float w = 0;
</span><del>-    for (int i = oldSize; i &lt; glyphBuffer.size(); ++i)
</del><ins>+    for (unsigned i = oldSize; i &lt; glyphBuffer.size(); ++i)
</ins><span class="cx">         w += glyphBuffer.advanceAt(i).width();
</span><span class="cx">     width = w;
</span><span class="cx">     return glyphBuffer.size() &gt; oldSize;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsWidthIteratorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/WidthIterator.h (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/WidthIterator.h        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/platform/graphics/WidthIterator.h        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -42,7 +42,7 @@
</span><span class="cx"> public:
</span><span class="cx">     WidthIterator(const FontCascade*, const TextRun&amp;, HashSet&lt;const Font*&gt;* fallbackFonts = 0, bool accountForGlyphBounds = false, bool forTextEmphasis = false);
</span><span class="cx"> 
</span><del>-    unsigned advance(int to, GlyphBuffer*);
</del><ins>+    unsigned advance(unsigned to, GlyphBuffer*);
</ins><span class="cx">     bool advanceOneCharacter(float&amp; width, GlyphBuffer&amp;);
</span><span class="cx"> 
</span><span class="cx">     float maxGlyphBoundingBoxY() const { ASSERT(m_accountForGlyphBounds); return m_maxGlyphBoundingBoxY; }
</span><span class="lines">@@ -70,8 +70,8 @@
</span><span class="cx">     inline unsigned advanceInternal(TextIterator&amp;, GlyphBuffer*);
</span><span class="cx"> 
</span><span class="cx">     enum class TransformsType { None, Forced, NotForced };
</span><del>-    TransformsType shouldApplyFontTransforms(const GlyphBuffer*, int lastGlyphCount, UChar32 previousCharacter) const;
-    float applyFontTransforms(GlyphBuffer*, bool ltr, int&amp; lastGlyphCount, const Font*, UChar32 previousCharacter, bool force, CharactersTreatedAsSpace&amp;);
</del><ins>+    TransformsType shouldApplyFontTransforms(const GlyphBuffer*, unsigned lastGlyphCount, UChar32 previousCharacter) const;
+    float applyFontTransforms(GlyphBuffer*, bool ltr, unsigned&amp; lastGlyphCount, const Font*, UChar32 previousCharacter, bool force, CharactersTreatedAsSpace&amp;);
</ins><span class="cx"> 
</span><span class="cx">     HashSet&lt;const Font*&gt;* m_fallbackFonts { nullptr };
</span><span class="cx">     bool m_accountForGlyphBounds { false };
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscairoFontCairocpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cairo/FontCairo.cpp (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cairo/FontCairo.cpp        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/platform/graphics/cairo/FontCairo.cpp        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -47,7 +47,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-static void drawGlyphsToContext(cairo_t* context, const Font&amp; font, GlyphBufferGlyph* glyphs, int numGlyphs)
</del><ins>+static void drawGlyphsToContext(cairo_t* context, const Font&amp; font, GlyphBufferGlyph* glyphs, unsigned numGlyphs)
</ins><span class="cx"> {
</span><span class="cx">     cairo_matrix_t originalTransform;
</span><span class="cx">     float syntheticBoldOffset = font.syntheticBoldOffset();
</span><span class="lines">@@ -66,7 +66,7 @@
</span><span class="cx">         cairo_set_matrix(context, &amp;originalTransform);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static void drawGlyphsShadow(GraphicsContext&amp; graphicsContext, const FloatPoint&amp; point, const Font&amp; font, GlyphBufferGlyph* glyphs, int numGlyphs)
</del><ins>+static void drawGlyphsShadow(GraphicsContext&amp; graphicsContext, const FloatPoint&amp; point, const Font&amp; font, GlyphBufferGlyph* glyphs, unsigned numGlyphs)
</ins><span class="cx"> {
</span><span class="cx">     ShadowBlur&amp; shadow = graphicsContext.platformContext()-&gt;shadowBlur();
</span><span class="cx"> 
</span><span class="lines">@@ -98,7 +98,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void FontCascade::drawGlyphs(GraphicsContext&amp; context, const Font&amp; font, const GlyphBuffer&amp; glyphBuffer,
</span><del>-    int from, int numGlyphs, const FloatPoint&amp; point, FontSmoothingMode)
</del><ins>+    unsigned from, unsigned numGlyphs, const FloatPoint&amp; point, FontSmoothingMode)
</ins><span class="cx"> {
</span><span class="cx">     if (!font.platformData().size())
</span><span class="cx">         return;
</span><span class="lines">@@ -106,7 +106,7 @@
</span><span class="cx">     GlyphBufferGlyph* glyphs = const_cast&lt;GlyphBufferGlyph*&gt;(glyphBuffer.glyphs(from));
</span><span class="cx"> 
</span><span class="cx">     float offset = point.x();
</span><del>-    for (int i = 0; i &lt; numGlyphs; i++) {
</del><ins>+    for (unsigned i = 0; i &lt; numGlyphs; i++) {
</ins><span class="cx">         glyphs[i].x = offset;
</span><span class="cx">         glyphs[i].y = point.y();
</span><span class="cx">         offset += glyphBuffer.advanceAt(from + i).width();
</span><span class="lines">@@ -229,7 +229,7 @@
</span><span class="cx">     void advance() final;
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    int m_index;
</del><ins>+    unsigned m_index;
</ins><span class="cx">     const TextRun&amp; m_textRun;
</span><span class="cx">     const GlyphBuffer&amp; m_glyphBuffer;
</span><span class="cx">     const Font* m_fontData;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscairoFontCairoHarfbuzzNGcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -40,7 +40,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-float FontCascade::getGlyphsAndAdvancesForComplexText(const TextRun&amp; run, int, int, GlyphBuffer&amp; glyphBuffer, ForTextEmphasisOrNot /* forTextEmphasis */) const
</del><ins>+float FontCascade::getGlyphsAndAdvancesForComplexText(const TextRun&amp; run, unsigned, unsigned, GlyphBuffer&amp; glyphBuffer, ForTextEmphasisOrNot /* forTextEmphasis */) const
</ins><span class="cx"> {
</span><span class="cx">     HarfBuzzShaper shaper(this, run);
</span><span class="cx">     if (!shaper.shape(&amp;glyphBuffer)) {
</span><span class="lines">@@ -52,7 +52,7 @@
</span><span class="cx">     return 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void FontCascade::drawEmphasisMarksForComplexText(GraphicsContext&amp; /* context */, const TextRun&amp; /* run */, const AtomicString&amp; /* mark */, const FloatPoint&amp; /* point */, int /* from */, int /* to */) const
</del><ins>+void FontCascade::drawEmphasisMarksForComplexText(GraphicsContext&amp; /* context */, const TextRun&amp; /* run */, const AtomicString&amp; /* mark */, const FloatPoint&amp; /* point */, unsigned /* from */, unsigned /* to */) const
</ins><span class="cx"> {
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span><span class="lines">@@ -85,7 +85,7 @@
</span><span class="cx">     return 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void FontCascade::adjustSelectionRectForComplexText(const TextRun&amp; run, LayoutRect&amp; selectionRect, int from, int to) const
</del><ins>+void FontCascade::adjustSelectionRectForComplexText(const TextRun&amp; run, LayoutRect&amp; selectionRect, unsigned from, unsigned to) const
</ins><span class="cx"> {
</span><span class="cx">     HarfBuzzShaper shaper(this, run);
</span><span class="cx">     if (shaper.shape()) {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscocoaFontCascadeCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -70,11 +70,11 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline void fillVectorWithHorizontalGlyphPositions(Vector&lt;CGPoint, 256&gt;&amp; positions, CGContextRef context, const CGSize* advances, size_t count)
</del><ins>+static inline void fillVectorWithHorizontalGlyphPositions(Vector&lt;CGPoint, 256&gt;&amp; positions, CGContextRef context, const CGSize* advances, unsigned count)
</ins><span class="cx"> {
</span><span class="cx">     CGAffineTransform matrix = CGAffineTransformInvert(CGContextGetTextMatrix(context));
</span><span class="cx">     positions[0] = CGPointZero;
</span><del>-    for (size_t i = 1; i &lt; count; ++i) {
</del><ins>+    for (unsigned i = 1; i &lt; count; ++i) {
</ins><span class="cx">         CGSize advance = CGSizeApplyAffineTransform(advances[i - 1], matrix);
</span><span class="cx">         positions[i].x = positions[i - 1].x + advance.width;
</span><span class="cx">         positions[i].y = positions[i - 1].y + advance.height;
</span><span class="lines">@@ -91,7 +91,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static void showLetterpressedGlyphsWithAdvances(const FloatPoint&amp; point, const Font&amp; font, CGContextRef context, const CGGlyph* glyphs, const CGSize* advances, size_t count)
</del><ins>+static void showLetterpressedGlyphsWithAdvances(const FloatPoint&amp; point, const Font&amp; font, CGContextRef context, const CGGlyph* glyphs, const CGSize* advances, unsigned count)
</ins><span class="cx"> {
</span><span class="cx"> #if ENABLE(LETTERPRESS)
</span><span class="cx">     if (!count)
</span><span class="lines">@@ -158,7 +158,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-static void showGlyphsWithAdvances(const FloatPoint&amp; point, const Font&amp; font, CGContextRef context, const CGGlyph* glyphs, const CGSize* advances, size_t count)
</del><ins>+static void showGlyphsWithAdvances(const FloatPoint&amp; point, const Font&amp; font, CGContextRef context, const CGGlyph* glyphs, const CGSize* advances, unsigned count)
</ins><span class="cx"> {
</span><span class="cx">     if (!count)
</span><span class="cx">         return;
</span><span class="lines">@@ -182,7 +182,7 @@
</span><span class="cx">         CGAffineTransform transform = CGAffineTransformInvert(CGContextGetTextMatrix(context));
</span><span class="cx"> 
</span><span class="cx">         CGPoint position = FloatPoint(point.x(), point.y() + font.fontMetrics().floatAscent(IdeographicBaseline) - font.fontMetrics().floatAscent());
</span><del>-        for (size_t i = 0; i &lt; count; ++i) {
</del><ins>+        for (unsigned i = 0; i &lt; count; ++i) {
</ins><span class="cx">             CGSize translation = CGSizeApplyAffineTransform(translations[i], rotateLeftTransform);
</span><span class="cx">             positions[i] = CGPointApplyAffineTransform(CGPointMake(position.x - translation.width, position.y + translation.height), transform);
</span><span class="cx">             position.x += advances[i].width;
</span><span class="lines">@@ -220,7 +220,7 @@
</span><span class="cx">     CGContextSetShouldSubpixelQuantizeFonts(cgContext, doSubpixelQuantization);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void FontCascade::drawGlyphs(GraphicsContext&amp; context, const Font&amp; font, const GlyphBuffer&amp; glyphBuffer, int from, int numGlyphs, const FloatPoint&amp; anchorPoint, FontSmoothingMode smoothingMode)
</del><ins>+void FontCascade::drawGlyphs(GraphicsContext&amp; context, const Font&amp; font, const GlyphBuffer&amp; glyphBuffer, unsigned from, unsigned numGlyphs, const FloatPoint&amp; anchorPoint, FontSmoothingMode smoothingMode)
</ins><span class="cx"> {
</span><span class="cx">     const FontPlatformData&amp; platformData = font.platformData();
</span><span class="cx">     if (!platformData.size())
</span><span class="lines">@@ -434,7 +434,7 @@
</span><span class="cx">     void advance() final;
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    int m_index;
</del><ins>+    unsigned m_index;
</ins><span class="cx">     const TextRun&amp; m_textRun;
</span><span class="cx">     const GlyphBuffer&amp; m_glyphBuffer;
</span><span class="cx">     const Font* m_fontData;
</span><span class="lines">@@ -488,7 +488,7 @@
</span><span class="cx">     FloatPoint origin = FloatPoint(textOrigin.x() + deltaX, textOrigin.y());
</span><span class="cx">     MacGlyphToPathTranslator translator(run, glyphBuffer, origin);
</span><span class="cx">     DashArray result;
</span><del>-    for (int index = 0; translator.containsMorePaths(); ++index, translator.advance()) {
</del><ins>+    for (unsigned index = 0; translator.containsMorePaths(); ++index, translator.advance()) {
</ins><span class="cx">         GlyphIterationState info = GlyphIterationState(CGPointMake(0, 0), CGPointMake(0, 0), lineExtents.y(), lineExtents.y() + lineExtents.height(), lineExtents.x() + lineExtents.width(), lineExtents.x());
</span><span class="cx">         const Font* localFont = glyphBuffer.fontAt(index);
</span><span class="cx">         if (!localFont) {
</span><span class="lines">@@ -527,7 +527,7 @@
</span><span class="cx">     return CTFontDescriptorIsSystemUIFont(adoptCF(CTFontCopyFontDescriptor(fontData.platformData().ctFont())).get());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void FontCascade::adjustSelectionRectForComplexText(const TextRun&amp; run, LayoutRect&amp; selectionRect, int from, int to) const
</del><ins>+void FontCascade::adjustSelectionRectForComplexText(const TextRun&amp; run, LayoutRect&amp; selectionRect, unsigned from, unsigned to) const
</ins><span class="cx"> {
</span><span class="cx">     ComplexTextController controller(*this, run);
</span><span class="cx">     controller.advance(from);
</span><span class="lines">@@ -542,7 +542,7 @@
</span><span class="cx">     selectionRect.setWidth(LayoutUnit::fromFloatCeil(afterWidth - beforeWidth));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-float FontCascade::getGlyphsAndAdvancesForComplexText(const TextRun&amp; run, int from, int to, GlyphBuffer&amp; glyphBuffer, ForTextEmphasisOrNot forTextEmphasis) const
</del><ins>+float FontCascade::getGlyphsAndAdvancesForComplexText(const TextRun&amp; run, unsigned from, unsigned to, GlyphBuffer&amp; glyphBuffer, ForTextEmphasisOrNot forTextEmphasis) const
</ins><span class="cx"> {
</span><span class="cx">     float initialAdvance;
</span><span class="cx"> 
</span><span class="lines">@@ -565,7 +565,7 @@
</span><span class="cx">     return initialAdvance;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void FontCascade::drawEmphasisMarksForComplexText(GraphicsContext&amp; context, const TextRun&amp; run, const AtomicString&amp; mark, const FloatPoint&amp; point, int from, int to) const
</del><ins>+void FontCascade::drawEmphasisMarksForComplexText(GraphicsContext&amp; context, const TextRun&amp; run, const AtomicString&amp; mark, const FloatPoint&amp; point, unsigned from, unsigned to) const
</ins><span class="cx"> {
</span><span class="cx">     GlyphBuffer glyphBuffer;
</span><span class="cx">     float initialAdvance = getGlyphsAndAdvancesForComplexText(run, from, to, glyphBuffer, ForTextEmphasis);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsdisplaylistsDisplayListRecordercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -100,7 +100,7 @@
</span><span class="cx">     appendItem(SetMiterLimit::create(miterLimit));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Recorder::drawGlyphs(const Font&amp; font, const GlyphBuffer&amp; glyphBuffer, int from, int numGlyphs, const FloatPoint&amp; startPoint, FontSmoothingMode smoothingMode)
</del><ins>+void Recorder::drawGlyphs(const Font&amp; font, const GlyphBuffer&amp; glyphBuffer, unsigned from, unsigned numGlyphs, const FloatPoint&amp; startPoint, FontSmoothingMode smoothingMode)
</ins><span class="cx"> {
</span><span class="cx">     DrawingItem&amp; newItem = downcast&lt;DrawingItem&gt;(appendItem(DrawGlyphs::create(font, glyphBuffer.glyphs(from), glyphBuffer.advances(from), numGlyphs, FloatPoint(), toFloatSize(startPoint), smoothingMode)));
</span><span class="cx">     updateItemExtent(newItem);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsdisplaylistsDisplayListRecorderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -80,7 +80,7 @@
</span><span class="cx">     void applyFillPattern();
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    void drawGlyphs(const Font&amp;, const GlyphBuffer&amp;, int from, int numGlyphs, const FloatPoint&amp; anchorPoint, FontSmoothingMode);
</del><ins>+    void drawGlyphs(const Font&amp;, const GlyphBuffer&amp;, unsigned from, unsigned numGlyphs, const FloatPoint&amp; anchorPoint, FontSmoothingMode);
</ins><span class="cx"> 
</span><span class="cx">     void drawImage(Image&amp;, const FloatRect&amp; destination, const FloatRect&amp; source, const ImagePaintingOptions&amp;);
</span><span class="cx">     void drawTiledImage(Image&amp;, const FloatRect&amp; destination, const FloatPoint&amp; source, const FloatSize&amp; tileSize, const FloatSize&amp; spacing, const ImagePaintingOptions&amp;);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsharfbuzzHarfBuzzShapercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.cpp (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.cpp        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.cpp        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -97,7 +97,7 @@
</span><span class="cx">     m_offsets[index] = FloatPoint(offsetX, offsetY);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-int HarfBuzzShaper::HarfBuzzRun::characterIndexForXPosition(float targetX)
</del><ins>+unsigned HarfBuzzShaper::HarfBuzzRun::characterIndexForXPosition(float targetX)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(targetX &lt;= m_width);
</span><span class="cx">     float currentX = 0;
</span><span class="lines">@@ -156,9 +156,9 @@
</span><span class="cx">     return position;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static void normalizeCharacters(const TextRun&amp; run, UChar* destination, int length)
</del><ins>+static void normalizeCharacters(const TextRun&amp; run, UChar* destination, unsigned length)
</ins><span class="cx"> {
</span><del>-    int position = 0;
</del><ins>+    unsigned position = 0;
</ins><span class="cx">     bool error = false;
</span><span class="cx">     const UChar* source;
</span><span class="cx">     String stringFor8BitRun;
</span><span class="lines">@@ -170,7 +170,7 @@
</span><span class="cx"> 
</span><span class="cx">     while (position &lt; length) {
</span><span class="cx">         UChar32 character;
</span><del>-        int nextPosition = position;
</del><ins>+        unsigned nextPosition = position;
</ins><span class="cx">         U16_NEXT(source, nextPosition, length, character);
</span><span class="cx">         // Don't normalize tabs as they are not treated as spaces for word-end.
</span><span class="cx">         if (FontCascade::treatAsSpace(character) &amp;&amp; character != '\t')
</span><span class="lines">@@ -204,14 +204,14 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static void normalizeSpacesAndMirrorChars(const UChar* source, UChar* destination, int length, HarfBuzzShaper::NormalizeMode normalizeMode)
</del><ins>+static void normalizeSpacesAndMirrorChars(const UChar* source, UChar* destination, unsigned length, HarfBuzzShaper::NormalizeMode normalizeMode)
</ins><span class="cx"> {
</span><del>-    int position = 0;
</del><ins>+    unsigned position = 0;
</ins><span class="cx">     bool error = false;
</span><span class="cx">     // Iterate characters in source and mirror character if needed.
</span><span class="cx">     while (position &lt; length) {
</span><span class="cx">         UChar32 character;
</span><del>-        int nextPosition = position;
</del><ins>+        unsigned nextPosition = position;
</ins><span class="cx">         U16_NEXT(source, nextPosition, length, character);
</span><span class="cx">         // Don't normalize tabs as they are not treated as spaces for word-end
</span><span class="cx">         if (FontCascade::treatAsSpace(character) &amp;&amp; character != '\t')
</span><span class="lines">@@ -417,11 +417,11 @@
</span><span class="cx">                 continue;
</span><span class="cx"> 
</span><span class="cx">             if (U_GET_GC_MASK(character) &amp; U_GC_M_MASK) {
</span><del>-                int markLength = clusterLength;
</del><ins>+                unsigned markLength = clusterLength;
</ins><span class="cx">                 const UChar* markCharactersEnd = iterator.characters() + clusterLength;
</span><span class="cx">                 while (markCharactersEnd &lt; normalizedBufferEnd) {
</span><span class="cx">                     UChar32 nextCharacter;
</span><del>-                    int nextCharacterLength = 0;
</del><ins>+                    unsigned nextCharacterLength = 0;
</ins><span class="cx">                     U16_NEXT(markCharactersEnd, nextCharacterLength, normalizedBufferEnd - markCharactersEnd, nextCharacter);
</span><span class="cx">                     if (!(U_GET_GC_MASK(nextCharacter) &amp; U_GC_M_MASK))
</span><span class="cx">                         break;
</span><span class="lines">@@ -446,11 +446,11 @@
</span><span class="cx">                 nextScript = currentScript;
</span><span class="cx">             currentCharacterPosition = iterator.characters();
</span><span class="cx">         }
</span><del>-        unsigned numCharactersOfCurrentRun = iterator.currentCharacter() - startIndexOfCurrentRun;
</del><ins>+        unsigned numCharactersOfCurrentRun = iterator.currentIndex() - startIndexOfCurrentRun;
</ins><span class="cx">         hb_script_t script = hb_icu_script_to_script(currentScript);
</span><span class="cx">         m_harfBuzzRuns.append(std::make_unique&lt;HarfBuzzRun&gt;(currentFontData, startIndexOfCurrentRun, numCharactersOfCurrentRun, m_run.direction(), script));
</span><span class="cx">         currentFontData = nextFontData;
</span><del>-        startIndexOfCurrentRun = iterator.currentCharacter();
</del><ins>+        startIndexOfCurrentRun = iterator.currentIndex();
</ins><span class="cx">     } while (iterator.consume(character, clusterLength));
</span><span class="cx"> 
</span><span class="cx">     return !m_harfBuzzRuns.isEmpty();
</span><span class="lines">@@ -640,7 +640,7 @@
</span><span class="cx">     return charactersSoFar;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-FloatRect HarfBuzzShaper::selectionRect(const FloatPoint&amp; point, int height, int from, int to)
</del><ins>+FloatRect HarfBuzzShaper::selectionRect(const FloatPoint&amp; point, int height, unsigned from, unsigned to)
</ins><span class="cx"> {
</span><span class="cx">     float currentX = 0;
</span><span class="cx">     float fromX = 0;
</span><span class="lines">@@ -653,18 +653,22 @@
</span><span class="cx">     for (unsigned i = 0; i &lt; m_harfBuzzRuns.size(); ++i) {
</span><span class="cx">         if (m_run.rtl())
</span><span class="cx">             currentX -= m_harfBuzzRuns[i]-&gt;width();
</span><del>-        int numCharacters = m_harfBuzzRuns[i]-&gt;numCharacters();
-        if (!foundFromX &amp;&amp; from &gt;= 0 &amp;&amp; from &lt; numCharacters) {
</del><ins>+        unsigned numCharacters = m_harfBuzzRuns[i]-&gt;numCharacters();
+        if (!foundFromX &amp;&amp; from &lt; numCharacters) {
</ins><span class="cx">             fromX = m_harfBuzzRuns[i]-&gt;xPositionForOffset(from) + currentX;
</span><span class="cx">             foundFromX = true;
</span><del>-        } else
</del><ins>+        } else {
+            ASSERT(from &gt;= numCharacters);
</ins><span class="cx">             from -= numCharacters;
</span><ins>+        }
</ins><span class="cx"> 
</span><del>-        if (!foundToX &amp;&amp; to &gt;= 0 &amp;&amp; to &lt; numCharacters) {
</del><ins>+        if (!foundToX &amp;&amp; to &lt; numCharacters) {
</ins><span class="cx">             toX = m_harfBuzzRuns[i]-&gt;xPositionForOffset(to) + currentX;
</span><span class="cx">             foundToX = true;
</span><del>-        } else
</del><ins>+        } else {
+            ASSERT(to &gt;= numCharacters);
</ins><span class="cx">             to -= numCharacters;
</span><ins>+        }
</ins><span class="cx"> 
</span><span class="cx">         if (foundFromX &amp;&amp; foundToX)
</span><span class="cx">             break;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsharfbuzzHarfBuzzShaperh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.h (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.h        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.h        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -59,7 +59,7 @@
</span><span class="cx">     FloatPoint adjustStartPoint(const FloatPoint&amp;);
</span><span class="cx">     float totalWidth() { return m_totalWidth; }
</span><span class="cx">     int offsetForPosition(float targetX);
</span><del>-    FloatRect selectionRect(const FloatPoint&amp;, int height, int from, int to);
</del><ins>+    FloatRect selectionRect(const FloatPoint&amp;, int height, unsigned from, unsigned to);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     class HarfBuzzRun {
</span><span class="lines">@@ -70,7 +70,7 @@
</span><span class="cx">         void setGlyphAndPositions(unsigned index, uint16_t glyphId, float advance, float offsetX, float offsetY);
</span><span class="cx">         void setWidth(float width) { m_width = width; }
</span><span class="cx"> 
</span><del>-        int characterIndexForXPosition(float targetX);
</del><ins>+        unsigned characterIndexForXPosition(float targetX);
</ins><span class="cx">         float xPositionForOffset(unsigned offset);
</span><span class="cx"> 
</span><span class="cx">         const Font* fontData() { return m_fontData; }
</span><span class="lines">@@ -88,7 +88,7 @@
</span><span class="cx">     private:
</span><span class="cx">         const Font* m_fontData;
</span><span class="cx">         unsigned m_startIndex;
</span><del>-        size_t m_numCharacters;
</del><ins>+        unsigned m_numCharacters;
</ins><span class="cx">         unsigned m_numGlyphs;
</span><span class="cx">         TextDirection m_direction;
</span><span class="cx">         hb_script_t m_script;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsmacComplexTextControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.h (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.h        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.h        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -54,7 +54,7 @@
</span><span class="cx">     ComplexTextController(const FontCascade&amp;, const TextRun&amp;, bool mayUseNaturalWritingDirection = false, HashSet&lt;const Font*&gt;* fallbackFonts = 0, bool forTextEmphasis = false);
</span><span class="cx"> 
</span><span class="cx">     // Advance and emit glyphs up to the specified character.
</span><del>-    void advance(unsigned to, GlyphBuffer* = 0, GlyphIterationStyle = IncludePartialGlyphs, HashSet&lt;const Font*&gt;* fallbackFonts = 0);
</del><ins>+    void advance(unsigned to, GlyphBuffer* = nullptr, GlyphIterationStyle = IncludePartialGlyphs, HashSet&lt;const Font*&gt;* fallbackFonts = nullptr);
</ins><span class="cx"> 
</span><span class="cx">     // Compute the character offset for a given x coordinate.
</span><span class="cx">     int offsetForPosition(float x, bool includePartialGlyphs);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicswinFontCGWincpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/win/FontCGWin.cpp (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/win/FontCGWin.cpp        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/platform/graphics/win/FontCGWin.cpp        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -128,7 +128,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void FontCascade::drawGlyphs(GraphicsContext&amp; graphicsContext, const Font&amp; font, const GlyphBuffer&amp; glyphBuffer,
</span><del>-    int from, int numGlyphs, const FloatPoint&amp; point, FontSmoothingMode smoothingMode)
</del><ins>+    unsigned from, unsigned numGlyphs, const FloatPoint&amp; point, FontSmoothingMode smoothingMode)
</ins><span class="cx"> {
</span><span class="cx">     CGContextRef cgContext = graphicsContext.platformContext();
</span><span class="cx">     bool shouldUseFontSmoothing = WebCoreShouldUseFontSmoothing();
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicswinFontWincpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/win/FontWin.cpp (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/win/FontWin.cpp        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/platform/graphics/win/FontWin.cpp        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -50,7 +50,7 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void FontCascade::adjustSelectionRectForComplexText(const TextRun&amp; run, LayoutRect&amp; selectionRect, int from, int to) const
</del><ins>+void FontCascade::adjustSelectionRectForComplexText(const TextRun&amp; run, LayoutRect&amp; selectionRect, unsigned from, unsigned to) const
</ins><span class="cx"> {
</span><span class="cx">     UniscribeController it(this, run);
</span><span class="cx">     it.advance(from);
</span><span class="lines">@@ -66,7 +66,7 @@
</span><span class="cx">     selectionRect.setWidth(afterWidth - beforeWidth);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-float FontCascade::getGlyphsAndAdvancesForComplexText(const TextRun&amp; run, int from, int to, GlyphBuffer&amp; glyphBuffer, ForTextEmphasisOrNot forTextEmphasis) const
</del><ins>+float FontCascade::getGlyphsAndAdvancesForComplexText(const TextRun&amp; run, unsigned from, unsigned to, GlyphBuffer&amp; glyphBuffer, ForTextEmphasisOrNot forTextEmphasis) const
</ins><span class="cx"> {
</span><span class="cx">     if (forTextEmphasis) {
</span><span class="cx">         // FIXME: Add forTextEmphasis paremeter to UniscribeController and use it.
</span><span class="lines">@@ -91,7 +91,7 @@
</span><span class="cx">     return beforeWidth;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void FontCascade::drawEmphasisMarksForComplexText(GraphicsContext&amp; context, const TextRun&amp; run, const AtomicString&amp; mark, const FloatPoint&amp; point, int from, int to) const
</del><ins>+void FontCascade::drawEmphasisMarksForComplexText(GraphicsContext&amp; context, const TextRun&amp; run, const AtomicString&amp; mark, const FloatPoint&amp; point, unsigned from, unsigned to) const
</ins><span class="cx"> {
</span><span class="cx">     GlyphBuffer glyphBuffer;
</span><span class="cx">     float initialAdvance = getGlyphsAndAdvancesForComplexText(run, from, to, glyphBuffer, ForTextEmphasis);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingEllipsisBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/EllipsisBox.cpp (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/EllipsisBox.cpp        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/rendering/EllipsisBox.cpp        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -136,7 +136,7 @@
</span><span class="cx">     // FIXME: Why is this always LTR? Fix by passing correct text run flags below.
</span><span class="cx">     LayoutRect selectionRect = LayoutRect(x() + paintOffset.x(), y() + paintOffset.y() + rootBox.selectionTop(), 0, rootBox.selectionHeight());
</span><span class="cx">     TextRun run = RenderBlock::constructTextRun(m_str, style, AllowTrailingExpansion);
</span><del>-    font.adjustSelectionRectForText(run, selectionRect, 0, -1);
</del><ins>+    font.adjustSelectionRectForText(run, selectionRect);
</ins><span class="cx">     context.fillRect(snapRectToDevicePixelsWithWritingDirection(selectionRect, renderer().document().deviceScaleFactor(), run.ltr()), c);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingInlineTextBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/InlineTextBox.cpp        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -130,11 +130,15 @@
</span><span class="cx">     return root().selectionHeight();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool InlineTextBox::isSelected(int startPos, int endPos) const
</del><ins>+bool InlineTextBox::isSelected(unsigned startPos, unsigned endPos) const
</ins><span class="cx"> {
</span><del>-    int sPos = std::max(startPos - m_start, 0);
-    int ePos = std::min(endPos - m_start, static_cast&lt;int&gt;(m_len));
-    return (sPos &lt; ePos);
</del><ins>+    int sPos = clampedOffset(startPos);
+    int ePos = clampedOffset(endPos);
+    // FIXME: https://bugs.webkit.org/show_bug.cgi?id=160786
+    // We should only be checking if sPos &gt;= ePos here, because those are the
+    // indices used to actually generate the selection rect. Allowing us past this guard
+    // on any other condition creates zero-width selection rects.
+    return sPos &lt; ePos || (startPos == endPos &amp;&amp; startPos &gt;= start() &amp;&amp; startPos &lt;= (start() + len()));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> RenderObject::SelectionState InlineTextBox::selectionState()
</span><span class="lines">@@ -141,10 +145,11 @@
</span><span class="cx"> {
</span><span class="cx">     RenderObject::SelectionState state = renderer().selectionState();
</span><span class="cx">     if (state == RenderObject::SelectionStart || state == RenderObject::SelectionEnd || state == RenderObject::SelectionBoth) {
</span><del>-        int startPos, endPos;
</del><ins>+        unsigned startPos, endPos;
</ins><span class="cx">         renderer().selectionStartEnd(startPos, endPos);
</span><span class="cx">         // The position after a hard line break is considered to be past its end.
</span><del>-        int lastSelectable = start() + len() - (isLineBreak() ? 1 : 0);
</del><ins>+        ASSERT(start() + len() &gt;= (isLineBreak() ? 1 : 0));
+        unsigned lastSelectable = start() + len() - (isLineBreak() ? 1 : 0);
</ins><span class="cx"> 
</span><span class="cx">         bool start = (state != RenderObject::SelectionEnd &amp;&amp; startPos &gt;= m_start &amp;&amp; startPos &lt; m_start + m_len);
</span><span class="cx">         bool end = (state != RenderObject::SelectionStart &amp;&amp; endPos &gt; m_start &amp;&amp; endPos &lt;= lastSelectable);
</span><span class="lines">@@ -165,8 +170,8 @@
</span><span class="cx">     if (m_truncation != cNoTruncation &amp;&amp; root().ellipsisBox()) {
</span><span class="cx">         EllipsisBox* ellipsis = root().ellipsisBox();
</span><span class="cx">         if (state != RenderObject::SelectionNone) {
</span><del>-            int selectionStart;
-            int selectionEnd;
</del><ins>+            unsigned selectionStart;
+            unsigned selectionEnd;
</ins><span class="cx">             std::tie(selectionStart, selectionEnd) = selectionStartEnd();
</span><span class="cx">             // The ellipsis should be considered to be selected if the end of
</span><span class="cx">             // the selection is past the beginning of the truncation and the
</span><span class="lines">@@ -191,12 +196,16 @@
</span><span class="cx">     return style.fontCascade();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-LayoutRect InlineTextBox::localSelectionRect(int startPos, int endPos) const
</del><ins>+LayoutRect InlineTextBox::localSelectionRect(unsigned startPos, unsigned endPos) const
</ins><span class="cx"> {
</span><del>-    int sPos = std::max(startPos - m_start, 0);
-    int ePos = std::min(endPos - m_start, (int)m_len);
-    
-    if (sPos &gt; ePos)
</del><ins>+    unsigned sPos = clampedOffset(startPos);
+    unsigned ePos = clampedOffset(endPos);
+
+    // FIXME: https://bugs.webkit.org/show_bug.cgi?id=160786
+    // We should only be checking if sPos &gt;= ePos here, because those are the
+    // indices used to actually generate the selection rect. Allowing us past this guard
+    // on any other condition creates zero-width selection rects.
+    if (sPos &gt;= ePos &amp;&amp; !(startPos == endPos &amp;&amp; startPos &gt;= start() &amp;&amp; startPos &lt;= (start() + len())))
</ins><span class="cx">         return LayoutRect();
</span><span class="cx"> 
</span><span class="cx">     LayoutUnit selectionTop = this-&gt;selectionTop();
</span><span class="lines">@@ -212,7 +221,7 @@
</span><span class="cx"> 
</span><span class="cx">     LayoutRect selectionRect = LayoutRect(LayoutPoint(logicalLeft(), selectionTop), LayoutSize(m_logicalWidth, selectionHeight));
</span><span class="cx">     // Avoid computing the font width when the entire line box is selected as an optimization.
</span><del>-    if (sPos || ePos != static_cast&lt;int&gt;(m_len))
</del><ins>+    if (sPos || ePos != m_len)
</ins><span class="cx">         font.adjustSelectionRectForText(textRun, selectionRect, sPos, ePos);
</span><span class="cx">     IntRect snappedSelectionRect = enclosingIntRect(selectionRect);
</span><span class="cx">     LayoutUnit logicalWidth = snappedSelectionRect.width();
</span><span class="lines">@@ -508,18 +517,18 @@
</span><span class="cx">     TextRun textRun = constructTextRun(lineStyle, alternateStringToRender);
</span><span class="cx">     unsigned length = textRun.length();
</span><span class="cx"> 
</span><del>-    int selectionStart = 0;
-    int selectionEnd = 0;
</del><ins>+    unsigned selectionStart = 0;
+    unsigned selectionEnd = 0;
</ins><span class="cx">     if (haveSelection &amp;&amp; (paintSelectedTextOnly || paintSelectedTextSeparately))
</span><span class="cx">         std::tie(selectionStart, selectionEnd) = selectionStartEnd();
</span><span class="cx"> 
</span><span class="cx">     if (m_truncation != cNoTruncation) {
</span><del>-        selectionStart = std::min&lt;int&gt;(selectionStart, m_truncation);
-        selectionEnd = std::min&lt;int&gt;(selectionEnd, m_truncation);
</del><ins>+        selectionStart = std::min(selectionStart, static_cast&lt;unsigned&gt;(m_truncation));
+        selectionEnd = std::min(selectionEnd, static_cast&lt;unsigned&gt;(m_truncation));
</ins><span class="cx">         length = m_truncation;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    int emphasisMarkOffset = 0;
</del><ins>+    float emphasisMarkOffset = 0;
</ins><span class="cx">     bool emphasisMarkAbove;
</span><span class="cx">     bool hasTextEmphasis = emphasisMarkExistsAndIsAbove(lineStyle, emphasisMarkAbove);
</span><span class="cx">     const AtomicString&amp; emphasisMark = hasTextEmphasis ? lineStyle.textEmphasisMarkString() : nullAtom;
</span><span class="lines">@@ -587,20 +596,25 @@
</span><span class="cx">         context.concatCTM(rotation(boxRect, Counterclockwise));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-std::pair&lt;int, int&gt; InlineTextBox::selectionStartEnd() const
</del><ins>+unsigned InlineTextBox::clampedOffset(unsigned x) const
</ins><span class="cx"> {
</span><ins>+    return std::max(std::min(x, start() + len()), start()) - start();
+}
+
+std::pair&lt;unsigned, unsigned&gt; InlineTextBox::selectionStartEnd() const
+{
</ins><span class="cx">     auto selectionState = renderer().selectionState();
</span><span class="cx">     if (selectionState == RenderObject::SelectionInside)
</span><span class="cx">         return { 0, m_len };
</span><span class="cx">     
</span><del>-    int start;
-    int end;
</del><ins>+    unsigned start;
+    unsigned end;
</ins><span class="cx">     renderer().selectionStartEnd(start, end);
</span><span class="cx">     if (selectionState == RenderObject::SelectionStart)
</span><span class="cx">         end = renderer().textLength();
</span><span class="cx">     else if (selectionState == RenderObject::SelectionEnd)
</span><span class="cx">         start = 0;
</span><del>-    return { std::max(start - m_start, 0), std::min&lt;int&gt;(end - m_start, m_len) };
</del><ins>+    return { clampedOffset(start), clampedOffset(end) };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InlineTextBox::paintSelection(GraphicsContext&amp; context, const FloatPoint&amp; boxOrigin, const RenderStyle&amp; style, const FontCascade&amp; font, Color textColor)
</span><span class="lines">@@ -610,8 +624,8 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     // See if we have a selection to paint at all.
</span><del>-    int selectionStart;
-    int selectionEnd;
</del><ins>+    unsigned selectionStart;
+    unsigned selectionEnd;
</ins><span class="cx">     std::tie(selectionStart, selectionEnd) = selectionStartEnd();
</span><span class="cx">     if (selectionStart &gt;= selectionEnd)
</span><span class="cx">         return;
</span><span class="lines">@@ -634,7 +648,7 @@
</span><span class="cx">     unsigned length = m_truncation != cNoTruncation ? m_truncation : len();
</span><span class="cx"> 
</span><span class="cx">     String hyphenatedString;
</span><del>-    bool respectHyphen = selectionEnd == static_cast&lt;int&gt;(length) &amp;&amp; hasHyphen();
</del><ins>+    bool respectHyphen = selectionEnd == length &amp;&amp; hasHyphen();
</ins><span class="cx">     if (respectHyphen)
</span><span class="cx">         hyphenatedString = hyphenatedStringForTextRun(style, length);
</span><span class="cx">     TextRun textRun = constructTextRun(style, hyphenatedString, Optional&lt;unsigned&gt;(length));
</span><span class="lines">@@ -660,11 +674,10 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void InlineTextBox::paintCompositionBackground(GraphicsContext&amp; context, const FloatPoint&amp; boxOrigin, const RenderStyle&amp; style, const FontCascade&amp; font, int startPos, int endPos)
</del><ins>+void InlineTextBox::paintCompositionBackground(GraphicsContext&amp; context, const FloatPoint&amp; boxOrigin, const RenderStyle&amp; style, const FontCascade&amp; font, unsigned startPos, unsigned endPos)
</ins><span class="cx"> {
</span><del>-    int offset = m_start;
-    int selectionStart = std::max(startPos - offset, 0);
-    int selectionEnd = std::min&lt;int&gt;(endPos - offset, m_len);
</del><ins>+    unsigned selectionStart = clampedOffset(startPos);
+    unsigned selectionEnd = clampedOffset(endPos);
</ins><span class="cx">     if (selectionStart &gt;= selectionEnd)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="lines">@@ -756,7 +769,7 @@
</span><span class="cx"> 
</span><span class="cx">     // Determine whether we need to measure text
</span><span class="cx">     bool markerSpansWholeBox = true;
</span><del>-    if (m_start &lt;= (int)marker.startOffset())
</del><ins>+    if (m_start &lt;= marker.startOffset())
</ins><span class="cx">         markerSpansWholeBox = false;
</span><span class="cx">     if ((end() + 1) != marker.endOffset()) // end points at the last char, not past it
</span><span class="cx">         markerSpansWholeBox = false;
</span><span class="lines">@@ -765,11 +778,11 @@
</span><span class="cx"> 
</span><span class="cx">     bool isDictationMarker = marker.type() == DocumentMarker::DictationAlternatives;
</span><span class="cx">     if (!markerSpansWholeBox || grammar || isDictationMarker) {
</span><del>-        int startPosition = std::max&lt;int&gt;(marker.startOffset() - m_start, 0);
-        int endPosition = std::min&lt;int&gt;(marker.endOffset() - m_start, m_len);
</del><ins>+        unsigned startPosition = clampedOffset(marker.startOffset());
+        unsigned endPosition = clampedOffset(marker.endOffset());
</ins><span class="cx">         
</span><span class="cx">         if (m_truncation != cNoTruncation)
</span><del>-            endPosition = std::min&lt;int&gt;(endPosition, m_truncation);
</del><ins>+            endPosition = std::min(endPosition, static_cast&lt;unsigned&gt;(m_truncation));
</ins><span class="cx"> 
</span><span class="cx">         // Calculate start &amp; width
</span><span class="cx">         int deltaY = renderer().style().isFlippedLinesWritingMode() ? selectionBottom() - logicalBottom() : logicalTop() - selectionTop();
</span><span class="lines">@@ -818,8 +831,8 @@
</span><span class="cx">     LayoutUnit deltaY = renderer().style().isFlippedLinesWritingMode() ? selectionBottom() - logicalBottom() : logicalTop() - selectionTop();
</span><span class="cx">     LayoutRect selectionRect = LayoutRect(boxOrigin.x(), boxOrigin.y() - deltaY, 0, this-&gt;selectionHeight());
</span><span class="cx"> 
</span><del>-    int sPos = std::max&lt;int&gt;(marker.startOffset() - m_start, 0);
-    int ePos = std::min&lt;int&gt;(marker.endOffset() - m_start, m_len);
</del><ins>+    unsigned sPos = clampedOffset(marker.startOffset());
+    unsigned ePos = clampedOffset(marker.endOffset());
</ins><span class="cx">     TextRun run = constructTextRun(style);
</span><span class="cx">     font.adjustSelectionRectForText(run, selectionRect, sPos, ePos);
</span><span class="cx"> 
</span><span class="lines">@@ -985,10 +998,10 @@
</span><span class="cx">     return font.offsetForPosition(constructTextRun(lineStyle), lineOffset - logicalLeft(), includePartialGlyphs);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-float InlineTextBox::positionForOffset(int offset) const
</del><ins>+float InlineTextBox::positionForOffset(unsigned offset) const
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(offset &gt;= m_start);
</span><del>-    ASSERT(offset &lt;= m_start + m_len);
</del><ins>+    ASSERT(offset &lt;= m_start + len());
</ins><span class="cx"> 
</span><span class="cx">     if (isLineBreak())
</span><span class="cx">         return logicalLeft();
</span><span class="lines">@@ -995,8 +1008,8 @@
</span><span class="cx"> 
</span><span class="cx">     const RenderStyle&amp; lineStyle = this-&gt;lineStyle();
</span><span class="cx">     const FontCascade&amp; font = fontToUse(lineStyle, renderer());
</span><del>-    int from = !isLeftToRightDirection() ? offset - m_start : 0;
-    int to = !isLeftToRightDirection() ? m_len : offset - m_start;
</del><ins>+    unsigned from = !isLeftToRightDirection() ? clampedOffset(offset) : 0;
+    unsigned to = !isLeftToRightDirection() ? m_len : clampedOffset(offset);
</ins><span class="cx">     // FIXME: Do we need to add rightBearing here?
</span><span class="cx">     LayoutRect selectionRect = LayoutRect(logicalLeft(), 0, 0, 0);
</span><span class="cx">     TextRun run = constructTextRun(lineStyle);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingInlineTextBoxh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/InlineTextBox.h (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/InlineTextBox.h        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/rendering/InlineTextBox.h        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -42,11 +42,6 @@
</span><span class="cx"> public:
</span><span class="cx">     explicit InlineTextBox(RenderText&amp; renderer)
</span><span class="cx">         : InlineBox(renderer)
</span><del>-        , m_prevTextBox(nullptr)
-        , m_nextTextBox(nullptr)
-        , m_start(0)
-        , m_len(0)
-        , m_truncation(cNoTruncation)
</del><span class="cx">     {
</span><span class="cx">         setBehavesLikeText(true);
</span><span class="cx">     }
</span><span class="lines">@@ -69,7 +64,7 @@
</span><span class="cx">     void setStart(unsigned start) { m_start = start; }
</span><span class="cx">     void setLen(unsigned len) { m_len = len; }
</span><span class="cx"> 
</span><del>-    void offsetRun(int d) { ASSERT(!isDirty()); m_start += d; }
</del><ins>+    void offsetRun(int d) { ASSERT(!isDirty()); ASSERT(d &gt; 0 || m_start &gt;= static_cast&lt;unsigned&gt;(-d)); m_start += d; }
</ins><span class="cx"> 
</span><span class="cx">     unsigned short truncation() const { return m_truncation; }
</span><span class="cx"> 
</span><span class="lines">@@ -120,9 +115,9 @@
</span><span class="cx"> public:
</span><span class="cx">     FloatRect calculateBoundaries() const override { return FloatRect(x(), y(), width(), height()); }
</span><span class="cx"> 
</span><del>-    virtual LayoutRect localSelectionRect(int startPos, int endPos) const;
-    bool isSelected(int startPos, int endPos) const;
-    std::pair&lt;int, int&gt; selectionStartEnd() const;
</del><ins>+    virtual LayoutRect localSelectionRect(unsigned startPos, unsigned endPos) const;
+    bool isSelected(unsigned startPos, unsigned endPos) const;
+    std::pair&lt;unsigned, unsigned&gt; selectionStartEnd() const;
</ins><span class="cx"> 
</span><span class="cx"> protected:
</span><span class="cx">     void paint(PaintInfo&amp;, const LayoutPoint&amp;, LayoutUnit lineTop, LayoutUnit lineBottom) override;
</span><span class="lines">@@ -155,12 +150,13 @@
</span><span class="cx"> 
</span><span class="cx"> public:
</span><span class="cx">     virtual int offsetForPosition(float x, bool includePartialGlyphs = true) const;
</span><del>-    virtual float positionForOffset(int offset) const;
</del><ins>+    virtual float positionForOffset(unsigned offset) const;
</ins><span class="cx"> 
</span><span class="cx"> protected:
</span><del>-    void paintCompositionBackground(GraphicsContext&amp;, const FloatPoint&amp; boxOrigin, const RenderStyle&amp;, const FontCascade&amp;, int startPos, int endPos);
</del><ins>+    void paintCompositionBackground(GraphicsContext&amp;, const FloatPoint&amp; boxOrigin, const RenderStyle&amp;, const FontCascade&amp;, unsigned startPos, unsigned endPos);
</ins><span class="cx">     void paintDocumentMarkers(GraphicsContext&amp;, const FloatPoint&amp; boxOrigin, const RenderStyle&amp;, const FontCascade&amp;, bool background);
</span><span class="cx">     void paintCompositionUnderline(GraphicsContext&amp;, const FloatPoint&amp; boxOrigin, const CompositionUnderline&amp;);
</span><ins>+    unsigned clampedOffset(unsigned) const;
</ins><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><span class="lines">@@ -173,15 +169,15 @@
</span><span class="cx"> 
</span><span class="cx">     void behavesLikeText() const = delete;
</span><span class="cx"> 
</span><del>-    InlineTextBox* m_prevTextBox; // The previous box that also uses our RenderObject
-    InlineTextBox* m_nextTextBox; // The next box that also uses our RenderObject
</del><ins>+    InlineTextBox* m_prevTextBox { nullptr }; // The previous box that also uses our RenderObject
+    InlineTextBox* m_nextTextBox { nullptr }; // The next box that also uses our RenderObject
</ins><span class="cx"> 
</span><del>-    int m_start;
-    unsigned short m_len;
</del><ins>+    unsigned m_start { 0 };
+    unsigned short m_len { 0 };
</ins><span class="cx"> 
</span><span class="cx">     // Where to truncate when text overflow is applied. We use special constants to
</span><span class="cx">     // denote no truncation (the whole run paints) and full truncation (nothing paints at all).
</span><del>-    unsigned short m_truncation;
</del><ins>+    unsigned short m_truncation { cNoTruncation };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlock.cpp        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -3489,7 +3489,7 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-LayoutRect RenderBlock::localCaretRect(InlineBox* inlineBox, int caretOffset, LayoutUnit* extraWidthToEndOfLine)
</del><ins>+LayoutRect RenderBlock::localCaretRect(InlineBox* inlineBox, unsigned caretOffset, LayoutUnit* extraWidthToEndOfLine)
</ins><span class="cx"> {
</span><span class="cx">     // Do the normal calculation in most cases.
</span><span class="cx">     if (firstChild())
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlock.h (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlock.h        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/rendering/RenderBlock.h        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -476,7 +476,7 @@
</span><span class="cx"> 
</span><span class="cx">     void paintContinuationOutlines(PaintInfo&amp;, const LayoutPoint&amp;);
</span><span class="cx"> 
</span><del>-    LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* extraWidthToEndOfLine = 0) final;
</del><ins>+    LayoutRect localCaretRect(InlineBox*, unsigned caretOffset, LayoutUnit* extraWidthToEndOfLine = 0) final;
</ins><span class="cx">     
</span><span class="cx">     // FIXME-BLOCKFLOW: Remove virtualizaion when all callers have moved to RenderBlockFlow
</span><span class="cx">     virtual VisiblePosition positionForPointWithInlineChildren(const LayoutPoint&amp;, const RenderRegion*);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBox.cpp        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -4383,7 +4383,7 @@
</span><span class="cx">     computedValues.m_position = logicalTopPos;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-LayoutRect RenderBox::localCaretRect(InlineBox* box, int caretOffset, LayoutUnit* extraWidthToEndOfLine)
</del><ins>+LayoutRect RenderBox::localCaretRect(InlineBox* box, unsigned caretOffset, LayoutUnit* extraWidthToEndOfLine)
</ins><span class="cx"> {
</span><span class="cx">     // VisiblePositions at offsets inside containers either a) refer to the positions before/after
</span><span class="cx">     // those containers (tables and select elements) or b) refer to the position inside an empty block.
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBox.h (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBox.h        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/rendering/RenderBox.h        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -481,7 +481,7 @@
</span><span class="cx">     bool hasUnsplittableScrollingOverflow() const;
</span><span class="cx">     bool isUnsplittableForPagination() const;
</span><span class="cx"> 
</span><del>-    LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* extraWidthToEndOfLine = nullptr) override;
</del><ins>+    LayoutRect localCaretRect(InlineBox*, unsigned caretOffset, LayoutUnit* extraWidthToEndOfLine = nullptr) override;
</ins><span class="cx"> 
</span><span class="cx">     virtual LayoutRect overflowClipRect(const LayoutPoint&amp; location, RenderRegion*, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize, PaintPhase = PaintPhaseBlockBackground);
</span><span class="cx">     virtual LayoutRect overflowClipRectForChildLayers(const LayoutPoint&amp; location, RenderRegion* region, OverlayScrollbarSizeRelevancy relevancy) { return overflowClipRect(location, region, relevancy); }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderInlinecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderInline.cpp (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderInline.cpp        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -249,7 +249,7 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-LayoutRect RenderInline::localCaretRect(InlineBox* inlineBox, int, LayoutUnit* extraWidthToEndOfLine)
</del><ins>+LayoutRect RenderInline::localCaretRect(InlineBox* inlineBox, unsigned, LayoutUnit* extraWidthToEndOfLine)
</ins><span class="cx"> {
</span><span class="cx">     if (firstChild()) {
</span><span class="cx">         // This condition is possible if the RenderInline is at an editing boundary,
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderInlineh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderInline.h (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderInline.h        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/rendering/RenderInline.h        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -96,7 +96,7 @@
</span><span class="cx">     void setAlwaysCreateLineBoxes() { setRenderInlineAlwaysCreatesLineBoxes(true); }
</span><span class="cx">     void updateAlwaysCreateLineBoxes(bool fullLayout);
</span><span class="cx"> 
</span><del>-    LayoutRect localCaretRect(InlineBox*, int, LayoutUnit* extraWidthToEndOfLine) final;
</del><ins>+    LayoutRect localCaretRect(InlineBox*, unsigned, LayoutUnit* extraWidthToEndOfLine) final;
</ins><span class="cx"> 
</span><span class="cx">     bool hitTestCulledInline(const HitTestRequest&amp;, HitTestResult&amp;, const HitTestLocation&amp; locationInContainer, const LayoutPoint&amp; accumulatedOffset);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLineBreakcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLineBreak.cpp (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLineBreak.cpp        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/rendering/RenderLineBreak.cpp        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -166,7 +166,7 @@
</span><span class="cx">     m_inlineBoxWrapper-&gt;root().setHasSelectedChildren(state != SelectionNone);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-LayoutRect RenderLineBreak::localCaretRect(InlineBox* inlineBox, int caretOffset, LayoutUnit* extraWidthToEndOfLine)
</del><ins>+LayoutRect RenderLineBreak::localCaretRect(InlineBox* inlineBox, unsigned caretOffset, LayoutUnit* extraWidthToEndOfLine)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT_UNUSED(caretOffset, !caretOffset);
</span><span class="cx">     ASSERT_UNUSED(inlineBox, inlineBox == m_inlineBoxWrapper);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLineBreakh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLineBreak.h (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLineBreak.h        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/rendering/RenderLineBreak.h        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -66,7 +66,7 @@
</span><span class="cx">     int caretMinOffset() const override;
</span><span class="cx">     int caretMaxOffset() const override;
</span><span class="cx">     bool canBeSelectionLeaf() const override;
</span><del>-    LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* extraWidthToEndOfLine) override;
</del><ins>+    LayoutRect localCaretRect(InlineBox*, unsigned caretOffset, LayoutUnit* extraWidthToEndOfLine) override;
</ins><span class="cx">     void setSelectionState(SelectionState) override;
</span><span class="cx"> 
</span><span class="cx">     LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositionMode) const override;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderObject.cpp        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -1206,7 +1206,7 @@
</span><span class="cx">     return view();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RenderObject::selectionStartEnd(int&amp; spos, int&amp; epos) const
</del><ins>+void RenderObject::selectionStartEnd(unsigned&amp; spos, unsigned&amp; epos) const
</ins><span class="cx"> {
</span><span class="cx">     selectionRoot().selectionData().selectionStartEndPositions(spos, epos);
</span><span class="cx"> }
</span><span class="lines">@@ -1377,7 +1377,7 @@
</span><span class="cx">     return offset;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-LayoutRect RenderObject::localCaretRect(InlineBox*, int, LayoutUnit* extraWidthToEndOfLine)
</del><ins>+LayoutRect RenderObject::localCaretRect(InlineBox*, unsigned, LayoutUnit* extraWidthToEndOfLine)
</ins><span class="cx"> {
</span><span class="cx">     if (extraWidthToEndOfLine)
</span><span class="cx">         *extraWidthToEndOfLine = 0;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderObject.h (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderObject.h        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/rendering/RenderObject.h        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -749,7 +749,7 @@
</span><span class="cx">      * @param extraWidthToEndOfLine optional out arg to give extra width to end of line -
</span><span class="cx">      * useful for character range rect computations
</span><span class="cx">      */
</span><del>-    virtual LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* extraWidthToEndOfLine = nullptr);
</del><ins>+    virtual LayoutRect localCaretRect(InlineBox*, unsigned caretOffset, LayoutUnit* extraWidthToEndOfLine = nullptr);
</ins><span class="cx"> 
</span><span class="cx">     // When performing a global document tear-down, the renderer of the document is cleared.  We use this
</span><span class="cx">     // as a hook to detect the case of document destruction and don't waste time doing unnecessary work.
</span><span class="lines">@@ -782,7 +782,7 @@
</span><span class="cx">     virtual void imageChanged(WrappedImagePtr, const IntRect* = nullptr) { }
</span><span class="cx"> 
</span><span class="cx">     SelectionSubtreeRoot&amp; selectionRoot() const;
</span><del>-    void selectionStartEnd(int&amp; spos, int&amp; epos) const;
</del><ins>+    void selectionStartEnd(unsigned&amp; spos, unsigned&amp; epos) const;
</ins><span class="cx">     
</span><span class="cx">     void removeFromParent();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderReplacedcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderReplaced.cpp (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderReplaced.cpp        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/rendering/RenderReplaced.cpp        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -616,18 +616,18 @@
</span><span class="cx">     if (s == SelectionInside)
</span><span class="cx">         return true;
</span><span class="cx"> 
</span><del>-    int selectionStart, selectionEnd;
</del><ins>+    unsigned selectionStart, selectionEnd;
</ins><span class="cx">     selectionStartEnd(selectionStart, selectionEnd);
</span><span class="cx">     if (s == SelectionStart)
</span><span class="cx">         return selectionStart == 0;
</span><span class="cx">         
</span><del>-    int end = element()-&gt;hasChildNodes() ? element()-&gt;countChildNodes() : 1;
</del><ins>+    unsigned end = element()-&gt;hasChildNodes() ? element()-&gt;countChildNodes() : 1;
</ins><span class="cx">     if (s == SelectionEnd)
</span><span class="cx">         return selectionEnd == end;
</span><span class="cx">     if (s == SelectionBoth)
</span><span class="cx">         return selectionStart == 0 &amp;&amp; selectionEnd == end;
</span><span class="cx">         
</span><del>-    ASSERT(0);
</del><ins>+    ASSERT_NOT_REACHED();
</ins><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderTextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderText.cpp (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderText.cpp        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/rendering/RenderText.cpp        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -442,7 +442,7 @@
</span><span class="cx">     return m_lineBoxes.positionForPoint(*this, point);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-LayoutRect RenderText::localCaretRect(InlineBox* inlineBox, int caretOffset, LayoutUnit* extraWidthToEndOfLine)
</del><ins>+LayoutRect RenderText::localCaretRect(InlineBox* inlineBox, unsigned caretOffset, LayoutUnit* extraWidthToEndOfLine)
</ins><span class="cx"> {
</span><span class="cx">     if (!inlineBox)
</span><span class="cx">         return LayoutRect();
</span><span class="lines">@@ -1372,13 +1372,12 @@
</span><span class="cx"> 
</span><span class="cx">     if (selectionState() == SelectionNone)
</span><span class="cx">         return LayoutRect();
</span><del>-    RenderBlock* cb = containingBlock();
-    if (!cb)
</del><ins>+    if (!containingBlock())
</ins><span class="cx">         return LayoutRect();
</span><span class="cx"> 
</span><span class="cx">     // Now calculate startPos and endPos for painting selection.
</span><span class="cx">     // We include a selection while endPos &gt; 0
</span><del>-    int startPos, endPos;
</del><ins>+    unsigned startPos, endPos;
</ins><span class="cx">     if (selectionState() == SelectionInside) {
</span><span class="cx">         // We are fully selected.
</span><span class="cx">         startPos = 0;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderTexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderText.h (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderText.h        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/rendering/RenderText.h        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -119,7 +119,7 @@
</span><span class="cx">     bool canBeSelectionLeaf() const override { return true; }
</span><span class="cx">     void setSelectionState(SelectionState) final;
</span><span class="cx">     LayoutRect selectionRectForRepaint(const RenderLayerModelObject* repaintContainer, bool clipToVisibleContent = true) override;
</span><del>-    LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* extraWidthToEndOfLine = 0) override;
</del><ins>+    LayoutRect localCaretRect(InlineBox*, unsigned caretOffset, LayoutUnit* extraWidthToEndOfLine = 0) override;
</ins><span class="cx"> 
</span><span class="cx">     LayoutRect collectSelectionRectsForLineBoxes(const RenderLayerModelObject* repaintContainer, bool clipToVisibleContent, Vector&lt;LayoutRect&gt;&amp; rects);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderTextLineBoxescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderTextLineBoxes.cpp (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderTextLineBoxes.cpp        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/rendering/RenderTextLineBoxes.cpp        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -445,7 +445,7 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    int start, end;
</del><ins>+    unsigned start, end;
</ins><span class="cx">     renderer.selectionStartEnd(start, end);
</span><span class="cx">     if (state == RenderObject::SelectionStart) {
</span><span class="cx">         end = renderer.textLength();
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderView.cpp (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderView.cpp        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/rendering/RenderView.cpp        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -118,19 +118,7 @@
</span><span class="cx"> RenderView::RenderView(Document&amp; document, RenderStyle&amp;&amp; style)
</span><span class="cx">     : RenderBlockFlow(document, WTFMove(style))
</span><span class="cx">     , m_frameView(*document.view())
</span><del>-    , m_selectionUnsplitStart(nullptr)
-    , m_selectionUnsplitEnd(nullptr)
-    , m_selectionUnsplitStartPos(-1)
-    , m_selectionUnsplitEndPos(-1)
</del><span class="cx">     , m_lazyRepaintTimer(*this, &amp;RenderView::lazyRepaintTimerFired)
</span><del>-    , m_pageLogicalHeight(0)
-    , m_pageLogicalHeightChanged(false)
-    , m_layoutState(nullptr)
-    , m_layoutStateDisableCount(0)
-    , m_renderQuoteHead(nullptr)
-    , m_renderCounterCount(0)
-    , m_selectionWasCaret(false)
-    , m_hasSoftwareFilters(false)
</del><span class="cx"> #if ENABLE(SERVICE_CONTROLS)
</span><span class="cx">     , m_selectionRectGatherer(*this)
</span><span class="cx"> #endif
</span><span class="lines">@@ -772,7 +760,10 @@
</span><span class="cx">     SelectionMap selectedObjects;
</span><span class="cx"> 
</span><span class="cx">     RenderObject* os = root.selectionData().selectionStart();
</span><del>-    RenderObject* stop = rendererAfterPosition(root.selectionData().selectionEnd(), root.selectionData().selectionEndPos());
</del><ins>+    auto* selectionEnd = root.selectionData().selectionEnd();
+    RenderObject* stop = nullptr;
+    if (selectionEnd)
+        stop = rendererAfterPosition(selectionEnd, root.selectionData().selectionEndPos().value());
</ins><span class="cx">     SelectionIterator selectionIterator(os);
</span><span class="cx">     while (os &amp;&amp; os != stop) {
</span><span class="cx">         if ((os-&gt;canBeSelectionLeaf() || os == root.selectionData().selectionStart() || os == root.selectionData().selectionEnd()) &amp;&amp; os-&gt;selectionState() != SelectionNone) {
</span><span class="lines">@@ -821,7 +812,10 @@
</span><span class="cx"> {
</span><span class="cx">     HashSet&lt;RenderBlock*&gt; processedBlocks;
</span><span class="cx"> 
</span><del>-    RenderObject* end = rendererAfterPosition(root.selectionData().selectionEnd(), root.selectionData().selectionEndPos());
</del><ins>+    auto* selectionEnd = root.selectionData().selectionEnd();
+    RenderObject* end = nullptr;
+    if (selectionEnd)
+        end = rendererAfterPosition(selectionEnd, root.selectionData().selectionEndPos().value());
</ins><span class="cx">     SelectionIterator selectionIterator(root.selectionData().selectionStart());
</span><span class="cx">     for (RenderObject* o = selectionIterator.current(); o &amp;&amp; o != end; o = selectionIterator.next()) {
</span><span class="cx">         if (!o-&gt;canBeSelectionLeaf() &amp;&amp; o != root.selectionData().selectionStart() &amp;&amp; o != root.selectionData().selectionEnd())
</span><span class="lines">@@ -840,7 +834,7 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RenderView::setSelection(RenderObject* start, int startPos, RenderObject* end, int endPos, SelectionRepaintMode blockRepaintMode)
</del><ins>+void RenderView::setSelection(RenderObject* start, Optional&lt;unsigned&gt; startPos, RenderObject* end, Optional&lt;unsigned&gt; endPos, SelectionRepaintMode blockRepaintMode)
</ins><span class="cx"> {
</span><span class="cx">     // Make sure both our start and end objects are defined.
</span><span class="cx">     // Check www.msnbc.com and try clicking around to find the case where this happened.
</span><span class="lines">@@ -877,7 +871,7 @@
</span><span class="cx">     splitSelectionBetweenSubtrees(start, startPos, end, endPos, blockRepaintMode);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RenderView::splitSelectionBetweenSubtrees(const RenderObject* start, int startPos, const RenderObject* end, int endPos, SelectionRepaintMode blockRepaintMode)
</del><ins>+void RenderView::splitSelectionBetweenSubtrees(const RenderObject* start, Optional&lt;unsigned&gt; startPos, const RenderObject* end, Optional&lt;unsigned&gt; endPos, SelectionRepaintMode blockRepaintMode)
</ins><span class="cx"> {
</span><span class="cx">     // Compute the visible selection end points for each of the subtrees.
</span><span class="cx">     RenderSubtreesMap renderSubtreesMap;
</span><span class="lines">@@ -902,14 +896,16 @@
</span><span class="cx">             SelectionSubtreeData selectionData = renderSubtreesMap.get(&amp;root);
</span><span class="cx">             if (selectionData.selectionClear()) {
</span><span class="cx">                 selectionData.setSelectionStart(node-&gt;renderer());
</span><del>-                selectionData.setSelectionStartPos(node == startNode ? startPos : 0);
</del><ins>+                selectionData.setSelectionStartPos(node == startNode ? startPos : Optional&lt;unsigned&gt;(0));
</ins><span class="cx">             }
</span><span class="cx"> 
</span><span class="cx">             selectionData.setSelectionEnd(node-&gt;renderer());
</span><span class="cx">             if (node == endNode)
</span><span class="cx">                 selectionData.setSelectionEndPos(endPos);
</span><del>-            else
-                selectionData.setSelectionEndPos(node-&gt;offsetInCharacters() ? node-&gt;maxCharacterOffset() : node-&gt;countChildNodes());
</del><ins>+            else {
+                unsigned newEndPos = node-&gt;offsetInCharacters() ? node-&gt;maxCharacterOffset() : node-&gt;countChildNodes();
+                selectionData.setSelectionEndPos(newEndPos);
+            }
</ins><span class="cx"> 
</span><span class="cx">             renderSubtreesMap.set(&amp;root, selectionData);
</span><span class="cx">         }
</span><span class="lines">@@ -960,7 +956,10 @@
</span><span class="cx">     // the union of those rects might remain the same even when changes have occurred.
</span><span class="cx"> 
</span><span class="cx">     RenderObject* os = root.selectionData().selectionStart();
</span><del>-    RenderObject* stop = rendererAfterPosition(root.selectionData().selectionEnd(), root.selectionData().selectionEndPos());
</del><ins>+    auto* selectionEnd = root.selectionData().selectionEnd();
+    RenderObject* stop = nullptr;
+    if (selectionEnd)
+        stop = rendererAfterPosition(selectionEnd, root.selectionData().selectionEndPos().value());
</ins><span class="cx">     SelectionIterator selectionIterator(os);
</span><span class="cx">     while (os &amp;&amp; os != stop) {
</span><span class="cx">         if (isValidObjectForNewSelection(root, *os)) {
</span><span class="lines">@@ -998,7 +997,10 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     RenderObject* selectionStart = root.selectionData().selectionStart();
</span><del>-    RenderObject* selectionEnd = rendererAfterPosition(root.selectionData().selectionEnd(), root.selectionData().selectionEndPos());
</del><ins>+    auto* selectionDataEnd = root.selectionData().selectionEnd();
+    RenderObject* selectionEnd = nullptr;
+    if (selectionDataEnd)
+        selectionEnd = rendererAfterPosition(selectionDataEnd, root.selectionData().selectionEndPos().value());
</ins><span class="cx">     SelectionIterator selectionIterator(selectionStart);
</span><span class="cx">     for (RenderObject* currentRenderer = selectionStart; currentRenderer &amp;&amp; currentRenderer != selectionEnd; currentRenderer = selectionIterator.next()) {
</span><span class="cx">         if (currentRenderer == root.selectionData().selectionStart() || currentRenderer == root.selectionData().selectionEnd())
</span><span class="lines">@@ -1089,7 +1091,7 @@
</span><span class="cx">         selectedBlockInfo.value-&gt;repaint();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RenderView::getSelection(RenderObject*&amp; startRenderer, int&amp; startOffset, RenderObject*&amp; endRenderer, int&amp; endOffset) const
</del><ins>+void RenderView::getSelection(RenderObject*&amp; startRenderer, Optional&lt;unsigned&gt;&amp; startOffset, RenderObject*&amp; endRenderer, Optional&lt;unsigned&gt;&amp; endOffset) const
</ins><span class="cx"> {
</span><span class="cx">     startRenderer = m_selectionUnsplitStart;
</span><span class="cx">     startOffset = m_selectionUnsplitStartPos;
</span><span class="lines">@@ -1100,7 +1102,7 @@
</span><span class="cx"> void RenderView::clearSelection()
</span><span class="cx"> {
</span><span class="cx">     layer()-&gt;repaintBlockSelectionGaps();
</span><del>-    setSelection(nullptr, -1, nullptr, -1, RepaintNewMinusOld);
</del><ins>+    setSelection(nullptr, Nullopt, nullptr, Nullopt, RepaintNewMinusOld);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool RenderView::printing() const
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderView.h (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderView.h        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/rendering/RenderView.h        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -85,8 +85,8 @@
</span><span class="cx">     void paintBoxDecorations(PaintInfo&amp;, const LayoutPoint&amp;) override;
</span><span class="cx"> 
</span><span class="cx">     enum SelectionRepaintMode { RepaintNewXOROld, RepaintNewMinusOld, RepaintNothing };
</span><del>-    void setSelection(RenderObject* start, int startPos, RenderObject* end, int endPos, SelectionRepaintMode = RepaintNewXOROld);
-    void getSelection(RenderObject*&amp; startRenderer, int&amp; startOffset, RenderObject*&amp; endRenderer, int&amp; endOffset) const;
</del><ins>+    void setSelection(RenderObject* start, Optional&lt;unsigned&gt; startPos, RenderObject* endObject, Optional&lt;unsigned&gt; endPos, SelectionRepaintMode = RepaintNewXOROld);
+    void getSelection(RenderObject*&amp; startRenderer, Optional&lt;unsigned&gt;&amp; startOffset, RenderObject*&amp; endRenderer, Optional&lt;unsigned&gt;&amp; endOffset) const;
</ins><span class="cx">     void clearSelection();
</span><span class="cx">     RenderObject* selectionUnsplitStart() const { return m_selectionUnsplitStart; }
</span><span class="cx">     RenderObject* selectionUnsplitEnd() const { return m_selectionUnsplitEnd; }
</span><span class="lines">@@ -307,7 +307,7 @@
</span><span class="cx"> 
</span><span class="cx">     bool isScrollableOrRubberbandableBox() const override;
</span><span class="cx"> 
</span><del>-    void splitSelectionBetweenSubtrees(const RenderObject* startRenderer, int startPos, const RenderObject* endRenderer, int endPos, SelectionRepaintMode blockRepaintMode);
</del><ins>+    void splitSelectionBetweenSubtrees(const RenderObject* startRenderer, Optional&lt;unsigned&gt; startPos, const RenderObject* endRenderer, Optional&lt;unsigned&gt; endPos, SelectionRepaintMode blockRepaintMode);
</ins><span class="cx">     void clearSubtreeSelection(const SelectionSubtreeRoot&amp;, SelectionRepaintMode, OldSelectionData&amp;) const;
</span><span class="cx">     void updateSelectionForSubtrees(RenderSubtreesMap&amp;, SelectionRepaintMode);
</span><span class="cx">     void applySubtreeSelection(const SelectionSubtreeRoot&amp;, SelectionRepaintMode, const OldSelectionData&amp;);
</span><span class="lines">@@ -317,10 +317,10 @@
</span><span class="cx"> private:
</span><span class="cx">     FrameView&amp; m_frameView;
</span><span class="cx"> 
</span><del>-    RenderObject* m_selectionUnsplitStart;
-    RenderObject* m_selectionUnsplitEnd;
-    int m_selectionUnsplitStartPos;
-    int m_selectionUnsplitEndPos;
</del><ins>+    RenderObject* m_selectionUnsplitStart { nullptr };
+    RenderObject* m_selectionUnsplitEnd { nullptr };
+    Optional&lt;unsigned&gt; m_selectionUnsplitStartPos;
+    Optional&lt;unsigned&gt; m_selectionUnsplitEndPos;
</ins><span class="cx"> 
</span><span class="cx">     // Include this RenderView.
</span><span class="cx">     uint64_t m_rendererCount { 1 };
</span><span class="lines">@@ -329,18 +329,11 @@
</span><span class="cx"> 
</span><span class="cx">     // FIXME: Only used by embedded WebViews inside AppKit NSViews.  Find a way to remove.
</span><span class="cx">     struct LegacyPrinting {
</span><del>-        LegacyPrinting()
-            : m_bestTruncatedAt(0)
-            , m_truncatedAt(0)
-            , m_truncatorWidth(0)
-            , m_forcedPageBreak(false)
-        { }
-
-        int m_bestTruncatedAt;
-        int m_truncatedAt;
-        int m_truncatorWidth;
</del><ins>+        int m_bestTruncatedAt { 0 };
+        int m_truncatedAt { 0 };
+        int m_truncatorWidth { 0 };
</ins><span class="cx">         IntRect m_printRect;
</span><del>-        bool m_forcedPageBreak;
</del><ins>+        bool m_forcedPageBreak { false };
</ins><span class="cx">     };
</span><span class="cx">     LegacyPrinting m_legacyPrinting;
</span><span class="cx">     // End deprecated members.
</span><span class="lines">@@ -354,17 +347,17 @@
</span><span class="cx"> 
</span><span class="cx">     std::unique_ptr&lt;ImageQualityController&gt; m_imageQualityController;
</span><span class="cx">     LayoutUnit m_pageLogicalHeight;
</span><del>-    bool m_pageLogicalHeightChanged;
</del><ins>+    bool m_pageLogicalHeightChanged { false };
</ins><span class="cx">     std::unique_ptr&lt;LayoutState&gt; m_layoutState;
</span><del>-    unsigned m_layoutStateDisableCount;
</del><ins>+    unsigned m_layoutStateDisableCount { 0 };
</ins><span class="cx">     std::unique_ptr&lt;RenderLayerCompositor&gt; m_compositor;
</span><span class="cx">     std::unique_ptr&lt;FlowThreadController&gt; m_flowThreadController;
</span><span class="cx"> 
</span><del>-    RenderQuote* m_renderQuoteHead;
-    unsigned m_renderCounterCount;
</del><ins>+    RenderQuote* m_renderQuoteHead { nullptr };
+    unsigned m_renderCounterCount { 0 };
</ins><span class="cx"> 
</span><del>-    bool m_selectionWasCaret;
-    bool m_hasSoftwareFilters;
</del><ins>+    bool m_selectionWasCaret { false };
+    bool m_hasSoftwareFilters { false };
</ins><span class="cx">     bool m_usesFirstLineRules { false };
</span><span class="cx">     bool m_usesFirstLetterRules { false };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingSelectionSubtreeRootcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/SelectionSubtreeRoot.cpp (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/SelectionSubtreeRoot.cpp        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/rendering/SelectionSubtreeRoot.cpp        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -42,11 +42,6 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-SelectionSubtreeRoot::SelectionSubtreeRoot(RenderObject* selectionStart, int selectionStartPos, RenderObject* selectionEnd, int selectionEndPos)
-    : m_selectionSubtreeData(selectionStart, selectionStartPos, selectionEnd, selectionEndPos)
-{
-}
-
</del><span class="cx"> void SelectionSubtreeRoot::adjustForVisibleSelection(Document&amp; document)
</span><span class="cx"> {
</span><span class="cx">     if (m_selectionSubtreeData.selectionClear())
</span><span class="lines">@@ -53,8 +48,10 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     // Create a range based on the cached end points
</span><del>-    Position startPosition = createLegacyEditingPosition(m_selectionSubtreeData.selectionStart()-&gt;node(), m_selectionSubtreeData.selectionStartPos());
-    Position endPosition = createLegacyEditingPosition(m_selectionSubtreeData.selectionEnd()-&gt;node(), m_selectionSubtreeData.selectionEndPos());
</del><ins>+    auto selectionStart = m_selectionSubtreeData.selectionStartPos().value();
+    auto selectionEnd = m_selectionSubtreeData.selectionEndPos().value();
+    Position startPosition = createLegacyEditingPosition(m_selectionSubtreeData.selectionStart()-&gt;node(), selectionStart);
+    Position endPosition = createLegacyEditingPosition(m_selectionSubtreeData.selectionEnd()-&gt;node(), selectionEnd);
</ins><span class="cx"> 
</span><span class="cx">     RefPtr&lt;Range&gt; range = Range::create(document, startPosition.parentAnchoredEquivalent(), endPosition.parentAnchoredEquivalent());
</span><span class="cx">     VisibleSelection selection(*range);
</span><span class="lines">@@ -82,10 +79,13 @@
</span><span class="cx">     if (&amp;startPos.deprecatedNode()-&gt;renderer()-&gt;selectionRoot() != this)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    auto newStartPos = startPos.deprecatedEditingOffset();
+    auto newEndPos = endPos.deprecatedEditingOffset();
+    ASSERT(newStartPos &gt;= 0 &amp;&amp; newEndPos &gt;= 0);
</ins><span class="cx">     m_selectionSubtreeData.setSelectionStart(startPos.deprecatedNode()-&gt;renderer());
</span><del>-    m_selectionSubtreeData.setSelectionStartPos(startPos.deprecatedEditingOffset());
</del><ins>+    m_selectionSubtreeData.setSelectionStartPos(newStartPos);
</ins><span class="cx">     m_selectionSubtreeData.setSelectionEnd(endPos.deprecatedNode()-&gt;renderer());
</span><del>-    m_selectionSubtreeData.setSelectionEndPos(endPos.deprecatedEditingOffset());
</del><ins>+    m_selectionSubtreeData.setSelectionEndPos(newEndPos);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingSelectionSubtreeRooth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/SelectionSubtreeRoot.h (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/SelectionSubtreeRoot.h        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/rendering/SelectionSubtreeRoot.h        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -45,13 +45,11 @@
</span><span class="cx"> 
</span><span class="cx">     struct OldSelectionData {
</span><span class="cx">         OldSelectionData()
</span><del>-            : selectionStartPos(-1)
-            , selectionEndPos(-1)
</del><span class="cx">         {
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        int selectionStartPos;
-        int selectionEndPos;
</del><ins>+        Optional&lt;unsigned&gt; selectionStartPos;
+        Optional&lt;unsigned&gt; selectionEndPos;
</ins><span class="cx">         SelectedObjectMap selectedObjects;
</span><span class="cx">         SelectedBlockMap selectedBlocks;
</span><span class="cx">     };
</span><span class="lines">@@ -58,15 +56,9 @@
</span><span class="cx"> 
</span><span class="cx">     class SelectionSubtreeData {
</span><span class="cx">     public:
</span><del>-        SelectionSubtreeData()
-            : m_selectionStart(nullptr)
-            , m_selectionStartPos(-1)
-            , m_selectionEnd(nullptr)
-            , m_selectionEndPos(-1)
-        {
-        }
</del><ins>+        SelectionSubtreeData() = default;
</ins><span class="cx"> 
</span><del>-        SelectionSubtreeData(RenderObject* selectionStart, int selectionStartPos, RenderObject* selectionEnd, int selectionEndPos)
</del><ins>+        SelectionSubtreeData(RenderObject* selectionStart, Optional&lt;unsigned&gt; selectionStartPos, RenderObject* selectionEnd, Optional&lt;unsigned&gt; selectionEndPos)
</ins><span class="cx">             : m_selectionStart(selectionStart)
</span><span class="cx">             , m_selectionStartPos(selectionStartPos)
</span><span class="cx">             , m_selectionEnd(selectionEnd)
</span><span class="lines">@@ -75,39 +67,39 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         RenderObject* selectionStart() const { return m_selectionStart; }
</span><del>-        int selectionStartPos() const { return m_selectionStartPos; }
</del><ins>+        Optional&lt;unsigned&gt; selectionStartPos() const { return m_selectionStartPos; }
</ins><span class="cx">         RenderObject* selectionEnd() const { return m_selectionEnd; }
</span><del>-        int selectionEndPos() const { return m_selectionEndPos; }
</del><ins>+        Optional&lt;unsigned&gt; selectionEndPos() const { return m_selectionEndPos; }
</ins><span class="cx">         bool selectionClear() const
</span><span class="cx">         {
</span><span class="cx">             return !m_selectionStart
</span><del>-            &amp;&amp; (m_selectionStartPos == -1)
</del><ins>+            &amp;&amp; (!m_selectionStartPos)
</ins><span class="cx">             &amp;&amp; !m_selectionEnd
</span><del>-            &amp;&amp; (m_selectionEndPos == -1);
</del><ins>+            &amp;&amp; (!m_selectionEndPos);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><del>-        void selectionStartEndPositions(int&amp; startPos, int&amp; endPos) const
</del><ins>+        void selectionStartEndPositions(unsigned&amp; startPos, unsigned&amp; endPos) const
</ins><span class="cx">         {
</span><del>-            startPos = m_selectionStartPos;
-            endPos = m_selectionEndPos;
</del><ins>+            startPos = m_selectionStartPos.value();
+            endPos = m_selectionEndPos.value();
</ins><span class="cx">         }
</span><span class="cx">         void setSelectionStart(RenderObject* selectionStart) { m_selectionStart = selectionStart; }
</span><del>-        void setSelectionStartPos(int selectionStartPos) { m_selectionStartPos = selectionStartPos; }
</del><ins>+        void setSelectionStartPos(Optional&lt;unsigned&gt; selectionStartPos) { m_selectionStartPos = selectionStartPos;}
</ins><span class="cx">         void setSelectionEnd(RenderObject* selectionEnd) { m_selectionEnd = selectionEnd; }
</span><del>-        void setSelectionEndPos(int selectionEndPos) { m_selectionEndPos = selectionEndPos; }
</del><ins>+        void setSelectionEndPos(Optional&lt;unsigned&gt; selectionEndPos) { m_selectionEndPos = selectionEndPos;}
</ins><span class="cx">         void clearSelection()
</span><span class="cx">         {
</span><span class="cx">             m_selectionStart = nullptr;
</span><del>-            m_selectionStartPos = -1;
</del><ins>+            m_selectionStartPos = Nullopt;
</ins><span class="cx">             m_selectionEnd = nullptr;
</span><del>-            m_selectionEndPos = -1;
</del><ins>+            m_selectionEndPos = Nullopt;
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">     private:
</span><del>-        RenderObject* m_selectionStart;
-        int m_selectionStartPos;
-        RenderObject* m_selectionEnd;
-        int m_selectionEndPos;
</del><ins>+        RenderObject* m_selectionStart { nullptr };
+        Optional&lt;unsigned&gt; m_selectionStartPos;
+        RenderObject* m_selectionEnd { nullptr };
+        Optional&lt;unsigned&gt; m_selectionEndPos;
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     typedef HashMap&lt;SelectionSubtreeRoot*, SelectionSubtreeData&gt; RenderSubtreesMap;
</span><span class="lines">@@ -114,7 +106,6 @@
</span><span class="cx">     typedef HashMap&lt;const SelectionSubtreeRoot*, std::unique_ptr&lt;OldSelectionData&gt;&gt; SubtreeOldSelectionDataMap;
</span><span class="cx"> 
</span><span class="cx">     SelectionSubtreeRoot();
</span><del>-    SelectionSubtreeRoot(RenderObject* selectionStart, int selectionStartPos, RenderObject* selectionEnd, int selectionEndPos);
</del><span class="cx"> 
</span><span class="cx">     SelectionSubtreeData&amp; selectionData() { return m_selectionSubtreeData; }
</span><span class="cx">     const SelectionSubtreeData&amp; selectionData() const { return m_selectionSubtreeData; }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingTextPaintercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/TextPainter.cpp (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/TextPainter.cpp        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/rendering/TextPainter.cpp        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -84,17 +84,17 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void TextPainter::drawTextOrEmphasisMarks(const FontCascade&amp; font, const TextRun&amp; textRun, const AtomicString&amp; emphasisMark,
</span><del>-    int emphasisMarkOffset, const FloatPoint&amp; textOrigin, int startOffset, int endOffset)
</del><ins>+    float emphasisMarkOffset, const FloatPoint&amp; textOrigin, unsigned startOffset, unsigned endOffset)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(startOffset &lt; endOffset);
</span><span class="cx">     if (emphasisMark.isEmpty())
</span><span class="cx">         m_context.drawText(font, textRun, textOrigin, startOffset, endOffset);
</span><span class="cx">     else
</span><del>-        m_context.drawEmphasisMarks(font, textRun, emphasisMark, textOrigin + IntSize(0, emphasisMarkOffset), startOffset, endOffset);
</del><ins>+        m_context.drawEmphasisMarks(font, textRun, emphasisMark, textOrigin + FloatSize(0, emphasisMarkOffset), startOffset, endOffset);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void TextPainter::paintTextWithShadows(const ShadowData* shadow, const FontCascade&amp; font, const TextRun&amp; textRun, const FloatRect&amp; boxRect, const FloatPoint&amp; textOrigin,
</span><del>-    int startOffset, int endOffset, const AtomicString&amp; emphasisMark, int emphasisMarkOffset, bool stroked)
</del><ins>+    unsigned startOffset, unsigned endOffset, const AtomicString&amp; emphasisMark, float emphasisMarkOffset, bool stroked)
</ins><span class="cx"> {
</span><span class="cx">     if (!shadow) {
</span><span class="cx">         drawTextOrEmphasisMarks(font, textRun, emphasisMark, emphasisMarkOffset, textOrigin, startOffset, endOffset);
</span><span class="lines">@@ -120,7 +120,7 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TextPainter::paintTextAndEmphasisMarksIfNeeded(const TextRun&amp; textRun, const FloatRect&amp; boxRect, const FloatPoint&amp; textOrigin, int startOffset, int endOffset,
</del><ins>+void TextPainter::paintTextAndEmphasisMarksIfNeeded(const TextRun&amp; textRun, const FloatRect&amp; boxRect, const FloatPoint&amp; textOrigin, unsigned startOffset, unsigned endOffset,
</ins><span class="cx">     const TextPaintStyle&amp; paintStyle, const ShadowData* shadow)
</span><span class="cx"> {
</span><span class="cx">     // FIXME: Truncate right-to-left text correctly.
</span><span class="lines">@@ -145,7 +145,7 @@
</span><span class="cx">         m_context.concatCTM(rotation(boxRect, Counterclockwise));
</span><span class="cx"> }
</span><span class="cx">     
</span><del>-void TextPainter::paintText(const TextRun&amp; textRun, int length, const FloatRect&amp; boxRect, const FloatPoint&amp; textOrigin, int selectionStart, int selectionEnd,
</del><ins>+void TextPainter::paintText(const TextRun&amp; textRun, unsigned length, const FloatRect&amp; boxRect, const FloatPoint&amp; textOrigin, unsigned selectionStart, unsigned selectionEnd,
</ins><span class="cx">     bool paintSelectedTextOnly, bool paintSelectedTextSeparately)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(m_font);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingTextPainterh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/TextPainter.h (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/TextPainter.h        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/rendering/TextPainter.h        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -54,18 +54,18 @@
</span><span class="cx">     void setSelectionPaintStyle(const TextPaintStyle&amp; selectionPaintStyle) { m_selectionPaintStyle = selectionPaintStyle; }
</span><span class="cx">     void setIsHorizontal(bool isHorizontal) { m_textBoxIsHorizontal = isHorizontal; }
</span><span class="cx">     void setFont(const FontCascade&amp; font) { m_font = &amp;font; }
</span><del>-    void addEmphasis(const AtomicString&amp; emphasisMark, int emphasisMarkOffset, RenderCombineText*);
</del><ins>+    void addEmphasis(const AtomicString&amp; emphasisMark, float emphasisMarkOffset, RenderCombineText*);
</ins><span class="cx">     void addTextShadow(const ShadowData* textShadow, const ShadowData* selectionShadow);
</span><span class="cx"> 
</span><del>-    void paintText(const TextRun&amp;, int length, const FloatRect&amp; boxRect, const FloatPoint&amp; textOrigin,
-        int selectionStart = 0, int selectionEnd = 0, bool paintSelectedTextOnly = false, bool paintSelectedTextSeparately = false);
</del><ins>+    void paintText(const TextRun&amp;, unsigned length, const FloatRect&amp; boxRect, const FloatPoint&amp; textOrigin,
+        unsigned selectionStart = 0, unsigned selectionEnd = 0, bool paintSelectedTextOnly = false, bool paintSelectedTextSeparately = false);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    void drawTextOrEmphasisMarks(const FontCascade&amp;, const TextRun&amp;, const AtomicString&amp; emphasisMark, int emphasisMarkOffset,
-        const FloatPoint&amp; textOrigin, int startOffset, int endOffset);
</del><ins>+    void drawTextOrEmphasisMarks(const FontCascade&amp;, const TextRun&amp;, const AtomicString&amp; emphasisMark, float emphasisMarkOffset,
+        const FloatPoint&amp; textOrigin, unsigned startOffset, unsigned endOffset);
</ins><span class="cx">     void paintTextWithShadows(const ShadowData*, const FontCascade&amp;, const TextRun&amp;, const FloatRect&amp; boxRect, const FloatPoint&amp; textOrigin,
</span><del>-        int startOffset, int endOffset, const AtomicString&amp; emphasisMark, int emphasisMarkOffset, bool stroked);
-    void paintTextAndEmphasisMarksIfNeeded(const TextRun&amp;, const FloatRect&amp; boxRect, const FloatPoint&amp; textOrigin, int startOffset, int endOffset,
</del><ins>+        unsigned startOffset, unsigned endOffset, const AtomicString&amp; emphasisMark, float emphasisMarkOffset, bool stroked);
+    void paintTextAndEmphasisMarksIfNeeded(const TextRun&amp;, const FloatRect&amp; boxRect, const FloatPoint&amp; textOrigin, unsigned startOffset, unsigned endOffset,
</ins><span class="cx">         const TextPaintStyle&amp;, const ShadowData*);
</span><span class="cx"> 
</span><span class="cx">     GraphicsContext&amp; m_context;
</span><span class="lines">@@ -76,11 +76,11 @@
</span><span class="cx">     const ShadowData* m_selectionShadow { nullptr };
</span><span class="cx">     AtomicString m_emphasisMark;
</span><span class="cx">     RenderCombineText* m_combinedText { nullptr };
</span><del>-    int m_emphasisMarkOffset { 0 };
</del><ins>+    float m_emphasisMarkOffset { 0 };
</ins><span class="cx">     bool m_textBoxIsHorizontal { true };
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-inline void TextPainter::addEmphasis(const AtomicString&amp; emphasisMark, int emphasisMarkOffset, RenderCombineText* combinedText)
</del><ins>+inline void TextPainter::addEmphasis(const AtomicString&amp; emphasisMark, float emphasisMarkOffset, RenderCombineText* combinedText)
</ins><span class="cx"> {
</span><span class="cx">     m_emphasisMark = emphasisMark;
</span><span class="cx">     m_emphasisMarkOffset = emphasisMarkOffset;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgRenderSVGInlineTextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/RenderSVGInlineText.cpp (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/RenderSVGInlineText.cpp        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGInlineText.cpp        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -116,17 +116,17 @@
</span><span class="cx">     return WTFMove(box);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-LayoutRect RenderSVGInlineText::localCaretRect(InlineBox* box, int caretOffset, LayoutUnit*)
</del><ins>+LayoutRect RenderSVGInlineText::localCaretRect(InlineBox* box, unsigned caretOffset, LayoutUnit*)
</ins><span class="cx"> {
</span><span class="cx">     if (!is&lt;InlineTextBox&gt;(box))
</span><span class="cx">         return LayoutRect();
</span><span class="cx"> 
</span><span class="cx">     auto&amp; textBox = downcast&lt;InlineTextBox&gt;(*box);
</span><del>-    if (static_cast&lt;unsigned&gt;(caretOffset) &lt; textBox.start() || static_cast&lt;unsigned&gt;(caretOffset) &gt; textBox.start() + textBox.len())
</del><ins>+    if (caretOffset &lt; textBox.start() || caretOffset &gt; textBox.start() + textBox.len())
</ins><span class="cx">         return LayoutRect();
</span><span class="cx"> 
</span><span class="cx">     // Use the edge of the selection rect to determine the caret rect.
</span><del>-    if (static_cast&lt;unsigned&gt;(caretOffset) &lt; textBox.start() + textBox.len()) {
</del><ins>+    if (caretOffset &lt; textBox.start() + textBox.len()) {
</ins><span class="cx">         LayoutRect rect = textBox.localSelectionRect(caretOffset, caretOffset + 1);
</span><span class="cx">         LayoutUnit x = textBox.isLeftToRightDirection() ? rect.x() : rect.maxX();
</span><span class="cx">         return LayoutRect(x, rect.y(), caretWidth, rect.height());
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgRenderSVGInlineTexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/RenderSVGInlineText.h (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/RenderSVGInlineText.h        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGInlineText.h        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -60,7 +60,7 @@
</span><span class="cx">     bool isSVGInlineText() const override { return true; }
</span><span class="cx"> 
</span><span class="cx">     VisiblePosition positionForPoint(const LayoutPoint&amp;, const RenderRegion*) override;
</span><del>-    LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* extraWidthToEndOfLine = 0) override;
</del><ins>+    LayoutRect localCaretRect(InlineBox*, unsigned caretOffset, LayoutUnit* extraWidthToEndOfLine = 0) override;
</ins><span class="cx">     IntRect linesBoundingBox() const override;
</span><span class="cx">     std::unique_ptr&lt;InlineTextBox&gt; createTextBox() override;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgSVGInlineTextBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -100,7 +100,7 @@
</span><span class="cx">     return fragment.characterOffset - start() + renderer().scaledFont().offsetForPosition(textRun, position * scalingFactor, includePartialGlyphs);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-float SVGInlineTextBox::positionForOffset(int) const
</del><ins>+float SVGInlineTextBox::positionForOffset(unsigned) const
</ins><span class="cx"> {
</span><span class="cx">     // SVG doesn't use the offset &lt;-&gt; position selection system. 
</span><span class="cx">     ASSERT_NOT_REACHED();
</span><span class="lines">@@ -107,7 +107,7 @@
</span><span class="cx">     return 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-FloatRect SVGInlineTextBox::selectionRectForTextFragment(const SVGTextFragment&amp; fragment, int startPosition, int endPosition, const RenderStyle* style) const
</del><ins>+FloatRect SVGInlineTextBox::selectionRectForTextFragment(const SVGTextFragment&amp; fragment, unsigned startPosition, unsigned endPosition, const RenderStyle* style) const
</ins><span class="cx"> {
</span><span class="cx">     ASSERT_WITH_SECURITY_IMPLICATION(startPosition &lt; endPosition);
</span><span class="cx">     ASSERT(style);
</span><span class="lines">@@ -134,11 +134,10 @@
</span><span class="cx">     return snappedSelectionRect;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-LayoutRect SVGInlineTextBox::localSelectionRect(int startPosition, int endPosition) const
</del><ins>+LayoutRect SVGInlineTextBox::localSelectionRect(unsigned startPosition, unsigned endPosition) const
</ins><span class="cx"> {
</span><del>-    int boxStart = start();
-    startPosition = std::max(startPosition - boxStart, 0);
-    endPosition = std::min(endPosition - boxStart, static_cast&lt;int&gt;(len()));
</del><ins>+    startPosition = clampedOffset(startPosition);
+    endPosition = clampedOffset(endPosition);
</ins><span class="cx">     if (startPosition &gt;= endPosition)
</span><span class="cx">         return LayoutRect();
</span><span class="cx"> 
</span><span class="lines">@@ -146,8 +145,8 @@
</span><span class="cx"> 
</span><span class="cx">     AffineTransform fragmentTransform;
</span><span class="cx">     FloatRect selectionRect;
</span><del>-    int fragmentStartPosition = 0;
-    int fragmentEndPosition = 0;
</del><ins>+    unsigned fragmentStartPosition = 0;
+    unsigned fragmentEndPosition = 0;
</ins><span class="cx"> 
</span><span class="cx">     unsigned textFragmentsSize = m_textFragments.size();
</span><span class="cx">     for (unsigned i = 0; i &lt; textFragmentsSize; ++i) {
</span><span class="lines">@@ -203,12 +202,12 @@
</span><span class="cx"> 
</span><span class="cx">     auto&amp; style = parentRenderer.style();
</span><span class="cx"> 
</span><del>-    int startPosition;
-    int endPosition;
</del><ins>+    unsigned startPosition;
+    unsigned endPosition;
</ins><span class="cx">     std::tie(startPosition, endPosition) = selectionStartEnd();
</span><span class="cx"> 
</span><del>-    int fragmentStartPosition = 0;
-    int fragmentEndPosition = 0;
</del><ins>+    unsigned fragmentStartPosition = 0;
+    unsigned fragmentEndPosition = 0;
</ins><span class="cx">     AffineTransform fragmentTransform;
</span><span class="cx">     unsigned textFragmentsSize = m_textFragments.size();
</span><span class="cx">     for (unsigned i = 0; i &lt; textFragmentsSize; ++i) {
</span><span class="lines">@@ -407,13 +406,14 @@
</span><span class="cx">     return run;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool SVGInlineTextBox::mapStartEndPositionsIntoFragmentCoordinates(const SVGTextFragment&amp; fragment, int&amp; startPosition, int&amp; endPosition) const
</del><ins>+bool SVGInlineTextBox::mapStartEndPositionsIntoFragmentCoordinates(const SVGTextFragment&amp; fragment, unsigned&amp; startPosition, unsigned&amp; endPosition) const
</ins><span class="cx"> {
</span><span class="cx">     if (startPosition &gt;= endPosition)
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    int offset = static_cast&lt;int&gt;(fragment.characterOffset) - start();
-    int length = static_cast&lt;int&gt;(fragment.length);
</del><ins>+    ASSERT(fragment.characterOffset &gt;= start());
+    unsigned offset = fragment.characterOffset - start();
+    unsigned length = fragment.length;
</ins><span class="cx"> 
</span><span class="cx">     if (startPosition &gt;= offset + length || endPosition &lt;= offset)
</span><span class="cx">         return false;
</span><span class="lines">@@ -420,8 +420,10 @@
</span><span class="cx"> 
</span><span class="cx">     if (startPosition &lt; offset)
</span><span class="cx">         startPosition = 0;
</span><del>-    else
</del><ins>+    else {
+        ASSERT(startPosition &gt;= offset);
</ins><span class="cx">         startPosition -= offset;
</span><ins>+    }
</ins><span class="cx"> 
</span><span class="cx">     if (endPosition &gt; offset + length)
</span><span class="cx">         endPosition = length;
</span><span class="lines">@@ -540,7 +542,7 @@
</span><span class="cx">         releasePaintingResource(contextPtr, &amp;path);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void SVGInlineTextBox::paintTextWithShadows(GraphicsContext&amp; context, const RenderStyle* style, TextRun&amp; textRun, const SVGTextFragment&amp; fragment, int startPosition, int endPosition)
</del><ins>+void SVGInlineTextBox::paintTextWithShadows(GraphicsContext&amp; context, const RenderStyle* style, TextRun&amp; textRun, const SVGTextFragment&amp; fragment, unsigned startPosition, unsigned endPosition)
</ins><span class="cx"> {
</span><span class="cx">     float scalingFactor = renderer().scalingFactor();
</span><span class="cx">     ASSERT(scalingFactor);
</span><span class="lines">@@ -590,8 +592,8 @@
</span><span class="cx">     ASSERT(style);
</span><span class="cx">     ASSERT(selectionStyle);
</span><span class="cx"> 
</span><del>-    int startPosition = 0;
-    int endPosition = 0;
</del><ins>+    unsigned startPosition = 0;
+    unsigned endPosition = 0;
</ins><span class="cx">     if (hasSelection) {
</span><span class="cx">         std::tie(startPosition, endPosition) = selectionStartEnd();
</span><span class="cx">         hasSelection = mapStartEndPositionsIntoFragmentCoordinates(fragment, startPosition, endPosition);
</span><span class="lines">@@ -618,7 +620,7 @@
</span><span class="cx">         SVGResourcesCache::clientStyleChanged(parent()-&gt;renderer(), StyleDifferenceRepaint, *style);
</span><span class="cx"> 
</span><span class="cx">     // Eventually draw text using regular style from the end position of the selection to the end of the current chunk part
</span><del>-    if (endPosition &lt; static_cast&lt;int&gt;(fragment.length) &amp;&amp; !paintSelectedTextOnly)
</del><ins>+    if (endPosition &lt; fragment.length &amp;&amp; !paintSelectedTextOnly)
</ins><span class="cx">         paintTextWithShadows(context, style, textRun, fragment, endPosition, fragment.length);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgSVGInlineTextBoxh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.h (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.h        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.h        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -43,13 +43,13 @@
</span><span class="cx">     int selectionTop() { return top(); }
</span><span class="cx">     int selectionHeight() { return static_cast&lt;int&gt;(ceilf(m_logicalHeight)); }
</span><span class="cx">     int offsetForPosition(float x, bool includePartialGlyphs = true) const override;
</span><del>-    float positionForOffset(int offset) const override;
</del><ins>+    float positionForOffset(unsigned offset) const override;
</ins><span class="cx"> 
</span><span class="cx">     void paintSelectionBackground(PaintInfo&amp;);
</span><span class="cx">     void paint(PaintInfo&amp;, const LayoutPoint&amp;, LayoutUnit lineTop, LayoutUnit lineBottom) override;
</span><del>-    LayoutRect localSelectionRect(int startPosition, int endPosition) const override;
</del><ins>+    LayoutRect localSelectionRect(unsigned startPosition, unsigned endPosition) const override;
</ins><span class="cx"> 
</span><del>-    bool mapStartEndPositionsIntoFragmentCoordinates(const SVGTextFragment&amp;, int&amp; startPosition, int&amp; endPosition) const;
</del><ins>+    bool mapStartEndPositionsIntoFragmentCoordinates(const SVGTextFragment&amp;, unsigned&amp; startPosition, unsigned&amp; endPosition) const;
</ins><span class="cx"> 
</span><span class="cx">     FloatRect calculateBoundaries() const override;
</span><span class="cx"> 
</span><span class="lines">@@ -64,7 +64,7 @@
</span><span class="cx">     void setStartsNewTextChunk(bool newTextChunk) { m_startsNewTextChunk = newTextChunk; }
</span><span class="cx"> 
</span><span class="cx">     int offsetForPositionInFragment(const SVGTextFragment&amp;, float position, bool includePartialGlyphs) const;
</span><del>-    FloatRect selectionRectForTextFragment(const SVGTextFragment&amp;, int fragmentStartPosition, int fragmentEndPosition, const RenderStyle*) const;
</del><ins>+    FloatRect selectionRectForTextFragment(const SVGTextFragment&amp;, unsigned fragmentStartPosition, unsigned fragmentEndPosition, const RenderStyle*) const;
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     bool isSVGInlineTextBox() const override { return true; }
</span><span class="lines">@@ -79,7 +79,7 @@
</span><span class="cx"> 
</span><span class="cx">     void paintDecoration(GraphicsContext&amp;, TextDecoration, const SVGTextFragment&amp;);
</span><span class="cx">     void paintDecorationWithStyle(GraphicsContext&amp;, TextDecoration, const SVGTextFragment&amp;, RenderBoxModelObject&amp; decorationRenderer);
</span><del>-    void paintTextWithShadows(GraphicsContext&amp;, const RenderStyle*, TextRun&amp;, const SVGTextFragment&amp;, int startPosition, int endPosition);
</del><ins>+    void paintTextWithShadows(GraphicsContext&amp;, const RenderStyle*, TextRun&amp;, const SVGTextFragment&amp;, unsigned startPosition, unsigned endPosition);
</ins><span class="cx">     void paintText(GraphicsContext&amp;, const RenderStyle*, const RenderStyle* selectionStyle, const SVGTextFragment&amp;, bool hasSelection, bool paintSelectedTextOnly);
</span><span class="cx"> 
</span><span class="cx">     bool nodeAtPoint(const HitTestRequest&amp;, HitTestResult&amp;, const HitTestLocation&amp; locationInContainer, const LayoutPoint&amp; accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom, HitTestAction) override;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgSVGTextQuerycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/SVGTextQuery.cpp (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/SVGTextQuery.cpp        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/rendering/svg/SVGTextQuery.cpp        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -134,13 +134,15 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool SVGTextQuery::mapStartEndPositionsIntoFragmentCoordinates(Data* queryData, const SVGTextFragment&amp; fragment, int&amp; startPosition, int&amp; endPosition) const
</del><ins>+bool SVGTextQuery::mapStartEndPositionsIntoFragmentCoordinates(Data* queryData, const SVGTextFragment&amp; fragment, unsigned&amp; startPosition, unsigned&amp; endPosition) const
</ins><span class="cx"> {
</span><span class="cx">     // Reuse the same logic used for text selection &amp; painting, to map our query start/length into start/endPositions of the current text fragment.
</span><ins>+    ASSERT(startPosition &gt;= queryData-&gt;processedCharacters);
+    ASSERT(endPosition &gt;= queryData-&gt;processedCharacters);
</ins><span class="cx">     startPosition -= queryData-&gt;processedCharacters;
</span><span class="cx">     endPosition -= queryData-&gt;processedCharacters;
</span><span class="cx"> 
</span><del>-    if (startPosition &gt;= endPosition || startPosition &lt; 0 || endPosition &lt; 0)
</del><ins>+    if (startPosition &gt;= endPosition)
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     modifyStartEndPositionsRespectingLigatures(queryData, startPosition, endPosition);
</span><span class="lines">@@ -151,7 +153,7 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void SVGTextQuery::modifyStartEndPositionsRespectingLigatures(Data* queryData, int&amp; startPosition, int&amp; endPosition) const
</del><ins>+void SVGTextQuery::modifyStartEndPositionsRespectingLigatures(Data* queryData, unsigned&amp; startPosition, unsigned&amp; endPosition) const
</ins><span class="cx"> {
</span><span class="cx">     SVGTextLayoutAttributes* layoutAttributes = queryData-&gt;textRenderer-&gt;layoutAttributes();
</span><span class="cx">     Vector&lt;SVGTextMetrics&gt;&amp; textMetricsValues = layoutAttributes-&gt;textMetricsValues();
</span><span class="lines">@@ -167,7 +169,7 @@
</span><span class="cx">     bool alterStartPosition = true;
</span><span class="cx">     bool alterEndPosition = true;
</span><span class="cx"> 
</span><del>-    int lastPositionOffset = -1;
</del><ins>+    Optional&lt;unsigned&gt; lastPositionOffset;
</ins><span class="cx">     for (; textMetricsOffset &lt; textMetricsSize &amp;&amp; positionOffset &lt; positionSize; ++textMetricsOffset) {
</span><span class="cx">         SVGTextMetrics&amp; metrics = textMetricsValues[textMetricsOffset];
</span><span class="cx"> 
</span><span class="lines">@@ -182,21 +184,21 @@
</span><span class="cx">             break;
</span><span class="cx"> 
</span><span class="cx">         // If the start position maps to a character in the metrics list, we don't need to modify it.
</span><del>-        if (startPosition == static_cast&lt;int&gt;(positionOffset))
</del><ins>+        if (startPosition == positionOffset)
</ins><span class="cx">             alterStartPosition = false;
</span><span class="cx"> 
</span><span class="cx">         // If the start position maps to a character in the metrics list, we don't need to modify it.
</span><del>-        if (endPosition == static_cast&lt;int&gt;(positionOffset))
</del><ins>+        if (endPosition == positionOffset)
</ins><span class="cx">             alterEndPosition = false;
</span><span class="cx"> 
</span><span class="cx">         // Detect ligatures.
</span><del>-        if (lastPositionOffset != -1 &amp;&amp; lastPositionOffset - positionOffset &gt; 1) {
-            if (alterStartPosition &amp;&amp; startPosition &gt; lastPositionOffset &amp;&amp; startPosition &lt; static_cast&lt;int&gt;(positionOffset)) {
-                startPosition = lastPositionOffset;
</del><ins>+        if (lastPositionOffset &amp;&amp; lastPositionOffset.value() - positionOffset &gt; 1) {
+            if (alterStartPosition &amp;&amp; startPosition &gt; lastPositionOffset.value() &amp;&amp; startPosition &lt; positionOffset) {
+                startPosition = lastPositionOffset.value();
</ins><span class="cx">                 alterStartPosition = false;
</span><span class="cx">             }
</span><span class="cx"> 
</span><del>-            if (alterEndPosition &amp;&amp; endPosition &gt; lastPositionOffset &amp;&amp; endPosition &lt; static_cast&lt;int&gt;(positionOffset)) {
</del><ins>+            if (alterEndPosition &amp;&amp; endPosition &gt; lastPositionOffset.value() &amp;&amp; endPosition &lt; positionOffset) {
</ins><span class="cx">                 endPosition = positionOffset;
</span><span class="cx">                 alterEndPosition = false;
</span><span class="cx">             }
</span><span class="lines">@@ -212,11 +214,11 @@
</span><span class="cx">     if (!alterStartPosition &amp;&amp; !alterEndPosition)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    if (lastPositionOffset != -1 &amp;&amp; lastPositionOffset - positionOffset &gt; 1) {
-        if (alterStartPosition &amp;&amp; startPosition &gt; lastPositionOffset &amp;&amp; startPosition &lt; static_cast&lt;int&gt;(positionOffset))
-            startPosition = lastPositionOffset;
</del><ins>+    if (lastPositionOffset &amp;&amp; lastPositionOffset.value() - positionOffset &gt; 1) {
+        if (alterStartPosition &amp;&amp; startPosition &gt; lastPositionOffset.value() &amp;&amp; startPosition &lt; positionOffset)
+            startPosition = lastPositionOffset.value();
</ins><span class="cx"> 
</span><del>-        if (alterEndPosition &amp;&amp; endPosition &gt; lastPositionOffset &amp;&amp; endPosition &lt; static_cast&lt;int&gt;(positionOffset))
</del><ins>+        if (alterEndPosition &amp;&amp; endPosition &gt; lastPositionOffset.value() &amp;&amp; endPosition &lt; positionOffset)
</ins><span class="cx">             endPosition = positionOffset;
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="lines">@@ -284,8 +286,8 @@
</span><span class="cx"> {
</span><span class="cx">     SubStringLengthData* data = static_cast&lt;SubStringLengthData*&gt;(queryData);
</span><span class="cx"> 
</span><del>-    int startPosition = data-&gt;startPosition;
-    int endPosition = startPosition + data-&gt;length;
</del><ins>+    unsigned startPosition = data-&gt;startPosition;
+    unsigned endPosition = startPosition + data-&gt;length;
</ins><span class="cx">     if (!mapStartEndPositionsIntoFragmentCoordinates(queryData, fragment, startPosition, endPosition))
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="lines">@@ -319,8 +321,8 @@
</span><span class="cx"> {
</span><span class="cx">     StartPositionOfCharacterData* data = static_cast&lt;StartPositionOfCharacterData*&gt;(queryData);
</span><span class="cx"> 
</span><del>-    int startPosition = data-&gt;position;
-    int endPosition = startPosition + 1;
</del><ins>+    unsigned startPosition = data-&gt;position;
+    unsigned endPosition = startPosition + 1;
</ins><span class="cx">     if (!mapStartEndPositionsIntoFragmentCoordinates(queryData, fragment, startPosition, endPosition))
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="lines">@@ -368,8 +370,8 @@
</span><span class="cx"> {
</span><span class="cx">     EndPositionOfCharacterData* data = static_cast&lt;EndPositionOfCharacterData*&gt;(queryData);
</span><span class="cx"> 
</span><del>-    int startPosition = data-&gt;position;
-    int endPosition = startPosition + 1;
</del><ins>+    unsigned startPosition = data-&gt;position;
+    unsigned endPosition = startPosition + 1;
</ins><span class="cx">     if (!mapStartEndPositionsIntoFragmentCoordinates(queryData, fragment, startPosition, endPosition))
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="lines">@@ -416,8 +418,8 @@
</span><span class="cx"> {
</span><span class="cx">     RotationOfCharacterData* data = static_cast&lt;RotationOfCharacterData*&gt;(queryData);
</span><span class="cx"> 
</span><del>-    int startPosition = data-&gt;position;
-    int endPosition = startPosition + 1;
</del><ins>+    unsigned startPosition = data-&gt;position;
+    unsigned endPosition = startPosition + 1;
</ins><span class="cx">     if (!mapStartEndPositionsIntoFragmentCoordinates(queryData, fragment, startPosition, endPosition))
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="lines">@@ -454,7 +456,7 @@
</span><span class="cx">     FloatRect extent;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-static inline void calculateGlyphBoundaries(SVGTextQuery::Data* queryData, const SVGTextFragment&amp; fragment, int startPosition, FloatRect&amp; extent)
</del><ins>+static inline void calculateGlyphBoundaries(SVGTextQuery::Data* queryData, const SVGTextFragment&amp; fragment, unsigned startPosition, FloatRect&amp; extent)
</ins><span class="cx"> {
</span><span class="cx">     float scalingFactor = queryData-&gt;textRenderer-&gt;scalingFactor();
</span><span class="cx">     ASSERT(scalingFactor);
</span><span class="lines">@@ -484,8 +486,8 @@
</span><span class="cx"> {
</span><span class="cx">     ExtentOfCharacterData* data = static_cast&lt;ExtentOfCharacterData*&gt;(queryData);
</span><span class="cx"> 
</span><del>-    int startPosition = data-&gt;position;
-    int endPosition = startPosition + 1;
</del><ins>+    unsigned startPosition = data-&gt;position;
+    unsigned endPosition = startPosition + 1;
</ins><span class="cx">     if (!mapStartEndPositionsIntoFragmentCoordinates(queryData, fragment, startPosition, endPosition))
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="lines">@@ -519,8 +521,8 @@
</span><span class="cx"> 
</span><span class="cx">     FloatRect extent;
</span><span class="cx">     for (unsigned i = 0; i &lt; fragment.length; ++i) {
</span><del>-        int startPosition = data-&gt;processedCharacters + i;
-        int endPosition = startPosition + 1;
</del><ins>+        unsigned startPosition = data-&gt;processedCharacters + i;
+        unsigned endPosition = startPosition + 1;
</ins><span class="cx">         if (!mapStartEndPositionsIntoFragmentCoordinates(queryData, fragment, startPosition, endPosition))
</span><span class="cx">             continue;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgSVGTextQueryh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/SVGTextQuery.h (204399 => 204400)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/SVGTextQuery.h        2016-08-12 01:12:37 UTC (rev 204399)
+++ trunk/Source/WebCore/rendering/svg/SVGTextQuery.h        2016-08-12 01:22:55 UTC (rev 204400)
</span><span class="lines">@@ -52,8 +52,8 @@
</span><span class="cx">     bool executeQuery(Data*, ProcessTextFragmentCallback) const;
</span><span class="cx"> 
</span><span class="cx">     void collectTextBoxesInFlowBox(InlineFlowBox*);
</span><del>-    bool mapStartEndPositionsIntoFragmentCoordinates(Data*, const SVGTextFragment&amp;, int&amp; startPosition, int&amp; endPosition) const;
-    void modifyStartEndPositionsRespectingLigatures(Data*, int&amp; startPosition, int&amp; endPosition) const;
</del><ins>+    bool mapStartEndPositionsIntoFragmentCoordinates(Data*, const SVGTextFragment&amp;, unsigned&amp; startPosition, unsigned&amp; endPosition) const;
+    void modifyStartEndPositionsRespectingLigatures(Data*, unsigned&amp; startPosition, unsigned&amp; endPosition) const;
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     bool numberOfCharactersCallback(Data*, const SVGTextFragment&amp;) const;
</span></span></pre>
</div>
</div>

</body>
</html>