Modified: tags/Safari-609.1.10.1/Tools/ChangeLog (252295 => 252296)
--- tags/Safari-609.1.10.1/Tools/ChangeLog 2019-11-09 00:52:36 UTC (rev 252295)
+++ tags/Safari-609.1.10.1/Tools/ChangeLog 2019-11-09 00:52:39 UTC (rev 252296)
@@ -1,5 +1,51 @@
2019-11-08 Alan Coon <alanc...@apple.com>
+ Cherry-pick r252061. rdar://problem/55854631
+
+ TestWebKitAPI.WebKit.DocumentEditingContext is failing on iPad
+ https://bugs.webkit.org/show_bug.cgi?id=203828
+ <rdar://problem/55854631>
+
+ Reviewed by Myles Maxfield.
+
+ Specify both a font size and line height when using Ahem as per [1]. Otherwise, text may be
+ rendered inconsistently. Plus, disable text-autosizing and fix viewport to make test result
+ consistent on both iPhone and iPad.
+
+ [1] <https://web-platform-tests.org/writing-tests/ahem.html>
+
+ * TestWebKitAPI/Tests/WebKitCocoa/DocumentEditingContext.mm:
+ (applyStyle): Remove unused style for <iframe>s and fix up parameter name to conform to style guide.
+ (applyAhemStyle): Set -webkit-text-size-adjust to 100% to disable auto-sizing. Fix viewport width
+ and initial scale to ensure the result is the same on both iPhone and iPad. Also remove unused style
+ for <iframe>s and renamed parameter name to conform to style guide.
+ (TEST):
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252061 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2019-11-05 Daniel Bates <daba...@apple.com>
+
+ TestWebKitAPI.WebKit.DocumentEditingContext is failing on iPad
+ https://bugs.webkit.org/show_bug.cgi?id=203828
+ <rdar://problem/55854631>
+
+ Reviewed by Myles Maxfield.
+
+ Specify both a font size and line height when using Ahem as per [1]. Otherwise, text may be
+ rendered inconsistently. Plus, disable text-autosizing and fix viewport to make test result
+ consistent on both iPhone and iPad.
+
+ [1] <https://web-platform-tests.org/writing-tests/ahem.html>
+
+ * TestWebKitAPI/Tests/WebKitCocoa/DocumentEditingContext.mm:
+ (applyStyle): Remove unused style for <iframe>s and fix up parameter name to conform to style guide.
+ (applyAhemStyle): Set -webkit-text-size-adjust to 100% to disable auto-sizing. Fix viewport width
+ and initial scale to ensure the result is the same on both iPhone and iPad. Also remove unused style
+ for <iframe>s and renamed parameter name to conform to style guide.
+ (TEST):
+
+2019-11-08 Alan Coon <alanc...@apple.com>
+
Cherry-pick r252023. rdar://problem/55854631
Add Googletest assertion support for CGRect and NSRect
Modified: tags/Safari-609.1.10.1/Tools/TestWebKitAPI/Tests/WebKitCocoa/DocumentEditingContext.mm (252295 => 252296)
--- tags/Safari-609.1.10.1/Tools/TestWebKitAPI/Tests/WebKitCocoa/DocumentEditingContext.mm 2019-11-09 00:52:36 UTC (rev 252295)
+++ tags/Safari-609.1.10.1/Tools/TestWebKitAPI/Tests/WebKitCocoa/DocumentEditingContext.mm 2019-11-09 00:52:39 UTC (rev 252296)
@@ -99,14 +99,16 @@
@end
-static NSString *applyStyle(NSString *HTMLString)
+static NSString *applyStyle(NSString *htmlString)
{
- return [@"<style>body { margin: 0; } iframe { border: none; }</style><meta name='viewport' content='initial-scale=1'>" stringByAppendingString:HTMLString];
+ return [@"<style>body { margin: 0; } </style><meta name='viewport' content='initial-scale=1'>" stringByAppendingString:htmlString];
}
-static NSString *applyAhemStyle(NSString *HTMLString)
+constexpr unsigned glyphWidth { 25 }; // pixels
+
+static NSString *applyAhemStyle(NSString *htmlString)
{
- 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];
+ 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];
}
TEST(WebKit, DocumentEditingContext)
@@ -204,10 +206,10 @@
return [@(a.CGRectValue.origin.x) compare:@(b.CGRectValue.origin.x)];
}];
EXPECT_EQ(4UL, rects.count);
- EXPECT_EQ(CGRectMake(0, 0, 23, 24), rects[0].CGRectValue);
- EXPECT_EQ(CGRectMake(23, 0, 23, 24), rects[1].CGRectValue);
- EXPECT_EQ(CGRectMake(46, 0, 23, 24), rects[2].CGRectValue);
- EXPECT_EQ(CGRectMake(69, 0, 23, 24), rects[3].CGRectValue);
+ EXPECT_EQ(CGRectMake(0, 0, glyphWidth, glyphWidth), rects[0].CGRectValue);
+ EXPECT_EQ(CGRectMake(glyphWidth, 0, glyphWidth, glyphWidth), rects[1].CGRectValue);
+ EXPECT_EQ(CGRectMake(2 * glyphWidth, 0, glyphWidth, glyphWidth), rects[2].CGRectValue);
+ EXPECT_EQ(CGRectMake(3 * glyphWidth, 0, glyphWidth, glyphWidth), rects[3].CGRectValue);
rects = [context characterRectsForCharacterRange:NSMakeRange(5, 1)];
EXPECT_EQ(0UL, rects.count);
@@ -215,10 +217,10 @@
EXPECT_NSSTRING_EQ(" MMM", context.contextAfter);
rects = [context characterRectsForCharacterRange:NSMakeRange(0, 1)];
EXPECT_EQ(1UL, rects.count);
- EXPECT_EQ(CGRectMake(0, 0, 23, 24), rects.firstObject.CGRectValue);
+ EXPECT_EQ(CGRectMake(0, 0, glyphWidth, glyphWidth), rects.firstObject.CGRectValue);
rects = [context characterRectsForCharacterRange:NSMakeRange(6, 1)];
EXPECT_EQ(1UL, rects.count);
- EXPECT_EQ(CGRectMake(138, 0, 23, 24), rects.firstObject.CGRectValue);
+ EXPECT_EQ(CGRectMake(6 * glyphWidth, 0, glyphWidth, glyphWidth), rects.firstObject.CGRectValue);
// Text Input Context
[webView synchronouslyLoadHTMLString:applyStyle(@"<input type='text' style='width: 50px; height: 50px;' value='hello, world'>")];