Diff
Modified: trunk/Source/WTF/ChangeLog (184002 => 184003)
--- trunk/Source/WTF/ChangeLog 2015-05-08 18:59:31 UTC (rev 184002)
+++ trunk/Source/WTF/ChangeLog 2015-05-08 19:01:03 UTC (rev 184003)
@@ -1,3 +1,16 @@
+2015-05-08 Commit Queue <[email protected]>
+
+ Unreviewed, rolling out r183996.
+ https://bugs.webkit.org/show_bug.cgi?id=144806
+
+ ASan detected use-after free (Requested by ap on #webkit).
+
+ Reverted changeset:
+
+ "Remove convenience constructors for TextRun"
+ https://bugs.webkit.org/show_bug.cgi?id=144752
+ http://trac.webkit.org/changeset/183996
+
2015-05-08 Myles C. Maxfield <[email protected]>
Remove convenience constructors for TextRun
Modified: trunk/Source/WTF/wtf/text/StringView.h (184002 => 184003)
--- trunk/Source/WTF/wtf/text/StringView.h 2015-05-08 18:59:31 UTC (rev 184002)
+++ trunk/Source/WTF/wtf/text/StringView.h 2015-05-08 19:01:03 UTC (rev 184003)
@@ -58,7 +58,6 @@
StringView(const String&);
StringView(const StringImpl&);
- StringView(const StringImpl*);
StringView(const LChar*, unsigned length);
StringView(const UChar*, unsigned length);
@@ -272,18 +271,6 @@
initialize(string.characters16(), string.length());
}
-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());
-}
-
inline StringView::StringView(const String& string)
{
setUnderlyingString(string.impl());
Modified: trunk/Source/WebCore/ChangeLog (184002 => 184003)
--- trunk/Source/WebCore/ChangeLog 2015-05-08 18:59:31 UTC (rev 184002)
+++ trunk/Source/WebCore/ChangeLog 2015-05-08 19:01:03 UTC (rev 184003)
@@ -1,3 +1,16 @@
+2015-05-08 Commit Queue <[email protected]>
+
+ Unreviewed, rolling out r183996.
+ https://bugs.webkit.org/show_bug.cgi?id=144806
+
+ ASan detected use-after free (Requested by ap on #webkit).
+
+ Reverted changeset:
+
+ "Remove convenience constructors for TextRun"
+ https://bugs.webkit.org/show_bug.cgi?id=144752
+ http://trac.webkit.org/changeset/183996
+
2015-05-08 Eric Carlson <[email protected]>
[Mac] Playback target clients do not unregister on page reload
Modified: trunk/Source/WebCore/css/CSSPrimitiveValue.cpp (184002 => 184003)
--- trunk/Source/WebCore/css/CSSPrimitiveValue.cpp 2015-05-08 18:59:31 UTC (rev 184002)
+++ trunk/Source/WebCore/css/CSSPrimitiveValue.cpp 2015-05-08 19:01:03 UTC (rev 184003)
@@ -1051,7 +1051,7 @@
StringBuilder result;
result.reserveCapacity(6 + m_value.string->length());
result.appendLiteral("attr(");
- result.append(String(m_value.string));
+ result.append(m_value.string);
result.append(')');
return result.toString();
Modified: trunk/Source/WebCore/platform/graphics/StringTruncator.cpp (184002 => 184003)
--- trunk/Source/WebCore/platform/graphics/StringTruncator.cpp 2015-05-08 18:59:31 UTC (rev 184002)
+++ trunk/Source/WebCore/platform/graphics/StringTruncator.cpp 2015-05-08 19:01:03 UTC (rev 184003)
@@ -194,7 +194,7 @@
static float stringWidth(const FontCascade& renderer, const UChar* characters, unsigned length, bool disableRoundingHacks)
{
- TextRun run(StringView(characters, length));
+ TextRun run(characters, length);
if (disableRoundingHacks)
run.disableRoundingHacks();
return renderer.width(run);
Modified: trunk/Source/WebCore/platform/graphics/TextRun.h (184002 => 184003)
--- trunk/Source/WebCore/platform/graphics/TextRun.h 2015-05-08 18:59:31 UTC (rev 184002)
+++ trunk/Source/WebCore/platform/graphics/TextRun.h 2015-05-08 19:01:03 UTC (rev 184003)
@@ -52,9 +52,9 @@
typedef unsigned RoundingHacks;
- 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())
+ 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())
, m_tabSize(0)
, m_xpos(xpos)
, m_horizontalGlyphStretch(1)
@@ -70,6 +70,21 @@
{
}
+ 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))
+ {
+ }
+
TextRun subRun(unsigned startOffset, unsigned length) const
{
ASSERT_WITH_SECURITY_IMPLICATION(startOffset < m_text.length());
Modified: trunk/Source/WebCore/platform/mac/DragImageMac.mm (184002 => 184003)
--- trunk/Source/WebCore/platform/mac/DragImageMac.mm 2015-05-08 18:59:31 UTC (rev 184002)
+++ trunk/Source/WebCore/platform/mac/DragImageMac.mm 2015-05-08 19:01:03 UTC (rev 184003)
@@ -192,7 +192,7 @@
if (canUseFastRenderer(buffer.data(), length)) {
FontCascade webCoreFont(FontPlatformData(reinterpret_cast<CTFontRef>(font), [font pointSize]));
- TextRun run(StringView(buffer.data(), length));
+ TextRun run(buffer.data(), length);
run.disableRoundingHacks();
return webCoreFont.width(run);
}
@@ -224,7 +224,7 @@
CGContextScaleCTM(cgContext, 1, -1);
FontCascade webCoreFont(FontPlatformData(reinterpret_cast<CTFontRef>(font), [font pointSize]), Antialiased);
- TextRun run(StringView(buffer.data(), length));
+ TextRun run(buffer.data(), length);
run.disableRoundingHacks();
CGFloat red;
Modified: trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp (184002 => 184003)
--- trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp 2015-05-08 18:59:31 UTC (rev 184002)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp 2015-05-08 19:01:03 UTC (rev 184003)
@@ -40,7 +40,7 @@
, preserveNewline(style.preserveNewline())
, wrapLines(style.autoWrap())
, breakWordOnOverflow(style.overflowWrap() == BreakOverflowWrap && (wrapLines || preserveNewline))
- , spaceWidth(font.width(TextRun(StringView(&space, 1))))
+ , spaceWidth(font.width(TextRun(&space, 1)))
, tabWidth(collapseWhitespace ? 0 : style.tabSize())
, locale(style.locale())
{
@@ -197,7 +197,7 @@
bool measureWithEndSpace = m_style.collapseWhitespace && segmentTo < segment.text.length() && segment.text[segmentTo] == ' ';
if (measureWithEndSpace)
++segmentTo;
- TextRun run(StringView(segment.text.substring(segmentFrom, segmentTo - segmentFrom)));
+ TextRun run(segment.text.characters<CharacterType>() + segmentFrom, segmentTo - segmentFrom);
run.setXPos(xPosition);
run.setTabSize(!!m_style.tabWidth, m_style.tabWidth);
float width = m_style.font.width(run);
Modified: trunk/Source/WebCore/rendering/TextPainter.cpp (184002 => 184003)
--- trunk/Source/WebCore/rendering/TextPainter.cpp 2015-05-08 18:59:31 UTC (rev 184002)
+++ trunk/Source/WebCore/rendering/TextPainter.cpp 2015-05-08 19:01:03 UTC (rev 184003)
@@ -170,7 +170,7 @@
if (!m_emphasisMark.isEmpty()) {
updateGraphicsContext(m_context, m_textPaintStyle, UseEmphasisMarkColor);
- static NeverDestroyed<TextRun> objectReplacementCharacterTextRun(StringView(&objectReplacementCharacter, 1));
+ static NeverDestroyed<TextRun> objectReplacementCharacterTextRun(&objectReplacementCharacter, 1);
TextRun& emphasisMarkTextRun = m_combinedText ? objectReplacementCharacterTextRun.get() : m_textRun;
FloatPoint emphasisMarkTextOrigin = m_combinedText ? FloatPoint(boxOrigin.x() + m_boxRect.width() / 2, boxOrigin.y() + m_font.fontMetrics().ascent()) : m_textOrigin;
if (m_combinedText)
@@ -196,7 +196,7 @@
if (!m_emphasisMark.isEmpty()) {
updateGraphicsContext(m_context, m_selectionPaintStyle, UseEmphasisMarkColor);
- DEPRECATED_DEFINE_STATIC_LOCAL(TextRun, objectReplacementCharacterTextRun, (StringView(&objectReplacementCharacter, 1)));
+ DEPRECATED_DEFINE_STATIC_LOCAL(TextRun, objectReplacementCharacterTextRun, (&objectReplacementCharacter, 1));
TextRun& emphasisMarkTextRun = m_combinedText ? objectReplacementCharacterTextRun : m_textRun;
FloatPoint emphasisMarkTextOrigin = m_combinedText ? FloatPoint(boxOrigin.x() + m_boxRect.width() / 2, boxOrigin.y() + m_font.fontMetrics().ascent()) : m_textOrigin;
if (m_combinedText)
Modified: trunk/Source/WebKit/mac/ChangeLog (184002 => 184003)
--- trunk/Source/WebKit/mac/ChangeLog 2015-05-08 18:59:31 UTC (rev 184002)
+++ trunk/Source/WebKit/mac/ChangeLog 2015-05-08 19:01:03 UTC (rev 184003)
@@ -1,3 +1,16 @@
+2015-05-08 Commit Queue <[email protected]>
+
+ Unreviewed, rolling out r183996.
+ https://bugs.webkit.org/show_bug.cgi?id=144806
+
+ ASan detected use-after free (Requested by ap on #webkit).
+
+ Reverted changeset:
+
+ "Remove convenience constructors for TextRun"
+ https://bugs.webkit.org/show_bug.cgi?id=144752
+ http://trac.webkit.org/changeset/183996
+
2015-05-08 Myles C. Maxfield <[email protected]>
Remove convenience constructors for TextRun
Modified: trunk/Source/WebKit/mac/Misc/WebKitNSStringExtras.mm (184002 => 184003)
--- trunk/Source/WebKit/mac/Misc/WebKitNSStringExtras.mm 2015-05-08 18:59:31 UTC (rev 184002)
+++ trunk/Source/WebKit/mac/Misc/WebKitNSStringExtras.mm 2015-05-08 19:01:03 UTC (rev 184003)
@@ -93,7 +93,7 @@
CGContextScaleCTM(cgContext, 1, -1);
FontCascade webCoreFont(FontPlatformData(reinterpret_cast<CTFontRef>(font), [font pointSize]), fontSmoothingIsAllowed ? AutoSmoothing : Antialiased);
- TextRun run(StringView(buffer.data(), length));
+ TextRun run(buffer.data(), length);
run.disableRoundingHacks();
CGFloat red;
@@ -139,7 +139,7 @@
if (canUseFastRenderer(buffer.data(), length)) {
FontCascade webCoreFont(FontPlatformData(reinterpret_cast<CTFontRef>(font), [font pointSize]));
- TextRun run(StringView(buffer.data(), length));
+ TextRun run(buffer.data(), length);
run.disableRoundingHacks();
return webCoreFont.width(run);
}
Modified: trunk/Tools/ChangeLog (184002 => 184003)
--- trunk/Tools/ChangeLog 2015-05-08 18:59:31 UTC (rev 184002)
+++ trunk/Tools/ChangeLog 2015-05-08 19:01:03 UTC (rev 184003)
@@ -1,3 +1,16 @@
+2015-05-08 Commit Queue <[email protected]>
+
+ Unreviewed, rolling out r183996.
+ https://bugs.webkit.org/show_bug.cgi?id=144806
+
+ ASan detected use-after free (Requested by ap on #webkit).
+
+ Reverted changeset:
+
+ "Remove convenience constructors for TextRun"
+ https://bugs.webkit.org/show_bug.cgi?id=144752
+ http://trac.webkit.org/changeset/183996
+
2015-05-08 Myles C. Maxfield <[email protected]>
Remove convenience constructors for TextRun
Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/StringView.cpp (184002 => 184003)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/StringView.cpp 2015-05-08 18:59:31 UTC (rev 184002)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/StringView.cpp 2015-05-08 19:01:03 UTC (rev 184003)
@@ -697,23 +697,4 @@
EXPECT_FALSE(referenceUTF8.endsWithIgnoringASCIICase(reference));
}
-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());
-}
-
} // namespace TestWebKitAPI