<!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>[183996] trunk</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/183996">183996</a></dd>
<dt>Author</dt> <dd>mmaxfield@apple.com</dd>
<dt>Date</dt> <dd>2015-05-08 10:18:00 -0700 (Fri, 08 May 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Remove convenience constructors for TextRun
https://bugs.webkit.org/show_bug.cgi?id=144752
Source/WebCore:
These convenience constructors are unnecessary. Moving the code that makes the StringView
back to the call site will also help us make things more elegant in future refactoring.
Reviewed by Darin Adler.
No new tests because there is no behavior change.
* css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText): Remove ambiguous call.
* platform/graphics/StringTruncator.cpp:
(WebCore::stringWidth):
* platform/graphics/TextRun.h:
(WebCore::TextRun::TextRun):
* platform/mac/DragImageMac.mm:
(WebCore::widthWithFont):
(WebCore::drawAtPoint):
* rendering/SimpleLineLayout.cpp:
(WebCore::SimpleLineLayout::canUseFor):
* rendering/SimpleLineLayoutTextFragmentIterator.cpp:
(WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style):
(WebCore::SimpleLineLayout::TextFragmentIterator::runWidth):
* rendering/TextPainter.cpp:
(WebCore::TextPainter::paintText):
Source/WebKit/mac:
These convenience constructors are unnecessary. Moving the code that makes the StringView
back to the call site will also help us make things more elegant in future refactoring.
Reviewed by Darin Adler.
No new tests because there is no behavior change.
* Misc/WebKitNSStringExtras.mm:
(-[NSString _web_drawAtPoint:font:textColor:allowingFontSmoothing:]):
(-[NSString _web_widthWithFont:]):
Source/WTF:
Reviewed by Anders Carlsson.
No reason why StringView shouldn't have a StringImpl* constructor.
Test: StringView8Bit in TestWebKitAPI
* wtf/text/StringView.h: Add the constructor.
Tools:
Reviewed by Anders Carlsson.
Test the StringView which takes a StringImpl*.
* TestWebKitAPI/Tests/WTF/StringView.cpp:
(StringView8Bit): Testing is8Bit() on StringView</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtftextStringViewh">trunk/Source/WTF/wtf/text/StringView.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssCSSPrimitiveValuecpp">trunk/Source/WebCore/css/CSSPrimitiveValue.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsStringTruncatorcpp">trunk/Source/WebCore/platform/graphics/StringTruncator.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsTextRunh">trunk/Source/WebCore/platform/graphics/TextRun.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmacDragImageMacmm">trunk/Source/WebCore/platform/mac/DragImageMac.mm</a></li>
<li><a href="#trunkSourceWebCorerenderingSimpleLineLayoutTextFragmentIteratorcpp">trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingTextPaintercpp">trunk/Source/WebCore/rendering/TextPainter.cpp</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacMiscWebKitNSStringExtrasmm">trunk/Source/WebKit/mac/Misc/WebKitNSStringExtras.mm</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWTFStringViewcpp">trunk/Tools/TestWebKitAPI/Tests/WTF/StringView.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (183995 => 183996)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2015-05-08 16:09:42 UTC (rev 183995)
+++ trunk/Source/WTF/ChangeLog        2015-05-08 17:18:00 UTC (rev 183996)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2015-05-08 Myles C. Maxfield <mmaxfield@apple.com>
+
+ Remove convenience constructors for TextRun
+ https://bugs.webkit.org/show_bug.cgi?id=144752
+
+ Reviewed by Anders Carlsson.
+
+ No reason why StringView shouldn't have a StringImpl* constructor.
+
+ Test: StringView8Bit in TestWebKitAPI
+
+ * wtf/text/StringView.h: Add the constructor.
+
</ins><span class="cx"> 2015-05-08 Andreas Kling <akling@apple.com>
</span><span class="cx">
</span><span class="cx"> Optimize serialization of quoted JSON strings.
</span></span></pre></div>
<a id="trunkSourceWTFwtftextStringViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/text/StringView.h (183995 => 183996)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/text/StringView.h        2015-05-08 16:09:42 UTC (rev 183995)
+++ trunk/Source/WTF/wtf/text/StringView.h        2015-05-08 17:18:00 UTC (rev 183996)
</span><span class="lines">@@ -58,6 +58,7 @@
</span><span class="cx">
</span><span class="cx"> StringView(const String&);
</span><span class="cx"> StringView(const StringImpl&);
</span><ins>+ StringView(const StringImpl*);
</ins><span class="cx"> StringView(const LChar*, unsigned length);
</span><span class="cx"> StringView(const UChar*, unsigned length);
</span><span class="cx">
</span><span class="lines">@@ -271,6 +272,18 @@
</span><span class="cx"> initialize(string.characters16(), string.length());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+inline StringView::StringView(const StringImpl* string)
+{
+ if (!string)
+ return;
+
+ setUnderlyingString(string);
+ if (string->is8Bit())
+ initialize(string->characters8(), string->length());
+ else
+ initialize(string->characters16(), string->length());
+}
+
</ins><span class="cx"> inline StringView::StringView(const String& string)
</span><span class="cx"> {
</span><span class="cx"> setUnderlyingString(string.impl());
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (183995 => 183996)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-05-08 16:09:42 UTC (rev 183995)
+++ trunk/Source/WebCore/ChangeLog        2015-05-08 17:18:00 UTC (rev 183996)
</span><span class="lines">@@ -1,3 +1,32 @@
</span><ins>+2015-05-08 Myles C. Maxfield <mmaxfield@apple.com>
+
+ Remove convenience constructors for TextRun
+ https://bugs.webkit.org/show_bug.cgi?id=144752
+
+ These convenience constructors are unnecessary. Moving the code that makes the StringView
+ back to the call site will also help us make things more elegant in future refactoring.
+
+ Reviewed by Darin Adler.
+
+ No new tests because there is no behavior change.
+
+ * css/CSSPrimitiveValue.cpp:
+ (WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText): Remove ambiguous call.
+ * platform/graphics/StringTruncator.cpp:
+ (WebCore::stringWidth):
+ * platform/graphics/TextRun.h:
+ (WebCore::TextRun::TextRun):
+ * platform/mac/DragImageMac.mm:
+ (WebCore::widthWithFont):
+ (WebCore::drawAtPoint):
+ * rendering/SimpleLineLayout.cpp:
+ (WebCore::SimpleLineLayout::canUseFor):
+ * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
+ (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style):
+ (WebCore::SimpleLineLayout::TextFragmentIterator::runWidth):
+ * rendering/TextPainter.cpp:
+ (WebCore::TextPainter::paintText):
+
</ins><span class="cx"> 2015-05-08 Xabier Rodriguez Calvar <calvaris@igalia.com> and Youenn Fablet <youenn.fablet@crf.canon.fr>
</span><span class="cx">
</span><span class="cx"> [Streams API] ReadableStream constructor start function should be able to error the stream
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSPrimitiveValuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSPrimitiveValue.cpp (183995 => 183996)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSPrimitiveValue.cpp        2015-05-08 16:09:42 UTC (rev 183995)
+++ trunk/Source/WebCore/css/CSSPrimitiveValue.cpp        2015-05-08 17:18:00 UTC (rev 183996)
</span><span class="lines">@@ -1051,7 +1051,7 @@
</span><span class="cx"> StringBuilder result;
</span><span class="cx"> result.reserveCapacity(6 + m_value.string->length());
</span><span class="cx"> result.appendLiteral("attr(");
</span><del>- result.append(m_value.string);
</del><ins>+ result.append(String(m_value.string));
</ins><span class="cx"> result.append(')');
</span><span class="cx">
</span><span class="cx"> return result.toString();
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsStringTruncatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/StringTruncator.cpp (183995 => 183996)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/StringTruncator.cpp        2015-05-08 16:09:42 UTC (rev 183995)
+++ trunk/Source/WebCore/platform/graphics/StringTruncator.cpp        2015-05-08 17:18:00 UTC (rev 183996)
</span><span class="lines">@@ -194,7 +194,7 @@
</span><span class="cx">
</span><span class="cx"> static float stringWidth(const FontCascade& renderer, const UChar* characters, unsigned length, bool disableRoundingHacks)
</span><span class="cx"> {
</span><del>- TextRun run(characters, length);
</del><ins>+ TextRun run(StringView(characters, length));
</ins><span class="cx"> if (disableRoundingHacks)
</span><span class="cx"> run.disableRoundingHacks();
</span><span class="cx"> return renderer.width(run);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsTextRunh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/TextRun.h (183995 => 183996)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/TextRun.h        2015-05-08 16:09:42 UTC (rev 183995)
+++ trunk/Source/WebCore/platform/graphics/TextRun.h        2015-05-08 17:18:00 UTC (rev 183996)
</span><span class="lines">@@ -52,9 +52,9 @@
</span><span class="cx">
</span><span class="cx"> typedef unsigned RoundingHacks;
</span><span class="cx">
</span><del>- explicit TextRun(StringView s, float xpos = 0, float expansion = 0, ExpansionBehavior expansionBehavior = AllowTrailingExpansion | ForbidLeadingExpansion, TextDirection direction = LTR, bool directionalOverride = false, bool characterScanForCodePath = true, RoundingHacks roundingHacks = RunRounding | WordRounding)
- : m_text(s)
- , m_charactersLength(s.length())
</del><ins>+ explicit TextRun(StringView text, float xpos = 0, float expansion = 0, ExpansionBehavior expansionBehavior = AllowTrailingExpansion | ForbidLeadingExpansion, TextDirection direction = LTR, bool directionalOverride = false, bool characterScanForCodePath = true, RoundingHacks roundingHacks = RunRounding | WordRounding)
+ : m_text(text)
+ , m_charactersLength(text.length())
</ins><span class="cx"> , m_tabSize(0)
</span><span class="cx"> , m_xpos(xpos)
</span><span class="cx"> , m_horizontalGlyphStretch(1)
</span><span class="lines">@@ -70,21 +70,6 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>- explicit TextRun(const String& s)
- : TextRun(StringView(s))
- {
- }
-
- TextRun(const LChar* c, unsigned len)
- : TextRun(StringView(c, len))
- {
- }
-
- TextRun(const UChar* c, unsigned len)
- : TextRun(StringView(c, len))
- {
- }
-
</del><span class="cx"> TextRun subRun(unsigned startOffset, unsigned length) const
</span><span class="cx"> {
</span><span class="cx"> ASSERT_WITH_SECURITY_IMPLICATION(startOffset < m_text.length());
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmacDragImageMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mac/DragImageMac.mm (183995 => 183996)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/DragImageMac.mm        2015-05-08 16:09:42 UTC (rev 183995)
+++ trunk/Source/WebCore/platform/mac/DragImageMac.mm        2015-05-08 17:18:00 UTC (rev 183996)
</span><span class="lines">@@ -192,7 +192,7 @@
</span><span class="cx">
</span><span class="cx"> if (canUseFastRenderer(buffer.data(), length)) {
</span><span class="cx"> FontCascade webCoreFont(FontPlatformData(reinterpret_cast<CTFontRef>(font), [font pointSize]));
</span><del>- TextRun run(buffer.data(), length);
</del><ins>+ TextRun run(StringView(buffer.data(), length));
</ins><span class="cx"> run.disableRoundingHacks();
</span><span class="cx"> return webCoreFont.width(run);
</span><span class="cx"> }
</span><span class="lines">@@ -224,7 +224,7 @@
</span><span class="cx"> CGContextScaleCTM(cgContext, 1, -1);
</span><span class="cx">
</span><span class="cx"> FontCascade webCoreFont(FontPlatformData(reinterpret_cast<CTFontRef>(font), [font pointSize]), Antialiased);
</span><del>- TextRun run(buffer.data(), length);
</del><ins>+ TextRun run(StringView(buffer.data(), length));
</ins><span class="cx"> run.disableRoundingHacks();
</span><span class="cx">
</span><span class="cx"> CGFloat red;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingSimpleLineLayoutTextFragmentIteratorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp (183995 => 183996)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp        2015-05-08 16:09:42 UTC (rev 183995)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp        2015-05-08 17:18:00 UTC (rev 183996)
</span><span class="lines">@@ -40,7 +40,7 @@
</span><span class="cx"> , preserveNewline(style.preserveNewline())
</span><span class="cx"> , wrapLines(style.autoWrap())
</span><span class="cx"> , breakWordOnOverflow(style.overflowWrap() == BreakOverflowWrap && (wrapLines || preserveNewline))
</span><del>- , spaceWidth(font.width(TextRun(&space, 1)))
</del><ins>+ , spaceWidth(font.width(TextRun(StringView(&space, 1))))
</ins><span class="cx"> , tabWidth(collapseWhitespace ? 0 : style.tabSize())
</span><span class="cx"> , locale(style.locale())
</span><span class="cx"> {
</span><span class="lines">@@ -197,7 +197,7 @@
</span><span class="cx"> bool measureWithEndSpace = m_style.collapseWhitespace && segmentTo < segment.text.length() && segment.text[segmentTo] == ' ';
</span><span class="cx"> if (measureWithEndSpace)
</span><span class="cx"> ++segmentTo;
</span><del>- TextRun run(segment.text.characters<CharacterType>() + segmentFrom, segmentTo - segmentFrom);
</del><ins>+ TextRun run(StringView(segment.text.substring(segmentFrom, segmentTo - segmentFrom)));
</ins><span class="cx"> run.setXPos(xPosition);
</span><span class="cx"> run.setTabSize(!!m_style.tabWidth, m_style.tabWidth);
</span><span class="cx"> float width = m_style.font.width(run);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingTextPaintercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/TextPainter.cpp (183995 => 183996)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/TextPainter.cpp        2015-05-08 16:09:42 UTC (rev 183995)
+++ trunk/Source/WebCore/rendering/TextPainter.cpp        2015-05-08 17:18:00 UTC (rev 183996)
</span><span class="lines">@@ -170,7 +170,7 @@
</span><span class="cx"> if (!m_emphasisMark.isEmpty()) {
</span><span class="cx"> updateGraphicsContext(m_context, m_textPaintStyle, UseEmphasisMarkColor);
</span><span class="cx">
</span><del>- static NeverDestroyed<TextRun> objectReplacementCharacterTextRun(&objectReplacementCharacter, 1);
</del><ins>+ static NeverDestroyed<TextRun> objectReplacementCharacterTextRun(StringView(&objectReplacementCharacter, 1));
</ins><span class="cx"> TextRun& emphasisMarkTextRun = m_combinedText ? objectReplacementCharacterTextRun.get() : m_textRun;
</span><span class="cx"> FloatPoint emphasisMarkTextOrigin = m_combinedText ? FloatPoint(boxOrigin.x() + m_boxRect.width() / 2, boxOrigin.y() + m_font.fontMetrics().ascent()) : m_textOrigin;
</span><span class="cx"> if (m_combinedText)
</span><span class="lines">@@ -196,7 +196,7 @@
</span><span class="cx"> if (!m_emphasisMark.isEmpty()) {
</span><span class="cx"> updateGraphicsContext(m_context, m_selectionPaintStyle, UseEmphasisMarkColor);
</span><span class="cx">
</span><del>- DEPRECATED_DEFINE_STATIC_LOCAL(TextRun, objectReplacementCharacterTextRun, (&objectReplacementCharacter, 1));
</del><ins>+ DEPRECATED_DEFINE_STATIC_LOCAL(TextRun, objectReplacementCharacterTextRun, (StringView(&objectReplacementCharacter, 1)));
</ins><span class="cx"> TextRun& emphasisMarkTextRun = m_combinedText ? objectReplacementCharacterTextRun : m_textRun;
</span><span class="cx"> FloatPoint emphasisMarkTextOrigin = m_combinedText ? FloatPoint(boxOrigin.x() + m_boxRect.width() / 2, boxOrigin.y() + m_font.fontMetrics().ascent()) : m_textOrigin;
</span><span class="cx"> if (m_combinedText)
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (183995 => 183996)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2015-05-08 16:09:42 UTC (rev 183995)
+++ trunk/Source/WebKit/mac/ChangeLog        2015-05-08 17:18:00 UTC (rev 183996)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2015-05-08 Myles C. Maxfield <mmaxfield@apple.com>
+
+ Remove convenience constructors for TextRun
+ https://bugs.webkit.org/show_bug.cgi?id=144752
+
+ These convenience constructors are unnecessary. Moving the code that makes the StringView
+ back to the call site will also help us make things more elegant in future refactoring.
+
+ Reviewed by Darin Adler.
+
+ No new tests because there is no behavior change.
+
+ * Misc/WebKitNSStringExtras.mm:
+ (-[NSString _web_drawAtPoint:font:textColor:allowingFontSmoothing:]):
+ (-[NSString _web_widthWithFont:]):
+
</ins><span class="cx"> 2015-05-07 Anders Carlsson <andersca@apple.com>
</span><span class="cx">
</span><span class="cx"> Build fixes.
</span></span></pre></div>
<a id="trunkSourceWebKitmacMiscWebKitNSStringExtrasmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Misc/WebKitNSStringExtras.mm (183995 => 183996)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Misc/WebKitNSStringExtras.mm        2015-05-08 16:09:42 UTC (rev 183995)
+++ trunk/Source/WebKit/mac/Misc/WebKitNSStringExtras.mm        2015-05-08 17:18:00 UTC (rev 183996)
</span><span class="lines">@@ -93,7 +93,7 @@
</span><span class="cx"> CGContextScaleCTM(cgContext, 1, -1);
</span><span class="cx">
</span><span class="cx"> FontCascade webCoreFont(FontPlatformData(reinterpret_cast<CTFontRef>(font), [font pointSize]), fontSmoothingIsAllowed ? AutoSmoothing : Antialiased);
</span><del>- TextRun run(buffer.data(), length);
</del><ins>+ TextRun run(StringView(buffer.data(), length));
</ins><span class="cx"> run.disableRoundingHacks();
</span><span class="cx">
</span><span class="cx"> CGFloat red;
</span><span class="lines">@@ -139,7 +139,7 @@
</span><span class="cx">
</span><span class="cx"> if (canUseFastRenderer(buffer.data(), length)) {
</span><span class="cx"> FontCascade webCoreFont(FontPlatformData(reinterpret_cast<CTFontRef>(font), [font pointSize]));
</span><del>- TextRun run(buffer.data(), length);
</del><ins>+ TextRun run(StringView(buffer.data(), length));
</ins><span class="cx"> run.disableRoundingHacks();
</span><span class="cx"> return webCoreFont.width(run);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (183995 => 183996)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2015-05-08 16:09:42 UTC (rev 183995)
+++ trunk/Tools/ChangeLog        2015-05-08 17:18:00 UTC (rev 183996)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2015-05-08 Myles C. Maxfield <mmaxfield@apple.com>
+
+ Remove convenience constructors for TextRun
+ https://bugs.webkit.org/show_bug.cgi?id=144752
+
+ Reviewed by Anders Carlsson.
+
+ Test the StringView which takes a StringImpl*.
+
+ * TestWebKitAPI/Tests/WTF/StringView.cpp:
+ (StringView8Bit): Testing is8Bit() on StringView
+
</ins><span class="cx"> 2015-05-08 Carlos Garcia Campos <cgarcia@igalia.com>
</span><span class="cx">
</span><span class="cx"> [GTK] WTR doesn't correctly handle the Escape key
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWTFStringViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/StringView.cpp (183995 => 183996)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WTF/StringView.cpp        2015-05-08 16:09:42 UTC (rev 183995)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/StringView.cpp        2015-05-08 17:18:00 UTC (rev 183996)
</span><span class="lines">@@ -697,4 +697,23 @@
</span><span class="cx"> EXPECT_FALSE(referenceUTF8.endsWithIgnoringASCIICase(reference));
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+TEST(WTF, StringView8Bit)
+{
+ StringView nullView;
+ StringView emptyView = StringView::empty();
+ EXPECT_TRUE(StringView().is8Bit());
+ EXPECT_TRUE(StringView::empty().is8Bit());
+
+ LChar* lcharPtr = nullptr;
+ UChar* ucharPtr = nullptr;
+ EXPECT_TRUE(StringView(lcharPtr, 0).is8Bit());
+ EXPECT_FALSE(StringView(ucharPtr, 0).is8Bit());
+
+ EXPECT_TRUE(StringView(String(lcharPtr, 0)).is8Bit());
+ EXPECT_TRUE(StringView(String(ucharPtr, 0)).is8Bit());
+
+ EXPECT_TRUE(StringView(String().impl()).is8Bit());
+ EXPECT_TRUE(StringView(emptyString().impl()).is8Bit());
+}
+
</ins><span class="cx"> } // namespace TestWebKitAPI
</span></span></pre>
</div>
</div>
</body>
</html>