Changeset 258974 in webkit
- Timestamp:
- Mar 24, 2020 11:00:23 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r258969 r258974 1 2020-03-24 Daniel Bates <dabates@apple.com> 2 3 Unreviewed, reverting r258945. 4 5 Revert change that broke API tests while I investigate 6 offline. 7 8 Reverted changeset: 9 10 "Element context character rects may be in wrong coordinate 11 system" 12 https://bugs.webkit.org/show_bug.cgi?id=209493 13 https://trac.webkit.org/changeset/258945 14 1 15 2020-03-24 John Wilander <wilander@apple.com> 2 16 -
trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
r258945 r258974 4243 4243 const int stride = 1; 4244 4244 while (!iterator.atEnd()) { 4245 if (!iterator.text().isEmpty()) { 4246 auto currentRange = createLiveRange(iterator.range()); 4247 auto absoluteBoundingBox = currentRange->absoluteBoundingBox(Range::BoundingRectBehavior::IgnoreEmptyTextSelections); 4248 rects.append({ currentRange->ownerDocument().view()->contentsToRootView(absoluteBoundingBox), { offsetSoFar++, stride } }); 4249 } 4245 if (!iterator.text().isEmpty()) 4246 rects.append({ createLiveRange(iterator.range())->absoluteBoundingBox(Range::BoundingRectBehavior::IgnoreEmptyTextSelections), { offsetSoFar++, stride } }); 4250 4247 iterator.advance(stride); 4251 4248 } -
trunk/Tools/ChangeLog
r258973 r258974 1 2020-03-24 Daniel Bates <dabates@apple.com> 2 3 Unreviewed, reverting r258945. 4 5 Revert change that broke API tests while I investigate 6 offline. 7 8 Reverted changeset: 9 10 "Element context character rects may be in wrong coordinate 11 system" 12 https://bugs.webkit.org/show_bug.cgi?id=209493 13 https://trac.webkit.org/changeset/258945 14 1 15 2020-03-24 Jiewen Tan <jiewen_tan@apple.com> 2 16 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/DocumentEditingContext.mm
r258945 r258974 514 514 } 515 515 516 TEST(DocumentEditingContext, RequestRectsInTextAreaInsideIFrame)517 {518 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);519 // Use "padding: 0" for the <textarea> as the default user-agent stylesheet can effect text wrapping.520 [webView synchronouslyLoadHTMLString:applyAhemStyle([NSString stringWithFormat:@"<iframe srcdoc=\"%@\" style='position: absolute; left: 1em; top: 1em; border: none'></iframe>", applyAhemStyle(@"<textarea id='test' style='padding: 0'>The quick brown fox jumps over the lazy dog.</textarea><script>let textarea = document.querySelector('iframe').contentDocument.getElementById('test'); textarea.focus(); textarea.setSelectionRange(0, 0); /* Place caret at the beginning of the field. */</script>")])];521 522 auto *context = [webView synchronouslyRequestDocumentContext:makeRequest(UIWKDocumentRequestText | UIWKDocumentRequestRects, UITextGranularityWord, 1)];523 EXPECT_NOT_NULL(context);524 EXPECT_NULL(context.contextBefore);525 EXPECT_NSSTRING_EQ("The", context.contextAfter);526 auto *textRects = [context textRects];527 EXPECT_EQ(3U, textRects.count);528 529 #if PLATFORM(MACCATALYST)530 const size_t yPos = 27;531 const size_t height = 26;532 #else533 const size_t yPos = 28;534 const size_t height = 25;535 #endif536 537 if (textRects.count >= 3) {538 CGFloat x = 28;539 EXPECT_EQ(CGRectMake(x + 0 * glyphWidth, yPos, 25, height), textRects[0].CGRectValue); // T540 EXPECT_EQ(CGRectMake(x + 1 * glyphWidth, yPos, 25, height), textRects[1].CGRectValue); // h541 EXPECT_EQ(CGRectMake(x + 2 * glyphWidth, yPos, 25, height), textRects[2].CGRectValue); // e542 }543 }544 545 TEST(DocumentEditingContext, RequestRectsInTextAreaInsideScrolledIFrame)546 {547 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);548 // Use "padding: 0" for the <textarea> as the default user-agent stylesheet can effect text wrapping.549 [webView synchronouslyLoadHTMLString:applyAhemStyle([NSString stringWithFormat:@"<iframe srcdoc=\"%@\" style='position: absolute; left: 1em; top: 1em; border: none' height='200'></iframe>", applyAhemStyle(@"<body style='height: 1000px'><div style='width: 200px; height: 200px'></div><textarea id='test' style='padding: 0'>The quick brown fox jumps over the lazy dog.</textarea><script>let textarea = document.getElementById('test'); textarea.focus(); textarea.setSelectionRange(0, 0); window.scrollTo(0, 200); /* Scroll <textarea> to the top. */</script></body>")])];550 551 auto *context = [webView synchronouslyRequestDocumentContext:makeRequest(UIWKDocumentRequestText | UIWKDocumentRequestRects, UITextGranularityWord, 1)];552 EXPECT_NOT_NULL(context);553 EXPECT_NULL(context.contextBefore);554 EXPECT_NSSTRING_EQ("The", context.contextAfter);555 auto *textRects = [context textRects];556 EXPECT_EQ(3U, textRects.count);557 558 #if PLATFORM(MACCATALYST)559 const size_t yPos = 27;560 const size_t height = 26;561 #else562 const size_t yPos = 28;563 const size_t height = 25;564 #endif565 566 if (textRects.count >= 3) {567 CGFloat x = 28;568 EXPECT_EQ(CGRectMake(x + 0 * glyphWidth, yPos, 25, height), textRects[0].CGRectValue); // T569 EXPECT_EQ(CGRectMake(x + 1 * glyphWidth, yPos, 25, height), textRects[1].CGRectValue); // h570 EXPECT_EQ(CGRectMake(x + 2 * glyphWidth, yPos, 25, height), textRects[2].CGRectValue); // e571 }572 }573 574 516 // MARK: Tests using word granularity 575 517
Note: See TracChangeset
for help on using the changeset viewer.