Changeset 258974 in webkit


Ignore:
Timestamp:
Mar 24, 2020 11:00:23 PM (4 years ago)
Author:
dbates@webkit.org
Message:

Unreviewed, reverting r258945.

Revert change that broke API tests while I investigate
offline.

Reverted changeset:

"Element context character rects may be in wrong coordinate
system"
https://bugs.webkit.org/show_bug.cgi?id=209493
https://trac.webkit.org/changeset/258945

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r258969 r258974  
     12020-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
    1152020-03-24  John Wilander  <wilander@apple.com>
    216
  • trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

    r258945 r258974  
    42434243        const int stride = 1;
    42444244        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 } });
    42504247            iterator.advance(stride);
    42514248        }
  • trunk/Tools/ChangeLog

    r258973 r258974  
     12020-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
    1152020-03-24  Jiewen Tan  <jiewen_tan@apple.com>
    216
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/DocumentEditingContext.mm

    r258945 r258974  
    514514}
    515515
    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 #else
    533     const size_t yPos = 28;
    534     const size_t height = 25;
    535 #endif
    536 
    537     if (textRects.count >= 3) {
    538         CGFloat x = 28;
    539         EXPECT_EQ(CGRectMake(x + 0 * glyphWidth, yPos, 25, height), textRects[0].CGRectValue); // T
    540         EXPECT_EQ(CGRectMake(x + 1 * glyphWidth, yPos, 25, height), textRects[1].CGRectValue); // h
    541         EXPECT_EQ(CGRectMake(x + 2 * glyphWidth, yPos, 25, height), textRects[2].CGRectValue); // e
    542     }
    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 #else
    562     const size_t yPos = 28;
    563     const size_t height = 25;
    564 #endif
    565 
    566     if (textRects.count >= 3) {
    567         CGFloat x = 28;
    568         EXPECT_EQ(CGRectMake(x + 0 * glyphWidth, yPos, 25, height), textRects[0].CGRectValue); // T
    569         EXPECT_EQ(CGRectMake(x + 1 * glyphWidth, yPos, 25, height), textRects[1].CGRectValue); // h
    570         EXPECT_EQ(CGRectMake(x + 2 * glyphWidth, yPos, 25, height), textRects[2].CGRectValue); // e
    571     }
    572 }
    573 
    574516// MARK: Tests using word granularity
    575517
Note: See TracChangeset for help on using the changeset viewer.