<!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>[174746] 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/174746">174746</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2014-10-15 17:05:37 -0700 (Wed, 15 Oct 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Use is<>() / downcast<>() for InlineBox subclasses
https://bugs.webkit.org/show_bug.cgi?id=137749
Reviewed by Darin Adler.
Use is<>() / downcast<>() for InlineBox subclasses and clean up the
surrounding code.
No new tests, no behavior change.
* dom/Position.cpp:
(WebCore::Position::upstream):
(WebCore::Position::downstream):
* editing/VisibleUnits.cpp:
(WebCore::wordBreakIteratorForMinOffsetBoundary):
(WebCore::wordBreakIteratorForMaxOffsetBoundary):
(WebCore::visualWordPosition):
(WebCore::startPositionForLine):
(WebCore::endPositionForLine):
* rendering/InlineBox.cpp:
(WebCore::InlineBox::root):
(WebCore::InlineBox::nextLeafChild):
(WebCore::InlineBox::prevLeafChild):
(WebCore::InlineBox::nextLeafChildIgnoringLineBreak):
* rendering/InlineBox.h:
* rendering/InlineElementBox.h:
* rendering/InlineFlowBox.cpp:
(WebCore::InlineFlowBox::getFlowSpacingLogicalWidth):
(WebCore::InlineFlowBox::addToLine):
(WebCore::InlineFlowBox::determineSpacingForFlowBoxes):
(WebCore::InlineFlowBox::placeBoxRangeInInlineDirection):
(WebCore::InlineFlowBox::requiresIdeographicBaseline):
(WebCore::InlineFlowBox::adjustMaxAscentAndDescent):
(WebCore::InlineFlowBox::computeLogicalBoxHeights):
(WebCore::InlineFlowBox::placeBoxesInBlockDirection):
(WebCore::InlineFlowBox::computeMaxLogicalTop):
(WebCore::InlineFlowBox::flipLinesInBlockDirection):
(WebCore::InlineFlowBox::computeOverflow):
(WebCore::InlineFlowBox::firstLeafChild):
(WebCore::InlineFlowBox::lastLeafChild):
(WebCore::InlineFlowBox::computeOverAnnotationAdjustment):
(WebCore::InlineFlowBox::computeUnderAnnotationAdjustment):
* rendering/InlineFlowBox.h:
* rendering/InlineTextBox.h:
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::positionForBox):
* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::firstRootBox):
(WebCore::RenderBlockFlow::lastRootBox):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::createLineBoxes):
(WebCore::RenderBlockFlow::constructLine):
(WebCore::setLogicalWidthForTextRun):
(WebCore::computeExpansionForJustifiedText):
(WebCore::RenderBlockFlow::computeInlineDirectionPositionsForSegment):
(WebCore::RenderBlockFlow::computeBlockDirectionPositionsForLine):
(WebCore::RenderBlockFlow::createLineBoxesFromBidiRuns):
* rendering/RenderText.cpp:
(WebCore::RenderText::localCaretRect):
* rendering/RootInlineBox.cpp:
(WebCore::RootInlineBox::isHyphenated):
(WebCore::RootInlineBox::ascentAndDescentForBox):
* rendering/RootInlineBox.h:
(WebCore::RootInlineBox::nextRootBox):
(WebCore::RootInlineBox::prevRootBox):
* rendering/svg/RenderSVGInlineText.cpp:
(WebCore::RenderSVGInlineText::localCaretRect):
(WebCore::RenderSVGInlineText::positionForPoint):
* rendering/svg/RenderSVGText.cpp:
(WebCore::RenderSVGText::positionForPoint):
* rendering/svg/SVGInlineFlowBox.cpp:
(WebCore::SVGInlineFlowBox::paintSelectionBackground):
(WebCore::SVGInlineFlowBox::paint):
(WebCore::SVGInlineFlowBox::computeTextMatchMarkerRectForRenderer):
* rendering/svg/SVGInlineFlowBox.h:
* rendering/svg/SVGInlineTextBox.h:
* rendering/svg/SVGRenderTreeAsText.cpp:
(WebCore::writeRenderSVGTextBox):
(WebCore::writeSVGInlineTextBoxes):
* rendering/svg/SVGRootInlineBox.cpp:
(WebCore::SVGRootInlineBox::paint):
(WebCore::SVGRootInlineBox::layoutCharactersInTextBoxes):
(WebCore::SVGRootInlineBox::layoutChildBoxes):
(WebCore::reverseInlineBoxRangeAndValueListsIfNeeded):
* rendering/svg/SVGRootInlineBox.h:
* rendering/svg/SVGTextQuery.cpp:
(WebCore::SVGTextQuery::collectTextBoxesInFlowBox):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoredomPositioncpp">trunk/Source/WebCore/dom/Position.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingVisibleUnitscpp">trunk/Source/WebCore/editing/VisibleUnits.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingInlineBoxcpp">trunk/Source/WebCore/rendering/InlineBox.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingInlineBoxh">trunk/Source/WebCore/rendering/InlineBox.h</a></li>
<li><a href="#trunkSourceWebCorerenderingInlineElementBoxh">trunk/Source/WebCore/rendering/InlineElementBox.h</a></li>
<li><a href="#trunkSourceWebCorerenderingInlineFlowBoxcpp">trunk/Source/WebCore/rendering/InlineFlowBox.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingInlineFlowBoxh">trunk/Source/WebCore/rendering/InlineFlowBox.h</a></li>
<li><a href="#trunkSourceWebCorerenderingInlineTextBoxh">trunk/Source/WebCore/rendering/InlineTextBox.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBlockFlowcpp">trunk/Source/WebCore/rendering/RenderBlockFlow.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBlockFlowh">trunk/Source/WebCore/rendering/RenderBlockFlow.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBlockLineLayoutcpp">trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderTextcpp">trunk/Source/WebCore/rendering/RenderText.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRootInlineBoxcpp">trunk/Source/WebCore/rendering/RootInlineBox.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRootInlineBoxh">trunk/Source/WebCore/rendering/RootInlineBox.h</a></li>
<li><a href="#trunkSourceWebCorerenderingsvgRenderSVGInlineTextcpp">trunk/Source/WebCore/rendering/svg/RenderSVGInlineText.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingsvgRenderSVGTextcpp">trunk/Source/WebCore/rendering/svg/RenderSVGText.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingsvgSVGInlineFlowBoxcpp">trunk/Source/WebCore/rendering/svg/SVGInlineFlowBox.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingsvgSVGInlineFlowBoxh">trunk/Source/WebCore/rendering/svg/SVGInlineFlowBox.h</a></li>
<li><a href="#trunkSourceWebCorerenderingsvgSVGInlineTextBoxh">trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.h</a></li>
<li><a href="#trunkSourceWebCorerenderingsvgSVGRenderTreeAsTextcpp">trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingsvgSVGRootInlineBoxcpp">trunk/Source/WebCore/rendering/svg/SVGRootInlineBox.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingsvgSVGRootInlineBoxh">trunk/Source/WebCore/rendering/svg/SVGRootInlineBox.h</a></li>
<li><a href="#trunkSourceWebCorerenderingsvgSVGTextQuerycpp">trunk/Source/WebCore/rendering/svg/SVGTextQuery.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (174745 => 174746)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-10-15 22:36:08 UTC (rev 174745)
+++ trunk/Source/WebCore/ChangeLog        2014-10-16 00:05:37 UTC (rev 174746)
</span><span class="lines">@@ -1,3 +1,93 @@
</span><ins>+2014-10-15 Chris Dumez <cdumez@apple.com>
+
+ Use is<>() / downcast<>() for InlineBox subclasses
+ https://bugs.webkit.org/show_bug.cgi?id=137749
+
+ Reviewed by Darin Adler.
+
+ Use is<>() / downcast<>() for InlineBox subclasses and clean up the
+ surrounding code.
+
+ No new tests, no behavior change.
+
+ * dom/Position.cpp:
+ (WebCore::Position::upstream):
+ (WebCore::Position::downstream):
+ * editing/VisibleUnits.cpp:
+ (WebCore::wordBreakIteratorForMinOffsetBoundary):
+ (WebCore::wordBreakIteratorForMaxOffsetBoundary):
+ (WebCore::visualWordPosition):
+ (WebCore::startPositionForLine):
+ (WebCore::endPositionForLine):
+ * rendering/InlineBox.cpp:
+ (WebCore::InlineBox::root):
+ (WebCore::InlineBox::nextLeafChild):
+ (WebCore::InlineBox::prevLeafChild):
+ (WebCore::InlineBox::nextLeafChildIgnoringLineBreak):
+ * rendering/InlineBox.h:
+ * rendering/InlineElementBox.h:
+ * rendering/InlineFlowBox.cpp:
+ (WebCore::InlineFlowBox::getFlowSpacingLogicalWidth):
+ (WebCore::InlineFlowBox::addToLine):
+ (WebCore::InlineFlowBox::determineSpacingForFlowBoxes):
+ (WebCore::InlineFlowBox::placeBoxRangeInInlineDirection):
+ (WebCore::InlineFlowBox::requiresIdeographicBaseline):
+ (WebCore::InlineFlowBox::adjustMaxAscentAndDescent):
+ (WebCore::InlineFlowBox::computeLogicalBoxHeights):
+ (WebCore::InlineFlowBox::placeBoxesInBlockDirection):
+ (WebCore::InlineFlowBox::computeMaxLogicalTop):
+ (WebCore::InlineFlowBox::flipLinesInBlockDirection):
+ (WebCore::InlineFlowBox::computeOverflow):
+ (WebCore::InlineFlowBox::firstLeafChild):
+ (WebCore::InlineFlowBox::lastLeafChild):
+ (WebCore::InlineFlowBox::computeOverAnnotationAdjustment):
+ (WebCore::InlineFlowBox::computeUnderAnnotationAdjustment):
+ * rendering/InlineFlowBox.h:
+ * rendering/InlineTextBox.h:
+ * rendering/RenderBlockFlow.cpp:
+ (WebCore::RenderBlockFlow::positionForBox):
+ * rendering/RenderBlockFlow.h:
+ (WebCore::RenderBlockFlow::firstRootBox):
+ (WebCore::RenderBlockFlow::lastRootBox):
+ * rendering/RenderBlockLineLayout.cpp:
+ (WebCore::RenderBlockFlow::createLineBoxes):
+ (WebCore::RenderBlockFlow::constructLine):
+ (WebCore::setLogicalWidthForTextRun):
+ (WebCore::computeExpansionForJustifiedText):
+ (WebCore::RenderBlockFlow::computeInlineDirectionPositionsForSegment):
+ (WebCore::RenderBlockFlow::computeBlockDirectionPositionsForLine):
+ (WebCore::RenderBlockFlow::createLineBoxesFromBidiRuns):
+ * rendering/RenderText.cpp:
+ (WebCore::RenderText::localCaretRect):
+ * rendering/RootInlineBox.cpp:
+ (WebCore::RootInlineBox::isHyphenated):
+ (WebCore::RootInlineBox::ascentAndDescentForBox):
+ * rendering/RootInlineBox.h:
+ (WebCore::RootInlineBox::nextRootBox):
+ (WebCore::RootInlineBox::prevRootBox):
+ * rendering/svg/RenderSVGInlineText.cpp:
+ (WebCore::RenderSVGInlineText::localCaretRect):
+ (WebCore::RenderSVGInlineText::positionForPoint):
+ * rendering/svg/RenderSVGText.cpp:
+ (WebCore::RenderSVGText::positionForPoint):
+ * rendering/svg/SVGInlineFlowBox.cpp:
+ (WebCore::SVGInlineFlowBox::paintSelectionBackground):
+ (WebCore::SVGInlineFlowBox::paint):
+ (WebCore::SVGInlineFlowBox::computeTextMatchMarkerRectForRenderer):
+ * rendering/svg/SVGInlineFlowBox.h:
+ * rendering/svg/SVGInlineTextBox.h:
+ * rendering/svg/SVGRenderTreeAsText.cpp:
+ (WebCore::writeRenderSVGTextBox):
+ (WebCore::writeSVGInlineTextBoxes):
+ * rendering/svg/SVGRootInlineBox.cpp:
+ (WebCore::SVGRootInlineBox::paint):
+ (WebCore::SVGRootInlineBox::layoutCharactersInTextBoxes):
+ (WebCore::SVGRootInlineBox::layoutChildBoxes):
+ (WebCore::reverseInlineBoxRangeAndValueListsIfNeeded):
+ * rendering/svg/SVGRootInlineBox.h:
+ * rendering/svg/SVGTextQuery.cpp:
+ (WebCore::SVGTextQuery::collectTextBoxesInFlowBox):
+
</ins><span class="cx"> 2014-10-15 Roger Fong <roger_fong@apple.com>
</span><span class="cx">
</span><span class="cx"> glReadPixels on NVIDIA cards returns the wrong values for the alpha channel when alpha is off.
</span></span></pre></div>
<a id="trunkSourceWebCoredomPositioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Position.cpp (174745 => 174746)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Position.cpp        2014-10-15 22:36:08 UTC (rev 174745)
+++ trunk/Source/WebCore/dom/Position.cpp        2014-10-16 00:05:37 UTC (rev 174746)
</span><span class="lines">@@ -661,7 +661,7 @@
</span><span class="cx"> otherBox = otherBox->nextLeafChild();
</span><span class="cx"> if (!otherBox)
</span><span class="cx"> break;
</span><del>- if (otherBox == lastTextBox || (&otherBox->renderer() == &textRenderer && toInlineTextBox(otherBox)->start() > textOffset))
</del><ins>+ if (otherBox == lastTextBox || (&otherBox->renderer() == &textRenderer && downcast<InlineTextBox>(*otherBox).start() > textOffset))
</ins><span class="cx"> continuesOnNextLine = false;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -670,7 +670,7 @@
</span><span class="cx"> otherBox = otherBox->prevLeafChild();
</span><span class="cx"> if (!otherBox)
</span><span class="cx"> break;
</span><del>- if (otherBox == lastTextBox || (&otherBox->renderer() == &textRenderer && toInlineTextBox(otherBox)->start() > textOffset))
</del><ins>+ if (otherBox == lastTextBox || (&otherBox->renderer() == &textRenderer && downcast<InlineTextBox>(*otherBox).start() > textOffset))
</ins><span class="cx"> continuesOnNextLine = false;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -789,7 +789,7 @@
</span><span class="cx"> otherBox = otherBox->nextLeafChild();
</span><span class="cx"> if (!otherBox)
</span><span class="cx"> break;
</span><del>- if (otherBox == lastTextBox || (&otherBox->renderer() == &textRenderer && toInlineTextBox(otherBox)->start() >= textOffset))
</del><ins>+ if (otherBox == lastTextBox || (&otherBox->renderer() == &textRenderer && downcast<InlineTextBox>(*otherBox).start() >= textOffset))
</ins><span class="cx"> continuesOnNextLine = false;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -798,7 +798,7 @@
</span><span class="cx"> otherBox = otherBox->prevLeafChild();
</span><span class="cx"> if (!otherBox)
</span><span class="cx"> break;
</span><del>- if (otherBox == lastTextBox || (&otherBox->renderer() == &textRenderer && toInlineTextBox(otherBox)->start() >= textOffset))
</del><ins>+ if (otherBox == lastTextBox || (&otherBox->renderer() == &textRenderer && downcast<InlineTextBox>(*otherBox).start() >= textOffset))
</ins><span class="cx"> continuesOnNextLine = false;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingVisibleUnitscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/VisibleUnits.cpp (174745 => 174746)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/VisibleUnits.cpp        2014-10-15 22:36:08 UTC (rev 174745)
+++ trunk/Source/WebCore/editing/VisibleUnits.cpp        2014-10-16 00:05:37 UTC (rev 174746)
</span><span class="lines">@@ -292,10 +292,10 @@
</span><span class="cx">
</span><span class="cx"> string.clear();
</span><span class="cx">
</span><del>- if (previousBox && previousBox->isInlineTextBox()) {
- const InlineTextBox* previousTextBox = toInlineTextBox(previousBox);
- previousBoxLength = previousTextBox->len();
- append(string, StringView(previousTextBox->renderer().text()).substring(previousTextBox->start(), previousBoxLength));
</del><ins>+ if (is<InlineTextBox>(previousBox)) {
+ const auto& previousTextBox = downcast<InlineTextBox>(*previousBox);
+ previousBoxLength = previousTextBox.len();
+ append(string, StringView(previousTextBox.renderer().text()).substring(previousTextBox.start(), previousBoxLength));
</ins><span class="cx"> }
</span><span class="cx"> append(string, StringView(textBox->renderer().text()).substring(textBox->start(), textBox->len()));
</span><span class="cx">
</span><span class="lines">@@ -312,9 +312,9 @@
</span><span class="cx">
</span><span class="cx"> string.clear();
</span><span class="cx"> append(string, StringView(textBox->renderer().text()).substring(textBox->start(), textBox->len()));
</span><del>- if (nextBox && nextBox->isInlineTextBox()) {
- const InlineTextBox* nextTextBox = toInlineTextBox(nextBox);
- append(string, StringView(nextTextBox->renderer().text()).substring(nextTextBox->start(), nextTextBox->len()));
</del><ins>+ if (is<InlineTextBox>(nextBox)) {
+ const auto& nextTextBox = downcast<InlineTextBox>(*nextBox);
+ append(string, StringView(nextTextBox.renderer().text()).substring(nextTextBox.start(), nextTextBox.len()));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return wordBreakIterator(StringView(string.data(), string.size()));
</span><span class="lines">@@ -364,23 +364,23 @@
</span><span class="cx">
</span><span class="cx"> if (!box)
</span><span class="cx"> break;
</span><del>- if (!box->isInlineTextBox()) {
</del><ins>+ if (!is<InlineTextBox>(*box)) {
</ins><span class="cx"> current = adjacentCharacterPosition;
</span><span class="cx"> continue;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- InlineTextBox* textBox = toInlineTextBox(box);
</del><ins>+ InlineTextBox& textBox = downcast<InlineTextBox>(*box);
</ins><span class="cx"> int previousBoxLength = 0;
</span><span class="cx"> bool previousBoxInDifferentBlock = false;
</span><span class="cx"> bool nextBoxInDifferentBlock = false;
</span><span class="cx"> bool movingIntoNewBox = previouslyVisitedBox != box;
</span><span class="cx">
</span><span class="cx"> if (offsetInBox == box->caretMinOffset())
</span><del>- iter = wordBreakIteratorForMinOffsetBoundary(visiblePosition, textBox, previousBoxLength, previousBoxInDifferentBlock, string, leafBoxes);
</del><ins>+ iter = wordBreakIteratorForMinOffsetBoundary(visiblePosition, &textBox, previousBoxLength, previousBoxInDifferentBlock, string, leafBoxes);
</ins><span class="cx"> else if (offsetInBox == box->caretMaxOffset())
</span><del>- iter = wordBreakIteratorForMaxOffsetBoundary(visiblePosition, textBox, nextBoxInDifferentBlock, string, leafBoxes);
</del><ins>+ iter = wordBreakIteratorForMaxOffsetBoundary(visiblePosition, &textBox, nextBoxInDifferentBlock, string, leafBoxes);
</ins><span class="cx"> else if (movingIntoNewBox) {
</span><del>- iter = wordBreakIterator(StringView(textBox->renderer().text()).substring(textBox->start(), textBox->len()));
</del><ins>+ iter = wordBreakIterator(StringView(textBox.renderer().text()).substring(textBox.start(), textBox.len()));
</ins><span class="cx"> previouslyVisitedBox = box;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -388,17 +388,17 @@
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> textBreakFirst(iter);
</span><del>- int offsetInIterator = offsetInBox - textBox->start() + previousBoxLength;
</del><ins>+ int offsetInIterator = offsetInBox - textBox.start() + previousBoxLength;
</ins><span class="cx">
</span><span class="cx"> bool isWordBreak;
</span><span class="cx"> bool boxHasSameDirectionalityAsBlock = box->direction() == blockDirection;
</span><span class="cx"> bool movingBackward = (direction == MoveLeft && box->direction() == LTR) || (direction == MoveRight && box->direction() == RTL);
</span><span class="cx"> if ((skipsSpaceWhenMovingRight && boxHasSameDirectionalityAsBlock)
</span><span class="cx"> || (!skipsSpaceWhenMovingRight && movingBackward)) {
</span><del>- bool logicalStartInRenderer = offsetInBox == static_cast<int>(textBox->start()) && previousBoxInDifferentBlock;
</del><ins>+ bool logicalStartInRenderer = offsetInBox == static_cast<int>(textBox.start()) && previousBoxInDifferentBlock;
</ins><span class="cx"> isWordBreak = isLogicalStartOfWord(iter, offsetInIterator, logicalStartInRenderer);
</span><span class="cx"> } else {
</span><del>- bool logicalEndInRenderer = offsetInBox == static_cast<int>(textBox->start() + textBox->len()) && nextBoxInDifferentBlock;
</del><ins>+ bool logicalEndInRenderer = offsetInBox == static_cast<int>(textBox.start() + textBox.len()) && nextBoxInDifferentBlock;
</ins><span class="cx"> isWordBreak = islogicalEndOfWord(iter, offsetInIterator, logicalEndInRenderer);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -767,7 +767,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- return is<Text>(*startNode) ? Position(downcast<Text>(startNode), toInlineTextBox(startBox)->start())
</del><ins>+ return is<Text>(*startNode) ? Position(downcast<Text>(startNode), downcast<InlineTextBox>(*startBox).start())
</ins><span class="cx"> : positionBeforeNode(startNode);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -836,13 +836,13 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Position pos;
</span><del>- if (endNode->hasTagName(brTag))
</del><ins>+ if (is<HTMLBRElement>(*endNode))
</ins><span class="cx"> pos = positionBeforeNode(endNode);
</span><del>- else if (endBox->isInlineTextBox() && is<Text>(*endNode)) {
- InlineTextBox* endTextBox = toInlineTextBox(endBox);
- int endOffset = endTextBox->start();
- if (!endTextBox->isLineBreak())
- endOffset += endTextBox->len();
</del><ins>+ else if (is<InlineTextBox>(*endBox) && is<Text>(*endNode)) {
+ auto& endTextBox = downcast<InlineTextBox>(*endBox);
+ int endOffset = endTextBox.start();
+ if (!endTextBox.isLineBreak())
+ endOffset += endTextBox.len();
</ins><span class="cx"> pos = Position(downcast<Text>(endNode), endOffset);
</span><span class="cx"> } else
</span><span class="cx"> pos = positionAfterNode(endNode);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingInlineBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/InlineBox.cpp (174745 => 174746)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/InlineBox.cpp        2014-10-15 22:36:08 UTC (rev 174745)
+++ trunk/Source/WebCore/rendering/InlineBox.cpp        2014-10-16 00:05:37 UTC (rev 174746)
</span><span class="lines">@@ -184,16 +184,14 @@
</span><span class="cx"> {
</span><span class="cx"> if (parent())
</span><span class="cx"> return parent()->root();
</span><del>- ASSERT_WITH_SECURITY_IMPLICATION(isRootInlineBox());
- return toRootInlineBox(*this);
</del><ins>+ return downcast<RootInlineBox>(*this);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> RootInlineBox& InlineBox::root()
</span><span class="cx"> {
</span><span class="cx"> if (parent())
</span><span class="cx"> return parent()->root();
</span><del>- ASSERT_WITH_SECURITY_IMPLICATION(isRootInlineBox());
- return toRootInlineBox(*this);
</del><ins>+ return downcast<RootInlineBox>(*this);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool InlineBox::nextOnLineExists() const
</span><span class="lines">@@ -222,9 +220,9 @@
</span><span class="cx">
</span><span class="cx"> InlineBox* InlineBox::nextLeafChild() const
</span><span class="cx"> {
</span><del>- InlineBox* leaf = 0;
</del><ins>+ InlineBox* leaf = nullptr;
</ins><span class="cx"> for (InlineBox* box = nextOnLine(); box && !leaf; box = box->nextOnLine())
</span><del>- leaf = box->isLeaf() ? box : toInlineFlowBox(box)->firstLeafChild();
</del><ins>+ leaf = box->isLeaf() ? box : downcast<InlineFlowBox>(*box).firstLeafChild();
</ins><span class="cx"> if (!leaf && parent())
</span><span class="cx"> leaf = parent()->nextLeafChild();
</span><span class="cx"> return leaf;
</span><span class="lines">@@ -232,9 +230,9 @@
</span><span class="cx">
</span><span class="cx"> InlineBox* InlineBox::prevLeafChild() const
</span><span class="cx"> {
</span><del>- InlineBox* leaf = 0;
</del><ins>+ InlineBox* leaf = nullptr;
</ins><span class="cx"> for (InlineBox* box = prevOnLine(); box && !leaf; box = box->prevOnLine())
</span><del>- leaf = box->isLeaf() ? box : toInlineFlowBox(box)->lastLeafChild();
</del><ins>+ leaf = box->isLeaf() ? box : downcast<InlineFlowBox>(*box).lastLeafChild();
</ins><span class="cx"> if (!leaf && parent())
</span><span class="cx"> leaf = parent()->prevLeafChild();
</span><span class="cx"> return leaf;
</span><span class="lines">@@ -244,7 +242,7 @@
</span><span class="cx"> {
</span><span class="cx"> InlineBox* leaf = nextLeafChild();
</span><span class="cx"> if (leaf && leaf->isLineBreak())
</span><del>- return 0;
</del><ins>+ return nullptr;
</ins><span class="cx"> return leaf;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingInlineBoxh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/InlineBox.h (174745 => 174746)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/InlineBox.h        2014-10-15 22:36:08 UTC (rev 174745)
+++ trunk/Source/WebCore/rendering/InlineBox.h        2014-10-16 00:05:37 UTC (rev 174746)
</span><span class="lines">@@ -24,6 +24,7 @@
</span><span class="cx"> #include "RenderBoxModelObject.h"
</span><span class="cx"> #include "RenderText.h"
</span><span class="cx"> #include "TextDirection.h"
</span><ins>+#include <wtf/TypeCasts.h>
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="lines">@@ -421,9 +422,6 @@
</span><span class="cx"> #endif
</span><span class="cx"> };
</span><span class="cx">
</span><del>-#define INLINE_BOX_OBJECT_TYPE_CASTS(ToValueTypeName, predicate) \
- TYPE_CASTS_BASE(ToValueTypeName, InlineBox, object, object->predicate, object.predicate)
-
</del><span class="cx"> #if ASSERT_WITH_SECURITY_IMPLICATION_DISABLED
</span><span class="cx">
</span><span class="cx"> inline InlineBox::~InlineBox()
</span><span class="lines">@@ -438,6 +436,11 @@
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><ins>+#define SPECIALIZE_TYPE_TRAITS_INLINE_BOX(ToValueTypeName, predicate) \
+SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::ToValueTypeName) \
+ static bool isType(const WebCore::InlineBox& box) { return box.predicate; } \
+SPECIALIZE_TYPE_TRAITS_END()
+
</ins><span class="cx"> #ifndef NDEBUG
</span><span class="cx"> // Outside the WebCore namespace for ease of invocation from gdb.
</span><span class="cx"> void showNodeTree(const WebCore::InlineBox*);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingInlineElementBoxh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/InlineElementBox.h (174745 => 174746)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/InlineElementBox.h        2014-10-15 22:36:08 UTC (rev 174745)
+++ trunk/Source/WebCore/rendering/InlineElementBox.h        2014-10-16 00:05:37 UTC (rev 174746)
</span><span class="lines">@@ -55,8 +55,8 @@
</span><span class="cx"> virtual bool isInlineElementBox() const override final { return true; }
</span><span class="cx"> };
</span><span class="cx">
</span><del>-INLINE_BOX_OBJECT_TYPE_CASTS(InlineElementBox, isInlineElementBox())
</del><ins>+} // namespace WebCore
</ins><span class="cx">
</span><del>-}
</del><ins>+SPECIALIZE_TYPE_TRAITS_INLINE_BOX(InlineElementBox, isInlineElementBox())
</ins><span class="cx">
</span><span class="cx"> #endif // InlineElementBox_h
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingInlineFlowBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/InlineFlowBox.cpp (174745 => 174746)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/InlineFlowBox.cpp        2014-10-15 22:36:08 UTC (rev 174745)
+++ trunk/Source/WebCore/rendering/InlineFlowBox.cpp        2014-10-16 00:05:37 UTC (rev 174746)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #include "RenderBlock.h"
</span><span class="cx"> #include "RenderInline.h"
</span><span class="cx"> #include "RenderLayer.h"
</span><ins>+#include "RenderLineBreak.h"
</ins><span class="cx"> #include "RenderListMarker.h"
</span><span class="cx"> #include "RenderRubyBase.h"
</span><span class="cx"> #include "RenderRubyRun.h"
</span><span class="lines">@@ -70,12 +71,12 @@
</span><span class="cx">
</span><span class="cx"> LayoutUnit InlineFlowBox::getFlowSpacingLogicalWidth()
</span><span class="cx"> {
</span><del>- LayoutUnit totWidth = marginBorderPaddingLogicalLeft() + marginBorderPaddingLogicalRight();
- for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
- if (curr->isInlineFlowBox())
- totWidth += toInlineFlowBox(curr)->getFlowSpacingLogicalWidth();
</del><ins>+ LayoutUnit totalWidth = marginBorderPaddingLogicalLeft() + marginBorderPaddingLogicalRight();
+ for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) {
+ if (is<InlineFlowBox>(*child))
+ totalWidth += downcast<InlineFlowBox>(*child).getFlowSpacingLogicalWidth();
</ins><span class="cx"> }
</span><del>- return totWidth;
</del><ins>+ return totalWidth;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static void setHasTextDescendantsOnAncestors(InlineFlowBox* box)
</span><span class="lines">@@ -108,8 +109,8 @@
</span><span class="cx"> if (child->renderer().parent() == &renderer())
</span><span class="cx"> m_hasTextChildren = true;
</span><span class="cx"> setHasTextDescendantsOnAncestors(this);
</span><del>- } else if (child->isInlineFlowBox()) {
- if (toInlineFlowBox(child)->hasTextDescendants())
</del><ins>+ } else if (is<InlineFlowBox>(*child)) {
+ if (downcast<InlineFlowBox>(*child).hasTextDescendants())
</ins><span class="cx"> setHasTextDescendantsOnAncestors(this);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -134,10 +135,9 @@
</span><span class="cx"> // Other than making a zillion tests have to regenerate results, there's no reason to ditch the optimization here.
</span><span class="cx"> shouldClearDescendantsHaveSameLineHeightAndBaseline = child->renderer().isBR();
</span><span class="cx"> } else {
</span><del>- ASSERT(isInlineFlowBox());
- InlineFlowBox* childFlowBox = toInlineFlowBox(child);
</del><ins>+ auto& childFlowBox = downcast<InlineFlowBox>(*child);
</ins><span class="cx"> // Check the child's bit, and then also check for differences in font, line-height, vertical-align
</span><del>- if (!childFlowBox->descendantsHaveSameLineHeightAndBaseline()
</del><ins>+ if (!childFlowBox.descendantsHaveSameLineHeightAndBaseline()
</ins><span class="cx"> || !parentStyle.font().fontMetrics().hasIdenticalAscentDescentAndLineGap(childStyle.font().fontMetrics())
</span><span class="cx"> || parentStyle.lineHeight() != childStyle.lineHeight()
</span><span class="cx"> || (parentStyle.verticalAlign() != BASELINE && !isRootInlineBox()) || childStyle.verticalAlign() != BASELINE
</span><span class="lines">@@ -165,7 +165,7 @@
</span><span class="cx"> || childStyle.hasBorderImageOutsets()))
</span><span class="cx"> child->clearKnownToHaveNoOverflow();
</span><span class="cx">
</span><del>- if (knownToHaveNoOverflow() && child->isInlineFlowBox() && !toInlineFlowBox(child)->knownToHaveNoOverflow())
</del><ins>+ if (knownToHaveNoOverflow() && is<InlineFlowBox>(*child) && !downcast<InlineFlowBox>(*child).knownToHaveNoOverflow())
</ins><span class="cx"> clearKnownToHaveNoOverflow();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -347,11 +347,9 @@
</span><span class="cx"> setEdges(includeLeftEdge, includeRightEdge);
</span><span class="cx">
</span><span class="cx"> // Recur into our children.
</span><del>- for (InlineBox* currChild = firstChild(); currChild; currChild = currChild->nextOnLine()) {
- if (currChild->isInlineFlowBox()) {
- InlineFlowBox* currFlow = toInlineFlowBox(currChild);
- currFlow->determineSpacingForFlowBoxes(lastLine, isLogicallyLastRunWrapped, logicallyLastRunRenderer);
- }
</del><ins>+ for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) {
+ if (is<InlineFlowBox>(*child))
+ downcast<InlineFlowBox>(*child).determineSpacingForFlowBoxes(lastLine, isLogicallyLastRunWrapped, logicallyLastRunRenderer);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -375,52 +373,52 @@
</span><span class="cx">
</span><span class="cx"> float InlineFlowBox::placeBoxRangeInInlineDirection(InlineBox* firstChild, InlineBox* lastChild, float& logicalLeft, float& minLogicalLeft, float& maxLogicalRight, bool& needsWordSpacing)
</span><span class="cx"> {
</span><del>- for (InlineBox* curr = firstChild; curr && curr != lastChild; curr = curr->nextOnLine()) {
- if (curr->renderer().isText()) {
- InlineTextBox* text = toInlineTextBox(curr);
- RenderText& rt = text->renderer();
- if (rt.textLength()) {
- if (needsWordSpacing && isSpaceOrNewline(rt.characterAt(text->start())))
- logicalLeft += text->lineStyle().font().wordSpacing();
- needsWordSpacing = !isSpaceOrNewline(rt.characterAt(text->end()));
</del><ins>+ for (InlineBox* child = firstChild; child && child != lastChild; child = child->nextOnLine()) {
+ if (is<RenderText>(child->renderer())) {
+ auto& textBox = downcast<InlineTextBox>(*child);
+ RenderText& renderText = textBox.renderer();
+ if (renderText.textLength()) {
+ if (needsWordSpacing && isSpaceOrNewline(renderText.characterAt(textBox.start())))
+ logicalLeft += textBox.lineStyle().font().wordSpacing();
+ needsWordSpacing = !isSpaceOrNewline(renderText.characterAt(textBox.end()));
</ins><span class="cx"> }
</span><del>- text->setLogicalLeft(logicalLeft);
</del><ins>+ textBox.setLogicalLeft(logicalLeft);
</ins><span class="cx"> if (knownToHaveNoOverflow())
</span><span class="cx"> minLogicalLeft = std::min(logicalLeft, minLogicalLeft);
</span><del>- logicalLeft += text->logicalWidth();
</del><ins>+ logicalLeft += textBox.logicalWidth();
</ins><span class="cx"> if (knownToHaveNoOverflow())
</span><span class="cx"> maxLogicalRight = std::max(logicalLeft, maxLogicalRight);
</span><span class="cx"> } else {
</span><del>- if (curr->renderer().isOutOfFlowPositioned()) {
- if (curr->renderer().parent()->style().isLeftToRightDirection())
- curr->setLogicalLeft(logicalLeft);
</del><ins>+ if (child->renderer().isOutOfFlowPositioned()) {
+ if (child->renderer().parent()->style().isLeftToRightDirection())
+ child->setLogicalLeft(logicalLeft);
</ins><span class="cx"> else
</span><span class="cx"> // Our offset that we cache needs to be from the edge of the right border box and
</span><span class="cx"> // not the left border box. We have to subtract |x| from the width of the block
</span><span class="cx"> // (which can be obtained from the root line box).
</span><del>- curr->setLogicalLeft(root().blockFlow().logicalWidth() - logicalLeft);
</del><ins>+ child->setLogicalLeft(root().blockFlow().logicalWidth() - logicalLeft);
</ins><span class="cx"> continue; // The positioned object has no effect on the width.
</span><span class="cx"> }
</span><del>- if (curr->renderer().isRenderInline()) {
- InlineFlowBox* flow = toInlineFlowBox(curr);
- logicalLeft += flow->marginLogicalLeft();
</del><ins>+ if (is<RenderInline>(child->renderer())) {
+ auto& flow = downcast<InlineFlowBox>(*child);
+ logicalLeft += flow.marginLogicalLeft();
</ins><span class="cx"> if (knownToHaveNoOverflow())
</span><span class="cx"> minLogicalLeft = std::min(logicalLeft, minLogicalLeft);
</span><del>- logicalLeft = flow->placeBoxesInInlineDirection(logicalLeft, needsWordSpacing);
</del><ins>+ logicalLeft = flow.placeBoxesInInlineDirection(logicalLeft, needsWordSpacing);
</ins><span class="cx"> if (knownToHaveNoOverflow())
</span><span class="cx"> maxLogicalRight = std::max(logicalLeft, maxLogicalRight);
</span><del>- logicalLeft += flow->marginLogicalRight();
- } else if (!curr->renderer().isListMarker() || toRenderListMarker(curr->renderer()).isInside()) {
</del><ins>+ logicalLeft += flow.marginLogicalRight();
+ } else if (!child->renderer().isListMarker() || toRenderListMarker(child->renderer()).isInside()) {
</ins><span class="cx"> // The box can have a different writing-mode than the overall line, so this is a bit complicated.
</span><span class="cx"> // Just get all the physical margin and overflow values by hand based off |isVertical|.
</span><del>- LayoutUnit logicalLeftMargin = isHorizontal() ? curr->boxModelObject()->marginLeft() : curr->boxModelObject()->marginTop();
- LayoutUnit logicalRightMargin = isHorizontal() ? curr->boxModelObject()->marginRight() : curr->boxModelObject()->marginBottom();
</del><ins>+ LayoutUnit logicalLeftMargin = isHorizontal() ? child->boxModelObject()->marginLeft() : child->boxModelObject()->marginTop();
+ LayoutUnit logicalRightMargin = isHorizontal() ? child->boxModelObject()->marginRight() : child->boxModelObject()->marginBottom();
</ins><span class="cx">
</span><span class="cx"> logicalLeft += logicalLeftMargin;
</span><del>- curr->setLogicalLeft(logicalLeft);
</del><ins>+ child->setLogicalLeft(logicalLeft);
</ins><span class="cx"> if (knownToHaveNoOverflow())
</span><span class="cx"> minLogicalLeft = std::min(logicalLeft, minLogicalLeft);
</span><del>- logicalLeft += curr->logicalWidth();
</del><ins>+ logicalLeft += child->logicalWidth();
</ins><span class="cx"> if (knownToHaveNoOverflow())
</span><span class="cx"> maxLogicalRight = std::max(logicalLeft, maxLogicalRight);
</span><span class="cx"> logicalLeft += logicalRightMargin;
</span><span class="lines">@@ -442,26 +440,26 @@
</span><span class="cx"> || lineStyle.font().primaryFont()->hasVerticalGlyphs())
</span><span class="cx"> return true;
</span><span class="cx">
</span><del>- for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
- if (curr->renderer().isOutOfFlowPositioned())
</del><ins>+ for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) {
+ if (child->renderer().isOutOfFlowPositioned())
</ins><span class="cx"> continue; // Positioned placeholders don't affect calculations.
</span><span class="cx">
</span><del>- if (curr->isInlineFlowBox()) {
- if (toInlineFlowBox(curr)->requiresIdeographicBaseline(textBoxDataMap))
</del><ins>+ if (is<InlineFlowBox>(*child)) {
+ if (downcast<InlineFlowBox>(*child).requiresIdeographicBaseline(textBoxDataMap))
</ins><span class="cx"> return true;
</span><span class="cx"> } else {
</span><del>- if (curr->lineStyle().font().primaryFont()->hasVerticalGlyphs())
</del><ins>+ if (child->lineStyle().font().primaryFont()->hasVerticalGlyphs())
</ins><span class="cx"> return true;
</span><span class="cx">
</span><del>- const Vector<const SimpleFontData*>* usedFonts = 0;
- if (curr->isInlineTextBox()) {
- GlyphOverflowAndFallbackFontsMap::const_iterator it = textBoxDataMap.find(toInlineTextBox(curr));
- usedFonts = it == textBoxDataMap.end() ? 0 : &it->value.first;
</del><ins>+ const Vector<const SimpleFontData*>* usedFonts = nullptr;
+ if (is<InlineTextBox>(*child)) {
+ GlyphOverflowAndFallbackFontsMap::const_iterator it = textBoxDataMap.find(downcast<InlineTextBox>(child));
+ usedFonts = it == textBoxDataMap.end() ? nullptr : &it->value.first;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (usedFonts) {
</span><del>- for (size_t i = 0; i < usedFonts->size(); ++i) {
- if (usedFonts->at(i)->hasVerticalGlyphs())
</del><ins>+ for (const SimpleFontData* fontData : *usedFonts) {
+ if (fontData->hasVerticalGlyphs())
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -480,15 +478,15 @@
</span><span class="cx">
</span><span class="cx"> void InlineFlowBox::adjustMaxAscentAndDescent(int& maxAscent, int& maxDescent, int maxPositionTop, int maxPositionBottom)
</span><span class="cx"> {
</span><del>- for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
</del><ins>+ for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) {
</ins><span class="cx"> // The computed lineheight needs to be extended for the
</span><span class="cx"> // positioned elements
</span><del>- if (curr->renderer().isOutOfFlowPositioned())
</del><ins>+ if (child->renderer().isOutOfFlowPositioned())
</ins><span class="cx"> continue; // Positioned placeholders don't affect calculations.
</span><span class="cx">
</span><del>- if ((curr->verticalAlign() == TOP || curr->verticalAlign() == BOTTOM) && verticalAlignApplies(curr->renderer())) {
- int lineHeight = curr->lineHeight();
- if (curr->verticalAlign() == TOP) {
</del><ins>+ if ((child->verticalAlign() == TOP || child->verticalAlign() == BOTTOM) && verticalAlignApplies(child->renderer())) {
+ int lineHeight = child->lineHeight();
+ if (child->verticalAlign() == TOP) {
</ins><span class="cx"> if (maxAscent + maxDescent < lineHeight)
</span><span class="cx"> maxDescent = lineHeight - maxAscent;
</span><span class="cx"> }
</span><span class="lines">@@ -501,8 +499,8 @@
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (curr->isInlineFlowBox())
- toInlineFlowBox(curr)->adjustMaxAscentAndDescent(maxAscent, maxDescent, maxPositionTop, maxPositionBottom);
</del><ins>+ if (is<InlineFlowBox>(*child))
+ downcast<InlineFlowBox>(*child).adjustMaxAscentAndDescent(maxAscent, maxDescent, maxPositionTop, maxPositionBottom);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -550,11 +548,11 @@
</span><span class="cx"> if (!checkChildren)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
- if (curr->renderer().isOutOfFlowPositioned())
</del><ins>+ for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) {
+ if (child->renderer().isOutOfFlowPositioned())
</ins><span class="cx"> continue; // Positioned placeholders don't affect calculations.
</span><span class="cx">
</span><del>- InlineFlowBox* inlineFlowBox = curr->isInlineFlowBox() ? toInlineFlowBox(curr) : 0;
</del><ins>+ InlineFlowBox* inlineFlowBox = is<InlineFlowBox>(*child) ? downcast<InlineFlowBox>(child) : nullptr;
</ins><span class="cx">
</span><span class="cx"> bool affectsAscent = false;
</span><span class="cx"> bool affectsDescent = false;
</span><span class="lines">@@ -562,17 +560,17 @@
</span><span class="cx"> // The verticalPositionForBox function returns the distance between the child box's baseline
</span><span class="cx"> // and the root box's baseline. The value is negative if the child box's baseline is above the
</span><span class="cx"> // root box's baseline, and it is positive if the child box's baseline is below the root box's baseline.
</span><del>- curr->setLogicalTop(rootBox.verticalPositionForBox(curr, verticalPositionCache));
</del><ins>+ child->setLogicalTop(rootBox.verticalPositionForBox(child, verticalPositionCache));
</ins><span class="cx">
</span><span class="cx"> int ascent = 0;
</span><span class="cx"> int descent = 0;
</span><del>- rootBox.ascentAndDescentForBox(*curr, textBoxDataMap, ascent, descent, affectsAscent, affectsDescent);
</del><ins>+ rootBox.ascentAndDescentForBox(*child, textBoxDataMap, ascent, descent, affectsAscent, affectsDescent);
</ins><span class="cx">
</span><span class="cx"> LayoutUnit boxHeight = ascent + descent;
</span><del>- if (curr->verticalAlign() == TOP && verticalAlignApplies(curr->renderer())) {
</del><ins>+ if (child->verticalAlign() == TOP && verticalAlignApplies(child->renderer())) {
</ins><span class="cx"> if (maxPositionTop < boxHeight)
</span><span class="cx"> maxPositionTop = boxHeight;
</span><del>- } else if (curr->verticalAlign() == BOTTOM && verticalAlignApplies(curr->renderer())) {
</del><ins>+ } else if (child->verticalAlign() == BOTTOM && verticalAlignApplies(child->renderer())) {
</ins><span class="cx"> if (maxPositionBottom < boxHeight)
</span><span class="cx"> maxPositionBottom = boxHeight;
</span><span class="cx"> } else if (!inlineFlowBox || strictMode || inlineFlowBox->hasTextChildren() || (inlineFlowBox->descendantsHaveSameLineHeightAndBaseline() && inlineFlowBox->hasTextDescendants())
</span><span class="lines">@@ -583,8 +581,8 @@
</span><span class="cx"> // means is that ascent and descent (including leading), can end up being negative. The setMaxAscent and
</span><span class="cx"> // setMaxDescent booleans are used to ensure that we're willing to initially set maxAscent/Descent to negative
</span><span class="cx"> // values.
</span><del>- ascent -= curr->logicalTop();
- descent += curr->logicalTop();
</del><ins>+ ascent -= child->logicalTop();
+ descent += child->logicalTop();
</ins><span class="cx"> if (affectsAscent && (maxAscent < ascent || !setMaxAscent)) {
</span><span class="cx"> maxAscent = ascent;
</span><span class="cx"> setMaxAscent = true;
</span><span class="lines">@@ -621,78 +619,78 @@
</span><span class="cx"> adjustmentForChildrenWithSameLineHeightAndBaseline += renderer().borderAndPaddingBefore();
</span><span class="cx"> }
</span><span class="cx">
</span><del>- for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
- if (curr->renderer().isOutOfFlowPositioned())
</del><ins>+ for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) {
+ if (child->renderer().isOutOfFlowPositioned())
</ins><span class="cx"> continue; // Positioned placeholders don't affect calculations.
</span><span class="cx">
</span><span class="cx"> if (descendantsHaveSameLineHeightAndBaseline()) {
</span><del>- curr->adjustBlockDirectionPosition(adjustmentForChildrenWithSameLineHeightAndBaseline);
</del><ins>+ child->adjustBlockDirectionPosition(adjustmentForChildrenWithSameLineHeightAndBaseline);
</ins><span class="cx"> continue;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- InlineFlowBox* inlineFlowBox = curr->isInlineFlowBox() ? toInlineFlowBox(curr) : 0;
</del><ins>+ InlineFlowBox* inlineFlowBox = is<InlineFlowBox>(*child) ? downcast<InlineFlowBox>(child) : nullptr;
</ins><span class="cx"> bool childAffectsTopBottomPos = true;
</span><span class="cx">
</span><del>- if (curr->verticalAlign() == TOP && verticalAlignApplies(curr->renderer()))
- curr->setLogicalTop(top);
- else if (curr->verticalAlign() == BOTTOM && verticalAlignApplies(curr->renderer()))
- curr->setLogicalTop(top + maxHeight - curr->lineHeight());
</del><ins>+ if (child->verticalAlign() == TOP && verticalAlignApplies(child->renderer()))
+ child->setLogicalTop(top);
+ else if (child->verticalAlign() == BOTTOM && verticalAlignApplies(child->renderer()))
+ child->setLogicalTop(top + maxHeight - child->lineHeight());
</ins><span class="cx"> else {
</span><span class="cx"> if (!strictMode && inlineFlowBox && !inlineFlowBox->hasTextChildren() && !inlineFlowBox->renderer().hasInlineDirectionBordersOrPadding()
</span><span class="cx"> && !(inlineFlowBox->descendantsHaveSameLineHeightAndBaseline() && inlineFlowBox->hasTextDescendants()))
</span><span class="cx"> childAffectsTopBottomPos = false;
</span><del>- LayoutUnit posAdjust = maxAscent - curr->baselinePosition(baselineType);
- curr->setLogicalTop(curr->logicalTop() + top + posAdjust);
</del><ins>+ LayoutUnit posAdjust = maxAscent - child->baselinePosition(baselineType);
+ child->setLogicalTop(child->logicalTop() + top + posAdjust);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- LayoutUnit newLogicalTop = curr->logicalTop();
</del><ins>+ LayoutUnit newLogicalTop = child->logicalTop();
</ins><span class="cx"> LayoutUnit newLogicalTopIncludingMargins = newLogicalTop;
</span><del>- LayoutUnit boxHeight = curr->logicalHeight();
</del><ins>+ LayoutUnit boxHeight = child->logicalHeight();
</ins><span class="cx"> LayoutUnit boxHeightIncludingMargins = boxHeight;
</span><span class="cx">
</span><del>- const RenderStyle& childLineStyle = curr->lineStyle();
- if (curr->behavesLikeText() || curr->isInlineFlowBox()) {
</del><ins>+ const RenderStyle& childLineStyle = child->lineStyle();
+ if (child->behavesLikeText() || is<InlineFlowBox>(*child)) {
</ins><span class="cx"> const FontMetrics& fontMetrics = childLineStyle.fontMetrics();
</span><del>- newLogicalTop += curr->baselinePosition(baselineType) - fontMetrics.ascent(baselineType);
- if (curr->isInlineFlowBox()) {
- RenderBoxModelObject& boxObject = downcast<RenderBoxModelObject>(curr->renderer());
</del><ins>+ newLogicalTop += child->baselinePosition(baselineType) - fontMetrics.ascent(baselineType);
+ if (is<InlineFlowBox>(*child)) {
+ RenderBoxModelObject& boxObject = downcast<InlineFlowBox>(*child).renderer();
</ins><span class="cx"> newLogicalTop -= childLineStyle.isHorizontalWritingMode()
</span><span class="cx"> ? boxObject.borderTop() + boxObject.paddingTop()
</span><span class="cx"> : boxObject.borderRight() + boxObject.paddingRight();
</span><span class="cx"> }
</span><span class="cx"> newLogicalTopIncludingMargins = newLogicalTop;
</span><del>- } else if (!curr->renderer().isBR()) {
- const RenderBox& box = toRenderBox(curr->renderer());
</del><ins>+ } else if (!child->renderer().isBR()) {
+ const auto& box = downcast<RenderBox>(child->renderer());
</ins><span class="cx"> newLogicalTopIncludingMargins = newLogicalTop;
</span><del>- LayoutUnit overSideMargin = curr->isHorizontal() ? box.marginTop() : box.marginRight();
- LayoutUnit underSideMargin = curr->isHorizontal() ? box.marginBottom() : box.marginLeft();
</del><ins>+ LayoutUnit overSideMargin = child->isHorizontal() ? box.marginTop() : box.marginRight();
+ LayoutUnit underSideMargin = child->isHorizontal() ? box.marginBottom() : box.marginLeft();
</ins><span class="cx"> newLogicalTop += overSideMargin;
</span><span class="cx"> boxHeightIncludingMargins += overSideMargin + underSideMargin;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- curr->setLogicalTop(newLogicalTop);
</del><ins>+ child->setLogicalTop(newLogicalTop);
</ins><span class="cx">
</span><span class="cx"> if (childAffectsTopBottomPos) {
</span><del>- if (curr->renderer().isRubyRun()) {
</del><ins>+ if (is<RenderRubyRun>(child->renderer())) {
</ins><span class="cx"> // Treat the leading on the first and last lines of ruby runs as not being part of the overall lineTop/lineBottom.
</span><span class="cx"> // Really this is a workaround hack for the fact that ruby should have been done as line layout and not done using
</span><span class="cx"> // inline-block.
</span><del>- if (renderer().style().isFlippedLinesWritingMode() == (curr->renderer().style().rubyPosition() == RubyPositionAfter))
</del><ins>+ if (renderer().style().isFlippedLinesWritingMode() == (child->renderer().style().rubyPosition() == RubyPositionAfter))
</ins><span class="cx"> hasAnnotationsBefore = true;
</span><span class="cx"> else
</span><span class="cx"> hasAnnotationsAfter = true;
</span><span class="cx">
</span><del>- RenderRubyRun& rubyRun = toRenderRubyRun(curr->renderer());
</del><ins>+ auto& rubyRun = downcast<RenderRubyRun>(child->renderer());
</ins><span class="cx"> if (RenderRubyBase* rubyBase = rubyRun.rubyBase()) {
</span><del>- LayoutUnit bottomRubyBaseLeading = (curr->logicalHeight() - rubyBase->logicalBottom()) + rubyBase->logicalHeight() - (rubyBase->lastRootBox() ? rubyBase->lastRootBox()->lineBottom() : LayoutUnit());
</del><ins>+ LayoutUnit bottomRubyBaseLeading = (child->logicalHeight() - rubyBase->logicalBottom()) + rubyBase->logicalHeight() - (rubyBase->lastRootBox() ? rubyBase->lastRootBox()->lineBottom() : LayoutUnit());
</ins><span class="cx"> LayoutUnit topRubyBaseLeading = rubyBase->logicalTop() + (rubyBase->firstRootBox() ? rubyBase->firstRootBox()->lineTop() : LayoutUnit());
</span><span class="cx"> newLogicalTop += !renderer().style().isFlippedLinesWritingMode() ? topRubyBaseLeading : bottomRubyBaseLeading;
</span><span class="cx"> boxHeight -= (topRubyBaseLeading + bottomRubyBaseLeading);
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>- if (curr->isInlineTextBox()) {
</del><ins>+ if (is<InlineTextBox>(*child)) {
</ins><span class="cx"> bool emphasisMarkIsOver;
</span><del>- if (toInlineTextBox(curr)->emphasisMarkExistsAndIsAbove(childLineStyle, emphasisMarkIsOver)) {
</del><ins>+ if (downcast<InlineTextBox>(*child).emphasisMarkExistsAndIsAbove(childLineStyle, emphasisMarkIsOver)) {
</ins><span class="cx"> if (emphasisMarkIsOver != childLineStyle.isFlippedLinesWritingMode())
</span><span class="cx"> hasAnnotationsBefore = true;
</span><span class="cx"> else
</span><span class="lines">@@ -740,17 +738,17 @@
</span><span class="cx">
</span><span class="cx"> void InlineFlowBox::computeMaxLogicalTop(float& maxLogicalTop) const
</span><span class="cx"> {
</span><del>- for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
- if (curr->renderer().isOutOfFlowPositioned())
</del><ins>+ for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) {
+ if (child->renderer().isOutOfFlowPositioned())
</ins><span class="cx"> continue; // Positioned placeholders don't affect calculations.
</span><span class="cx">
</span><span class="cx"> if (descendantsHaveSameLineHeightAndBaseline())
</span><span class="cx"> continue;
</span><span class="cx">
</span><del>- maxLogicalTop = std::max<float>(maxLogicalTop, curr->y());
</del><ins>+ maxLogicalTop = std::max<float>(maxLogicalTop, child->y());
</ins><span class="cx"> float localMaxLogicalTop = 0;
</span><del>- if (curr->isInlineFlowBox())
- toInlineFlowBox(curr)->computeMaxLogicalTop(localMaxLogicalTop);
</del><ins>+ if (is<InlineFlowBox>(*child))
+ downcast<InlineFlowBox>(*child).computeMaxLogicalTop(localMaxLogicalTop);
</ins><span class="cx"> maxLogicalTop = std::max<float>(maxLogicalTop, localMaxLogicalTop);
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -760,14 +758,14 @@
</span><span class="cx"> // Flip the box on the line such that the top is now relative to the lineBottom instead of the lineTop.
</span><span class="cx"> setLogicalTop(lineBottom - (logicalTop() - lineTop) - logicalHeight());
</span><span class="cx">
</span><del>- for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
- if (curr->renderer().isOutOfFlowPositioned())
</del><ins>+ for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) {
+ if (child->renderer().isOutOfFlowPositioned())
</ins><span class="cx"> continue; // Positioned placeholders aren't affected here.
</span><span class="cx">
</span><del>- if (curr->isInlineFlowBox())
- toInlineFlowBox(curr)->flipLinesInBlockDirection(lineTop, lineBottom);
</del><ins>+ if (is<InlineFlowBox>(*child))
+ downcast<InlineFlowBox>(*child).flipLinesInBlockDirection(lineTop, lineBottom);
</ins><span class="cx"> else
</span><del>- curr->setLogicalTop(lineBottom - (curr->logicalTop() - lineTop) - curr->logicalHeight());
</del><ins>+ child->setLogicalTop(lineBottom - (child->logicalTop() - lineTop) - child->logicalHeight());
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -938,27 +936,27 @@
</span><span class="cx"> addBoxShadowVisualOverflow(logicalVisualOverflow);
</span><span class="cx"> addBorderOutsetVisualOverflow(logicalVisualOverflow);
</span><span class="cx">
</span><del>- for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
- if (curr->renderer().isOutOfFlowPositioned())
</del><ins>+ for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) {
+ if (child->renderer().isOutOfFlowPositioned())
</ins><span class="cx"> continue; // Positioned placeholders don't affect calculations.
</span><span class="cx">
</span><del>- if (curr->renderer().isLineBreak())
</del><ins>+ if (is<RenderLineBreak>(child->renderer()))
</ins><span class="cx"> continue;
</span><del>- if (curr->renderer().isText()) {
- InlineTextBox* text = toInlineTextBox(curr);
- LayoutRect textBoxOverflow(enclosingLayoutRect(text->logicalFrameRect()));
- addTextBoxVisualOverflow(*text, textBoxDataMap, textBoxOverflow);
</del><ins>+ if (is<RenderText>(child->renderer())) {
+ auto& textBox = downcast<InlineTextBox>(*child);
+ LayoutRect textBoxOverflow(enclosingLayoutRect(textBox.logicalFrameRect()));
+ addTextBoxVisualOverflow(textBox, textBoxDataMap, textBoxOverflow);
</ins><span class="cx"> logicalVisualOverflow.unite(textBoxOverflow);
</span><del>- } else if (curr->renderer().isRenderInline()) {
- InlineFlowBox* flow = toInlineFlowBox(curr);
- flow->computeOverflow(lineTop, lineBottom, textBoxDataMap);
- if (!flow->renderer().hasSelfPaintingLayer())
- logicalVisualOverflow.unite(flow->logicalVisualOverflowRect(lineTop, lineBottom));
- LayoutRect childLayoutOverflow = flow->logicalLayoutOverflowRect(lineTop, lineBottom);
- childLayoutOverflow.move(flow->renderer().relativePositionLogicalOffset());
</del><ins>+ } else if (is<RenderInline>(child->renderer())) {
+ auto& flow = downcast<InlineFlowBox>(*child);
+ flow.computeOverflow(lineTop, lineBottom, textBoxDataMap);
+ if (!flow.renderer().hasSelfPaintingLayer())
+ logicalVisualOverflow.unite(flow.logicalVisualOverflowRect(lineTop, lineBottom));
+ LayoutRect childLayoutOverflow = flow.logicalLayoutOverflowRect(lineTop, lineBottom);
+ childLayoutOverflow.move(flow.renderer().relativePositionLogicalOffset());
</ins><span class="cx"> logicalLayoutOverflow.unite(childLayoutOverflow);
</span><span class="cx"> } else
</span><del>- addReplacedChildOverflow(curr, logicalLayoutOverflow, logicalVisualOverflow);
</del><ins>+ addReplacedChildOverflow(child, logicalLayoutOverflow, logicalVisualOverflow);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> setOverflowFromLogicalRects(logicalLayoutOverflow, logicalVisualOverflow, lineTop, lineBottom);
</span><span class="lines">@@ -1424,17 +1422,17 @@
</span><span class="cx">
</span><span class="cx"> InlineBox* InlineFlowBox::firstLeafChild() const
</span><span class="cx"> {
</span><del>- InlineBox* leaf = 0;
</del><ins>+ InlineBox* leaf = nullptr;
</ins><span class="cx"> for (InlineBox* child = firstChild(); child && !leaf; child = child->nextOnLine())
</span><del>- leaf = child->isLeaf() ? child : toInlineFlowBox(child)->firstLeafChild();
</del><ins>+ leaf = child->isLeaf() ? child : downcast<InlineFlowBox>(*child).firstLeafChild();
</ins><span class="cx"> return leaf;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> InlineBox* InlineFlowBox::lastLeafChild() const
</span><span class="cx"> {
</span><del>- InlineBox* leaf = 0;
</del><ins>+ InlineBox* leaf = nullptr;
</ins><span class="cx"> for (InlineBox* child = lastChild(); child && !leaf; child = child->prevOnLine())
</span><del>- leaf = child->isLeaf() ? child : toInlineFlowBox(child)->lastLeafChild();
</del><ins>+ leaf = child->isLeaf() ? child : downcast<InlineFlowBox>(*child).lastLeafChild();
</ins><span class="cx"> return leaf;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1491,15 +1489,15 @@
</span><span class="cx"> LayoutUnit InlineFlowBox::computeOverAnnotationAdjustment(LayoutUnit allowedPosition) const
</span><span class="cx"> {
</span><span class="cx"> LayoutUnit result = 0;
</span><del>- for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
- if (curr->renderer().isOutOfFlowPositioned())
</del><ins>+ for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) {
+ if (child->renderer().isOutOfFlowPositioned())
</ins><span class="cx"> continue; // Positioned placeholders don't affect calculations.
</span><span class="cx">
</span><del>- if (curr->isInlineFlowBox())
- result = std::max(result, toInlineFlowBox(curr)->computeOverAnnotationAdjustment(allowedPosition));
</del><ins>+ if (is<InlineFlowBox>(*child))
+ result = std::max(result, downcast<InlineFlowBox>(*child).computeOverAnnotationAdjustment(allowedPosition));
</ins><span class="cx">
</span><del>- if (curr->renderer().isReplaced() && curr->renderer().isRubyRun() && curr->renderer().style().rubyPosition() == RubyPositionBefore) {
- RenderRubyRun& rubyRun = toRenderRubyRun(curr->renderer());
</del><ins>+ if (child->renderer().isReplaced() && is<RenderRubyRun>(child->renderer()) && child->renderer().style().rubyPosition() == RubyPositionBefore) {
+ auto& rubyRun = downcast<RenderRubyRun>(child->renderer());
</ins><span class="cx"> RenderRubyText* rubyText = rubyRun.rubyText();
</span><span class="cx"> if (!rubyText)
</span><span class="cx"> continue;
</span><span class="lines">@@ -1508,26 +1506,26 @@
</span><span class="cx"> LayoutUnit topOfFirstRubyTextLine = rubyText->logicalTop() + (rubyText->firstRootBox() ? rubyText->firstRootBox()->lineTop() : LayoutUnit());
</span><span class="cx"> if (topOfFirstRubyTextLine >= 0)
</span><span class="cx"> continue;
</span><del>- topOfFirstRubyTextLine += curr->logicalTop();
</del><ins>+ topOfFirstRubyTextLine += child->logicalTop();
</ins><span class="cx"> result = std::max(result, allowedPosition - topOfFirstRubyTextLine);
</span><span class="cx"> } else {
</span><span class="cx"> LayoutUnit bottomOfLastRubyTextLine = rubyText->logicalTop() + (rubyText->lastRootBox() ? rubyText->lastRootBox()->lineBottom() : rubyText->logicalHeight());
</span><del>- if (bottomOfLastRubyTextLine <= curr->logicalHeight())
</del><ins>+ if (bottomOfLastRubyTextLine <= child->logicalHeight())
</ins><span class="cx"> continue;
</span><del>- bottomOfLastRubyTextLine += curr->logicalTop();
</del><ins>+ bottomOfLastRubyTextLine += child->logicalTop();
</ins><span class="cx"> result = std::max(result, bottomOfLastRubyTextLine - allowedPosition);
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (curr->isInlineTextBox()) {
- const RenderStyle& childLineStyle = curr->lineStyle();
</del><ins>+ if (is<InlineTextBox>(*child)) {
+ const RenderStyle& childLineStyle = child->lineStyle();
</ins><span class="cx"> bool emphasisMarkIsAbove;
</span><del>- if (childLineStyle.textEmphasisMark() != TextEmphasisMarkNone && toInlineTextBox(curr)->emphasisMarkExistsAndIsAbove(childLineStyle, emphasisMarkIsAbove) && emphasisMarkIsAbove) {
</del><ins>+ if (childLineStyle.textEmphasisMark() != TextEmphasisMarkNone && downcast<InlineTextBox>(*child).emphasisMarkExistsAndIsAbove(childLineStyle, emphasisMarkIsAbove) && emphasisMarkIsAbove) {
</ins><span class="cx"> if (!childLineStyle.isFlippedLinesWritingMode()) {
</span><del>- int topOfEmphasisMark = curr->logicalTop() - childLineStyle.font().emphasisMarkHeight(childLineStyle.textEmphasisMarkString());
</del><ins>+ int topOfEmphasisMark = child->logicalTop() - childLineStyle.font().emphasisMarkHeight(childLineStyle.textEmphasisMarkString());
</ins><span class="cx"> result = std::max(result, allowedPosition - topOfEmphasisMark);
</span><span class="cx"> } else {
</span><del>- int bottomOfEmphasisMark = curr->logicalBottom() + childLineStyle.font().emphasisMarkHeight(childLineStyle.textEmphasisMarkString());
</del><ins>+ int bottomOfEmphasisMark = child->logicalBottom() + childLineStyle.font().emphasisMarkHeight(childLineStyle.textEmphasisMarkString());
</ins><span class="cx"> result = std::max(result, bottomOfEmphasisMark - allowedPosition);
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -1539,15 +1537,15 @@
</span><span class="cx"> LayoutUnit InlineFlowBox::computeUnderAnnotationAdjustment(LayoutUnit allowedPosition) const
</span><span class="cx"> {
</span><span class="cx"> LayoutUnit result = 0;
</span><del>- for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
- if (curr->renderer().isOutOfFlowPositioned())
</del><ins>+ for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) {
+ if (child->renderer().isOutOfFlowPositioned())
</ins><span class="cx"> continue; // Positioned placeholders don't affect calculations.
</span><span class="cx">
</span><del>- if (curr->isInlineFlowBox())
- result = std::max(result, toInlineFlowBox(curr)->computeUnderAnnotationAdjustment(allowedPosition));
</del><ins>+ if (is<InlineFlowBox>(*child))
+ result = std::max(result, downcast<InlineFlowBox>(*child).computeUnderAnnotationAdjustment(allowedPosition));
</ins><span class="cx">
</span><del>- if (curr->renderer().isReplaced() && curr->renderer().isRubyRun() && curr->renderer().style().rubyPosition() == RubyPositionAfter) {
- RenderRubyRun& rubyRun = toRenderRubyRun(curr->renderer());
</del><ins>+ if (child->renderer().isReplaced() && is<RenderRubyRun>(child->renderer()) && child->renderer().style().rubyPosition() == RubyPositionAfter) {
+ auto& rubyRun = downcast<RenderRubyRun>(child->renderer());
</ins><span class="cx"> RenderRubyText* rubyText = rubyRun.rubyText();
</span><span class="cx"> if (!rubyText)
</span><span class="cx"> continue;
</span><span class="lines">@@ -1556,27 +1554,27 @@
</span><span class="cx"> LayoutUnit topOfFirstRubyTextLine = rubyText->logicalTop() + (rubyText->firstRootBox() ? rubyText->firstRootBox()->lineTop() : LayoutUnit());
</span><span class="cx"> if (topOfFirstRubyTextLine >= 0)
</span><span class="cx"> continue;
</span><del>- topOfFirstRubyTextLine += curr->logicalTop();
</del><ins>+ topOfFirstRubyTextLine += child->logicalTop();
</ins><span class="cx"> result = std::max(result, allowedPosition - topOfFirstRubyTextLine);
</span><span class="cx"> } else {
</span><span class="cx"> LayoutUnit bottomOfLastRubyTextLine = rubyText->logicalTop() + (rubyText->lastRootBox() ? rubyText->lastRootBox()->lineBottom() : rubyText->logicalHeight());
</span><del>- if (bottomOfLastRubyTextLine <= curr->logicalHeight())
</del><ins>+ if (bottomOfLastRubyTextLine <= child->logicalHeight())
</ins><span class="cx"> continue;
</span><del>- bottomOfLastRubyTextLine += curr->logicalTop();
</del><ins>+ bottomOfLastRubyTextLine += child->logicalTop();
</ins><span class="cx"> result = std::max(result, bottomOfLastRubyTextLine - allowedPosition);
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (curr->isInlineTextBox()) {
- const RenderStyle& childLineStyle = curr->lineStyle();
</del><ins>+ if (is<InlineTextBox>(*child)) {
+ const RenderStyle& childLineStyle = child->lineStyle();
</ins><span class="cx"> bool emphasisMarkIsAbove;
</span><del>- toInlineTextBox(curr)->emphasisMarkExistsAndIsAbove(childLineStyle, emphasisMarkIsAbove);
</del><ins>+ downcast<InlineTextBox>(*child).emphasisMarkExistsAndIsAbove(childLineStyle, emphasisMarkIsAbove);
</ins><span class="cx"> if (childLineStyle.textEmphasisMark() != TextEmphasisMarkNone && !emphasisMarkIsAbove) {
</span><span class="cx"> if (!childLineStyle.isFlippedLinesWritingMode()) {
</span><del>- LayoutUnit bottomOfEmphasisMark = curr->logicalBottom() + childLineStyle.font().emphasisMarkHeight(childLineStyle.textEmphasisMarkString());
</del><ins>+ LayoutUnit bottomOfEmphasisMark = child->logicalBottom() + childLineStyle.font().emphasisMarkHeight(childLineStyle.textEmphasisMarkString());
</ins><span class="cx"> result = std::max(result, bottomOfEmphasisMark - allowedPosition);
</span><span class="cx"> } else {
</span><del>- LayoutUnit topOfEmphasisMark = curr->logicalTop() - childLineStyle.font().emphasisMarkHeight(childLineStyle.textEmphasisMarkString());
</del><ins>+ LayoutUnit topOfEmphasisMark = child->logicalTop() - childLineStyle.font().emphasisMarkHeight(childLineStyle.textEmphasisMarkString());
</ins><span class="cx"> result = std::max(result, allowedPosition - topOfEmphasisMark);
</span><span class="cx"> }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingInlineFlowBoxh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/InlineFlowBox.h (174745 => 174746)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/InlineFlowBox.h        2014-10-15 22:36:08 UTC (rev 174745)
+++ trunk/Source/WebCore/rendering/InlineFlowBox.h        2014-10-16 00:05:37 UTC (rev 174746)
</span><span class="lines">@@ -344,8 +344,6 @@
</span><span class="cx"> #endif
</span><span class="cx"> };
</span><span class="cx">
</span><del>-INLINE_BOX_OBJECT_TYPE_CASTS(InlineFlowBox, isInlineFlowBox())
-
</del><span class="cx"> #ifdef NDEBUG
</span><span class="cx">
</span><span class="cx"> inline void InlineFlowBox::checkConsistency() const
</span><span class="lines">@@ -364,6 +362,8 @@
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><ins>+SPECIALIZE_TYPE_TRAITS_INLINE_BOX(InlineFlowBox, isInlineFlowBox())
+
</ins><span class="cx"> #ifndef NDEBUG
</span><span class="cx"> // Outside the WebCore namespace for ease of invocation from gdb.
</span><span class="cx"> void showTree(const WebCore::InlineFlowBox*);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingInlineTextBoxh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/InlineTextBox.h (174745 => 174746)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/InlineTextBox.h        2014-10-15 22:36:08 UTC (rev 174745)
+++ trunk/Source/WebCore/rendering/InlineTextBox.h        2014-10-16 00:05:37 UTC (rev 174746)
</span><span class="lines">@@ -179,8 +179,8 @@
</span><span class="cx"> unsigned short m_truncation;
</span><span class="cx"> };
</span><span class="cx">
</span><del>-INLINE_BOX_OBJECT_TYPE_CASTS(InlineTextBox, isInlineTextBox())
-
</del><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><ins>+SPECIALIZE_TYPE_TRAITS_INLINE_BOX(InlineTextBox, isInlineTextBox())
+
</ins><span class="cx"> #endif // InlineTextBox_h
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockFlowcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (174745 => 174746)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp        2014-10-15 22:36:08 UTC (rev 174745)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp        2014-10-16 00:05:37 UTC (rev 174746)
</span><span class="lines">@@ -3270,11 +3270,11 @@
</span><span class="cx"> if (!box->renderer().nonPseudoNode())
</span><span class="cx"> return createLegacyEditingPosition(nonPseudoElement(), start ? caretMinOffset() : caretMaxOffset());
</span><span class="cx">
</span><del>- if (!box->isInlineTextBox())
</del><ins>+ if (!is<InlineTextBox>(*box))
</ins><span class="cx"> return createLegacyEditingPosition(box->renderer().nonPseudoNode(), start ? box->renderer().caretMinOffset() : box->renderer().caretMaxOffset());
</span><span class="cx">
</span><del>- InlineTextBox* textBox = toInlineTextBox(box);
- return createLegacyEditingPosition(box->renderer().nonPseudoNode(), start ? textBox->start() : textBox->start() + textBox->len());
</del><ins>+ auto& textBox = downcast<InlineTextBox>(*box);
+ return createLegacyEditingPosition(textBox.renderer().nonPseudoNode(), start ? textBox.start() : textBox.start() + textBox.len());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> VisiblePosition RenderBlockFlow::positionForPointWithInlineChildren(const LayoutPoint& pointInLogicalContents, const RenderRegion* region)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockFlowh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.h (174745 => 174746)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlockFlow.h        2014-10-15 22:36:08 UTC (rev 174745)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.h        2014-10-16 00:05:37 UTC (rev 174746)
</span><span class="lines">@@ -338,8 +338,8 @@
</span><span class="cx"> RenderLineBoxList& lineBoxes() { return m_lineBoxes; }
</span><span class="cx"> const RenderLineBoxList& lineBoxes() const { return m_lineBoxes; }
</span><span class="cx">
</span><del>- RootInlineBox* firstRootBox() const { return toRootInlineBox(m_lineBoxes.firstLineBox()); }
- RootInlineBox* lastRootBox() const { return toRootInlineBox(m_lineBoxes.lastLineBox()); }
</del><ins>+ RootInlineBox* firstRootBox() const { return downcast<RootInlineBox>(m_lineBoxes.firstLineBox()); }
+ RootInlineBox* lastRootBox() const { return downcast<RootInlineBox>(m_lineBoxes.lastLineBox()); }
</ins><span class="cx">
</span><span class="cx"> virtual bool hasLines() const override final;
</span><span class="cx"> virtual void invalidateLineLayoutPath() override final;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockLineLayoutcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (174745 => 174746)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp        2014-10-15 22:36:08 UTC (rev 174745)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp        2014-10-16 00:05:37 UTC (rev 174746)
</span><span class="lines">@@ -213,8 +213,7 @@
</span><span class="cx"> // We need to make a new box for this render object. Once
</span><span class="cx"> // made, we need to place it at the end of the current line.
</span><span class="cx"> InlineBox* newBox = createInlineBoxForRenderer(obj, obj == this);
</span><del>- ASSERT_WITH_SECURITY_IMPLICATION(newBox->isInlineFlowBox());
- parentBox = toInlineFlowBox(newBox);
</del><ins>+ parentBox = downcast<InlineFlowBox>(newBox);
</ins><span class="cx"> parentBox->setIsFirstLine(lineInfo.isFirstLine());
</span><span class="cx"> parentBox->setIsHorizontal(isHorizontalWritingMode());
</span><span class="cx"> if (!hasDefaultLineBoxContain)
</span><span class="lines">@@ -314,13 +313,13 @@
</span><span class="cx"> bool visuallyOrdered = r->renderer().style().rtlOrdering() == VisualOrder;
</span><span class="cx"> box->setBidiLevel(r->level());
</span><span class="cx">
</span><del>- if (box->isInlineTextBox()) {
- InlineTextBox* text = toInlineTextBox(box);
- text->setStart(r->m_start);
- text->setLen(r->m_stop - r->m_start);
- text->setDirOverride(r->dirOverride(visuallyOrdered));
</del><ins>+ if (is<InlineTextBox>(*box)) {
+ auto& textBox = downcast<InlineTextBox>(*box);
+ textBox.setStart(r->m_start);
+ textBox.setLen(r->m_stop - r->m_start);
+ textBox.setDirOverride(r->dirOverride(visuallyOrdered));
</ins><span class="cx"> if (r->m_hasHyphen)
</span><del>- text->setHasHyphen(true);
</del><ins>+ textBox.setHasHyphen(true);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -478,7 +477,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> LayoutUnit hyphenWidth = 0;
</span><del>- if (toInlineTextBox(run->box())->hasHyphen())
</del><ins>+ if (downcast<InlineTextBox>(*run->box()).hasHyphen())
</ins><span class="cx"> hyphenWidth = measureHyphenWidth(renderer, font, &fallbackFonts);
</span><span class="cx">
</span><span class="cx"> float measuredWidth = 0;
</span><span class="lines">@@ -528,7 +527,7 @@
</span><span class="cx"> run->box()->setLogicalWidth(measuredWidth + hyphenWidth);
</span><span class="cx"> if (!fallbackFonts.isEmpty()) {
</span><span class="cx"> ASSERT(run->box()->behavesLikeText());
</span><del>- GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.add(toInlineTextBox(run->box()), std::make_pair(Vector<const SimpleFontData*>(), GlyphOverflow())).iterator;
</del><ins>+ GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.add(downcast<InlineTextBox>(run->box()), std::make_pair(Vector<const SimpleFontData*>(), GlyphOverflow())).iterator;
</ins><span class="cx"> ASSERT(it->value.first.isEmpty());
</span><span class="cx"> copyToVector(fallbackFonts, it->value.first);
</span><span class="cx"> run->box()->parent()->clearDescendantsHaveSameLineHeightAndBaseline();
</span><span class="lines">@@ -536,11 +535,11 @@
</span><span class="cx">
</span><span class="cx"> // Include text decoration visual overflow as part of the glyph overflow.
</span><span class="cx"> if (renderer->style().textDecorationsInEffect() != TextDecorationNone)
</span><del>- glyphOverflow.extendTo(visualOverflowForDecorations(run->box()->lineStyle(), toInlineTextBox(run->box())));
</del><ins>+ glyphOverflow.extendTo(visualOverflowForDecorations(run->box()->lineStyle(), downcast<InlineTextBox>(run->box())));
</ins><span class="cx">
</span><span class="cx"> if (!glyphOverflow.isEmpty()) {
</span><span class="cx"> ASSERT(run->box()->behavesLikeText());
</span><del>- GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.add(toInlineTextBox(run->box()), std::make_pair(Vector<const SimpleFontData*>(), GlyphOverflow())).iterator;
</del><ins>+ GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.add(downcast<InlineTextBox>(run->box()), std::make_pair(Vector<const SimpleFontData*>(), GlyphOverflow())).iterator;
</ins><span class="cx"> it->value.second = glyphOverflow;
</span><span class="cx"> run->box()->clearKnownToHaveNoOverflow();
</span><span class="cx"> }
</span><span class="lines">@@ -586,25 +585,25 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> size_t i = 0;
</span><del>- for (BidiRun* r = firstRun; r; r = r->next()) {
- if (!r->box() || r == trailingSpaceRun)
</del><ins>+ for (BidiRun* run = firstRun; run; run = run->next()) {
+ if (!run->box() || run == trailingSpaceRun)
</ins><span class="cx"> continue;
</span><span class="cx">
</span><del>- if (r->renderer().isText()) {
</del><ins>+ if (is<RenderText>(run->renderer())) {
</ins><span class="cx"> unsigned opportunitiesInRun = expansionOpportunities[i++];
</span><span class="cx">
</span><span class="cx"> ASSERT(opportunitiesInRun <= expansionOpportunityCount);
</span><span class="cx">
</span><span class="cx"> // Only justify text if whitespace is collapsed.
</span><del>- if (r->renderer().style().collapseWhiteSpace()) {
- InlineTextBox* textBox = toInlineTextBox(r->box());
</del><ins>+ if (run->renderer().style().collapseWhiteSpace()) {
+ InlineTextBox& textBox = downcast<InlineTextBox>(*run->box());
</ins><span class="cx"> float expansion = (availableLogicalWidth - totalLogicalWidth) * opportunitiesInRun / expansionOpportunityCount;
</span><del>- textBox->setExpansion(expansion);
</del><ins>+ textBox.setExpansion(expansion);
</ins><span class="cx"> totalLogicalWidth += expansion;
</span><span class="cx"> }
</span><span class="cx"> expansionOpportunityCount -= opportunitiesInRun;
</span><del>- } else if (r->renderer().isRubyRun())
- updateRubyForJustifiedText(toRenderRubyRun(r->renderer()), *r, expansionOpportunities, expansionOpportunityCount, totalLogicalWidth, availableLogicalWidth, i);
</del><ins>+ } else if (is<RenderRubyRun>(run->renderer()))
+ updateRubyForJustifiedText(downcast<RenderRubyRun>(run->renderer()), *run, expansionOpportunities, expansionOpportunityCount, totalLogicalWidth, availableLogicalWidth, i);
</ins><span class="cx">
</span><span class="cx"> if (!expansionOpportunityCount)
</span><span class="cx"> break;
</span><span class="lines">@@ -709,39 +708,40 @@
</span><span class="cx"> Vector<unsigned, 16> expansionOpportunities;
</span><span class="cx"> RenderObject* previousObject = nullptr;
</span><span class="cx">
</span><del>- BidiRun* r = firstRun;
- for (; r; r = r->next()) {
- if (!r->box() || r->renderer().isOutOfFlowPositioned() || r->box()->isLineBreak())
</del><ins>+ BidiRun* run = firstRun;
+ for (; run; run = run->next()) {
+ if (!run->box() || run->renderer().isOutOfFlowPositioned() || run->box()->isLineBreak()) {
</ins><span class="cx"> continue; // Positioned objects are only participating to figure out their
</span><span class="cx"> // correct static x position. They have no effect on the width.
</span><span class="cx"> // Similarly, line break boxes have no effect on the width.
</span><del>- if (is<RenderText>(r->renderer())) {
- RenderText& renderText = downcast<RenderText>(r->renderer());
- if (textAlign == JUSTIFY && r != trailingSpaceRun) {
</del><ins>+ }
+ if (is<RenderText>(run->renderer())) {
+ auto& renderText = downcast<RenderText>(run->renderer());
+ if (textAlign == JUSTIFY && run != trailingSpaceRun) {
</ins><span class="cx"> if (!isAfterExpansion)
</span><del>- toInlineTextBox(r->box())->setCanHaveLeadingExpansion(true);
- unsigned opportunitiesInRun = Font::expansionOpportunityCount(renderText.stringView(r->m_start, r->m_stop), r->box()->direction(), isAfterExpansion);
</del><ins>+ downcast<InlineTextBox>(*run->box()).setCanHaveLeadingExpansion(true);
+ unsigned opportunitiesInRun = Font::expansionOpportunityCount(renderText.stringView(run->m_start, run->m_stop), run->box()->direction(), isAfterExpansion);
</ins><span class="cx"> expansionOpportunities.append(opportunitiesInRun);
</span><span class="cx"> expansionOpportunityCount += opportunitiesInRun;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (int length = renderText.textLength()) {
</span><del>- if (!r->m_start && needsWordSpacing && isSpaceOrNewline(renderText.characterAt(r->m_start)))
</del><ins>+ if (!run->m_start && needsWordSpacing && isSpaceOrNewline(renderText.characterAt(run->m_start)))
</ins><span class="cx"> totalLogicalWidth += lineStyle(*renderText.parent(), lineInfo).font().wordSpacing();
</span><del>- needsWordSpacing = !isSpaceOrNewline(renderText.characterAt(r->m_stop - 1)) && r->m_stop == length;
</del><ins>+ needsWordSpacing = !isSpaceOrNewline(renderText.characterAt(run->m_stop - 1)) && run->m_stop == length;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- setLogicalWidthForTextRun(lineBox, r, &renderText, totalLogicalWidth, lineInfo, textBoxDataMap, verticalPositionCache, wordMeasurements);
</del><ins>+ setLogicalWidthForTextRun(lineBox, run, &renderText, totalLogicalWidth, lineInfo, textBoxDataMap, verticalPositionCache, wordMeasurements);
</ins><span class="cx"> } else {
</span><span class="cx"> bool encounteredJustifiedRuby = false;
</span><del>- if (r->renderer().isRubyRun() && textAlign == JUSTIFY && r != trailingSpaceRun && toRenderRubyRun(r->renderer()).rubyBase()) {
- auto* rubyBase = toRenderRubyRun(r->renderer()).rubyBase();
- if (rubyBase->firstRootBox() && !rubyBase->firstRootBox()->nextRootBox() && r->renderer().style().collapseWhiteSpace()) {
</del><ins>+ if (is<RenderRubyRun>(run->renderer()) && textAlign == JUSTIFY && run != trailingSpaceRun && toRenderRubyRun(run->renderer()).rubyBase()) {
+ auto* rubyBase = downcast<RenderRubyRun>(run->renderer()).rubyBase();
+ if (rubyBase->firstRootBox() && !rubyBase->firstRootBox()->nextRootBox() && run->renderer().style().collapseWhiteSpace()) {
</ins><span class="cx"> for (auto* leafChild = rubyBase->firstRootBox()->firstLeafChild(); leafChild; leafChild = leafChild->nextLeafChild()) {
</span><del>- if (!leafChild->isInlineTextBox())
</del><ins>+ if (!is<InlineTextBox>(*leafChild))
</ins><span class="cx"> continue;
</span><span class="cx"> if (!isAfterExpansion)
</span><del>- toInlineTextBox(leafChild)->setCanHaveLeadingExpansion(true);
</del><ins>+ downcast<InlineTextBox>(*leafChild).setCanHaveLeadingExpansion(true);
</ins><span class="cx"> encounteredJustifiedRuby = true;
</span><span class="cx"> auto& renderText = downcast<RenderText>(leafChild->renderer());
</span><span class="cx"> unsigned opportunitiesInRun = Font::expansionOpportunityCount(renderText.stringView(), leafChild->direction(), isAfterExpansion);
</span><span class="lines">@@ -754,17 +754,17 @@
</span><span class="cx"> if (!encounteredJustifiedRuby)
</span><span class="cx"> isAfterExpansion = false;
</span><span class="cx">
</span><del>- if (!r->renderer().isRenderInline()) {
- RenderBox& renderBox = toRenderBox(r->renderer());
- if (renderBox.isRubyRun())
- setMarginsForRubyRun(r, toRenderRubyRun(renderBox), previousObject, lineInfo);
- r->box()->setLogicalWidth(logicalWidthForChild(renderBox));
</del><ins>+ if (!is<RenderInline>(run->renderer())) {
+ auto& renderBox = downcast<RenderBox>(run->renderer());
+ if (is<RenderRubyRun>(renderBox))
+ setMarginsForRubyRun(run, downcast<RenderRubyRun>(renderBox), previousObject, lineInfo);
+ run->box()->setLogicalWidth(logicalWidthForChild(renderBox));
</ins><span class="cx"> totalLogicalWidth += marginStartForChild(renderBox) + marginEndForChild(renderBox);
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- totalLogicalWidth += r->box()->logicalWidth();
- previousObject = &r->renderer();
</del><ins>+ totalLogicalWidth += run->box()->logicalWidth();
+ previousObject = &run->renderer();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (isAfterExpansion && !expansionOpportunities.isEmpty()) {
</span><span class="lines">@@ -776,7 +776,7 @@
</span><span class="cx">
</span><span class="cx"> computeExpansionForJustifiedText(firstRun, trailingSpaceRun, expansionOpportunities, expansionOpportunityCount, totalLogicalWidth, availableLogicalWidth);
</span><span class="cx">
</span><del>- return r;
</del><ins>+ return run;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void RenderBlockFlow::computeBlockDirectionPositionsForLine(RootInlineBox* lineBox, BidiRun* firstRun, GlyphOverflowAndFallbackFontsMap& textBoxDataMap,
</span><span class="lines">@@ -785,26 +785,26 @@
</span><span class="cx"> setLogicalHeight(lineBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, verticalPositionCache));
</span><span class="cx">
</span><span class="cx"> // Now make sure we place replaced render objects correctly.
</span><del>- for (BidiRun* r = firstRun; r; r = r->next()) {
- ASSERT(r->box());
- if (!r->box())
</del><ins>+ for (BidiRun* run = firstRun; run; run = run->next()) {
+ ASSERT(run->box());
+ if (!run->box())
</ins><span class="cx"> continue; // Skip runs with no line boxes.
</span><span class="cx">
</span><del>- InlineBox& box = *r->box();
</del><ins>+ InlineBox& box = *run->box();
</ins><span class="cx">
</span><span class="cx"> // Align positioned boxes with the top of the line box. This is
</span><span class="cx"> // a reasonable approximation of an appropriate y position.
</span><del>- if (r->renderer().isOutOfFlowPositioned())
</del><ins>+ if (run->renderer().isOutOfFlowPositioned())
</ins><span class="cx"> box.setLogicalTop(logicalHeight());
</span><span class="cx">
</span><span class="cx"> // Position is used to properly position both replaced elements and
</span><span class="cx"> // to update the static normal flow x/y of positioned elements.
</span><del>- if (is<RenderText>(r->renderer()))
- downcast<RenderText>(r->renderer()).positionLineBox(toInlineTextBox(box));
- else if (is<RenderBox>(r->renderer()))
- downcast<RenderBox>(r->renderer()).positionLineBox(toInlineElementBox(box));
- else if (is<RenderLineBreak>(r->renderer()))
- downcast<RenderLineBreak>(r->renderer()).replaceInlineBoxWrapper(toInlineElementBox(box));
</del><ins>+ if (is<RenderText>(run->renderer()))
+ downcast<RenderText>(run->renderer()).positionLineBox(downcast<InlineTextBox>(box));
+ else if (is<RenderBox>(run->renderer()))
+ downcast<RenderBox>(run->renderer()).positionLineBox(downcast<InlineElementBox>(box));
+ else if (is<RenderLineBreak>(run->renderer()))
+ downcast<RenderLineBreak>(run->renderer()).replaceInlineBoxWrapper(downcast<InlineElementBox>(box));
</ins><span class="cx"> }
</span><span class="cx"> // Positioned objects and zero-length text nodes destroy their boxes in
</span><span class="cx"> // position(), which unnecessarily dirties the line.
</span><span class="lines">@@ -984,7 +984,7 @@
</span><span class="cx"> lineBox->setBidiLevel(bidiLevel);
</span><span class="cx"> lineBox->setEndsWithBreak(lineInfo.previousLineBrokeCleanly());
</span><span class="cx">
</span><del>- bool isSVGRootInlineBox = lineBox->isSVGRootInlineBox();
</del><ins>+ bool isSVGRootInlineBox = is<SVGRootInlineBox>(*lineBox);
</ins><span class="cx">
</span><span class="cx"> GlyphOverflowAndFallbackFontsMap textBoxDataMap;
</span><span class="cx">
</span><span class="lines">@@ -1002,7 +1002,7 @@
</span><span class="cx"> // text selection in RTL boxes would not work as expected.
</span><span class="cx"> if (isSVGRootInlineBox) {
</span><span class="cx"> ASSERT_WITH_SECURITY_IMPLICATION(isSVGText());
</span><del>- toSVGRootInlineBox(lineBox)->computePerCharacterLayoutInformation();
</del><ins>+ downcast<SVGRootInlineBox>(*lineBox).computePerCharacterLayoutInformation();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Compute our overflow now.
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderTextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderText.cpp (174745 => 174746)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderText.cpp        2014-10-15 22:36:08 UTC (rev 174745)
+++ trunk/Source/WebCore/rendering/RenderText.cpp        2014-10-16 00:05:37 UTC (rev 174746)
</span><span class="lines">@@ -431,9 +431,9 @@
</span><span class="cx"> if (!inlineBox)
</span><span class="cx"> return LayoutRect();
</span><span class="cx">
</span><del>- InlineTextBox* box = toInlineTextBox(inlineBox);
- float left = box->positionForOffset(caretOffset);
- return box->root().computeCaretRect(left, caretWidth, extraWidthToEndOfLine);
</del><ins>+ auto& box = downcast<InlineTextBox>(*inlineBox);
+ float left = box.positionForOffset(caretOffset);
+ return box.root().computeCaretRect(left, caretWidth, extraWidthToEndOfLine);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ALWAYS_INLINE float RenderText::widthFromCache(const Font& f, int start, int len, float xPos, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow, const RenderStyle& style) const
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRootInlineBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RootInlineBox.cpp (174745 => 174746)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RootInlineBox.cpp        2014-10-15 22:36:08 UTC (rev 174745)
+++ trunk/Source/WebCore/rendering/RootInlineBox.cpp        2014-10-16 00:05:37 UTC (rev 174746)
</span><span class="lines">@@ -95,12 +95,9 @@
</span><span class="cx"> bool RootInlineBox::isHyphenated() const
</span><span class="cx"> {
</span><span class="cx"> for (InlineBox* box = firstLeafChild(); box; box = box->nextLeafChild()) {
</span><del>- if (box->isInlineTextBox()) {
- if (toInlineTextBox(box)->hasHyphen())
- return true;
- }
</del><ins>+ if (is<InlineTextBox>(*box) && downcast<InlineTextBox>(*box).hasHyphen())
+ return true;
</ins><span class="cx"> }
</span><del>-
</del><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -830,10 +827,10 @@
</span><span class="cx">
</span><span class="cx"> Vector<const SimpleFontData*>* usedFonts = nullptr;
</span><span class="cx"> GlyphOverflow* glyphOverflow = nullptr;
</span><del>- if (box.isInlineTextBox()) {
- GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.find(toInlineTextBox(&box));
- usedFonts = it == textBoxDataMap.end() ? 0 : &it->value.first;
- glyphOverflow = it == textBoxDataMap.end() ? 0 : &it->value.second;
</del><ins>+ if (is<InlineTextBox>(box)) {
+ GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.find(&downcast<InlineTextBox>(box));
+ usedFonts = it == textBoxDataMap.end() ? nullptr : &it->value.first;
+ glyphOverflow = it == textBoxDataMap.end() ? nullptr : &it->value.second;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool includeLeading = includeLeadingForBox(box);
</span><span class="lines">@@ -1017,7 +1014,7 @@
</span><span class="cx"> if (box.renderer().isReplaced() || (box.renderer().isTextOrLineBreak() && !box.behavesLikeText()))
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- if (!box.behavesLikeText() && box.isInlineFlowBox() && !toInlineFlowBox(&box)->hasTextChildren())
</del><ins>+ if (!box.behavesLikeText() && is<InlineFlowBox>(box) && !downcast<InlineFlowBox>(box).hasTextChildren())
</ins><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> // For now map "glyphs" to "font" in vertical text mode until the bounds returned by glyphs aren't garbage.
</span><span class="lines">@@ -1030,7 +1027,7 @@
</span><span class="cx"> if (box.renderer().isReplaced() || (box.renderer().isTextOrLineBreak() && !box.behavesLikeText()))
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- if (!box.behavesLikeText() && box.isInlineFlowBox() && !toInlineFlowBox(&box)->hasTextChildren())
</del><ins>+ if (!box.behavesLikeText() && is<InlineFlowBox>(box) && !downcast<InlineFlowBox>(box).hasTextChildren())
</ins><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> // FIXME: We can't fit to glyphs yet for vertical text, since the bounds returned are garbage.
</span><span class="lines">@@ -1043,7 +1040,7 @@
</span><span class="cx"> if (box.renderer().isReplaced() || (box.renderer().isTextOrLineBreak() && !box.behavesLikeText()))
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- if (!box.behavesLikeText() && box.isInlineFlowBox() && !toInlineFlowBox(&box)->hasTextChildren())
</del><ins>+ if (!box.behavesLikeText() && is<InlineFlowBox>(box) && !downcast<InlineFlowBox>(box).hasTextChildren())
</ins><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> LineBoxContain lineBoxContain = renderer().style().lineBoxContain();
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRootInlineBoxh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RootInlineBox.h (174745 => 174746)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RootInlineBox.h        2014-10-15 22:36:08 UTC (rev 174745)
+++ trunk/Source/WebCore/rendering/RootInlineBox.h        2014-10-16 00:05:37 UTC (rev 174746)
</span><span class="lines">@@ -224,18 +224,18 @@
</span><span class="cx"> std::unique_ptr<Vector<RenderBox*>> m_floats;
</span><span class="cx"> };
</span><span class="cx">
</span><del>-INLINE_BOX_OBJECT_TYPE_CASTS(RootInlineBox, isRootInlineBox())
-
</del><span class="cx"> inline RootInlineBox* RootInlineBox::nextRootBox() const
</span><span class="cx"> {
</span><del>- return toRootInlineBox(m_nextLineBox);
</del><ins>+ return downcast<RootInlineBox>(m_nextLineBox);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> inline RootInlineBox* RootInlineBox::prevRootBox() const
</span><span class="cx"> {
</span><del>- return toRootInlineBox(m_prevLineBox);
</del><ins>+ return downcast<RootInlineBox>(m_prevLineBox);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><ins>+SPECIALIZE_TYPE_TRAITS_INLINE_BOX(RootInlineBox, isRootInlineBox())
+
</ins><span class="cx"> #endif // RootInlineBox_h
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgRenderSVGInlineTextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/RenderSVGInlineText.cpp (174745 => 174746)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/RenderSVGInlineText.cpp        2014-10-15 22:36:08 UTC (rev 174745)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGInlineText.cpp        2014-10-16 00:05:37 UTC (rev 174746)
</span><span class="lines">@@ -118,22 +118,22 @@
</span><span class="cx">
</span><span class="cx"> LayoutRect RenderSVGInlineText::localCaretRect(InlineBox* box, int caretOffset, LayoutUnit*)
</span><span class="cx"> {
</span><del>- if (!box || !box->isInlineTextBox())
</del><ins>+ if (!is<InlineTextBox>(box))
</ins><span class="cx"> return LayoutRect();
</span><span class="cx">
</span><del>- InlineTextBox* textBox = toInlineTextBox(box);
- if (static_cast<unsigned>(caretOffset) < textBox->start() || static_cast<unsigned>(caretOffset) > textBox->start() + textBox->len())
</del><ins>+ auto& textBox = downcast<InlineTextBox>(*box);
+ if (static_cast<unsigned>(caretOffset) < textBox.start() || static_cast<unsigned>(caretOffset) > 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<unsigned>(caretOffset) < textBox->start() + textBox->len()) {
- LayoutRect rect = textBox->localSelectionRect(caretOffset, caretOffset + 1);
- LayoutUnit x = box->isLeftToRightDirection() ? rect.x() : rect.maxX();
</del><ins>+ if (static_cast<unsigned>(caretOffset) < textBox.start() + textBox.len()) {
+ LayoutRect rect = textBox.localSelectionRect(caretOffset, caretOffset + 1);
+ LayoutUnit x = textBox.isLeftToRightDirection() ? rect.x() : rect.maxX();
</ins><span class="cx"> return LayoutRect(x, rect.y(), caretWidth, rect.height());
</span><span class="cx"> }
</span><span class="cx">
</span><del>- LayoutRect rect = textBox->localSelectionRect(caretOffset - 1, caretOffset);
- LayoutUnit x = box->isLeftToRightDirection() ? rect.maxX() : rect.x();
</del><ins>+ LayoutRect rect = textBox.localSelectionRect(caretOffset - 1, caretOffset);
+ LayoutUnit x = textBox.isLeftToRightDirection() ? rect.maxX() : rect.x();
</ins><span class="cx"> return LayoutRect(x, rect.y(), caretWidth, rect.height());
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -182,16 +182,16 @@
</span><span class="cx">
</span><span class="cx"> float closestDistance = std::numeric_limits<float>::max();
</span><span class="cx"> float closestDistancePosition = 0;
</span><del>- const SVGTextFragment* closestDistanceFragment = 0;
- SVGInlineTextBox* closestDistanceBox = 0;
</del><ins>+ const SVGTextFragment* closestDistanceFragment = nullptr;
+ SVGInlineTextBox* closestDistanceBox = nullptr;
</ins><span class="cx">
</span><span class="cx"> AffineTransform fragmentTransform;
</span><span class="cx"> for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) {
</span><del>- if (!box->isSVGInlineTextBox())
</del><ins>+ if (!is<SVGInlineTextBox>(*box))
</ins><span class="cx"> continue;
</span><span class="cx">
</span><del>- SVGInlineTextBox* textBox = toSVGInlineTextBox(box);
- Vector<SVGTextFragment>& fragments = textBox->textFragments();
</del><ins>+ auto& textBox = downcast<SVGInlineTextBox>(*box);
+ Vector<SVGTextFragment>& fragments = textBox.textFragments();
</ins><span class="cx">
</span><span class="cx"> unsigned textFragmentsSize = fragments.size();
</span><span class="cx"> for (unsigned i = 0; i < textFragmentsSize; ++i) {
</span><span class="lines">@@ -206,7 +206,7 @@
</span><span class="cx">
</span><span class="cx"> if (distance < closestDistance) {
</span><span class="cx"> closestDistance = distance;
</span><del>- closestDistanceBox = textBox;
</del><ins>+ closestDistanceBox = &textBox;
</ins><span class="cx"> closestDistanceFragment = &fragment;
</span><span class="cx"> closestDistancePosition = fragmentRect.x();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgRenderSVGTextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/RenderSVGText.cpp (174745 => 174746)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/RenderSVGText.cpp        2014-10-15 22:36:08 UTC (rev 174745)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGText.cpp        2014-10-16 00:05:37 UTC (rev 174746)
</span><span class="lines">@@ -472,11 +472,10 @@
</span><span class="cx"> if (!rootBox)
</span><span class="cx"> return createVisiblePosition(0, DOWNSTREAM);
</span><span class="cx">
</span><del>- ASSERT_WITH_SECURITY_IMPLICATION(rootBox->isSVGRootInlineBox());
</del><span class="cx"> ASSERT(!rootBox->nextRootBox());
</span><span class="cx"> ASSERT(childrenInline());
</span><span class="cx">
</span><del>- InlineBox* closestBox = toSVGRootInlineBox(rootBox)->closestLeafChildForPosition(pointInContents);
</del><ins>+ InlineBox* closestBox = downcast<SVGRootInlineBox>(*rootBox).closestLeafChildForPosition(pointInContents);
</ins><span class="cx"> if (!closestBox)
</span><span class="cx"> return createVisiblePosition(0, DOWNSTREAM);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgSVGInlineFlowBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/SVGInlineFlowBox.cpp (174745 => 174746)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/SVGInlineFlowBox.cpp        2014-10-15 22:36:08 UTC (rev 174745)
+++ trunk/Source/WebCore/rendering/svg/SVGInlineFlowBox.cpp        2014-10-16 00:05:37 UTC (rev 174746)
</span><span class="lines">@@ -38,10 +38,10 @@
</span><span class="cx">
</span><span class="cx"> PaintInfo childPaintInfo(paintInfo);
</span><span class="cx"> for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) {
</span><del>- if (child->isSVGInlineTextBox())
- toSVGInlineTextBox(child)->paintSelectionBackground(childPaintInfo);
- else if (child->isSVGInlineFlowBox())
- toSVGInlineFlowBox(child)->paintSelectionBackground(childPaintInfo);
</del><ins>+ if (is<SVGInlineTextBox>(*child))
+ downcast<SVGInlineTextBox>(*child).paintSelectionBackground(childPaintInfo);
+ else if (is<SVGInlineFlowBox>(*child))
+ downcast<SVGInlineFlowBox>(*child).paintSelectionBackground(childPaintInfo);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -53,8 +53,8 @@
</span><span class="cx"> SVGRenderingContext renderingContext(renderer(), paintInfo, SVGRenderingContext::SaveGraphicsContext);
</span><span class="cx"> if (renderingContext.isRenderingPrepared()) {
</span><span class="cx"> for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) {
</span><del>- if (child->isSVGInlineTextBox())
- computeTextMatchMarkerRectForRenderer(&(toSVGInlineTextBox(child)->renderer()));
</del><ins>+ if (is<SVGInlineTextBox>(*child))
+ computeTextMatchMarkerRectForRenderer(&downcast<SVGInlineTextBox>(*child).renderer());
</ins><span class="cx">
</span><span class="cx"> child->paint(paintInfo, paintOffset, 0, 0);
</span><span class="cx"> }
</span><span class="lines">@@ -95,13 +95,13 @@
</span><span class="cx">
</span><span class="cx"> FloatRect markerRect;
</span><span class="cx"> for (InlineTextBox* box = textRenderer->firstTextBox(); box; box = box->nextTextBox()) {
</span><del>- if (!box->isSVGInlineTextBox())
</del><ins>+ if (!is<SVGInlineTextBox>(*box))
</ins><span class="cx"> continue;
</span><span class="cx">
</span><del>- SVGInlineTextBox* textBox = toSVGInlineTextBox(box);
</del><ins>+ auto& textBox = downcast<SVGInlineTextBox>(*box);
</ins><span class="cx">
</span><del>- int markerStartPosition = std::max<int>(marker->startOffset() - textBox->start(), 0);
- int markerEndPosition = std::min<int>(marker->endOffset() - textBox->start(), textBox->len());
</del><ins>+ int markerStartPosition = std::max<int>(marker->startOffset() - textBox.start(), 0);
+ int markerEndPosition = std::min<int>(marker->endOffset() - textBox.start(), textBox.len());
</ins><span class="cx">
</span><span class="cx"> if (markerStartPosition >= markerEndPosition)
</span><span class="cx"> continue;
</span><span class="lines">@@ -109,17 +109,17 @@
</span><span class="cx"> int fragmentStartPosition = 0;
</span><span class="cx"> int fragmentEndPosition = 0;
</span><span class="cx">
</span><del>- const Vector<SVGTextFragment>& fragments = textBox->textFragments();
</del><ins>+ const Vector<SVGTextFragment>& fragments = textBox.textFragments();
</ins><span class="cx"> unsigned textFragmentsSize = fragments.size();
</span><span class="cx"> for (unsigned i = 0; i < textFragmentsSize; ++i) {
</span><span class="cx"> const SVGTextFragment& fragment = fragments.at(i);
</span><span class="cx">
</span><span class="cx"> fragmentStartPosition = markerStartPosition;
</span><span class="cx"> fragmentEndPosition = markerEndPosition;
</span><del>- if (!textBox->mapStartEndPositionsIntoFragmentCoordinates(fragment, fragmentStartPosition, fragmentEndPosition))
</del><ins>+ if (!textBox.mapStartEndPositionsIntoFragmentCoordinates(fragment, fragmentStartPosition, fragmentEndPosition))
</ins><span class="cx"> continue;
</span><span class="cx">
</span><del>- FloatRect fragmentRect = textBox->selectionRectForTextFragment(fragment, fragmentStartPosition, fragmentEndPosition, &style);
</del><ins>+ FloatRect fragmentRect = textBox.selectionRectForTextFragment(fragment, fragmentStartPosition, fragmentEndPosition, &style);
</ins><span class="cx"> fragment.buildFragmentTransform(fragmentTransform);
</span><span class="cx"> if (!fragmentTransform.isIdentity())
</span><span class="cx"> fragmentRect = fragmentTransform.mapRect(fragmentRect);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgSVGInlineFlowBoxh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/SVGInlineFlowBox.h (174745 => 174746)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/SVGInlineFlowBox.h        2014-10-15 22:36:08 UTC (rev 174745)
+++ trunk/Source/WebCore/rendering/svg/SVGInlineFlowBox.h        2014-10-16 00:05:37 UTC (rev 174746)
</span><span class="lines">@@ -52,8 +52,8 @@
</span><span class="cx"> float m_logicalHeight;
</span><span class="cx"> };
</span><span class="cx">
</span><del>-INLINE_BOX_OBJECT_TYPE_CASTS(SVGInlineFlowBox, isSVGInlineFlowBox())
-
</del><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><ins>+SPECIALIZE_TYPE_TRAITS_INLINE_BOX(SVGInlineFlowBox, isSVGInlineFlowBox())
+
</ins><span class="cx"> #endif // SVGInlineFlowBox_h
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgSVGInlineTextBoxh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.h (174745 => 174746)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.h        2014-10-15 22:36:08 UTC (rev 174745)
+++ trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.h        2014-10-16 00:05:37 UTC (rev 174746)
</span><span class="lines">@@ -92,8 +92,8 @@
</span><span class="cx"> Vector<SVGTextFragment> m_textFragments;
</span><span class="cx"> };
</span><span class="cx">
</span><del>-INLINE_BOX_OBJECT_TYPE_CASTS(SVGInlineTextBox, isSVGInlineTextBox())
-
</del><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><ins>+SPECIALIZE_TYPE_TRAITS_INLINE_BOX(SVGInlineTextBox, isSVGInlineTextBox())
+
</ins><span class="cx"> #endif // SVGInlineTextBox_h
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgSVGRenderTreeAsTextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp (174745 => 174746)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp        2014-10-15 22:36:08 UTC (rev 174745)
+++ trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp        2014-10-16 00:05:37 UTC (rev 174746)
</span><span class="lines">@@ -364,7 +364,7 @@
</span><span class="cx">
</span><span class="cx"> static void writeRenderSVGTextBox(TextStream& ts, const RenderSVGText& text)
</span><span class="cx"> {
</span><del>- SVGRootInlineBox* box = toSVGRootInlineBox(text.firstRootBox());
</del><ins>+ auto* box = downcast<SVGRootInlineBox>(text.firstRootBox());
</ins><span class="cx"> if (!box)
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="lines">@@ -434,10 +434,10 @@
</span><span class="cx"> static inline void writeSVGInlineTextBoxes(TextStream& ts, const RenderText& text, int indent)
</span><span class="cx"> {
</span><span class="cx"> for (InlineTextBox* box = text.firstTextBox(); box; box = box->nextTextBox()) {
</span><del>- if (!box->isSVGInlineTextBox())
</del><ins>+ if (!is<SVGInlineTextBox>(*box))
</ins><span class="cx"> continue;
</span><span class="cx">
</span><del>- writeSVGInlineTextBox(ts, toSVGInlineTextBox(box), indent);
</del><ins>+ writeSVGInlineTextBox(ts, downcast<SVGInlineTextBox>(box), indent);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgSVGRootInlineBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/SVGRootInlineBox.cpp (174745 => 174746)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/SVGRootInlineBox.cpp        2014-10-15 22:36:08 UTC (rev 174745)
+++ trunk/Source/WebCore/rendering/svg/SVGRootInlineBox.cpp        2014-10-16 00:05:37 UTC (rev 174746)
</span><span class="lines">@@ -56,18 +56,18 @@
</span><span class="cx"> PaintInfo childPaintInfo(paintInfo);
</span><span class="cx"> if (hasSelection) {
</span><span class="cx"> for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) {
</span><del>- if (child->isSVGInlineTextBox())
- toSVGInlineTextBox(child)->paintSelectionBackground(childPaintInfo);
- else if (child->isSVGInlineFlowBox())
- toSVGInlineFlowBox(child)->paintSelectionBackground(childPaintInfo);
</del><ins>+ if (is<SVGInlineTextBox>(*child))
+ downcast<SVGInlineTextBox>(*child).paintSelectionBackground(childPaintInfo);
+ else if (is<SVGInlineFlowBox>(*child))
+ downcast<SVGInlineFlowBox>(*child).paintSelectionBackground(childPaintInfo);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> SVGRenderingContext renderingContext(renderSVGText(), paintInfo, SVGRenderingContext::SaveGraphicsContext);
</span><span class="cx"> if (renderingContext.isRenderingPrepared()) {
</span><span class="cx"> for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) {
</span><del>- if (child->isSVGInlineTextBox())
- SVGInlineFlowBox::computeTextMatchMarkerRectForRenderer(&toSVGInlineTextBox(child)->renderer());
</del><ins>+ if (is<SVGInlineTextBox>(*child))
+ SVGInlineFlowBox::computeTextMatchMarkerRectForRenderer(&downcast<SVGInlineTextBox>(*child).renderer());
</ins><span class="cx">
</span><span class="cx"> child->paint(paintInfo, paintOffset, 0, 0);
</span><span class="cx"> }
</span><span class="lines">@@ -103,31 +103,27 @@
</span><span class="cx"> void SVGRootInlineBox::layoutCharactersInTextBoxes(InlineFlowBox* start, SVGTextLayoutEngine& characterLayout)
</span><span class="cx"> {
</span><span class="cx"> for (InlineBox* child = start->firstChild(); child; child = child->nextOnLine()) {
</span><del>- if (child->isSVGInlineTextBox()) {
- ASSERT(child->renderer().isSVGInlineText());
-
- SVGInlineTextBox* textBox = toSVGInlineTextBox(child);
- characterLayout.layoutInlineTextBox(textBox);
</del><ins>+ if (is<SVGInlineTextBox>(*child)) {
+ ASSERT(is<RenderSVGInlineText>(child->renderer()));
+ characterLayout.layoutInlineTextBox(downcast<SVGInlineTextBox>(child));
</ins><span class="cx"> } else {
</span><span class="cx"> // Skip generated content.
</span><span class="cx"> Node* node = child->renderer().node();
</span><span class="cx"> if (!node)
</span><span class="cx"> continue;
</span><span class="cx">
</span><del>- ASSERT_WITH_SECURITY_IMPLICATION(child->isInlineFlowBox());
-
- SVGInlineFlowBox* flowBox = toSVGInlineFlowBox(child);
</del><ins>+ auto& flowBox = downcast<SVGInlineFlowBox>(*child);
</ins><span class="cx"> bool isTextPath = node->hasTagName(SVGNames::textPathTag);
</span><span class="cx"> if (isTextPath) {
</span><span class="cx"> // Build text chunks for all <textPath> children, using the line layout algorithm.
</span><span class="cx"> // This is needeed as text-anchor is just an additional startOffset for text paths.
</span><span class="cx"> SVGTextLayoutEngine lineLayout(characterLayout.layoutAttributes());
</span><del>- layoutCharactersInTextBoxes(flowBox, lineLayout);
</del><ins>+ layoutCharactersInTextBoxes(&flowBox, lineLayout);
</ins><span class="cx">
</span><span class="cx"> characterLayout.beginTextPathLayout(&child->renderer(), lineLayout);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- layoutCharactersInTextBoxes(flowBox, characterLayout);
</del><ins>+ layoutCharactersInTextBoxes(&flowBox, characterLayout);
</ins><span class="cx">
</span><span class="cx"> if (isTextPath)
</span><span class="cx"> characterLayout.endTextPathLayout();
</span><span class="lines">@@ -139,30 +135,28 @@
</span><span class="cx"> {
</span><span class="cx"> for (InlineBox* child = start->firstChild(); child; child = child->nextOnLine()) {
</span><span class="cx"> FloatRect boxRect;
</span><del>- if (child->isSVGInlineTextBox()) {
- ASSERT(child->renderer().isSVGInlineText());
</del><ins>+ if (is<SVGInlineTextBox>(*child)) {
+ ASSERT(is<RenderSVGInlineText>(child->renderer()));
</ins><span class="cx">
</span><del>- SVGInlineTextBox* textBox = toSVGInlineTextBox(child);
- boxRect = textBox->calculateBoundaries();
- textBox->setX(boxRect.x());
- textBox->setY(boxRect.y());
- textBox->setLogicalWidth(boxRect.width());
- textBox->setLogicalHeight(boxRect.height());
</del><ins>+ auto& textBox = downcast<SVGInlineTextBox>(*child);
+ boxRect = textBox.calculateBoundaries();
+ textBox.setX(boxRect.x());
+ textBox.setY(boxRect.y());
+ textBox.setLogicalWidth(boxRect.width());
+ textBox.setLogicalHeight(boxRect.height());
</ins><span class="cx"> } else {
</span><span class="cx"> // Skip generated content.
</span><span class="cx"> if (!child->renderer().node())
</span><span class="cx"> continue;
</span><span class="cx">
</span><del>- ASSERT_WITH_SECURITY_IMPLICATION(child->isInlineFlowBox());
</del><ins>+ auto& flowBox = downcast<SVGInlineFlowBox>(*child);
+ layoutChildBoxes(&flowBox);
</ins><span class="cx">
</span><del>- SVGInlineFlowBox* flowBox = toSVGInlineFlowBox(child);
- layoutChildBoxes(flowBox);
-
- boxRect = flowBox->calculateBoundaries();
- flowBox->setX(boxRect.x());
- flowBox->setY(boxRect.y());
- flowBox->setLogicalWidth(boxRect.width());
- flowBox->setLogicalHeight(boxRect.height());
</del><ins>+ boxRect = flowBox.calculateBoundaries();
+ flowBox.setX(boxRect.x());
+ flowBox.setY(boxRect.y());
+ flowBox.setLogicalWidth(boxRect.width());
+ flowBox.setLogicalHeight(boxRect.height());
</ins><span class="cx"> }
</span><span class="cx"> if (childRect)
</span><span class="cx"> childRect->unite(boxRect);
</span><span class="lines">@@ -273,7 +267,7 @@
</span><span class="cx"> if (first == last || first == --last)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- if (!(*last)->isSVGInlineTextBox() || !(*first)->isSVGInlineTextBox()) {
</del><ins>+ if (!is<SVGInlineTextBox>(**last) || !is<SVGInlineTextBox>(**first)) {
</ins><span class="cx"> InlineBox* temp = *first;
</span><span class="cx"> *first = *last;
</span><span class="cx"> *last = temp;
</span><span class="lines">@@ -281,18 +275,18 @@
</span><span class="cx"> continue;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- SVGInlineTextBox* firstTextBox = toSVGInlineTextBox(*first);
- SVGInlineTextBox* lastTextBox = toSVGInlineTextBox(*last);
</del><ins>+ auto& firstTextBox = downcast<SVGInlineTextBox>(**first);
+ auto& lastTextBox = downcast<SVGInlineTextBox>(**last);
</ins><span class="cx">
</span><span class="cx"> // Reordering is only necessary for BiDi text that is _absolutely_ positioned.
</span><del>- if (firstTextBox->len() == 1 && firstTextBox->len() == lastTextBox->len()) {
- RenderSVGInlineText& firstContext = firstTextBox->renderer();
- RenderSVGInlineText& lastContext = lastTextBox->renderer();
</del><ins>+ if (firstTextBox.len() == 1 && firstTextBox.len() == lastTextBox.len()) {
+ RenderSVGInlineText& firstContext = firstTextBox.renderer();
+ RenderSVGInlineText& lastContext = lastTextBox.renderer();
</ins><span class="cx">
</span><del>- SVGTextLayoutAttributes* firstAttributes = 0;
- SVGTextLayoutAttributes* lastAttributes = 0;
</del><ins>+ SVGTextLayoutAttributes* firstAttributes = nullptr;
+ SVGTextLayoutAttributes* lastAttributes = nullptr;
</ins><span class="cx"> findFirstAndLastAttributesInVector(attributes, &firstContext, &lastContext, firstAttributes, lastAttributes);
</span><del>- swapItemsInLayoutAttributes(firstAttributes, lastAttributes, firstTextBox->start(), lastTextBox->start());
</del><ins>+ swapItemsInLayoutAttributes(firstAttributes, lastAttributes, firstTextBox.start(), lastTextBox.start());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> InlineBox* temp = *first;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgSVGRootInlineBoxh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/SVGRootInlineBox.h (174745 => 174746)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/SVGRootInlineBox.h        2014-10-15 22:36:08 UTC (rev 174745)
+++ trunk/Source/WebCore/rendering/svg/SVGRootInlineBox.h        2014-10-16 00:05:37 UTC (rev 174746)
</span><span class="lines">@@ -57,8 +57,8 @@
</span><span class="cx"> float m_logicalHeight;
</span><span class="cx"> };
</span><span class="cx">
</span><del>-INLINE_BOX_OBJECT_TYPE_CASTS(SVGRootInlineBox, isSVGRootInlineBox())
-
</del><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><ins>+SPECIALIZE_TYPE_TRAITS_INLINE_BOX(SVGRootInlineBox, isSVGRootInlineBox())
+
</ins><span class="cx"> #endif // SVGRootInlineBox_h
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgSVGTextQuerycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/SVGTextQuery.cpp (174745 => 174746)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/SVGTextQuery.cpp        2014-10-15 22:36:08 UTC (rev 174745)
+++ trunk/Source/WebCore/rendering/svg/SVGTextQuery.cpp        2014-10-16 00:05:37 UTC (rev 174746)
</span><span class="lines">@@ -89,17 +89,17 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> for (InlineBox* child = flowBox->firstChild(); child; child = child->nextOnLine()) {
</span><del>- if (child->isInlineFlowBox()) {
</del><ins>+ if (is<InlineFlowBox>(*child)) {
</ins><span class="cx"> // Skip generated content.
</span><span class="cx"> if (!child->renderer().node())
</span><span class="cx"> continue;
</span><span class="cx">
</span><del>- collectTextBoxesInFlowBox(toInlineFlowBox(child));
</del><ins>+ collectTextBoxesInFlowBox(downcast<InlineFlowBox>(child));
</ins><span class="cx"> continue;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (child->isSVGInlineTextBox())
- m_textBoxes.append(toSVGInlineTextBox(child));
</del><ins>+ if (is<SVGInlineTextBox>(*child))
+ m_textBoxes.append(downcast<SVGInlineTextBox>(child));
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>