Title: [134171] branches/chromium/1312
Revision
134171
Author
[email protected]
Date
2012-11-11 04:59:40 -0800 (Sun, 11 Nov 2012)

Log Message

Merge 133550 - [Chromium] Unicode combining diacritical aren't always combined on Linux
https://bugs.webkit.org/show_bug.cgi?id=101009

Reviewed by Kent Tamura.

Source/WebCore:

Add a space character to harfbuzzBuffer as pre-context. This will prevent
harfbuzz from inserting dotted-circle.

Test: fast/text/international/combining-marks-position.html

* platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp:
(WebCore::HarfBuzzShaper::shapeHarfBuzzRuns):

LayoutTests:

Add a test that checks whether combining marks are combined with base characters.

* fast/text/international/combining-marks-position-expected.txt: Added.
* fast/text/international/combining-marks-position.html: Added.


[email protected]
Review URL: https://codereview.chromium.org/11365191

Modified Paths

Added Paths

Diff

Copied: branches/chromium/1312/LayoutTests/fast/text/international/combining-marks-position-expected.txt (from rev 133550, trunk/LayoutTests/fast/text/international/combining-marks-position-expected.txt) (0 => 134171)


--- branches/chromium/1312/LayoutTests/fast/text/international/combining-marks-position-expected.txt	                        (rev 0)
+++ branches/chromium/1312/LayoutTests/fast/text/international/combining-marks-position-expected.txt	2012-11-11 12:59:40 UTC (rev 134171)
@@ -0,0 +1,8 @@
+This test ensures that combining marks apper over the previous (or next) character by comparing the length of words (one has marks, and the other doesn't have marks).
+
+test проверка
+tèst провѐрка
+خانه
+خانهٔ
+PASS. The length of targets and references are the same.
+

Copied: branches/chromium/1312/LayoutTests/fast/text/international/combining-marks-position.html (from rev 133550, trunk/LayoutTests/fast/text/international/combining-marks-position.html) (0 => 134171)


--- branches/chromium/1312/LayoutTests/fast/text/international/combining-marks-position.html	                        (rev 0)
+++ branches/chromium/1312/LayoutTests/fast/text/international/combining-marks-position.html	2012-11-11 12:59:40 UTC (rev 134171)
@@ -0,0 +1,49 @@
+<html>
+<head>
+<meta charset="utf-8" />
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+</script>
+</head>
+<body>
+<p>
+This test ensures that combining marks apper over the previous (or next) character by comparing the length of
+words (one has marks, and the other doesn't have marks).
+</p>
+
+<div style="font-family: arial;">
+<span id="reference1">test проверка</span>
+</div>
+<div style="font-family: arial;">
+<span id="target1">te&#768;st прове&#768;рка</span>
+</div>
+
+<div>
+<span id="reference2">خانه</span>
+</div>
+<div>
+<span id="target2">خانهٔ</span>
+</div>
+
+<div id="result"></div>
+
+<script>
+var reference1 = document.getElementById('reference1');
+var target1 = document.getElementById('target1');
+var reference2 = document.getElementById('reference2');
+var target2 = document.getElementById('target2');
+var result = document.getElementById('result');
+
+if (reference1.offsetWidth == target1.offsetWidth && reference2.offsetWidth == target2.offsetWidth)
+    result.innerHTML = 'PASS. The length of targets and references are the same.<br />'
+else
+    result.innerHTML = 'FAIL<br />' +
+                       'reference1.offsetWidth = ' + reference1.offsetWidth + '<br />' +
+                       'target1.offsetWidth = ' + target1.offsetWidth + '<br />' +
+                       'reference2.offsetWidth = ' + reference2.offsetWidth + '<br />' +
+                       'target2.offsetWidth = ' + target2.offsetWidth + '<br />'
+</script>
+
+</body>
+</html>

Modified: branches/chromium/1312/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp (134170 => 134171)


--- branches/chromium/1312/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp	2012-11-11 06:39:12 UTC (rev 134170)
+++ branches/chromium/1312/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp	2012-11-11 12:59:40 UTC (rev 134171)
@@ -322,6 +322,11 @@
         HarfBuzzRun* currentRun = m_harfbuzzRuns[runIndex].get();
         const SimpleFontData* currentFontData = currentRun->fontData();
 
+        // Add a space as pre-context to the buffer. This prevents showing dotted-circle
+        // for combining marks at the beginning of runs.
+        static const uint16_t preContext = ' ';
+        hb_buffer_add_utf16(harfbuzzBuffer.get(), &preContext, 1, 1, 0);
+
         if (m_font->isSmallCaps() && u_islower(m_normalizedBuffer[currentRun->startIndex()])) {
             String upperText = String(m_normalizedBuffer.get() + currentRun->startIndex(), currentRun->numCharacters());
             upperText.makeUpper();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to