Changeset 111589 in webkit
- Timestamp:
- Mar 21, 2012 12:04:30 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r111588 r111589 1 2012-03-21 Xiaomei Ji <xji@chromium.org> 2 3 [chromium] Font fallback in cr-win is wrong for string contains zero-width-space. 4 https://bugs.webkit.org/show_bug.cgi?id=79961 5 6 Reviewed by Adam Barth. 7 8 * fast/text/zero-width-characters-complex-script.html: 9 1 10 2012-03-21 Emil A Eklund <eae@chromium.org> 2 11 -
trunk/LayoutTests/fast/text/zero-width-characters-complex-script.html
r84264 r111589 2 2 <script> 3 3 4 function testChar( ch)4 function testChar(a, b, ch) 5 5 { 6 6 // Strings a and b selected here do not have any 'interaction' between them. 7 var a = "\u0915\u093E"8 var b = "\u0916";9 7 var span = document.getElementById("characters"); 10 8 span.firstChild.data = a + b; … … 22 20 } 23 21 22 function testWithZeroWidthSpace(a, b) { 23 var failedCount = 0; 24 25 for (var i = 1; i < 32; ++i) 26 if (i != 9 && i != 10 && i != 13) 27 failedCount += testChar(a, b, i); 28 29 for (var i = 0x7F; i < 0xA0; ++i) 30 failedCount += testChar(a, b, i); 31 failedCount += testChar(a, b, 0xAD); 32 33 // ZWJ (U+200C) and ZWNJ (U+200D) are excluded because they 34 // can affect the rendering in complex script text. 35 failedCount += testChar(a, b, 0x200B); 36 failedCount += testChar(a, b, 0x200E); 37 failedCount += testChar(a, b, 0x200F); 38 failedCount += testChar(a, b, 0x202A); 39 failedCount += testChar(a, b, 0x202B); 40 failedCount += testChar(a, b, 0x202C); 41 failedCount += testChar(a, b, 0x202D); 42 failedCount += testChar(a, b, 0x202E); 43 failedCount += testChar(a, b, 0xFEFF); 44 failedCount += testChar(a, b, 0xFFFC); 45 46 return failedCount; 47 } 48 24 49 function test() 25 50 { 26 51 if (window.layoutTestController) 27 52 layoutTestController.dumpAsText(); 28 var failedCount = 0;29 for (var i = 1; i < 32; ++i)30 if (i != 9 && i != 10 && i != 13)31 failedCount += testChar(i);32 53 33 for (var i = 0x7F; i < 0xA0; ++i) 34 failedCount += testChar(i); 35 failedCount += testChar(0xAD); 36 // ZWJ (U+200C) and ZWNJ (U+200D) are excluded because they 37 // can affect the rendering in complex script text. 38 failedCount += testChar(0x200B); 39 failedCount += testChar(0x200E); 40 failedCount += testChar(0x200F); 41 failedCount += testChar(0x202A); 42 failedCount += testChar(0x202B); 43 failedCount += testChar(0x202C); 44 failedCount += testChar(0x202D); 45 failedCount += testChar(0x202E); 46 failedCount += testChar(0xFEFF); 47 failedCount += testChar(0xFFFC); 54 var failedDevanagariCount = testWithZeroWidthSpace("\u0915\u093E", "\u0916"); 55 56 var failedArabicCount = testWithZeroWidthSpace("\u0627\u0644\u0645\u062A\u0648\u0633\u0637\u0020\u200B\u200B\u0647\u0648\u0020\u0020", "\u0647\u0648\u0020"); 48 57 49 58 var testArea = document.getElementById("testArea"); 50 59 testArea.parentNode.removeChild(testArea); 51 60 52 if (failedCount > 0) 53 result = "FAIL: " + failedCount + " characters had non-zero width" + 54 " or failed to get measured."; 55 else 61 var result = ""; 62 if (failedDevanagariCount == 0 && failedArabicCount == 0) 56 63 result = "PASS: All characters had zero-width."; 64 else { 65 if (failedDevanagariCount > 0) 66 result = "FAIL: " + failedDevanagariCount + " characters had non-zero width" + 67 " or failed to get measured when test with Devanagari"; 68 if (failedArabicCount > 0) 69 result += "\nFAIL: " + failedArabicCount + " characters had non-zero width" + 70 " or failed to get measured when test with Arabic"; 71 } 57 72 document.getElementById("result").firstChild.data = result; 58 73 } -
trunk/Source/WebCore/ChangeLog
r111587 r111589 1 2012-03-21 Xiaomei Ji <xji@chromium.org> 2 3 [chromium] Font fallback in cr-win is wrong for string contains zero-width-space. 4 https://bugs.webkit.org/show_bug.cgi?id=79961 5 6 Reviewed by Adam Barth. 7 8 Treat zero-width-space (\u200B) as true for treatAsZeroWidthSpaceInComplexScipt(). 9 10 * platform/graphics/Font.h: 11 (WebCore::Font::treatAsZeroWidthSpaceInComplexScript): 12 * platform/graphics/mac/ComplexTextController.cpp: 13 (WebCore::ComplexTextController::adjustGlyphsAndAdvances): 14 * platform/graphics/win/UniscribeController.cpp: 15 (WebCore::UniscribeController::shapeAndPlaceItem): 16 1 17 2012-03-21 Patrick Gansterer <paroga@webkit.org> 2 18 -
trunk/Source/WebCore/platform/graphics/Font.h
r104786 r111589 230 230 static bool treatAsSpace(UChar c) { return c == ' ' || c == '\t' || c == '\n' || c == noBreakSpace; } 231 231 static bool treatAsZeroWidthSpace(UChar c) { return treatAsZeroWidthSpaceInComplexScript(c) || c == 0x200c || c == 0x200d; } 232 static bool treatAsZeroWidthSpaceInComplexScript(UChar c) { return c < 0x20 || (c >= 0x7F && c < 0xA0) || c == softHyphen || (c >= 0x200e && c <= 0x200f) || (c >= 0x202a && c <= 0x202e) || c == zeroWidthNoBreakSpace || c == objectReplacementCharacter; }232 static bool treatAsZeroWidthSpaceInComplexScript(UChar c) { return c < 0x20 || (c >= 0x7F && c < 0xA0) || c == softHyphen || c == zeroWidthSpace || (c >= 0x200e && c <= 0x200f) || (c >= 0x202a && c <= 0x202e) || c == zeroWidthNoBreakSpace || c == objectReplacementCharacter; } 233 233 static bool canReceiveTextEmphasis(UChar32 c); 234 234 -
trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp
r105866 r111589 520 520 float tabWidth = m_font.tabWidth(*fontData); 521 521 advance.width = tabWidth - fmodf(m_run.xPos() + m_totalWidth + widthSinceLastCommit, tabWidth); 522 } else if ( ch == zeroWidthSpace || (Font::treatAsZeroWidthSpace(ch) && !treatAsSpace)) {522 } else if (Font::treatAsZeroWidthSpace(ch) && !treatAsSpace) { 523 523 advance.width = 0; 524 524 glyph = fontData->spaceGlyph(); -
trunk/Source/WebCore/platform/graphics/win/UniscribeController.cpp
r105756 r111589 273 273 UChar ch = *(str + k); 274 274 bool treatAsSpace = Font::treatAsSpace(ch); 275 bool treatAsZeroWidthSpace = ch == zeroWidthSpace ||Font::treatAsZeroWidthSpace(ch);275 bool treatAsZeroWidthSpace = Font::treatAsZeroWidthSpace(ch); 276 276 if (treatAsSpace || treatAsZeroWidthSpace) { 277 277 // Substitute in the space glyph at the appropriate place in the glyphs
Note: See TracChangeset
for help on using the changeset viewer.