Title: [144065] trunk/Source
Revision
144065
Author
le...@chromium.org
Date
2013-02-26 09:08:05 -0800 (Tue, 26 Feb 2013)

Log Message

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

Reviewed by Eric Seidel.

Source/WebCore:

Adding support for 8 bit TextRuns for platforms using HarfBuzz. 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.

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 Chromium.

* features.gypi:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (144064 => 144065)


--- trunk/Source/WebCore/ChangeLog	2013-02-26 16:37:50 UTC (rev 144064)
+++ trunk/Source/WebCore/ChangeLog	2013-02-26 17:08:05 UTC (rev 144065)
@@ -1,3 +1,22 @@
+2013-02-26  Levi Weintraub  <le...@chromium.org>
+
+        Add support for 8 bit TextRuns for Chromium/HarfBuzz
+        https://bugs.webkit.org/show_bug.cgi?id=99393
+
+        Reviewed by Eric Seidel.
+
+        Adding support for 8 bit TextRuns for platforms using HarfBuzz. 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.
+
+        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-02-26  Dmitry Zvorygin  <zvory...@chromium.org>
 
         Merged Tip and Debug log levels for web console.

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


--- trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.cpp	2013-02-26 16:37:50 UTC (rev 144064)
+++ trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.cpp	2013-02-26 17:08:05 UTC (rev 144065)
@@ -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 (144064 => 144065)


--- trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaperBase.cpp	2013-02-26 16:37:50 UTC (rev 144064)
+++ trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaperBase.cpp	2013-02-26 17:08:05 UTC (rev 144065)
@@ -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 (144064 => 144065)


--- trunk/Source/WebKit/chromium/ChangeLog	2013-02-26 16:37:50 UTC (rev 144064)
+++ trunk/Source/WebKit/chromium/ChangeLog	2013-02-26 17:08:05 UTC (rev 144065)
@@ -1,3 +1,14 @@
+2013-02-26  Levi Weintraub  <le...@chromium.org>
+
+        Add support for 8 bit TextRuns for Chromium/HarfBuzz
+        https://bugs.webkit.org/show_bug.cgi?id=99393
+
+        Reviewed by Eric Seidel.
+
+        Enabling 8 bit text runs for Chromium.
+
+        * features.gypi:
+
 2013-02-26  Dmitry Zvorygin  <zvory...@chromium.org>
 
         Merged Tip and Debug log levels for web console.

Modified: trunk/Source/WebKit/chromium/features.gypi (144064 => 144065)


--- trunk/Source/WebKit/chromium/features.gypi	2013-02-26 16:37:50 UTC (rev 144064)
+++ trunk/Source/WebKit/chromium/features.gypi	2013-02-26 17:08:05 UTC (rev 144065)
@@ -33,6 +33,7 @@
   'variables': {
     'feature_defines': [
       'ENABLE_3D_PLUGIN=1',
+      'ENABLE_8BIT_TEXTRUN=1',
       'ENABLE_BATTERY_STATUS=0',
       'ENABLE_BLOB=1',
       'ENABLE_BLOB_SLICE=1',
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to