Title: [224007] trunk/Source/WebCore
Revision
224007
Author
[email protected]
Date
2017-10-25 23:03:35 -0700 (Wed, 25 Oct 2017)

Log Message

[HarfBuzz] ComplexTextRun should initialize direction from the harfbuzz buffer
https://bugs.webkit.org/show_bug.cgi?id=178788

Reviewed by Michael Catanzaro.

Instead of using the TextRun direction. If the TextRun is ltr, but the harfbuzz buffer is rtl, the character
indexes will be swapped in m_coreTextIndices.

* platform/graphics/ComplexTextController.h:
(WebCore::ComplexTextController::ComplexTextRun::create): Remove the ltr parameter.
* platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp:
(WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun): Initialize m_isLTR using hb_buffer_get_direction().
(WebCore::ComplexTextController::collectComplexTextRunsForCharacters): Do not pass ltr to ComplexTextRun::create().

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (224006 => 224007)


--- trunk/Source/WebCore/ChangeLog	2017-10-26 05:23:12 UTC (rev 224006)
+++ trunk/Source/WebCore/ChangeLog	2017-10-26 06:03:35 UTC (rev 224007)
@@ -1,3 +1,19 @@
+2017-10-25  Carlos Garcia Campos  <[email protected]>
+
+        [HarfBuzz] ComplexTextRun should initialize direction from the harfbuzz buffer
+        https://bugs.webkit.org/show_bug.cgi?id=178788
+
+        Reviewed by Michael Catanzaro.
+
+        Instead of using the TextRun direction. If the TextRun is ltr, but the harfbuzz buffer is rtl, the character
+        indexes will be swapped in m_coreTextIndices.
+
+        * platform/graphics/ComplexTextController.h:
+        (WebCore::ComplexTextController::ComplexTextRun::create): Remove the ltr parameter.
+        * platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp:
+        (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun): Initialize m_isLTR using hb_buffer_get_direction().
+        (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): Do not pass ltr to ComplexTextRun::create().
+
 2017-10-25  Keith Miller  <[email protected]>
 
         Move remaining platform independent sources to unified sources

Modified: trunk/Source/WebCore/platform/graphics/ComplexTextController.h (224006 => 224007)


--- trunk/Source/WebCore/platform/graphics/ComplexTextController.h	2017-10-26 05:23:12 UTC (rev 224006)
+++ trunk/Source/WebCore/platform/graphics/ComplexTextController.h	2017-10-26 06:03:35 UTC (rev 224007)
@@ -79,9 +79,9 @@
             return adoptRef(*new ComplexTextRun(ctRun, font, characters, stringLocation, stringLength, indexBegin, indexEnd));
         }
 
-        static Ref<ComplexTextRun> create(hb_buffer_t* buffer, const Font& font, const UChar* characters, unsigned stringLocation, unsigned stringLength, unsigned indexBegin, unsigned indexEnd, bool ltr)
+        static Ref<ComplexTextRun> create(hb_buffer_t* buffer, const Font& font, const UChar* characters, unsigned stringLocation, unsigned stringLength, unsigned indexBegin, unsigned indexEnd)
         {
-            return adoptRef(*new ComplexTextRun(buffer, font, characters, stringLocation, stringLength, indexBegin, indexEnd, ltr));
+            return adoptRef(*new ComplexTextRun(buffer, font, characters, stringLocation, stringLength, indexBegin, indexEnd));
         }
 
         static Ref<ComplexTextRun> create(const Font& font, const UChar* characters, unsigned stringLocation, unsigned stringLength, unsigned indexBegin, unsigned indexEnd, bool ltr)
@@ -142,7 +142,7 @@
 
     private:
         ComplexTextRun(CTRunRef, const Font&, const UChar* characters, unsigned stringLocation, unsigned stringLength, unsigned indexBegin, unsigned indexEnd);
-        ComplexTextRun(hb_buffer_t*, const Font&, const UChar* characters, unsigned stringLocation, unsigned stringLength, unsigned indexBegin, unsigned indexEnd, bool ltr);
+        ComplexTextRun(hb_buffer_t*, const Font&, const UChar* characters, unsigned stringLocation, unsigned stringLength, unsigned indexBegin, unsigned indexEnd);
         ComplexTextRun(const Font&, const UChar* characters, unsigned stringLocation, unsigned stringLength, unsigned indexBegin, unsigned indexEnd, bool ltr);
         WEBCORE_EXPORT ComplexTextRun(const Vector<FloatSize>& advances, const Vector<FloatPoint>& origins, const Vector<Glyph>& glyphs, const Vector<unsigned>& stringIndices, FloatSize initialAdvance, const Font&, const UChar* characters, unsigned stringLocation, unsigned stringLength, unsigned indexBegin, unsigned indexEnd, bool ltr);
 

Modified: trunk/Source/WebCore/platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp (224006 => 224007)


--- trunk/Source/WebCore/platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp	2017-10-26 05:23:12 UTC (rev 224006)
+++ trunk/Source/WebCore/platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp	2017-10-26 06:03:35 UTC (rev 224007)
@@ -38,7 +38,7 @@
     return static_cast<float>(value) / (1 << 16);
 }
 
-ComplexTextController::ComplexTextRun::ComplexTextRun(hb_buffer_t* buffer, const Font& font, const UChar* characters, unsigned stringLocation, unsigned stringLength, unsigned indexBegin, unsigned indexEnd, bool ltr)
+ComplexTextController::ComplexTextRun::ComplexTextRun(hb_buffer_t* buffer, const Font& font, const UChar* characters, unsigned stringLocation, unsigned stringLength, unsigned indexBegin, unsigned indexEnd)
     : m_initialAdvance(0, 0)
     , m_font(font)
     , m_characters(characters)
@@ -47,7 +47,7 @@
     , m_indexEnd(indexEnd)
     , m_glyphCount(hb_buffer_get_length(buffer))
     , m_stringLocation(stringLocation)
-    , m_isLTR(ltr)
+    , m_isLTR(HB_DIRECTION_IS_FORWARD(hb_buffer_get_direction(buffer)))
 {
     if (!m_glyphCount)
         return;
@@ -224,7 +224,7 @@
 
         HbUniquePtr<hb_font_t> harfBuzzFont(face->createFont());
         hb_shape(harfBuzzFont.get(), buffer.get(), features.isEmpty() ? nullptr : features.data(), features.size());
-        m_complexTextRuns.append(ComplexTextRun::create(buffer.get(), *font, characters, stringLocation, length, run.startIndex, run.endIndex, m_run.ltr()));
+        m_complexTextRuns.append(ComplexTextRun::create(buffer.get(), *font, characters, stringLocation, length, run.startIndex, run.endIndex));
         hb_buffer_reset(buffer.get());
     }
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to