Changeset 252061 in webkit
- Timestamp:
- Nov 5, 2019 10:39:49 AM (4 years ago)
- Location:
- trunk/Tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r252060 r252061 1 2019-11-05 Daniel Bates <dabates@apple.com> 2 3 TestWebKitAPI.WebKit.DocumentEditingContext is failing on iPad 4 https://bugs.webkit.org/show_bug.cgi?id=203828 5 <rdar://problem/55854631> 6 7 Reviewed by Myles Maxfield. 8 9 Specify both a font size and line height when using Ahem as per [1]. Otherwise, text may be 10 rendered inconsistently. Plus, disable text-autosizing and fix viewport to make test result 11 consistent on both iPhone and iPad. 12 13 [1] <https://web-platform-tests.org/writing-tests/ahem.html> 14 15 * TestWebKitAPI/Tests/WebKitCocoa/DocumentEditingContext.mm: 16 (applyStyle): Remove unused style for <iframe>s and fix up parameter name to conform to style guide. 17 (applyAhemStyle): Set -webkit-text-size-adjust to 100% to disable auto-sizing. Fix viewport width 18 and initial scale to ensure the result is the same on both iPhone and iPad. Also remove unused style 19 for <iframe>s and renamed parameter name to conform to style guide. 20 (TEST): 21 1 22 2019-11-05 Sihui Liu <sihui_liu@apple.com> 2 23 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/DocumentEditingContext.mm
r252023 r252061 100 100 @end 101 101 102 static NSString *applyStyle(NSString *HTMLString) 103 { 104 return [@"<style>body { margin: 0; } iframe { border: none; }</style><meta name='viewport' content='initial-scale=1'>" stringByAppendingString:HTMLString]; 105 } 106 107 static NSString *applyAhemStyle(NSString *HTMLString) 108 { 109 return [@"<style>@font-face { font-family: customFont; src: url(Ahem.ttf); } body { margin: 0; font-family: customFont; } iframe { border: none; }</style><meta name='viewport' content='initial-scale=1'>" stringByAppendingString:HTMLString]; 102 static NSString *applyStyle(NSString *htmlString) 103 { 104 return [@"<style>body { margin: 0; } </style><meta name='viewport' content='initial-scale=1'>" stringByAppendingString:htmlString]; 105 } 106 107 constexpr unsigned glyphWidth { 25 }; // pixels 108 109 static NSString *applyAhemStyle(NSString *htmlString) 110 { 111 return [NSString stringWithFormat:@"<style>@font-face { font-family: Ahem; src: url(Ahem.ttf); } body { margin: 0; font: %upx/1 Ahem; -webkit-text-size-adjust: 100%%; }</style><meta name='viewport' content='width=980, initial-scale=1.0'>%@", glyphWidth, htmlString]; 110 112 } 111 113 … … 205 207 }]; 206 208 EXPECT_EQ(4UL, rects.count); 207 EXPECT_EQ(CGRectMake(0, 0, 23, 24), rects[0].CGRectValue);208 EXPECT_EQ(CGRectMake( 23, 0, 23, 24), rects[1].CGRectValue);209 EXPECT_EQ(CGRectMake( 46, 0, 23, 24), rects[2].CGRectValue);210 EXPECT_EQ(CGRectMake( 69, 0, 23, 24), rects[3].CGRectValue);209 EXPECT_EQ(CGRectMake(0, 0, glyphWidth, glyphWidth), rects[0].CGRectValue); 210 EXPECT_EQ(CGRectMake(glyphWidth, 0, glyphWidth, glyphWidth), rects[1].CGRectValue); 211 EXPECT_EQ(CGRectMake(2 * glyphWidth, 0, glyphWidth, glyphWidth), rects[2].CGRectValue); 212 EXPECT_EQ(CGRectMake(3 * glyphWidth, 0, glyphWidth, glyphWidth), rects[3].CGRectValue); 211 213 rects = [context characterRectsForCharacterRange:NSMakeRange(5, 1)]; 212 214 EXPECT_EQ(0UL, rects.count); … … 216 218 rects = [context characterRectsForCharacterRange:NSMakeRange(0, 1)]; 217 219 EXPECT_EQ(1UL, rects.count); 218 EXPECT_EQ(CGRectMake(0, 0, 23, 24), rects.firstObject.CGRectValue);220 EXPECT_EQ(CGRectMake(0, 0, glyphWidth, glyphWidth), rects.firstObject.CGRectValue); 219 221 rects = [context characterRectsForCharacterRange:NSMakeRange(6, 1)]; 220 222 EXPECT_EQ(1UL, rects.count); 221 EXPECT_EQ(CGRectMake( 138, 0, 23, 24), rects.firstObject.CGRectValue);223 EXPECT_EQ(CGRectMake(6 * glyphWidth, 0, glyphWidth, glyphWidth), rects.firstObject.CGRectValue); 222 224 223 225 // Text Input Context
Note: See TracChangeset
for help on using the changeset viewer.