Changeset 129664 in webkit


Ignore:
Timestamp:
Sep 26, 2012, 10:26:18 AM (13 years ago)
Author:
msaboff@apple.com
Message:

Update ComplexTextController for 8 bit TextRun changes
https://bugs.webkit.org/show_bug.cgi?id=97378

Reviewed by Geoffrey Garen.

Source/WebCore:

Since the ComplextTextController code is primarily used for UChar data, just upconvert an 8 bit
TextRun into a new String and hold on to the String with a vector for the life of the controller.

No change in functionality, therefore no new tests.

  • platform/graphics/mac/ComplexTextController.cpp:

(WebCore::ComplexTextController::ComplexTextController):
(WebCore::ComplexTextController::collectComplexTextRuns):

  • platform/graphics/mac/ComplexTextController.h:

(ComplexTextController):

Source/WTF:

Add a new create method to make a 16 bit string from 8 bit source data. This is used in
ComplexTextController when we have LChar* + length text data, but we really want 16 bit
data for the complex text rendering code.

  • wtf/text/WTFString.cpp:

(WTF::String::make16BitFrom8BitSource):
(WTF):

  • wtf/text/WTFString.h:

(String):

Location:
trunk/Source
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r129649 r129664  
     12012-09-26  Michael Saboff  <msaboff@apple.com>
     2
     3        Update ComplexTextController for 8 bit TextRun changes
     4        https://bugs.webkit.org/show_bug.cgi?id=97378
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Add a new create method to make a 16 bit string from 8 bit source data.  This is used in
     9        ComplexTextController when we have LChar* + length text data, but we really want 16 bit
     10        data for the complex text rendering code.
     11
     12        * wtf/text/WTFString.cpp:
     13        (WTF::String::make16BitFrom8BitSource):
     14        (WTF):
     15        * wtf/text/WTFString.h:
     16        (String):
     17
    1182012-09-26  Ilya Tikhonovsky  <loislo@chromium.org>
    219
  • trunk/Source/WTF/wtf/text/WTFString.cpp

    r129165 r129664  
    779779}
    780780
     781String String::make16BitFrom8BitSource(const LChar* source, size_t length)
     782{
     783    if (!length)
     784        return String();
     785   
     786    UChar* destination;
     787    String result = String::createUninitialized(length, destination);
     788   
     789    StringImpl::copyChars(destination, source, length);
     790   
     791    return result;
     792}
     793
    781794String String::fromUTF8(const LChar* stringStart, size_t length)
    782795{
  • trunk/Source/WTF/wtf/text/WTFString.h

    r129433 r129664  
    415415
    416416    WTF_EXPORT_STRING_API static String make8BitFrom16BitSource(const UChar*, size_t);
     417    WTF_EXPORT_STRING_API static String make16BitFrom8BitSource(const LChar*, size_t);
    417418
    418419    // String::fromUTF8 will return a null string if
  • trunk/Source/WebCore/ChangeLog

    r129662 r129664  
     12012-09-26  Michael Saboff  <msaboff@apple.com>
     2
     3        Update ComplexTextController for 8 bit TextRun changes
     4        https://bugs.webkit.org/show_bug.cgi?id=97378
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Since the ComplextTextController code is primarily used for UChar data, just upconvert an 8 bit
     9        TextRun into a new String and hold on to the String with a vector for the life of the controller.
     10
     11        No change in functionality, therefore no new tests.
     12
     13        * platform/graphics/mac/ComplexTextController.cpp:
     14        (WebCore::ComplexTextController::ComplexTextController):
     15        (WebCore::ComplexTextController::collectComplexTextRuns):
     16        * platform/graphics/mac/ComplexTextController.h:
     17        (ComplexTextController):
     18
    1192012-09-26  Michael Saboff  <msaboff@apple.com>
    220
  • trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp

    r129389 r129664  
    143143    else {
    144144        bool isAfterExpansion = m_afterExpansion;
    145         unsigned expansionOpportunityCount = Font::expansionOpportunityCount(m_run.characters16(), m_end, m_run.ltr() ? LTR : RTL, isAfterExpansion);
     145        unsigned expansionOpportunityCount;
     146        if (m_run.is8Bit())
     147            expansionOpportunityCount = Font::expansionOpportunityCount(m_run.characters8(), m_end, m_run.ltr() ? LTR : RTL, isAfterExpansion);
     148         else
     149             expansionOpportunityCount = Font::expansionOpportunityCount(m_run.characters16(), m_end, m_run.ltr() ? LTR : RTL, isAfterExpansion);
    146150        if (isAfterExpansion && !m_run.allowsTrailingExpansion())
    147151            expansionOpportunityCount--;
     
    285289
    286290    // We break up glyph run generation for the string by FontData.
    287     const UChar* cp = m_run.characters16();
     291    const UChar* cp;
     292
     293    if (m_run.is8Bit()) {
     294        String stringFor8BitRun = String::make16BitFrom8BitSource(m_run.characters8(), m_run.length());
     295        cp = stringFor8BitRun.characters16();
     296        m_stringsFor8BitRuns.append(stringFor8BitRun);
     297    } else
     298        cp = m_run.characters16();
    288299
    289300    if (m_font.isSmallCaps())
  • trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.h

    r126763 r129664  
    3232#include <wtf/RetainPtr.h>
    3333#include <wtf/Vector.h>
     34#include <wtf/text/WTFString.h>
    3435#include <wtf/unicode/Unicode.h>
    3536
     
    144145    bool m_forTextEmphasis;
    145146
     147    Vector<String> m_stringsFor8BitRuns;
    146148    Vector<UChar, 256> m_smallCapsBuffer;
    147149
Note: See TracChangeset for help on using the changeset viewer.