Title: [222020] trunk/Source/WebCore
Revision
222020
Author
[email protected]
Date
2017-09-14 08:37:44 -0700 (Thu, 14 Sep 2017)

Log Message

[Harfbuzz] Wrong offset returned by HarfBuzzShaper::offsetForPosition() when target point is at the middle of a character
https://bugs.webkit.org/show_bug.cgi?id=176897

Reviewed by Michael Catanzaro.

We should include the character when the point is greater than the center of the character.

Fixes: fast/multicol/hit-test-end-of-column-with-line-height.html
       fast/multicol/newmulticol/compare-with-old-impl/hit-test-end-of-column-with-line-height.html

* platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
(WebCore::HarfBuzzShaper::HarfBuzzRun::characterIndexForXPosition):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (222019 => 222020)


--- trunk/Source/WebCore/ChangeLog	2017-09-14 14:20:26 UTC (rev 222019)
+++ trunk/Source/WebCore/ChangeLog	2017-09-14 15:37:44 UTC (rev 222020)
@@ -1,3 +1,18 @@
+2017-09-14  Carlos Garcia Campos  <[email protected]>
+
+        [Harfbuzz] Wrong offset returned by HarfBuzzShaper::offsetForPosition() when target point is at the middle of a character
+        https://bugs.webkit.org/show_bug.cgi?id=176897
+
+        Reviewed by Michael Catanzaro.
+
+        We should include the character when the point is greater than the center of the character.
+
+        Fixes: fast/multicol/hit-test-end-of-column-with-line-height.html
+               fast/multicol/newmulticol/compare-with-old-impl/hit-test-end-of-column-with-line-height.html
+
+        * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
+        (WebCore::HarfBuzzShaper::HarfBuzzRun::characterIndexForXPosition):
+
 2017-09-14  Yusuke Suzuki  <[email protected]>
 
         [JSC] Add PrivateSymbolMode::{Include,Exclude} for PropertyNameArray

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


--- trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.cpp	2017-09-14 14:20:26 UTC (rev 222019)
+++ trunk/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.cpp	2017-09-14 15:37:44 UTC (rev 222020)
@@ -114,11 +114,11 @@
         while (glyphIndex < m_numGlyphs - 1 && m_glyphToCharacterIndexes[glyphIndex + 1] == characterIndex)
             characterWidth += m_advances[++glyphIndex];
 
-        if ((includePartialGlyphs && (targetX < currentX + characterWidth / 2.0))
+        if ((includePartialGlyphs && (targetX <= currentX + characterWidth / 2.0))
             || (!includePartialGlyphs && (targetX < currentX + characterWidth)))
             return rtl() ? std::min(m_numCharacters, characterIndex + 1) : characterIndex;
 
-        if ((includePartialGlyphs && (targetX >= (currentX + characterWidth / 2.0) && targetX < currentX + characterWidth))
+        if ((includePartialGlyphs && (targetX > (currentX + characterWidth / 2.0) && targetX < currentX + characterWidth))
             || (!includePartialGlyphs && (targetX >= currentX && targetX < currentX + characterWidth)))
             break;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to