<!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>[180944] 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/180944">180944</a></dd>
<dt>Author</dt> <dd>mmaxfield@apple.com</dd>
<dt>Date</dt> <dd>2015-03-03 11:13:13 -0800 (Tue, 03 Mar 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>BreakingContext cleanup
https://bugs.webkit.org/show_bug.cgi?id=142146
Reviewed by Dean Jackson.
1. Use commitLineBreakAtCurrentWidth() instead of directly
updating m_width and m_lineBreak, because the name makes the
intent clearer.
2. Remove duplicate function LineBreaker::nextSegmentBreak().
3. lineStyle() takes care of inspecting RenderText's parent's
style.
4. Add FIXME to BreakingContext::initializeForCurrentObject()
because it seems like we are ignoring first-line style for
some properties.
No new tests because there is no behavior change.
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::BreakingContext):
(WebCore::BreakingContext::initializeForCurrentObject):
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::handleText):
(WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):
(WebCore::BreakingContext::handleEndOfLine):
* rendering/line/LineBreaker.cpp:
(WebCore::LineBreaker::nextLineBreak): Deleted.
(WebCore::LineBreaker::nextSegmentBreak): Deleted.
* rendering/line/LineBreaker.h:
* rendering/line/LineInlineHeaders.h:
(WebCore::lineStyle):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorerenderinglineBreakingContextInlineHeadersh">trunk/Source/WebCore/rendering/line/BreakingContextInlineHeaders.h</a></li>
<li><a href="#trunkSourceWebCorerenderinglineLineBreakercpp">trunk/Source/WebCore/rendering/line/LineBreaker.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderinglineLineBreakerh">trunk/Source/WebCore/rendering/line/LineBreaker.h</a></li>
<li><a href="#trunkSourceWebCorerenderinglineLineInlineHeadersh">trunk/Source/WebCore/rendering/line/LineInlineHeaders.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (180943 => 180944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-03-03 18:52:00 UTC (rev 180943)
+++ trunk/Source/WebCore/ChangeLog        2015-03-03 19:13:13 UTC (rev 180944)
</span><span class="lines">@@ -1,3 +1,36 @@
</span><ins>+2015-03-03 Myles C. Maxfield <mmaxfield@apple.com>
+
+ BreakingContext cleanup
+ https://bugs.webkit.org/show_bug.cgi?id=142146
+
+ Reviewed by Dean Jackson.
+
+ 1. Use commitLineBreakAtCurrentWidth() instead of directly
+ updating m_width and m_lineBreak, because the name makes the
+ intent clearer.
+ 2. Remove duplicate function LineBreaker::nextSegmentBreak().
+ 3. lineStyle() takes care of inspecting RenderText's parent's
+ style.
+ 4. Add FIXME to BreakingContext::initializeForCurrentObject()
+ because it seems like we are ignoring first-line style for
+ some properties.
+
+ No new tests because there is no behavior change.
+
+ * rendering/line/BreakingContextInlineHeaders.h:
+ (WebCore::BreakingContext::BreakingContext):
+ (WebCore::BreakingContext::initializeForCurrentObject):
+ (WebCore::BreakingContext::handleReplaced):
+ (WebCore::BreakingContext::handleText):
+ (WebCore::BreakingContext::commitAndUpdateLineBreakIfNeeded):
+ (WebCore::BreakingContext::handleEndOfLine):
+ * rendering/line/LineBreaker.cpp:
+ (WebCore::LineBreaker::nextLineBreak): Deleted.
+ (WebCore::LineBreaker::nextSegmentBreak): Deleted.
+ * rendering/line/LineBreaker.h:
+ * rendering/line/LineInlineHeaders.h:
+ (WebCore::lineStyle):
+
</ins><span class="cx"> 2015-03-03 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><span class="cx"> Make AudioContext suspendable when it is not rendering
</span></span></pre></div>
<a id="trunkSourceWebCorerenderinglineBreakingContextInlineHeadersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/line/BreakingContextInlineHeaders.h (180943 => 180944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/line/BreakingContextInlineHeaders.h        2015-03-03 18:52:00 UTC (rev 180943)
+++ trunk/Source/WebCore/rendering/line/BreakingContextInlineHeaders.h        2015-03-03 19:13:13 UTC (rev 180944)
</span><span class="lines">@@ -71,8 +71,8 @@
</span><span class="cx"> , m_lineBreak(resolver.position())
</span><span class="cx"> , m_block(block)
</span><span class="cx"> , m_lastObject(m_current.renderer())
</span><del>- , m_nextObject(0)
- , m_currentStyle(0)
</del><ins>+ , m_nextObject(nullptr)
+ , m_currentStyle(nullptr)
</ins><span class="cx"> , m_blockStyle(block.style())
</span><span class="cx"> , m_lineInfo(inLineInfo)
</span><span class="cx"> , m_renderTextInfo(inRenderTextInfo)
</span><span class="lines">@@ -144,7 +144,7 @@
</span><span class="cx"> RenderObject* m_lastObject;
</span><span class="cx"> RenderObject* m_nextObject;
</span><span class="cx">
</span><del>- RenderStyle* m_currentStyle;
</del><ins>+ const RenderStyle* m_currentStyle;
</ins><span class="cx">
</span><span class="cx"> // Firefox and Opera will allow a table cell to grow to fit an image inside it under
</span><span class="cx"> // very specific circumstances (in order to match common WinIE renderings).
</span><span class="lines">@@ -194,7 +194,7 @@
</span><span class="cx"> {
</span><span class="cx"> m_hadUncommittedWidthBeforeCurrent = !!m_width.uncommittedWidth();
</span><span class="cx">
</span><del>- m_currentStyle = &m_current.renderer()->style();
</del><ins>+ m_currentStyle = &m_current.renderer()->style(); // FIXME: Should this be &lineStyle(*m_current.renderer(), m_lineInfo); ?
</ins><span class="cx">
</span><span class="cx"> ASSERT(m_currentStyle);
</span><span class="cx">
</span><span class="lines">@@ -424,8 +424,7 @@
</span><span class="cx"> // Break on replaced elements if either has normal white-space.
</span><span class="cx"> if ((m_autoWrap || RenderStyle::autoWrap(m_lastWS)) && (!m_current.renderer()->isImage() || m_allowImagesToBreak)
</span><span class="cx"> && (!m_current.renderer()->isRubyRun() || downcast<RenderRubyRun>(m_current.renderer())->canBreakBefore(m_renderTextInfo.m_lineBreakIterator))) {
</span><del>- m_width.commit();
- m_lineBreak.moveToStartOf(m_current.renderer());
</del><ins>+ commitLineBreakAtCurrentWidth(*m_current.renderer());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (m_ignoringSpaces)
</span><span class="lines">@@ -618,7 +617,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- const RenderStyle& style = lineStyle(*renderText.parent(), m_lineInfo);
</del><ins>+ const RenderStyle& style = lineStyle(renderText, m_lineInfo);
</ins><span class="cx"> const FontCascade& font = style.fontCascade();
</span><span class="cx"> bool isFixedPitch = font.isFixedPitch();
</span><span class="cx"> bool canHyphenate = style.hyphens() == HyphensAuto && WebCore::canHyphenate(style.locale());
</span><span class="lines">@@ -807,16 +806,15 @@
</span><span class="cx"> if (c == '\n' && m_preservesNewline) {
</span><span class="cx"> if (!stoppedIgnoringSpaces && m_current.offset())
</span><span class="cx"> ensureCharacterGetsLineBox(m_lineMidpointState, m_current);
</span><del>- m_lineBreak.moveTo(m_current.renderer(), m_current.offset(), m_current.nextBreakablePosition());
</del><ins>+ commitLineBreakAtCurrentWidth(*m_current.renderer(), m_current.offset(), m_current.nextBreakablePosition());
</ins><span class="cx"> m_lineBreak.increment();
</span><span class="cx"> m_lineInfo.setPreviousLineBrokeCleanly(true);
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (m_autoWrap && betweenWords) {
</span><del>- m_width.commit();
</del><ins>+ commitLineBreakAtCurrentWidth(*m_current.renderer(), m_current.offset(), m_current.nextBreakablePosition());
</ins><span class="cx"> wrapW = 0;
</span><del>- m_lineBreak.moveTo(m_current.renderer(), m_current.offset(), m_current.nextBreakablePosition());
</del><span class="cx"> // Auto-wrapping text should not wrap in the middle of a word once it has had an
</span><span class="cx"> // opportunity to break after a word.
</span><span class="cx"> breakWords = false;
</span><span class="lines">@@ -1011,8 +1009,7 @@
</span><span class="cx"> if (!m_current.renderer()->isFloatingOrOutOfFlowPositioned()) {
</span><span class="cx"> m_lastObject = m_current.renderer();
</span><span class="cx"> if (m_lastObject->isReplaced() && m_autoWrap && !m_lastObject->isRubyRun() && (!m_lastObject->isImage() || m_allowImagesToBreak) && (!is<RenderListMarker>(*m_lastObject) || downcast<RenderListMarker>(*m_lastObject).isInside())) {
</span><del>- m_width.commit();
- m_lineBreak.moveToStartOf(m_nextObject);
</del><ins>+ commitLineBreakAtCurrentWidth(*m_nextObject);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -1046,13 +1043,13 @@
</span><span class="cx"> if (m_lineBreak == m_resolver.position()) {
</span><span class="cx"> if (!m_lineBreak.renderer() || !m_lineBreak.renderer()->isBR()) {
</span><span class="cx"> // we just add as much as possible
</span><del>- if (m_blockStyle.whiteSpace() == PRE && !m_current.offset()) {
- m_lineBreak.moveTo(m_lastObject, m_lastObject->isText() ? m_lastObject->length() : 0);
- } else if (m_lineBreak.renderer()) {
</del><ins>+ if (m_blockStyle.whiteSpace() == PRE && !m_current.offset())
+ commitLineBreakAtCurrentWidth(*m_lastObject, m_lastObject->isText() ? m_lastObject->length() : 0);
+ else if (m_lineBreak.renderer()) {
</ins><span class="cx"> // Don't ever break in the middle of a word if we can help it.
</span><span class="cx"> // There's no room at all. We just have to be on this line,
</span><span class="cx"> // even though we'll spill out.
</span><del>- m_lineBreak.moveTo(m_current.renderer(), m_current.offset());
</del><ins>+ commitLineBreakAtCurrentWidth(*m_current.renderer(), m_current.offset());
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> // make sure we consume at least one char/object.
</span></span></pre></div>
<a id="trunkSourceWebCorerenderinglineLineBreakercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/line/LineBreaker.cpp (180943 => 180944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/line/LineBreaker.cpp        2015-03-03 18:52:00 UTC (rev 180943)
+++ trunk/Source/WebCore/rendering/line/LineBreaker.cpp        2015-03-03 19:13:13 UTC (rev 180944)
</span><span class="lines">@@ -79,11 +79,6 @@
</span><span class="cx">
</span><span class="cx"> InlineIterator LineBreaker::nextLineBreak(InlineBidiResolver& resolver, LineInfo& lineInfo, RenderTextInfo& renderTextInfo, FloatingObject* lastFloatFromPreviousLine, unsigned consecutiveHyphenatedLines, WordMeasurements& wordMeasurements)
</span><span class="cx"> {
</span><del>- return nextSegmentBreak(resolver, lineInfo, renderTextInfo, lastFloatFromPreviousLine, consecutiveHyphenatedLines, wordMeasurements);
-}
-
-InlineIterator LineBreaker::nextSegmentBreak(InlineBidiResolver& resolver, LineInfo& lineInfo, RenderTextInfo& renderTextInfo, FloatingObject* lastFloatFromPreviousLine, unsigned consecutiveHyphenatedLines, WordMeasurements& wordMeasurements)
-{
</del><span class="cx"> reset();
</span><span class="cx">
</span><span class="cx"> ASSERT(resolver.position().root() == &m_block);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderinglineLineBreakerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/line/LineBreaker.h (180943 => 180944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/line/LineBreaker.h        2015-03-03 18:52:00 UTC (rev 180943)
+++ trunk/Source/WebCore/rendering/line/LineBreaker.h        2015-03-03 19:13:13 UTC (rev 180944)
</span><span class="lines">@@ -64,7 +64,6 @@
</span><span class="cx"> private:
</span><span class="cx"> void reset();
</span><span class="cx">
</span><del>- InlineIterator nextSegmentBreak(InlineBidiResolver&, LineInfo&, RenderTextInfo&, FloatingObject* lastFloatFromPreviousLine, unsigned consecutiveHyphenatedLines, WordMeasurements&);
</del><span class="cx"> void skipTrailingWhitespace(InlineIterator&, const LineInfo&);
</span><span class="cx"> void skipLeadingWhitespace(InlineBidiResolver&, LineInfo&, FloatingObject* lastFloatFromPreviousLine, LineWidth&);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorerenderinglineLineInlineHeadersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/line/LineInlineHeaders.h (180943 => 180944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/line/LineInlineHeaders.h        2015-03-03 18:52:00 UTC (rev 180943)
+++ trunk/Source/WebCore/rendering/line/LineInlineHeaders.h        2015-03-03 19:13:13 UTC (rev 180944)
</span><span class="lines">@@ -43,7 +43,7 @@
</span><span class="cx"> return shouldApplyEndBorderPaddingOrMargin && (flow.borderEnd() || flow.marginEnd() || flow.paddingEnd());
</span><span class="cx"> }
</span><span class="cx">
</span><del>-inline const RenderStyle& lineStyle(const RenderElement& renderer, const LineInfo& lineInfo)
</del><ins>+inline const RenderStyle& lineStyle(const RenderObject& renderer, const LineInfo& lineInfo)
</ins><span class="cx"> {
</span><span class="cx"> return lineInfo.isFirstLine() ? renderer.firstLineStyle() : renderer.style();
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>