<!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>[181090] 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/181090">181090</a></dd>
<dt>Author</dt> <dd>mmaxfield@apple.com</dd>
<dt>Date</dt> <dd>2015-03-05 11:51:05 -0800 (Thu, 05 Mar 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Mechanical text-related cleanup
https://bugs.webkit.org/show_bug.cgi?id=142326
Reviewed by Andreas Kling.
Use nullptr instead of 0.
Use references instead of pointers.
No new tests because there is no behavior change.
* platform/graphics/cocoa/FontCascadeCocoa.mm:
(WebCore::FontCascade::adjustSelectionRectForComplexText):
(WebCore::FontCascade::getGlyphsAndAdvancesForComplexText):
(WebCore::FontCascade::floatWidthForComplexText):
(WebCore::FontCascade::offsetForPositionForComplexText):
* platform/graphics/mac/ComplexTextController.cpp:
(WebCore::TextLayout::TextLayout):
(WebCore::ComplexTextController::ComplexTextController):
* platform/graphics/mac/ComplexTextController.h:
* rendering/InlineIterator.h:
(WebCore::InlineIterator::InlineIterator):
(WebCore::InlineIterator::clear):
(WebCore::bidiNextShared):
(WebCore::bidiNextSkippingEmptyInlines):
(WebCore::bidiNextIncludingEmptyInlines):
(WebCore::InlineWalker::InlineWalker):
(WebCore::InlineIterator::increment):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::setLogicalWidthForTextRun):
(WebCore::RenderBlockFlow::computeInlineDirectionPositionsForSegment):
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::measureHyphenWidth):
(WebCore::textWidth):
(WebCore::tryHyphenating):
(WebCore::BreakingContext::handleText):
(WebCore::BreakingContext::optimalLineBreakLocationForTrailingWord):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscocoaFontCascadeCocoamm">trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsmacComplexTextControllercpp">trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsmacComplexTextControllerh">trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.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>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (181089 => 181090)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-03-05 19:40:07 UTC (rev 181089)
+++ trunk/Source/WebCore/ChangeLog        2015-03-05 19:51:05 UTC (rev 181090)
</span><span class="lines">@@ -1,3 +1,42 @@
</span><ins>+2015-03-05 Myles C. Maxfield <mmaxfield@apple.com>
+
+ Mechanical text-related cleanup
+ https://bugs.webkit.org/show_bug.cgi?id=142326
+
+ Reviewed by Andreas Kling.
+
+ Use nullptr instead of 0.
+ Use references instead of pointers.
+
+ No new tests because there is no behavior change.
+
+ * platform/graphics/cocoa/FontCascadeCocoa.mm:
+ (WebCore::FontCascade::adjustSelectionRectForComplexText):
+ (WebCore::FontCascade::getGlyphsAndAdvancesForComplexText):
+ (WebCore::FontCascade::floatWidthForComplexText):
+ (WebCore::FontCascade::offsetForPositionForComplexText):
+ * platform/graphics/mac/ComplexTextController.cpp:
+ (WebCore::TextLayout::TextLayout):
+ (WebCore::ComplexTextController::ComplexTextController):
+ * platform/graphics/mac/ComplexTextController.h:
+ * rendering/InlineIterator.h:
+ (WebCore::InlineIterator::InlineIterator):
+ (WebCore::InlineIterator::clear):
+ (WebCore::bidiNextShared):
+ (WebCore::bidiNextSkippingEmptyInlines):
+ (WebCore::bidiNextIncludingEmptyInlines):
+ (WebCore::InlineWalker::InlineWalker):
+ (WebCore::InlineIterator::increment):
+ * rendering/RenderBlockLineLayout.cpp:
+ (WebCore::setLogicalWidthForTextRun):
+ (WebCore::RenderBlockFlow::computeInlineDirectionPositionsForSegment):
+ * rendering/line/BreakingContextInlineHeaders.h:
+ (WebCore::measureHyphenWidth):
+ (WebCore::textWidth):
+ (WebCore::tryHyphenating):
+ (WebCore::BreakingContext::handleText):
+ (WebCore::BreakingContext::optimalLineBreakLocationForTrailingWord):
+
</ins><span class="cx"> 2015-03-05 Brent Fulgham <bfulgham@apple.com>
</span><span class="cx">
</span><span class="cx"> Move AxisScrollSnapAnimator logic to ScrollController
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscocoaFontCascadeCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm (181089 => 181090)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm        2015-03-05 19:40:07 UTC (rev 181089)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm        2015-03-05 19:51:05 UTC (rev 181090)
</span><span class="lines">@@ -589,7 +589,7 @@
</span><span class="cx">
</span><span class="cx"> void FontCascade::adjustSelectionRectForComplexText(const TextRun& run, LayoutRect& selectionRect, int from, int to) const
</span><span class="cx"> {
</span><del>- ComplexTextController controller(this, run);
</del><ins>+ ComplexTextController controller(*this, run);
</ins><span class="cx"> controller.advance(from);
</span><span class="cx"> float beforeWidth = controller.runWidthSoFar();
</span><span class="cx"> controller.advance(to);
</span><span class="lines">@@ -606,7 +606,7 @@
</span><span class="cx"> {
</span><span class="cx"> float initialAdvance;
</span><span class="cx">
</span><del>- ComplexTextController controller(this, run, false, 0, forTextEmphasis);
</del><ins>+ ComplexTextController controller(*this, run, false, 0, forTextEmphasis);
</ins><span class="cx"> controller.advance(from);
</span><span class="cx"> float beforeWidth = controller.runWidthSoFar();
</span><span class="cx"> controller.advance(to, &glyphBuffer);
</span><span class="lines">@@ -656,7 +656,7 @@
</span><span class="cx">
</span><span class="cx"> float FontCascade::floatWidthForComplexText(const TextRun& run, HashSet<const Font*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
</span><span class="cx"> {
</span><del>- ComplexTextController controller(this, run, true, fallbackFonts);
</del><ins>+ ComplexTextController controller(*this, run, true, fallbackFonts);
</ins><span class="cx"> if (glyphOverflow) {
</span><span class="cx"> glyphOverflow->top = std::max<int>(glyphOverflow->top, ceilf(-controller.minGlyphBoundingBoxY()) - (glyphOverflow->computeBounds ? 0 : fontMetrics().ascent()));
</span><span class="cx"> glyphOverflow->bottom = std::max<int>(glyphOverflow->bottom, ceilf(controller.maxGlyphBoundingBoxY()) - (glyphOverflow->computeBounds ? 0 : fontMetrics().descent()));
</span><span class="lines">@@ -668,7 +668,7 @@
</span><span class="cx">
</span><span class="cx"> int FontCascade::offsetForPositionForComplexText(const TextRun& run, float x, bool includePartialGlyphs) const
</span><span class="cx"> {
</span><del>- ComplexTextController controller(this, run);
</del><ins>+ ComplexTextController controller(*this, run);
</ins><span class="cx"> return controller.offsetForPosition(x, includePartialGlyphs);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsmacComplexTextControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp (181089 => 181090)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp        2015-03-05 19:40:07 UTC (rev 181089)
+++ trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp        2015-03-05 19:51:05 UTC (rev 181090)
</span><span class="lines">@@ -53,7 +53,7 @@
</span><span class="cx"> TextLayout(RenderText* text, const FontCascade& font, float xPos)
</span><span class="cx"> : m_font(font)
</span><span class="cx"> , m_run(constructTextRun(text, font, xPos))
</span><del>- , m_controller(std::make_unique<ComplexTextController>(&m_font, m_run, true))
</del><ins>+ , m_controller(std::make_unique<ComplexTextController>(m_font, m_run, true))
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -116,8 +116,8 @@
</span><span class="cx"> return static_cast<CGFloat>(ceil(f));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-ComplexTextController::ComplexTextController(const FontCascade* font, const TextRun& run, bool mayUseNaturalWritingDirection, HashSet<const Font*>* fallbackFonts, bool forTextEmphasis)
- : m_font(*font)
</del><ins>+ComplexTextController::ComplexTextController(const FontCascade& font, const TextRun& run, bool mayUseNaturalWritingDirection, HashSet<const Font*>* fallbackFonts, bool forTextEmphasis)
+ : m_font(font)
</ins><span class="cx"> , m_run(run)
</span><span class="cx"> , m_isLTROnly(true)
</span><span class="cx"> , m_mayUseNaturalWritingDirection(mayUseNaturalWritingDirection)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsmacComplexTextControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.h (181089 => 181090)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.h        2015-03-05 19:40:07 UTC (rev 181089)
+++ trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.h        2015-03-05 19:51:05 UTC (rev 181090)
</span><span class="lines">@@ -50,7 +50,7 @@
</span><span class="cx"> // complex scripts on OS X.
</span><span class="cx"> class ComplexTextController {
</span><span class="cx"> public:
</span><del>- ComplexTextController(const FontCascade*, const TextRun&, bool mayUseNaturalWritingDirection = false, HashSet<const Font*>* fallbackFonts = 0, bool forTextEmphasis = false);
</del><ins>+ ComplexTextController(const FontCascade&, const TextRun&, bool mayUseNaturalWritingDirection = false, HashSet<const Font*>* fallbackFonts = 0, bool forTextEmphasis = false);
</ins><span class="cx">
</span><span class="cx"> // Advance and emit glyphs up to the specified character.
</span><span class="cx"> void advance(unsigned to, GlyphBuffer* = 0, GlyphIterationStyle = IncludePartialGlyphs, HashSet<const Font*>* fallbackFonts = 0);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingInlineIteratorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/InlineIterator.h (181089 => 181090)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/InlineIterator.h        2015-03-05 19:40:07 UTC (rev 181089)
+++ trunk/Source/WebCore/rendering/InlineIterator.h        2015-03-05 19:51:05 UTC (rev 181090)
</span><span class="lines">@@ -37,8 +37,8 @@
</span><span class="cx"> class InlineIterator {
</span><span class="cx"> public:
</span><span class="cx"> InlineIterator()
</span><del>- : m_root(0)
- , m_renderer(0)
</del><ins>+ : m_root(nullptr)
+ , m_renderer(nullptr)
</ins><span class="cx"> , m_nextBreakablePosition(-1)
</span><span class="cx"> , m_pos(0)
</span><span class="cx"> , m_refersToEndOfPreviousNode(false)
</span><span class="lines">@@ -54,7 +54,7 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>- void clear() { moveTo(0, 0); }
</del><ins>+ void clear() { moveTo(nullptr, 0); }
</ins><span class="cx">
</span><span class="cx"> void moveToStartOf(RenderObject* object)
</span><span class="cx"> {
</span><span class="lines">@@ -79,7 +79,7 @@
</span><span class="cx"> void setRefersToEndOfPreviousNode();
</span><span class="cx">
</span><span class="cx"> void fastIncrementInTextNode();
</span><del>- void increment(InlineBidiResolver* = 0);
</del><ins>+ void increment(InlineBidiResolver* = nullptr);
</ins><span class="cx"> void fastDecrement();
</span><span class="cx"> bool atEnd() const;
</span><span class="cx">
</span><span class="lines">@@ -212,7 +212,7 @@
</span><span class="cx"> // This function will iterate over inlines within a block, optionally notifying
</span><span class="cx"> // a bidi resolver as it enters/exits inlines (so it can push/pop embedding levels).
</span><span class="cx"> template <class Observer>
</span><del>-static inline RenderObject* bidiNextShared(RenderElement& root, RenderObject* current, Observer* observer = 0, EmptyInlineBehavior emptyInlineBehavior = SkipEmptyInlines, bool* endOfInlinePtr = 0)
</del><ins>+static inline RenderObject* bidiNextShared(RenderElement& root, RenderObject* current, Observer* observer = nullptr, EmptyInlineBehavior emptyInlineBehavior = SkipEmptyInlines, bool* endOfInlinePtr = nullptr)
</ins><span class="cx"> {
</span><span class="cx"> RenderObject* next = nullptr;
</span><span class="cx"> // oldEndOfInline denotes if when we last stopped iterating if we were at the end of an inline.
</span><span class="lines">@@ -278,13 +278,13 @@
</span><span class="cx"> // This makes callers cleaner as they don't have to specify a type for the observer when not providing one.
</span><span class="cx"> static inline RenderObject* bidiNextSkippingEmptyInlines(RenderElement& root, RenderObject* current)
</span><span class="cx"> {
</span><del>- InlineBidiResolver* observer = 0;
</del><ins>+ InlineBidiResolver* observer = nullptr;
</ins><span class="cx"> return bidiNextSkippingEmptyInlines(root, current, observer);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static inline RenderObject* bidiNextIncludingEmptyInlines(RenderElement& root, RenderObject* current, bool* endOfInlinePtr = 0)
</del><ins>+static inline RenderObject* bidiNextIncludingEmptyInlines(RenderElement& root, RenderObject* current, bool* endOfInlinePtr = nullptr)
</ins><span class="cx"> {
</span><del>- InlineBidiResolver* observer = 0; // Callers who include empty inlines, never use an observer.
</del><ins>+ InlineBidiResolver* observer = nullptr; // Callers who include empty inlines, never use an observer.
</ins><span class="cx"> return bidiNextShared(root, current, observer, IncludeEmptyInlines, endOfInlinePtr);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -353,7 +353,7 @@
</span><span class="cx"> public:
</span><span class="cx"> InlineWalker(RenderElement& root)
</span><span class="cx"> : m_root(root)
</span><del>- , m_current(0)
</del><ins>+ , m_current(nullptr)
</ins><span class="cx"> , m_atEndOfInline(false)
</span><span class="cx"> {
</span><span class="cx"> // FIXME: This class should be taught how to do the SkipEmptyInlines codepath as well.
</span><span class="lines">@@ -387,7 +387,7 @@
</span><span class="cx"> if (m_pos < downcast<RenderText>(*m_renderer).textLength())
</span><span class="cx"> return;
</span><span class="cx"> }
</span><del>- // bidiNext can return 0, so use moveTo instead of moveToStartOf
</del><ins>+ // bidiNext can return nullptr, so use moveTo instead of moveToStartOf
</ins><span class="cx"> moveTo(bidiNextSkippingEmptyInlines(*m_root, m_renderer, resolver), 0);
</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 (181089 => 181090)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp        2015-03-05 19:40:07 UTC (rev 181089)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp        2015-03-05 19:51:05 UTC (rev 181090)
</span><span class="lines">@@ -455,13 +455,13 @@
</span><span class="cx"> setMarginEndForChild(renderer, -endOverhang);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static inline void setLogicalWidthForTextRun(RootInlineBox* lineBox, BidiRun* run, RenderText* renderer, float xPos, const LineInfo& lineInfo,
</del><ins>+static inline void setLogicalWidthForTextRun(RootInlineBox* lineBox, BidiRun* run, RenderText& renderer, float xPos, const LineInfo& lineInfo,
</ins><span class="cx"> GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache& verticalPositionCache, WordMeasurements& wordMeasurements)
</span><span class="cx"> {
</span><span class="cx"> HashSet<const Font*> fallbackFonts;
</span><span class="cx"> GlyphOverflow glyphOverflow;
</span><span class="cx">
</span><del>- const FontCascade& font = lineStyle(*renderer->parent(), lineInfo).fontCascade();
</del><ins>+ const FontCascade& font = lineStyle(*renderer.parent(), lineInfo).fontCascade();
</ins><span class="cx"> // Always compute glyph overflow if the block's line-box-contain value is "glyphs".
</span><span class="cx"> if (lineBox->fitsToGlyphs()) {
</span><span class="cx"> // If we don't stick out of the root line's font box, then don't bother computing our glyph overflow. This optimization
</span><span class="lines">@@ -483,7 +483,7 @@
</span><span class="cx"> float measuredWidth = 0;
</span><span class="cx">
</span><span class="cx"> bool kerningIsEnabled = font.typesettingFeatures() & Kerning;
</span><del>- bool canUseSimpleFontCodePath = renderer->canUseSimpleFontCodePath();
</del><ins>+ bool canUseSimpleFontCodePath = renderer.canUseSimpleFontCodePath();
</ins><span class="cx">
</span><span class="cx"> // Since we don't cache glyph overflows, we need to re-measure the run if
</span><span class="cx"> // the style is linebox-contain: glyph.
</span><span class="lines">@@ -494,18 +494,18 @@
</span><span class="cx"> WordMeasurement& wordMeasurement = wordMeasurements[i];
</span><span class="cx"> if (wordMeasurement.width <= 0 || wordMeasurement.startOffset == wordMeasurement.endOffset)
</span><span class="cx"> continue;
</span><del>- if (wordMeasurement.renderer != renderer || wordMeasurement.startOffset != lastEndOffset || wordMeasurement.endOffset > run->m_stop)
</del><ins>+ if (wordMeasurement.renderer != &renderer || wordMeasurement.startOffset != lastEndOffset || wordMeasurement.endOffset > run->m_stop)
</ins><span class="cx"> continue;
</span><span class="cx">
</span><span class="cx"> lastEndOffset = wordMeasurement.endOffset;
</span><span class="cx"> if (kerningIsEnabled && lastEndOffset == run->m_stop) {
</span><span class="cx"> int wordLength = lastEndOffset - wordMeasurement.startOffset;
</span><span class="cx"> GlyphOverflow overflow;
</span><del>- measuredWidth += renderer->width(wordMeasurement.startOffset, wordLength, xPos + measuredWidth, lineInfo.isFirstLine(),
</del><ins>+ measuredWidth += renderer.width(wordMeasurement.startOffset, wordLength, xPos + measuredWidth, lineInfo.isFirstLine(),
</ins><span class="cx"> &wordMeasurement.fallbackFonts, &overflow);
</span><del>- UChar c = renderer->characterAt(wordMeasurement.startOffset);
</del><ins>+ UChar c = renderer.characterAt(wordMeasurement.startOffset);
</ins><span class="cx"> if (i > 0 && wordLength == 1 && (c == ' ' || c == '\t'))
</span><del>- measuredWidth += renderer->style().fontCascade().wordSpacing();
</del><ins>+ measuredWidth += renderer.style().fontCascade().wordSpacing();
</ins><span class="cx"> } else
</span><span class="cx"> measuredWidth += wordMeasurement.width;
</span><span class="cx"> if (!wordMeasurement.fallbackFonts.isEmpty()) {
</span><span class="lines">@@ -522,7 +522,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (!measuredWidth)
</span><del>- measuredWidth = renderer->width(run->m_start, run->m_stop - run->m_start, xPos, lineInfo.isFirstLine(), &fallbackFonts, &glyphOverflow);
</del><ins>+ measuredWidth = renderer.width(run->m_start, run->m_stop - run->m_start, xPos, lineInfo.isFirstLine(), &fallbackFonts, &glyphOverflow);
</ins><span class="cx">
</span><span class="cx"> run->box()->setLogicalWidth(measuredWidth + hyphenWidth);
</span><span class="cx"> if (!fallbackFonts.isEmpty()) {
</span><span class="lines">@@ -534,7 +534,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Include text decoration visual overflow as part of the glyph overflow.
</span><del>- if (renderer->style().textDecorationsInEffect() != TextDecorationNone)
</del><ins>+ if (renderer.style().textDecorationsInEffect() != TextDecorationNone)
</ins><span class="cx"> glyphOverflow.extendTo(visualOverflowForDecorations(run->box()->lineStyle(), downcast<InlineTextBox>(run->box())));
</span><span class="cx">
</span><span class="cx"> if (!glyphOverflow.isEmpty()) {
</span><span class="lines">@@ -747,7 +747,7 @@
</span><span class="cx"> needsWordSpacing = !isSpaceOrNewline(renderText.characterAt(run->m_stop - 1)) && run->m_stop == length;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- setLogicalWidthForTextRun(lineBox, run, &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><span class="cx"> if (is<RenderRubyRun>(run->renderer()) && textAlign == JUSTIFY && run != trailingSpaceRun && downcast<RenderRubyRun>(run->renderer()).rubyBase()) {
</span></span></pre></div>
<a id="trunkSourceWebCorerenderinglineBreakingContextInlineHeadersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/line/BreakingContextInlineHeaders.h (181089 => 181090)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/line/BreakingContextInlineHeaders.h        2015-03-05 19:40:07 UTC (rev 181089)
+++ trunk/Source/WebCore/rendering/line/BreakingContextInlineHeaders.h        2015-03-05 19:51:05 UTC (rev 181090)
</span><span class="lines">@@ -557,28 +557,28 @@
</span><span class="cx"> downcast<RenderCounter>(renderText).updateCounter();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-inline float measureHyphenWidth(RenderText* renderer, const FontCascade& font, HashSet<const Font*>* fallbackFonts = 0)
</del><ins>+inline float measureHyphenWidth(RenderText& renderer, const FontCascade& font, HashSet<const Font*>* fallbackFonts = 0)
</ins><span class="cx"> {
</span><del>- const RenderStyle& style = renderer->style();
- return font.width(RenderBlock::constructTextRun(renderer, font, style.hyphenString().string(), style), fallbackFonts);
</del><ins>+ const RenderStyle& style = renderer.style();
+ return font.width(RenderBlock::constructTextRun(&renderer, font, style.hyphenString().string(), style), fallbackFonts);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-ALWAYS_INLINE float textWidth(RenderText* text, unsigned from, unsigned len, const FontCascade& font, float xPos, bool isFixedPitch, bool collapseWhiteSpace, HashSet<const Font*>& fallbackFonts, TextLayout* layout = 0)
</del><ins>+ALWAYS_INLINE float textWidth(RenderText& text, unsigned from, unsigned len, const FontCascade& font, float xPos, bool isFixedPitch, bool collapseWhiteSpace, HashSet<const Font*>& fallbackFonts, TextLayout* layout = nullptr)
</ins><span class="cx"> {
</span><del>- const RenderStyle& style = text->style();
</del><ins>+ const RenderStyle& style = text.style();
</ins><span class="cx">
</span><span class="cx"> GlyphOverflow glyphOverflow;
</span><del>- if (isFixedPitch || (!from && len == text->textLength()) || style.hasTextCombine())
- return text->width(from, len, font, xPos, &fallbackFonts, &glyphOverflow);
</del><ins>+ if (isFixedPitch || (!from && len == text.textLength()) || style.hasTextCombine())
+ return text.width(from, len, font, xPos, &fallbackFonts, &glyphOverflow);
</ins><span class="cx">
</span><span class="cx"> if (layout)
</span><span class="cx"> return FontCascade::width(*layout, from, len, &fallbackFonts);
</span><span class="cx">
</span><del>- TextRun run = RenderBlock::constructTextRun(text, font, text, from, len, style);
- run.setCharactersLength(text->textLength() - from);
</del><ins>+ TextRun run = RenderBlock::constructTextRun(&text, font, &text, from, len, style);
+ run.setCharactersLength(text.textLength() - from);
</ins><span class="cx"> ASSERT(run.charactersLength() >= run.length());
</span><span class="cx">
</span><del>- run.setCharacterScanForCodePath(!text->canUseSimpleFontCodePath());
</del><ins>+ run.setCharacterScanForCodePath(!text.canUseSimpleFontCodePath());
</ins><span class="cx"> run.setTabSize(!collapseWhiteSpace, style.tabSize());
</span><span class="cx"> run.setXPos(xPos);
</span><span class="cx"> return font.width(run, &fallbackFonts, &glyphOverflow);
</span><span class="lines">@@ -592,7 +592,7 @@
</span><span class="cx"> lineMidpointState.stopIgnoringSpaces(InlineIterator(0, textParagraphSeparator.renderer(), textParagraphSeparator.offset()));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-inline void tryHyphenating(RenderText* text, const FontCascade& font, const AtomicString& localeIdentifier, unsigned consecutiveHyphenatedLines, int consecutiveHyphenatedLinesLimit, int minimumPrefixLimit, int minimumSuffixLimit, unsigned lastSpace, unsigned pos, float xPos, int availableWidth, bool isFixedPitch, bool collapseWhiteSpace, int lastSpaceWordSpacing, InlineIterator& lineBreak, int nextBreakable, bool& hyphenated)
</del><ins>+inline void tryHyphenating(RenderText& text, const FontCascade& font, const AtomicString& localeIdentifier, unsigned consecutiveHyphenatedLines, int consecutiveHyphenatedLinesLimit, int minimumPrefixLimit, int minimumSuffixLimit, unsigned lastSpace, unsigned pos, float xPos, int availableWidth, bool isFixedPitch, bool collapseWhiteSpace, int lastSpaceWordSpacing, InlineIterator& lineBreak, int nextBreakable, bool& hyphenated)
</ins><span class="cx"> {
</span><span class="cx"> // Map 'hyphenate-limit-{before,after}: auto;' to 2.
</span><span class="cx"> unsigned minimumPrefixLength;
</span><span class="lines">@@ -622,9 +622,9 @@
</span><span class="cx"> if (maxPrefixWidth <= font.pixelSize() * 5 / 4)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- const RenderStyle& style = text->style();
- TextRun run = RenderBlock::constructTextRun(text, font, text, lastSpace, pos - lastSpace, style);
- run.setCharactersLength(text->textLength() - lastSpace);
</del><ins>+ const RenderStyle& style = text.style();
+ TextRun run = RenderBlock::constructTextRun(&text, font, &text, lastSpace, pos - lastSpace, style);
+ run.setCharactersLength(text.textLength() - lastSpace);
</ins><span class="cx"> ASSERT(run.charactersLength() >= run.length());
</span><span class="cx">
</span><span class="cx"> run.setTabSize(!collapseWhiteSpace, style.tabSize());
</span><span class="lines">@@ -634,14 +634,14 @@
</span><span class="cx"> if (prefixLength < minimumPrefixLength)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- prefixLength = lastHyphenLocation(StringView(text->text()).substring(lastSpace, pos - lastSpace), std::min(prefixLength, pos - lastSpace - minimumSuffixLength) + 1, localeIdentifier);
</del><ins>+ prefixLength = lastHyphenLocation(StringView(text.text()).substring(lastSpace, pos - lastSpace), std::min(prefixLength, pos - lastSpace - minimumSuffixLength) + 1, localeIdentifier);
</ins><span class="cx"> if (!prefixLength || prefixLength < minimumPrefixLength)
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> // When lastSpace is a space, which it always is except sometimes at the beginning of a line or after collapsed
</span><span class="cx"> // space, it should not count towards hyphenate-limit-before.
</span><span class="cx"> if (prefixLength == minimumPrefixLength) {
</span><del>- UChar characterAtLastSpace = text->characterAt(lastSpace);
</del><ins>+ UChar characterAtLastSpace = text.characterAt(lastSpace);
</ins><span class="cx"> if (characterAtLastSpace == ' ' || characterAtLastSpace == '\n' || characterAtLastSpace == '\t' || characterAtLastSpace == noBreakSpace)
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="lines">@@ -656,7 +656,7 @@
</span><span class="cx"> UNUSED_PARAM(isFixedPitch);
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>- lineBreak.moveTo(text, lastSpace + prefixLength, nextBreakable);
</del><ins>+ lineBreak.moveTo(&text, lastSpace + prefixLength, nextBreakable);
</ins><span class="cx"> hyphenated = true;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -742,7 +742,7 @@
</span><span class="cx"> m_lineInfo.setEmpty(false, &m_block, &m_width);
</span><span class="cx">
</span><span class="cx"> if (c == softHyphen && m_autoWrap && !hyphenWidth && style.hyphens() != HyphensNone) {
</span><del>- hyphenWidth = measureHyphenWidth(&renderText, font, &fallbackFonts);
</del><ins>+ hyphenWidth = measureHyphenWidth(renderText, font, &fallbackFonts);
</ins><span class="cx"> m_width.addUncommittedWidth(hyphenWidth);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -753,7 +753,7 @@
</span><span class="cx"> if ((breakAll || breakWords) && !midWordBreak && (!m_currentCharacterIsSpace || style.whiteSpace() != PRE_WRAP)) {
</span><span class="cx"> wrapW += charWidth;
</span><span class="cx"> bool midWordBreakIsBeforeSurrogatePair = U16_IS_LEAD(c) && m_current.offset() + 1 < renderText.textLength() && U16_IS_TRAIL(renderText[m_current.offset() + 1]);
</span><del>- charWidth = textWidth(&renderText, m_current.offset(), midWordBreakIsBeforeSurrogatePair ? 2 : 1, font, m_width.committedWidth() + wrapW, isFixedPitch, m_collapseWhiteSpace, fallbackFonts, textLayout);
</del><ins>+ charWidth = textWidth(renderText, m_current.offset(), midWordBreakIsBeforeSurrogatePair ? 2 : 1, font, m_width.committedWidth() + wrapW, isFixedPitch, m_collapseWhiteSpace, fallbackFonts, textLayout);
</ins><span class="cx"> midWordBreak = m_width.committedWidth() + wrapW + charWidth > m_width.availableWidth();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -790,9 +790,9 @@
</span><span class="cx">
</span><span class="cx"> float additionalTempWidth;
</span><span class="cx"> if (wordTrailingSpaceWidth && c == ' ')
</span><del>- additionalTempWidth = textWidth(&renderText, lastSpace, m_current.offset() + 1 - lastSpace, font, m_width.currentWidth(), isFixedPitch, m_collapseWhiteSpace, wordMeasurement.fallbackFonts, textLayout) - wordTrailingSpaceWidth;
</del><ins>+ additionalTempWidth = textWidth(renderText, lastSpace, m_current.offset() + 1 - lastSpace, font, m_width.currentWidth(), isFixedPitch, m_collapseWhiteSpace, wordMeasurement.fallbackFonts, textLayout) - wordTrailingSpaceWidth;
</ins><span class="cx"> else
</span><del>- additionalTempWidth = textWidth(&renderText, lastSpace, m_current.offset() - lastSpace, font, m_width.currentWidth(), isFixedPitch, m_collapseWhiteSpace, wordMeasurement.fallbackFonts, textLayout);
</del><ins>+ additionalTempWidth = textWidth(renderText, lastSpace, m_current.offset() - lastSpace, font, m_width.currentWidth(), isFixedPitch, m_collapseWhiteSpace, wordMeasurement.fallbackFonts, textLayout);
</ins><span class="cx">
</span><span class="cx"> if (wordMeasurement.fallbackFonts.isEmpty() && !fallbackFonts.isEmpty())
</span><span class="cx"> wordMeasurement.fallbackFonts.swap(fallbackFonts);
</span><span class="lines">@@ -820,7 +820,7 @@
</span><span class="cx"> // as candidate width for this line.
</span><span class="cx"> bool lineWasTooWide = false;
</span><span class="cx"> if (m_width.fitsOnLine() && m_currentCharacterIsWS && m_currentStyle->breakOnlyAfterWhiteSpace() && !midWordBreak) {
</span><del>- float charWidth = textWidth(&renderText, m_current.offset(), 1, font, m_width.currentWidth(), isFixedPitch, m_collapseWhiteSpace, wordMeasurement.fallbackFonts, textLayout) + (applyWordSpacing ? wordSpacing : 0);
</del><ins>+ float charWidth = textWidth(renderText, m_current.offset(), 1, font, m_width.currentWidth(), isFixedPitch, m_collapseWhiteSpace, wordMeasurement.fallbackFonts, textLayout) + (applyWordSpacing ? wordSpacing : 0);
</ins><span class="cx"> // Check if line is too big even without the extra space
</span><span class="cx"> // at the end of the line. If it is not, do nothing.
</span><span class="cx"> // If the line needs the extra whitespace to be too long,
</span><span class="lines">@@ -837,7 +837,7 @@
</span><span class="cx"> if (lineWasTooWide || !m_width.fitsOnLine()) {
</span><span class="cx"> if (canHyphenate && !m_width.fitsOnLine()) {
</span><span class="cx"> m_lineBreakHistory.push([&](InlineIterator& modifyMe) {
</span><del>- tryHyphenating(&renderText, font, style.locale(), consecutiveHyphenatedLines, m_blockStyle.hyphenationLimitLines(), style.hyphenationLimitBefore(), style.hyphenationLimitAfter(), lastSpace, m_current.offset(), m_width.currentWidth() - additionalTempWidth, m_width.availableWidth(), isFixedPitch, m_collapseWhiteSpace, lastSpaceWordSpacing, modifyMe, m_current.nextBreakablePosition(), m_lineBreaker.m_hyphenated);
</del><ins>+ tryHyphenating(renderText, font, style.locale(), consecutiveHyphenatedLines, m_blockStyle.hyphenationLimitLines(), style.hyphenationLimitBefore(), style.hyphenationLimitAfter(), lastSpace, m_current.offset(), m_width.currentWidth() - additionalTempWidth, m_width.availableWidth(), isFixedPitch, m_collapseWhiteSpace, lastSpaceWordSpacing, modifyMe, m_current.nextBreakablePosition(), m_lineBreaker.m_hyphenated);
</ins><span class="cx"> });
</span><span class="cx"> if (m_lineBreaker.m_hyphenated) {
</span><span class="cx"> m_atEnd = true;
</span><span class="lines">@@ -970,7 +970,7 @@
</span><span class="cx"> wordMeasurement.renderer = &renderText;
</span><span class="cx">
</span><span class="cx"> // IMPORTANT: current.m_pos is > length here!
</span><del>- float additionalTempWidth = m_ignoringSpaces ? 0 : textWidth(&renderText, lastSpace, m_current.offset() - lastSpace, font, m_width.currentWidth(), isFixedPitch, m_collapseWhiteSpace, wordMeasurement.fallbackFonts, textLayout);
</del><ins>+ float additionalTempWidth = m_ignoringSpaces ? 0 : textWidth(renderText, lastSpace, m_current.offset() - lastSpace, font, m_width.currentWidth(), isFixedPitch, m_collapseWhiteSpace, wordMeasurement.fallbackFonts, textLayout);
</ins><span class="cx"> wordMeasurement.startOffset = lastSpace;
</span><span class="cx"> wordMeasurement.endOffset = m_current.offset();
</span><span class="cx"> wordMeasurement.width = m_ignoringSpaces ? 0 : additionalTempWidth + wordSpacingForWordMeasurement;
</span><span class="lines">@@ -991,7 +991,7 @@
</span><span class="cx"> if (!m_width.fitsOnLine()) {
</span><span class="cx"> if (canHyphenate) {
</span><span class="cx"> m_lineBreakHistory.push([&](InlineIterator& modifyMe) {
</span><del>- tryHyphenating(&renderText, font, style.locale(), consecutiveHyphenatedLines, m_blockStyle.hyphenationLimitLines(), style.hyphenationLimitBefore(), style.hyphenationLimitAfter(), lastSpace, m_current.offset(), m_width.currentWidth() - additionalTempWidth, m_width.availableWidth(), isFixedPitch, m_collapseWhiteSpace, lastSpaceWordSpacing, modifyMe, m_current.nextBreakablePosition(), m_lineBreaker.m_hyphenated);
</del><ins>+ tryHyphenating(renderText, font, style.locale(), consecutiveHyphenatedLines, m_blockStyle.hyphenationLimitLines(), style.hyphenationLimitBefore(), style.hyphenationLimitAfter(), lastSpace, m_current.offset(), m_width.currentWidth() - additionalTempWidth, m_width.availableWidth(), isFixedPitch, m_collapseWhiteSpace, lastSpaceWordSpacing, modifyMe, m_current.nextBreakablePosition(), m_lineBreaker.m_hyphenated);
</ins><span class="cx"> });
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1186,7 +1186,7 @@
</span><span class="cx"> const InlineIterator& candidate = m_lineBreakHistory.get(i);
</span><span class="cx"> if (candidate.renderer() != lineBreak.renderer())
</span><span class="cx"> return best;
</span><del>- float width = textWidth(&renderText, candidate.offset(), renderText.textLength() - candidate.offset(), font, 0, font.isFixedPitch(), m_collapseWhiteSpace, dummyFonts);
</del><ins>+ float width = textWidth(renderText, candidate.offset(), renderText.textLength() - candidate.offset(), font, 0, font.isFixedPitch(), m_collapseWhiteSpace, dummyFonts);
</ins><span class="cx"> if (width > m_width.availableWidth())
</span><span class="cx"> return best;
</span><span class="cx"> if (width / m_width.availableWidth() > optimalTrailingLineRatio) // Subsequent line is long enough
</span></span></pre>
</div>
</div>
</body>
</html>