⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 184003 in webkit


Ignore:
Timestamp:
May 8, 2015, 12:01:03 PM (11 years ago)
Author:
commit-queue@webkit.org
Message:

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

Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r183996 r184003  
     12015-05-08  Commit Queue  <commit-queue@webkit.org>
     2
     3        Unreviewed, rolling out r183996.
     4        https://bugs.webkit.org/show_bug.cgi?id=144806
     5
     6        ASan detected use-after free (Requested by ap on #webkit).
     7
     8        Reverted changeset:
     9
     10        "Remove convenience constructors for TextRun"
     11        https://bugs.webkit.org/show_bug.cgi?id=144752
     12        http://trac.webkit.org/changeset/183996
     13
    1142015-05-08  Myles C. Maxfield  <mmaxfield@apple.com>
    215
  • trunk/Source/WTF/wtf/text/StringView.h

    r183996 r184003  
    5959    StringView(const String&);
    6060    StringView(const StringImpl&);
    61     StringView(const StringImpl*);
    6261    StringView(const LChar*, unsigned length);
    6362    StringView(const UChar*, unsigned length);
     
    271270    else
    272271        initialize(string.characters16(), string.length());
    273 }
    274 
    275 inline StringView::StringView(const StringImpl* string)
    276 {
    277     if (!string)
    278         return;
    279 
    280     setUnderlyingString(string);
    281     if (string->is8Bit())
    282         initialize(string->characters8(), string->length());
    283     else
    284         initialize(string->characters16(), string->length());
    285272}
    286273
  • trunk/Source/WebCore/ChangeLog

    r184001 r184003  
     12015-05-08  Commit Queue  <commit-queue@webkit.org>
     2
     3        Unreviewed, rolling out r183996.
     4        https://bugs.webkit.org/show_bug.cgi?id=144806
     5
     6        ASan detected use-after free (Requested by ap on #webkit).
     7
     8        Reverted changeset:
     9
     10        "Remove convenience constructors for TextRun"
     11        https://bugs.webkit.org/show_bug.cgi?id=144752
     12        http://trac.webkit.org/changeset/183996
     13
    1142015-05-08  Eric Carlson  <eric.carlson@apple.com>
    215
  • trunk/Source/WebCore/css/CSSPrimitiveValue.cpp

    r183996 r184003  
    10521052        result.reserveCapacity(6 + m_value.string->length());
    10531053        result.appendLiteral("attr(");
    1054         result.append(String(m_value.string));
     1054        result.append(m_value.string);
    10551055        result.append(')');
    10561056
  • trunk/Source/WebCore/platform/graphics/StringTruncator.cpp

    r183996 r184003  
    195195static float stringWidth(const FontCascade& renderer, const UChar* characters, unsigned length, bool disableRoundingHacks)
    196196{
    197     TextRun run(StringView(characters, length));
     197    TextRun run(characters, length);
    198198    if (disableRoundingHacks)
    199199        run.disableRoundingHacks();
  • trunk/Source/WebCore/platform/graphics/TextRun.h

    r183996 r184003  
    5353    typedef unsigned RoundingHacks;
    5454
    55     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)
    56         : m_text(text)
    57         , m_charactersLength(text.length())
     55    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)
     56        : m_text(s)
     57        , m_charactersLength(s.length())
    5858        , m_tabSize(0)
    5959        , m_xpos(xpos)
     
    7171    }
    7272
     73    explicit TextRun(const String& s)
     74        : TextRun(StringView(s))
     75    {
     76    }
     77
     78    TextRun(const LChar* c, unsigned len)
     79        : TextRun(StringView(c, len))
     80    {
     81    }
     82
     83    TextRun(const UChar* c, unsigned len)
     84        : TextRun(StringView(c, len))
     85    {
     86    }
     87
    7388    TextRun subRun(unsigned startOffset, unsigned length) const
    7489    {
  • trunk/Source/WebCore/platform/mac/DragImageMac.mm

    r183996 r184003  
    193193    if (canUseFastRenderer(buffer.data(), length)) {
    194194        FontCascade webCoreFont(FontPlatformData(reinterpret_cast<CTFontRef>(font), [font pointSize]));
    195         TextRun run(StringView(buffer.data(), length));
     195        TextRun run(buffer.data(), length);
    196196        run.disableRoundingHacks();
    197197        return webCoreFont.width(run);
     
    225225           
    226226        FontCascade webCoreFont(FontPlatformData(reinterpret_cast<CTFontRef>(font), [font pointSize]), Antialiased);
    227         TextRun run(StringView(buffer.data(), length));
     227        TextRun run(buffer.data(), length);
    228228        run.disableRoundingHacks();
    229229
  • trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp

    r183996 r184003  
    4141    , wrapLines(style.autoWrap())
    4242    , breakWordOnOverflow(style.overflowWrap() == BreakOverflowWrap && (wrapLines || preserveNewline))
    43     , spaceWidth(font.width(TextRun(StringView(&space, 1))))
     43    , spaceWidth(font.width(TextRun(&space, 1)))
    4444    , tabWidth(collapseWhitespace ? 0 : style.tabSize())
    4545    , locale(style.locale())
     
    198198    if (measureWithEndSpace)
    199199        ++segmentTo;
    200     TextRun run(StringView(segment.text.substring(segmentFrom, segmentTo - segmentFrom)));
     200    TextRun run(segment.text.characters<CharacterType>() + segmentFrom, segmentTo - segmentFrom);
    201201    run.setXPos(xPosition);
    202202    run.setTabSize(!!m_style.tabWidth, m_style.tabWidth);
  • trunk/Source/WebCore/rendering/TextPainter.cpp

    r183996 r184003  
    171171            updateGraphicsContext(m_context, m_textPaintStyle, UseEmphasisMarkColor);
    172172
    173             static NeverDestroyed<TextRun> objectReplacementCharacterTextRun(StringView(&objectReplacementCharacter, 1));
     173            static NeverDestroyed<TextRun> objectReplacementCharacterTextRun(&objectReplacementCharacter, 1);
    174174            TextRun& emphasisMarkTextRun = m_combinedText ? objectReplacementCharacterTextRun.get() : m_textRun;
    175175            FloatPoint emphasisMarkTextOrigin = m_combinedText ? FloatPoint(boxOrigin.x() + m_boxRect.width() / 2, boxOrigin.y() + m_font.fontMetrics().ascent()) : m_textOrigin;
     
    197197            updateGraphicsContext(m_context, m_selectionPaintStyle, UseEmphasisMarkColor);
    198198
    199             DEPRECATED_DEFINE_STATIC_LOCAL(TextRun, objectReplacementCharacterTextRun, (StringView(&objectReplacementCharacter, 1)));
     199            DEPRECATED_DEFINE_STATIC_LOCAL(TextRun, objectReplacementCharacterTextRun, (&objectReplacementCharacter, 1));
    200200            TextRun& emphasisMarkTextRun = m_combinedText ? objectReplacementCharacterTextRun : m_textRun;
    201201            FloatPoint emphasisMarkTextOrigin = m_combinedText ? FloatPoint(boxOrigin.x() + m_boxRect.width() / 2, boxOrigin.y() + m_font.fontMetrics().ascent()) : m_textOrigin;
  • trunk/Source/WebKit/mac/ChangeLog

    r183996 r184003  
     12015-05-08  Commit Queue  <commit-queue@webkit.org>
     2
     3        Unreviewed, rolling out r183996.
     4        https://bugs.webkit.org/show_bug.cgi?id=144806
     5
     6        ASan detected use-after free (Requested by ap on #webkit).
     7
     8        Reverted changeset:
     9
     10        "Remove convenience constructors for TextRun"
     11        https://bugs.webkit.org/show_bug.cgi?id=144752
     12        http://trac.webkit.org/changeset/183996
     13
    1142015-05-08  Myles C. Maxfield  <mmaxfield@apple.com>
    215
  • trunk/Source/WebKit/mac/Misc/WebKitNSStringExtras.mm

    r183996 r184003  
    9494
    9595        FontCascade webCoreFont(FontPlatformData(reinterpret_cast<CTFontRef>(font), [font pointSize]), fontSmoothingIsAllowed ? AutoSmoothing : Antialiased);
    96         TextRun run(StringView(buffer.data(), length));
     96        TextRun run(buffer.data(), length);
    9797        run.disableRoundingHacks();
    9898
     
    140140    if (canUseFastRenderer(buffer.data(), length)) {
    141141        FontCascade webCoreFont(FontPlatformData(reinterpret_cast<CTFontRef>(font), [font pointSize]));
    142         TextRun run(StringView(buffer.data(), length));
     142        TextRun run(buffer.data(), length);
    143143        run.disableRoundingHacks();
    144144        return webCoreFont.width(run);
  • trunk/Tools/ChangeLog

    r183996 r184003  
     12015-05-08  Commit Queue  <commit-queue@webkit.org>
     2
     3        Unreviewed, rolling out r183996.
     4        https://bugs.webkit.org/show_bug.cgi?id=144806
     5
     6        ASan detected use-after free (Requested by ap on #webkit).
     7
     8        Reverted changeset:
     9
     10        "Remove convenience constructors for TextRun"
     11        https://bugs.webkit.org/show_bug.cgi?id=144752
     12        http://trac.webkit.org/changeset/183996
     13
    1142015-05-08  Myles C. Maxfield  <mmaxfield@apple.com>
    215
  • trunk/Tools/TestWebKitAPI/Tests/WTF/StringView.cpp

    r183996 r184003  
    698698}
    699699
    700 TEST(WTF, StringView8Bit)
    701 {
    702     StringView nullView;
    703     StringView emptyView = StringView::empty();
    704     EXPECT_TRUE(StringView().is8Bit());
    705     EXPECT_TRUE(StringView::empty().is8Bit());
    706 
    707     LChar* lcharPtr = nullptr;
    708     UChar* ucharPtr = nullptr;
    709     EXPECT_TRUE(StringView(lcharPtr, 0).is8Bit());
    710     EXPECT_FALSE(StringView(ucharPtr, 0).is8Bit());
    711 
    712     EXPECT_TRUE(StringView(String(lcharPtr, 0)).is8Bit());
    713     EXPECT_TRUE(StringView(String(ucharPtr, 0)).is8Bit());
    714 
    715     EXPECT_TRUE(StringView(String().impl()).is8Bit());
    716     EXPECT_TRUE(StringView(emptyString().impl()).is8Bit());
    717 }
    718 
    719700} // namespace TestWebKitAPI
Note: See TracChangeset for help on using the changeset viewer.