Changeset 231396 in webkit
- Timestamp:
- May 4, 2018 9:39:52 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r231394 r231396 1 2018-05-04 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [iOS] Multiple links in Mail are dropped in a single line, and are difficult to tell apart 4 https://bugs.webkit.org/show_bug.cgi?id=185289 5 <rdar://problem/35756912> 6 7 Reviewed by Tim Horton and Darin Adler. 8 9 When inserting multiple URLs as individual items in a single drop, we currently separate each item with a space 10 (see r217284). However, it still seems difficult to tell dropped links apart. This patch makes some slight 11 tweaks to WebContentReader::readURL so that it inserts line breaks before dropped URLs, if the dropped URL isn't 12 the first item to be inserted in the resulting document fragment. 13 14 Augments existing API tests in DataInteractionTests. 15 16 * editing/ios/WebContentReaderIOS.mm: 17 18 Additionally remove some extraneous header imports from this implementation file. 19 20 (WebCore::WebContentReader::readURL): 21 1 22 2018-05-02 Dean Jackson <dino@apple.com> 2 23 -
trunk/Source/WebCore/editing/ios/WebContentReaderIOS.mm
r228531 r231396 29 29 #if PLATFORM(IOS) 30 30 31 #import "ArchiveResource.h"32 31 #import "Document.h" 33 32 #import "DocumentFragment.h" 34 #import "DocumentLoader.h"35 33 #import "Editor.h" 36 34 #import "EditorClient.h" 37 #import "FragmentScriptingPermission.h"38 #import "FrameLoader.h"39 #import "FrameLoaderClient.h"40 35 #import "HTMLAnchorElement.h" 36 #import "HTMLBRElement.h" 41 37 #import "HTMLNames.h" 42 #import "LegacyWebArchive.h"43 #import "MIMETypeRegistry.h"44 38 #import "Text.h" 45 #import "UTIUtilities.h"46 #import "markup.h"47 #import <MobileCoreServices/MobileCoreServices.h>48 #import <wtf/unicode/CharacterNames.h>49 39 50 40 namespace WebCore { … … 64 54 return false; 65 55 66 auto anchor = HTMLAnchorElement::create(*frame.document()); 56 auto document = makeRef(*frame.document()); 57 auto anchor = HTMLAnchorElement::create(document.get()); 67 58 anchor->setAttributeWithoutSynchronization(HTMLNames::hrefAttr, url.string()); 68 59 69 60 String linkText = title.length() ? title : String([[(NSURL *)url absoluteString] precomposedStringWithCanonicalMapping]); 70 anchor->appendChild( frame.document()->createTextNode(linkText));61 anchor->appendChild(document->createTextNode(linkText)); 71 62 72 auto newFragment = frame.document()->createDocumentFragment();63 auto newFragment = document->createDocumentFragment(); 73 64 if (fragment) 74 newFragment->appendChild( Text::create(*frame.document(), { &space, 1 }));65 newFragment->appendChild(HTMLBRElement::create(document.get())); 75 66 newFragment->appendChild(anchor); 76 67 addFragment(WTFMove(newFragment)); -
trunk/Tools/ChangeLog
r231383 r231396 1 2018-05-04 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [iOS] Multiple links in Mail are dropped in a single line, and are difficult to tell apart 4 https://bugs.webkit.org/show_bug.cgi?id=185289 5 <rdar://problem/35756912> 6 7 Reviewed by Tim Horton and Darin Adler. 8 9 Augment and rebaseline some iOS drag-and-drop API tests that handle dropping URLs as a part of multi-item drop 10 sessions. 11 12 * TestWebKitAPI/Tests/ios/DataInteractionTests.mm: 13 (TestWebKitAPI::TEST): 14 1 15 2018-05-04 Timothy Hatcher <timothy@apple.com> 2 16 -
trunk/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm
r229811 r231396 857 857 [dataInteractionSimulator runFrom:CGPointMake(300, 400) to:CGPointMake(100, 300)]; 858 858 859 NSArray *separatedLinks = [[webView stringByEvaluatingJavaScript:@"editor.textContent"] componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; 860 EXPECT_EQ(3UL, separatedLinks.count); 861 EXPECT_WK_STREQ("https://www.apple.com/iphone/", separatedLinks[0]); 862 EXPECT_WK_STREQ("https://www.apple.com/mac/", separatedLinks[1]); 863 EXPECT_WK_STREQ("https://webkit.org/", separatedLinks[2]); 859 NSArray *droppedURLs = [webView objectByEvaluatingJavaScript:@"Array.from(editor.querySelectorAll('a')).map(a => a.href)"]; 860 EXPECT_EQ(3UL, droppedURLs.count); 861 EXPECT_WK_STREQ("https://www.apple.com/iphone/", droppedURLs[0]); 862 EXPECT_WK_STREQ("https://www.apple.com/mac/", droppedURLs[1]); 863 EXPECT_WK_STREQ("https://webkit.org/", droppedURLs[2]); 864 865 NSArray *linksSeparatedByLine = [[webView objectByEvaluatingJavaScript:@"editor.innerText"] componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]]; 866 EXPECT_EQ(3UL, linksSeparatedByLine.count); 867 EXPECT_WK_STREQ("https://www.apple.com/iphone/", linksSeparatedByLine[0]); 868 EXPECT_WK_STREQ("https://www.apple.com/mac/", linksSeparatedByLine[1]); 869 EXPECT_WK_STREQ("https://webkit.org/", linksSeparatedByLine[2]); 864 870 } 865 871 … … 1467 1473 @0.66: [NSValue valueWithCGPoint:CGPointMake(50, 250)] 1468 1474 }]; 1469 EXPECT_WK_STREQ("ABCD 1475 EXPECT_WK_STREQ("ABCDA link", [webView stringByEvaluatingJavaScript:@"editor.textContent"]); 1470 1476 EXPECT_TRUE([webView stringByEvaluatingJavaScript:@"!!editor.querySelector('img')"]); 1471 1477 EXPECT_WK_STREQ("https://www.apple.com/", [webView stringByEvaluatingJavaScript:@"editor.querySelector('a').href"]);
Note: See TracChangeset
for help on using the changeset viewer.