<!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>[162472] 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/162472">162472</a></dd>
<dt>Author</dt> <dd>zoltan@webkit.org</dd>
<dt>Date</dt> <dd>2014-01-21 13:33:22 -0800 (Tue, 21 Jan 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Since MidpointState is a class, it should behave like a class
https://bugs.webkit.org/show_bug.cgi?id=127154
Reviewed by David Hyatt.
I modified MidpointState to behave like a class, updated the call sites also.
No new tests, no behavior change.
* platform/text/BidiResolver.h:
(WebCore::MidpointState::reset):
(WebCore::MidpointState::startIgnoringSpaces):
(WebCore::MidpointState::stopIgnoringSpaces):
(WebCore::MidpointState::midpoints):
(WebCore::MidpointState::numMidpoints):
(WebCore::MidpointState::currentMidpoint):
(WebCore::MidpointState::incrementCurrentMidpoint):
(WebCore::MidpointState::decreaseNumMidpoints):
(WebCore::MidpointState::betweenMidpoints):
(WebCore::MidpointState::setBetweenMidpoints):
(WebCore::MidpointState::addMidpoint): Renamed from deprecatedAddMidpoint, since now
its private, we no longer need to discourage callers from using it.
* rendering/InlineIterator.h:
(WebCore::IsolateTracker::addFakeRunIfNecessary):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::appendRunsForObject):
(WebCore::constructBidiRunsForLine):
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::checkMidpoints):
* rendering/line/TrailingObjects.cpp:
(WebCore::TrailingObjects::updateMidpointsForTrailingBoxes):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformtextBidiResolverh">trunk/Source/WebCore/platform/text/BidiResolver.h</a></li>
<li><a href="#trunkSourceWebCorerenderingInlineIteratorh">trunk/Source/WebCore/rendering/InlineIterator.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBlockLineLayoutcpp">trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderinglineBreakingContextInlineHeadersh">trunk/Source/WebCore/rendering/line/BreakingContextInlineHeaders.h</a></li>
<li><a href="#trunkSourceWebCorerenderinglineTrailingObjectscpp">trunk/Source/WebCore/rendering/line/TrailingObjects.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (162471 => 162472)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-01-21 21:29:48 UTC (rev 162471)
+++ trunk/Source/WebCore/ChangeLog        2014-01-21 21:33:22 UTC (rev 162472)
</span><span class="lines">@@ -1,3 +1,37 @@
</span><ins>+2014-01-21 Zoltan Horvath <zoltan@webkit.org>
+
+ Since MidpointState is a class, it should behave like a class
+ https://bugs.webkit.org/show_bug.cgi?id=127154
+
+ Reviewed by David Hyatt.
+
+ I modified MidpointState to behave like a class, updated the call sites also.
+
+ No new tests, no behavior change.
+
+ * platform/text/BidiResolver.h:
+ (WebCore::MidpointState::reset):
+ (WebCore::MidpointState::startIgnoringSpaces):
+ (WebCore::MidpointState::stopIgnoringSpaces):
+ (WebCore::MidpointState::midpoints):
+ (WebCore::MidpointState::numMidpoints):
+ (WebCore::MidpointState::currentMidpoint):
+ (WebCore::MidpointState::incrementCurrentMidpoint):
+ (WebCore::MidpointState::decreaseNumMidpoints):
+ (WebCore::MidpointState::betweenMidpoints):
+ (WebCore::MidpointState::setBetweenMidpoints):
+ (WebCore::MidpointState::addMidpoint): Renamed from deprecatedAddMidpoint, since now
+ its private, we no longer need to discourage callers from using it.
+ * rendering/InlineIterator.h:
+ (WebCore::IsolateTracker::addFakeRunIfNecessary):
+ * rendering/RenderBlockLineLayout.cpp:
+ (WebCore::RenderBlockFlow::appendRunsForObject):
+ (WebCore::constructBidiRunsForLine):
+ * rendering/line/BreakingContextInlineHeaders.h:
+ (WebCore::checkMidpoints):
+ * rendering/line/TrailingObjects.cpp:
+ (WebCore::TrailingObjects::updateMidpointsForTrailingBoxes):
+
</ins><span class="cx"> 2014-01-21 Commit Queue <commit-queue@webkit.org>
</span><span class="cx">
</span><span class="cx"> Unreviewed, rolling out r162452.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformtextBidiResolverh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/text/BidiResolver.h (162471 => 162472)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/text/BidiResolver.h        2014-01-21 21:29:48 UTC (rev 162471)
+++ trunk/Source/WebCore/platform/text/BidiResolver.h        2014-01-21 21:33:22 UTC (rev 162472)
</span><span class="lines">@@ -42,29 +42,21 @@
</span><span class="cx">
</span><span class="cx"> void reset()
</span><span class="cx"> {
</span><del>- numMidpoints = 0;
- currentMidpoint = 0;
- betweenMidpoints = false;
</del><ins>+ m_numMidpoints = 0;
+ m_currentMidpoint = 0;
+ m_betweenMidpoints = false;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- // The goal is to reuse the line state across multiple
- // lines so we just keep an array around for midpoints and never clear it across multiple
- // lines. We track the number of items and position using the two other variables.
- Vector<Iterator> midpoints;
- unsigned numMidpoints;
- unsigned currentMidpoint;
- bool betweenMidpoints;
-
</del><span class="cx"> void startIgnoringSpaces(const Iterator& midpoint)
</span><span class="cx"> {
</span><del>- ASSERT(!(numMidpoints % 2));
- deprecatedAddMidpoint(midpoint);
</del><ins>+ ASSERT(!(m_numMidpoints % 2));
+ addMidpoint(midpoint);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void stopIgnoringSpaces(const Iterator& midpoint)
</span><span class="cx"> {
</span><del>- ASSERT(numMidpoints % 2);
- deprecatedAddMidpoint(midpoint);
</del><ins>+ ASSERT(m_numMidpoints % 2);
+ addMidpoint(midpoint);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // When ignoring spaces, this needs to be called for objects that need line boxes such as RenderInlines or
</span><span class="lines">@@ -75,14 +67,30 @@
</span><span class="cx"> stopIgnoringSpaces(midpoint);
</span><span class="cx"> startIgnoringSpaces(midpoint);
</span><span class="cx"> }
</span><ins>+
+ Vector<Iterator>& midpoints() { return m_midpoints; }
+ const unsigned& numMidpoints() const { return m_numMidpoints; }
+ const unsigned& currentMidpoint() const { return m_currentMidpoint; }
+ void incrementCurrentMidpoint() { ++m_currentMidpoint; }
+ void decreaseNumMidpoints() { --m_numMidpoints; }
+ const bool& betweenMidpoints() const { return m_betweenMidpoints; }
+ void setBetweenMidpoints(bool betweenMidpoint) { m_betweenMidpoints = betweenMidpoint; }
</ins><span class="cx"> private:
</span><del>- void deprecatedAddMidpoint(const Iterator& midpoint)
</del><ins>+ // The goal is to reuse the line state across multiple
+ // lines so we just keep an array around for midpoints and never clear it across multiple
+ // lines. We track the number of items and position using the two other variables.
+ Vector<Iterator> m_midpoints;
+ unsigned m_numMidpoints;
+ unsigned m_currentMidpoint;
+ bool m_betweenMidpoints;
+
+ void addMidpoint(const Iterator& midpoint)
</ins><span class="cx"> {
</span><del>- if (midpoints.size() <= numMidpoints)
- midpoints.grow(numMidpoints + 10);
</del><ins>+ if (m_midpoints.size() <= m_numMidpoints)
+ m_midpoints.grow(m_numMidpoints + 10);
</ins><span class="cx">
</span><del>- Iterator* midpointsIterator = midpoints.data();
- midpointsIterator[numMidpoints++] = midpoint;
</del><ins>+ Iterator* midpointsIterator = m_midpoints.data();
+ midpointsIterator[m_numMidpoints++] = midpoint;
</ins><span class="cx"> }
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingInlineIteratorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/InlineIterator.h (162471 => 162472)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/InlineIterator.h        2014-01-21 21:29:48 UTC (rev 162471)
+++ trunk/Source/WebCore/rendering/InlineIterator.h        2014-01-21 21:33:22 UTC (rev 162472)
</span><span class="lines">@@ -497,9 +497,9 @@
</span><span class="cx"> // For now, if we enter an isolate between midpoints, we increment our current midpoint or else
</span><span class="cx"> // we'll leave the isolate and ignore the content that follows.
</span><span class="cx"> MidpointState<InlineIterator>& midpointState = resolver.midpointState();
</span><del>- if (midpointState.betweenMidpoints && midpointState.midpoints[midpointState.currentMidpoint].renderer() == &obj) {
- midpointState.betweenMidpoints = false;
- ++midpointState.currentMidpoint;
</del><ins>+ if (midpointState.betweenMidpoints() && midpointState.midpoints()[midpointState.currentMidpoint()].renderer() == &obj) {
+ midpointState.setBetweenMidpoints(false);
+ midpointState.incrementCurrentMidpoint();
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockLineLayoutcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (162471 => 162472)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp        2014-01-21 21:29:48 UTC (rev 162471)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp        2014-01-21 21:33:22 UTC (rev 162472)
</span><span class="lines">@@ -83,18 +83,18 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> LineMidpointState& lineMidpointState = resolver.midpointState();
</span><del>- bool haveNextMidpoint = (lineMidpointState.currentMidpoint < lineMidpointState.numMidpoints);
</del><ins>+ bool haveNextMidpoint = (lineMidpointState.currentMidpoint() < lineMidpointState.numMidpoints());
</ins><span class="cx"> InlineIterator nextMidpoint;
</span><span class="cx"> if (haveNextMidpoint)
</span><del>- nextMidpoint = lineMidpointState.midpoints[lineMidpointState.currentMidpoint];
- if (lineMidpointState.betweenMidpoints) {
</del><ins>+ nextMidpoint = lineMidpointState.midpoints()[lineMidpointState.currentMidpoint()];
+ if (lineMidpointState.betweenMidpoints()) {
</ins><span class="cx"> if (!(haveNextMidpoint && nextMidpoint.renderer() == obj))
</span><span class="cx"> return;
</span><span class="cx"> // This is a new start point. Stop ignoring objects and
</span><span class="cx"> // adjust our start.
</span><del>- lineMidpointState.betweenMidpoints = false;
</del><ins>+ lineMidpointState.setBetweenMidpoints(false);
</ins><span class="cx"> start = nextMidpoint.offset();
</span><del>- lineMidpointState.currentMidpoint++;
</del><ins>+ lineMidpointState.incrementCurrentMidpoint();
</ins><span class="cx"> if (start < end)
</span><span class="cx"> return appendRunsForObject(runs, start, end, obj, resolver);
</span><span class="cx"> } else {
</span><span class="lines">@@ -106,8 +106,8 @@
</span><span class="cx"> // An end midpoint has been encountered within our object. We
</span><span class="cx"> // need to go ahead and append a run with our endpoint.
</span><span class="cx"> if (static_cast<int>(nextMidpoint.offset() + 1) <= end) {
</span><del>- lineMidpointState.betweenMidpoints = true;
- lineMidpointState.currentMidpoint++;
</del><ins>+ lineMidpointState.setBetweenMidpoints(true);
+ lineMidpointState.incrementCurrentMidpoint();
</ins><span class="cx"> if (nextMidpoint.offset() != UINT_MAX) { // UINT_MAX means stop at the object and don't include any of it.
</span><span class="cx"> if (static_cast<int>(nextMidpoint.offset() + 1) > start)
</span><span class="cx"> runs.addRun(createRun(start, nextMidpoint.offset() + 1, obj, resolver));
</span><span class="lines">@@ -964,7 +964,7 @@
</span><span class="cx"> segmentMarker->m_startsSegment = true;
</span><span class="cx"> bidiRuns.addRun(segmentMarker);
</span><span class="cx"> // Do not collapse midpoints between segments
</span><del>- topResolver.midpointState().betweenMidpoints = false;
</del><ins>+ topResolver.midpointState().setBetweenMidpoints(false);
</ins><span class="cx"> }
</span><span class="cx"> if (segmentStart == segmentEnd)
</span><span class="cx"> continue;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderinglineBreakingContextInlineHeadersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/line/BreakingContextInlineHeaders.h (162471 => 162472)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/line/BreakingContextInlineHeaders.h        2014-01-21 21:29:48 UTC (rev 162471)
+++ trunk/Source/WebCore/rendering/line/BreakingContextInlineHeaders.h        2014-01-21 21:33:22 UTC (rev 162472)
</span><span class="lines">@@ -1068,16 +1068,16 @@
</span><span class="cx"> // Check to see if our last midpoint is a start point beyond the line break. If so,
</span><span class="cx"> // shave it off the list, and shave off a trailing space if the previous end point doesn't
</span><span class="cx"> // preserve whitespace.
</span><del>- if (lBreak.renderer() && lineMidpointState.numMidpoints && !(lineMidpointState.numMidpoints % 2)) {
- InlineIterator* midpoints = lineMidpointState.midpoints.data();
- InlineIterator& endpoint = midpoints[lineMidpointState.numMidpoints - 2];
- const InlineIterator& startpoint = midpoints[lineMidpointState.numMidpoints - 1];
</del><ins>+ if (lBreak.renderer() && lineMidpointState.numMidpoints() && !(lineMidpointState.numMidpoints() % 2)) {
+ InlineIterator* midpoints = lineMidpointState.midpoints().data();
+ InlineIterator& endpoint = midpoints[lineMidpointState.numMidpoints() - 2];
+ const InlineIterator& startpoint = midpoints[lineMidpointState.numMidpoints() - 1];
</ins><span class="cx"> InlineIterator currpoint = endpoint;
</span><span class="cx"> while (!currpoint.atEnd() && currpoint != startpoint && currpoint != lBreak)
</span><span class="cx"> currpoint.increment();
</span><span class="cx"> if (currpoint == lBreak) {
</span><span class="cx"> // We hit the line break before the start point. Shave off the start point.
</span><del>- lineMidpointState.numMidpoints--;
</del><ins>+ lineMidpointState.decreaseNumMidpoints();
</ins><span class="cx"> if (endpoint.renderer()->style().collapseWhiteSpace() && endpoint.renderer()->isText())
</span><span class="cx"> endpoint.setOffset(endpoint.offset() - 1);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderinglineTrailingObjectscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/line/TrailingObjects.cpp (162471 => 162472)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/line/TrailingObjects.cpp        2014-01-21 21:29:48 UTC (rev 162471)
+++ trunk/Source/WebCore/rendering/line/TrailingObjects.cpp        2014-01-21 21:33:22 UTC (rev 162472)
</span><span class="lines">@@ -36,24 +36,24 @@
</span><span class="cx">
</span><span class="cx"> // This object is either going to be part of the last midpoint, or it is going to be the actual endpoint.
</span><span class="cx"> // In both cases we just decrease our pos by 1 level to exclude the space, allowing it to - in effect - collapse into the newline.
</span><del>- if (lineMidpointState.numMidpoints % 2) {
</del><ins>+ if (lineMidpointState.numMidpoints() % 2) {
</ins><span class="cx"> // Find the trailing space object's midpoint.
</span><del>- int trailingSpaceMidpoint = lineMidpointState.numMidpoints - 1;
- for ( ; trailingSpaceMidpoint > 0 && lineMidpointState.midpoints[trailingSpaceMidpoint].renderer() != m_whitespace; --trailingSpaceMidpoint) { }
</del><ins>+ int trailingSpaceMidpoint = lineMidpointState.numMidpoints() - 1;
+ for ( ; trailingSpaceMidpoint > 0 && lineMidpointState.midpoints()[trailingSpaceMidpoint].renderer() != m_whitespace; --trailingSpaceMidpoint) { }
</ins><span class="cx"> ASSERT(trailingSpaceMidpoint >= 0);
</span><span class="cx"> if (collapseFirstSpace == CollapseFirstSpace)
</span><del>- lineMidpointState.midpoints[trailingSpaceMidpoint].setOffset(lineMidpointState.midpoints[trailingSpaceMidpoint].offset() -1);
</del><ins>+ lineMidpointState.midpoints()[trailingSpaceMidpoint].setOffset(lineMidpointState.midpoints()[trailingSpaceMidpoint].offset() -1);
</ins><span class="cx">
</span><span class="cx"> // Now make sure every single trailingPositionedBox following the trailingSpaceMidpoint properly stops and starts
</span><span class="cx"> // ignoring spaces.
</span><span class="cx"> size_t currentMidpoint = trailingSpaceMidpoint + 1;
</span><span class="cx"> for (size_t i = 0; i < m_boxes.size(); ++i) {
</span><del>- if (currentMidpoint >= lineMidpointState.numMidpoints) {
</del><ins>+ if (currentMidpoint >= lineMidpointState.numMidpoints()) {
</ins><span class="cx"> // We don't have a midpoint for this box yet.
</span><span class="cx"> lineMidpointState.ensureLineBoxInsideIgnoredSpaces(m_boxes[i]);
</span><span class="cx"> } else {
</span><del>- ASSERT(lineMidpointState.midpoints[currentMidpoint].renderer() == m_boxes[i]);
- ASSERT(lineMidpointState.midpoints[currentMidpoint + 1].renderer() == m_boxes[i]);
</del><ins>+ ASSERT(lineMidpointState.midpoints()[currentMidpoint].renderer() == m_boxes[i]);
+ ASSERT(lineMidpointState.midpoints()[currentMidpoint + 1].renderer() == m_boxes[i]);
</ins><span class="cx"> }
</span><span class="cx"> currentMidpoint += 2;
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>