Title: [144646] trunk/Source
Revision
144646
Author
[email protected]
Date
2013-03-04 10:56:53 -0800 (Mon, 04 Mar 2013)

Log Message

Add support for 8 bit TextRuns on Chromium Linux & Mac
https://bugs.webkit.org/show_bug.cgi?id=99393

Reviewed by Eric Seidel.

Source/WebCore: 

Adding support for 8 bit TextRuns for Mac and Linux Chromium. To accomplish this,
8 bit text runs are upconverted to 16 bit in the complex text path during string
normalization, as HarfBuzz operates on UChars.

Windows has platfom assumptions that TextRuns are 16 bit that need to be addressed
before enabling this optimization.

No new tests. No change in behavior.

(WebCore::HarfBuzzShaperBase::setNormalizedBuffer):
* platform/graphics/harfbuzz/HarfBuzzShaperBase.h:
* platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
(WebCore::normalizeCharacters):
(WebCore::HarfBuzzShaper::HarfBuzzShaper):

Source/WebKit/chromium: 

Enabling 8 bit text runs for Linux and Mac platforms.

* features.gypi:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (144645 => 144646)


--- trunk/Source/WebCore/ChangeLog	2013-03-04 18:50:47 UTC (rev 144645)
+++ trunk/Source/WebCore/ChangeLog	2013-03-04 18:56:53 UTC (rev 144646)
@@ -1,3 +1,25 @@
+2013-03-04  Levi Weintraub  <[email protected]>
+
+        Add support for 8 bit TextRuns on Chromium Linux & Mac
+        https://bugs.webkit.org/show_bug.cgi?id=99393
+
+        Reviewed by Eric Seidel.
+
+        Adding support for 8 bit TextRuns for Mac and Linux Chromium. To accomplish this,
+        8 bit text runs are upconverted to 16 bit in the complex text path during string
+        normalization, as HarfBuzz operates on UChars.
+
+        Windows has platfom assumptions that TextRuns are 16 bit that need to be addressed
+        before enabling this optimization.
+
+        No new tests. No change in behavior.
+
+        (WebCore::HarfBuzzShaperBase::setNormalizedBuffer):
+        * platform/graphics/harfbuzz/HarfBuzzShaperBase.h:
+        * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
+        (WebCore::normalizeCharacters):
+        (WebCore::HarfBuzzShaper::HarfBuzzShaper):
+
 2013-03-04  Alexis Menard  <[email protected]>
 
         transition-property property and transition shorthand property doesn't accept "all, all".

Modified: trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.cpp (144645 => 144646)


--- trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.cpp	2013-03-04 18:50:47 UTC (rev 144645)
+++ trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.cpp	2013-03-04 18:56:53 UTC (rev 144646)
@@ -156,10 +156,18 @@
     return position;
 }
 
-static void normalizeCharacters(const UChar* source, UChar* destination, int length)
+static void normalizeCharacters(const TextRun& run, UChar* destination, int length)
 {
     int position = 0;
     bool error = false;
+    const UChar* source;
+    String stringFor8BitRun;
+    if (run.is8Bit()) {
+        stringFor8BitRun = String::make16BitFrom8BitSource(run.characters8(), run.length());
+        source = stringFor8BitRun.characters16();
+    } else
+        source = run.characters16();
+
     while (position < length) {
         UChar32 character;
         int nextPosition = position;
@@ -182,7 +190,7 @@
 {
     m_normalizedBuffer = adoptArrayPtr(new UChar[m_run.length() + 1]);
     m_normalizedBufferLength = m_run.length();
-    normalizeCharacters(m_run.characters16(), m_normalizedBuffer.get(), m_normalizedBufferLength);
+    normalizeCharacters(m_run, m_normalizedBuffer.get(), m_normalizedBufferLength);
     setPadding(m_run.expansion());
     setFontFeatures();
 }

Modified: trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaperBase.cpp (144645 => 144646)


--- trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaperBase.cpp	2013-03-04 18:50:47 UTC (rev 144645)
+++ trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaperBase.cpp	2013-03-04 18:56:53 UTC (rev 144646)
@@ -94,10 +94,18 @@
     icu::UnicodeString normalizedString;
     UErrorCode error = U_ZERO_ERROR;
 
+    const UChar* runCharacters;
+    String stringFor8BitRun;
+    if (m_run.is8Bit()) {
+        stringFor8BitRun = String::make16BitFrom8BitSource(m_run.characters8(), m_run.length());
+        runCharacters = stringFor8BitRun.characters16();
+    } else
+        runCharacters = m_run.characters16();
+
     for (int i = 0; i < m_run.length(); ++i) {
-        UChar ch = m_run[i];
+        UChar ch = runCharacters[i];
         if (::ublock_getCode(ch) == UBLOCK_COMBINING_DIACRITICAL_MARKS) {
-            icu::Normalizer::normalize(icu::UnicodeString(m_run.characters16(),
+            icu::Normalizer::normalize(icu::UnicodeString(runCharacters,
                                        m_run.length()), UNORM_NFC, 0 /* no options */,
                                        normalizedString, error);
             if (U_FAILURE(error))
@@ -109,7 +117,7 @@
     const UChar* sourceText;
     if (normalizedString.isEmpty()) {
         m_normalizedBufferLength = m_run.length();
-        sourceText = m_run.characters16();
+        sourceText = runCharacters;
     } else {
         m_normalizedBufferLength = normalizedString.length();
         sourceText = normalizedString.getBuffer();

Modified: trunk/Source/WebKit/chromium/ChangeLog (144645 => 144646)


--- trunk/Source/WebKit/chromium/ChangeLog	2013-03-04 18:50:47 UTC (rev 144645)
+++ trunk/Source/WebKit/chromium/ChangeLog	2013-03-04 18:56:53 UTC (rev 144646)
@@ -1,3 +1,14 @@
+2013-03-04  Levi Weintraub  <[email protected]>
+
+        Add support for 8 bit TextRuns on Chromium Linux & Mac
+        https://bugs.webkit.org/show_bug.cgi?id=99393
+
+        Reviewed by Eric Seidel.
+
+        Enabling 8 bit text runs for Linux and Mac platforms.
+
+        * features.gypi:
+
 2013-03-04  Peter Beverloo  <[email protected]>
 
         [Chromium] Add a new dependency on jsr-305 for Android

Modified: trunk/Source/WebKit/chromium/features.gypi (144645 => 144646)


--- trunk/Source/WebKit/chromium/features.gypi	2013-03-04 18:50:47 UTC (rev 144645)
+++ trunk/Source/WebKit/chromium/features.gypi	2013-03-04 18:56:53 UTC (rev 144646)
@@ -208,6 +208,8 @@
       }],
       ['OS=="linux" or OS=="mac"', {
         'feature_defines': [
+          # 8Bit text runs should be enabled for all platforms webkit.org/b/111348
+          'ENABLE_8BIT_TEXTRUN=1',
           'ENABLE_BINDING_INTEGRITY=1',
         ],
       }, { # OS!="linux"
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to