Changeset 248343 in webkit
- Timestamp:
- Aug 6, 2019, 11:52:11 PM (7 years ago)
- Location:
- branches/safari-608.1-branch
- Files:
-
- 8 edited
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/Shared/EditorState.cpp (modified) (2 diffs)
-
Source/WebKit/Shared/EditorState.h (modified) (1 diff)
-
Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (modified) (1 diff)
-
Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (modified) (1 diff)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebKitCocoa/EditorStateTests.mm (modified) (1 diff)
-
Tools/TestWebKitAPI/cocoa/TestWKWebView.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-608.1-branch/Source/WebKit/ChangeLog
r248342 r248343 1 2019-08-06 Kocsen Chung <kocsen_chung@apple.com> 2 3 Cherry-pick r247679. rdar://problem/54017903 4 5 [iOS] [WebKit2] Add limited support for -isPosition:atBoundary:inDirection: in WKContentView 6 https://bugs.webkit.org/show_bug.cgi?id=199993 7 <rdar://problem/49523528> 8 9 Reviewed by Beth Dakin. 10 11 Source/WebKit: 12 13 Add support for -isPosition:atBoundary:inDirection:, only in the cases where the given position is the start or 14 and position and the given granularity is UITextGranularityParagraph. 15 16 Test: EditorStateTests.ParagraphBoundary 17 18 * Shared/EditorState.cpp: 19 (WebKit::EditorState::PostLayoutData::encode const): 20 (WebKit::EditorState::PostLayoutData::decode): 21 * Shared/EditorState.h: 22 23 Add a couple of bits to indicate whether the selection start or end positions are at paragraph boundaries. 24 25 * UIProcess/ios/WKContentViewInteraction.mm: 26 (-[WKContentView isPosition:atBoundary:inDirection:]): 27 28 Implement this to return selectionStartIsAtParagraphBoundary or selectionEndIsAtParagraphBoundary. 29 30 * WebProcess/WebPage/ios/WebPageIOS.mm: 31 (WebKit::WebPage::platformEditorState const): 32 33 Tools: 34 35 Add a new API test to verify the behavior of -isPosition:atBoundary:inDirection:. 36 37 * TestWebKitAPI/Tests/WebKitCocoa/EditorStateTests.mm: 38 (TestWebKitAPI::TEST): 39 * TestWebKitAPI/cocoa/TestWKWebView.h: 40 41 42 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247679 268f45cc-cd09-0410-ab3c-d52691b4dbfc 43 44 2019-07-21 Wenson Hsieh <wenson_hsieh@apple.com> 45 46 [iOS] [WebKit2] Add limited support for -isPosition:atBoundary:inDirection: in WKContentView 47 https://bugs.webkit.org/show_bug.cgi?id=199993 48 <rdar://problem/49523528> 49 50 Reviewed by Beth Dakin. 51 52 Add support for -isPosition:atBoundary:inDirection:, only in the cases where the given position is the start or 53 and position and the given granularity is UITextGranularityParagraph. 54 55 Test: EditorStateTests.ParagraphBoundary 56 57 * Shared/EditorState.cpp: 58 (WebKit::EditorState::PostLayoutData::encode const): 59 (WebKit::EditorState::PostLayoutData::decode): 60 * Shared/EditorState.h: 61 62 Add a couple of bits to indicate whether the selection start or end positions are at paragraph boundaries. 63 64 * UIProcess/ios/WKContentViewInteraction.mm: 65 (-[WKContentView isPosition:atBoundary:inDirection:]): 66 67 Implement this to return selectionStartIsAtParagraphBoundary or selectionEndIsAtParagraphBoundary. 68 69 * WebProcess/WebPage/ios/WebPageIOS.mm: 70 (WebKit::WebPage::platformEditorState const): 71 1 72 2019-08-06 Kocsen Chung <kocsen_chung@apple.com> 2 73 -
branches/safari-608.1-branch/Source/WebKit/Shared/EditorState.cpp
r243102 r248343 135 135 encoder << caretColor; 136 136 encoder << atStartOfSentence; 137 encoder << selectionStartIsAtParagraphBoundary; 138 encoder << selectionEndIsAtParagraphBoundary; 137 139 #endif 138 140 #if PLATFORM(MAC) … … 197 199 return false; 198 200 if (!decoder.decode(result.atStartOfSentence)) 201 return false; 202 if (!decoder.decode(result.selectionStartIsAtParagraphBoundary)) 203 return false; 204 if (!decoder.decode(result.selectionEndIsAtParagraphBoundary)) 199 205 return false; 200 206 #endif -
branches/safari-608.1-branch/Source/WebKit/Shared/EditorState.h
r243102 r248343 113 113 WebCore::Color caretColor; 114 114 bool atStartOfSentence { false }; 115 bool selectionStartIsAtParagraphBoundary { false }; 116 bool selectionEndIsAtParagraphBoundary { false }; 115 117 #endif 116 118 #if PLATFORM(MAC) -
branches/safari-608.1-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r248341 r248343 5069 5069 - (BOOL)isPosition:(UITextPosition *)position atBoundary:(UITextGranularity)granularity inDirection:(UITextDirection)direction 5070 5070 { 5071 if (granularity == UITextGranularityParagraph) { 5072 if (direction == UITextStorageDirectionBackward && [position isEqual:self.selectedTextRange.start]) 5073 return _page->editorState().postLayoutData().selectionStartIsAtParagraphBoundary; 5074 5075 if (direction == UITextStorageDirectionForward && [position isEqual:self.selectedTextRange.end]) 5076 return _page->editorState().postLayoutData().selectionEndIsAtParagraphBoundary; 5077 } 5078 5071 5079 return NO; 5072 5080 } -
branches/safari-608.1-branch/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
r247798 r248343 274 274 } 275 275 computeEditableRootHasContentAndPlainText(selection, postLayoutData); 276 postLayoutData.selectionStartIsAtParagraphBoundary = atBoundaryOfGranularity(selection.visibleStart(), TextGranularity::ParagraphGranularity, SelectionDirection::DirectionBackward); 277 postLayoutData.selectionEndIsAtParagraphBoundary = atBoundaryOfGranularity(selection.visibleEnd(), TextGranularity::ParagraphGranularity, SelectionDirection::DirectionForward); 276 278 } 277 279 } -
branches/safari-608.1-branch/Tools/ChangeLog
r248127 r248343 1 2019-08-06 Kocsen Chung <kocsen_chung@apple.com> 2 3 Cherry-pick r247679. rdar://problem/54017903 4 5 [iOS] [WebKit2] Add limited support for -isPosition:atBoundary:inDirection: in WKContentView 6 https://bugs.webkit.org/show_bug.cgi?id=199993 7 <rdar://problem/49523528> 8 9 Reviewed by Beth Dakin. 10 11 Source/WebKit: 12 13 Add support for -isPosition:atBoundary:inDirection:, only in the cases where the given position is the start or 14 and position and the given granularity is UITextGranularityParagraph. 15 16 Test: EditorStateTests.ParagraphBoundary 17 18 * Shared/EditorState.cpp: 19 (WebKit::EditorState::PostLayoutData::encode const): 20 (WebKit::EditorState::PostLayoutData::decode): 21 * Shared/EditorState.h: 22 23 Add a couple of bits to indicate whether the selection start or end positions are at paragraph boundaries. 24 25 * UIProcess/ios/WKContentViewInteraction.mm: 26 (-[WKContentView isPosition:atBoundary:inDirection:]): 27 28 Implement this to return selectionStartIsAtParagraphBoundary or selectionEndIsAtParagraphBoundary. 29 30 * WebProcess/WebPage/ios/WebPageIOS.mm: 31 (WebKit::WebPage::platformEditorState const): 32 33 Tools: 34 35 Add a new API test to verify the behavior of -isPosition:atBoundary:inDirection:. 36 37 * TestWebKitAPI/Tests/WebKitCocoa/EditorStateTests.mm: 38 (TestWebKitAPI::TEST): 39 * TestWebKitAPI/cocoa/TestWKWebView.h: 40 41 42 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247679 268f45cc-cd09-0410-ab3c-d52691b4dbfc 43 44 2019-07-21 Wenson Hsieh <wenson_hsieh@apple.com> 45 46 [iOS] [WebKit2] Add limited support for -isPosition:atBoundary:inDirection: in WKContentView 47 https://bugs.webkit.org/show_bug.cgi?id=199993 48 <rdar://problem/49523528> 49 50 Reviewed by Beth Dakin. 51 52 Add a new API test to verify the behavior of -isPosition:atBoundary:inDirection:. 53 54 * TestWebKitAPI/Tests/WebKitCocoa/EditorStateTests.mm: 55 (TestWebKitAPI::TEST): 56 * TestWebKitAPI/cocoa/TestWKWebView.h: 57 1 58 2019-08-01 Ryan Haddad <ryanhaddad@apple.com> 2 59 -
branches/safari-608.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/EditorStateTests.mm
r244955 r248343 399 399 } 400 400 401 TEST(EditorStateTests, ParagraphBoundary) 402 { 403 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]); 404 [webView synchronouslyLoadHTMLString:@"<body contenteditable><p>Hello world.</p></body>"]; 405 [webView stringByEvaluatingJavaScript:@"document.body.focus()"]; 406 [webView waitForNextPresentationUpdate]; 407 408 auto textInput = [webView textInputContentView]; 409 auto editor = adoptNS([[EditingTestHarness alloc] initWithWebView:webView.get()]); 410 [editor selectAll]; 411 412 EXPECT_TRUE([textInput isPosition:textInput.selectedTextRange.start atBoundary:UITextGranularityParagraph inDirection:UITextStorageDirectionBackward]); 413 EXPECT_TRUE([textInput isPosition:textInput.selectedTextRange.end atBoundary:UITextGranularityParagraph inDirection:UITextStorageDirectionForward]); 414 415 [editor moveForward]; 416 [editor moveBackward]; 417 [editor moveBackward]; 418 419 EXPECT_FALSE([textInput isPosition:textInput.selectedTextRange.start atBoundary:UITextGranularityParagraph inDirection:UITextStorageDirectionBackward]); 420 EXPECT_FALSE([textInput isPosition:textInput.selectedTextRange.end atBoundary:UITextGranularityParagraph inDirection:UITextStorageDirectionForward]); 421 } 422 401 423 #endif // PLATFORM(IOS_FAMILY) 402 424 -
branches/safari-608.1-branch/Tools/TestWebKitAPI/cocoa/TestWKWebView.h
r246924 r248343 87 87 88 88 @interface TestWKWebView (IOSOnly) 89 @property (nonatomic, readonly) UIView <UITextInputPrivate, UITextInputInternal, UITextInputMultiDocument, UIWKInteractionViewProtocol > *textInputContentView;89 @property (nonatomic, readonly) UIView <UITextInputPrivate, UITextInputInternal, UITextInputMultiDocument, UIWKInteractionViewProtocol, UITextInputTokenizer> *textInputContentView; 90 90 @property (nonatomic, readonly) RetainPtr<NSArray> selectionRectsAfterPresentationUpdate; 91 91 @property (nonatomic, readonly) CGRect caretViewRectInContentCoordinates;
Note:
See TracChangeset
for help on using the changeset viewer.