Changeset 244494 in webkit
- Timestamp:
- Apr 21, 2019 2:10:31 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r244493 r244494 1 2019-04-21 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Defer EditorState updates until the next layer tree flush in a few additional circumstances 4 https://bugs.webkit.org/show_bug.cgi?id=197145 5 <rdar://problem/50078170> 6 7 Reviewed by Darin Adler. 8 9 Gets rid of sendPartialEditorStateAndSchedulePostLayoutUpdate(), in favor of always scheduling a full editor 10 state update after the next compositing flush. 11 12 * WebProcess/WebPage/WebPage.cpp: 13 (WebKit::WebPage::updateEditorStateAfterLayoutIfEditabilityChanged): 14 (WebKit::WebPage::setNeedsFontAttributes): 15 (WebKit::WebPage::didChangeOverflowScrollPosition): 16 (WebKit::WebPage::didChangeSelection): 17 (WebKit::WebPage::didChangeSelectionOrOverflowScrollPosition): 18 (WebKit::WebPage::sendPartialEditorStateAndSchedulePostLayoutUpdate): Deleted. 19 * WebProcess/WebPage/WebPage.h: 20 * WebProcess/WebPage/ios/WebPageIOS.mm: 21 (WebKit::WebPage::platformEditorState const): 22 (WebKit::WebPage::updateVisibleContentRects): 23 1 24 2019-04-21 Chris Dumez <cdumez@apple.com> 2 25 -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp
r244446 r244494 1126 1126 EditorStateIsContentEditable editorStateIsContentEditable = frame.selection().selection().isContentEditable() ? EditorStateIsContentEditable::Yes : EditorStateIsContentEditable::No; 1127 1127 if (m_lastEditorStateWasContentEditable != editorStateIsContentEditable) 1128 s endPartialEditorStateAndSchedulePostLayoutUpdate();1128 scheduleFullEditorStateUpdate(); 1129 1129 } 1130 1130 … … 2765 2765 2766 2766 if (m_needsFontAttributes) 2767 s endPartialEditorStateAndSchedulePostLayoutUpdate();2767 scheduleFullEditorStateUpdate(); 2768 2768 } 2769 2769 … … 5288 5288 void WebPage::didChangeOverflowScrollPosition() 5289 5289 { 5290 didChangeSelectionOrOverflowScrollPosition( EditorStateUpdateScheduling::Deferred);5290 didChangeSelectionOrOverflowScrollPosition(); 5291 5291 } 5292 5292 5293 5293 void WebPage::didChangeSelection() 5294 5294 { 5295 didChangeSelectionOrOverflowScrollPosition( EditorStateUpdateScheduling::Immediate);5296 } 5297 5298 void WebPage::didChangeSelectionOrOverflowScrollPosition( EditorStateUpdateScheduling editorStateScheduling)5295 didChangeSelectionOrOverflowScrollPosition(); 5296 } 5297 5298 void WebPage::didChangeSelectionOrOverflowScrollPosition() 5299 5299 { 5300 5300 Frame& frame = m_page->focusController().focusedOrMainFrame(); … … 5339 5339 #endif 5340 5340 5341 if (editorStateScheduling == EditorStateUpdateScheduling::Immediate) 5342 sendPartialEditorStateAndSchedulePostLayoutUpdate(); 5343 else 5344 scheduleFullEditorStateUpdate(); 5341 scheduleFullEditorStateUpdate(); 5345 5342 } 5346 5343 … … 6025 6022 #endif 6026 6023 6027 void WebPage::sendPartialEditorStateAndSchedulePostLayoutUpdate()6028 {6029 Frame& frame = m_page->focusController().focusedOrMainFrame();6030 if (frame.editor().ignoreSelectionChanges())6031 return;6032 6033 send(Messages::WebPageProxy::EditorStateChanged(editorState(IncludePostLayoutDataHint::No)), pageID());6034 scheduleFullEditorStateUpdate();6035 }6036 6037 6024 void WebPage::flushPendingEditorStateUpdate() 6038 6025 { -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.h
r244446 r244494 1114 1114 static PluginView* pluginViewForFrame(WebCore::Frame*); 1115 1115 1116 void sendPartialEditorStateAndSchedulePostLayoutUpdate();1117 1116 void flushPendingEditorStateUpdate(); 1118 1117 … … 1273 1272 void setEditable(bool); 1274 1273 1275 enum class EditorStateUpdateScheduling { Deferred, Immediate }; 1276 void didChangeSelectionOrOverflowScrollPosition(EditorStateUpdateScheduling); 1274 void didChangeSelectionOrOverflowScrollPosition(); 1277 1275 1278 1276 void increaseListLevel(); -
trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
r244473 r244494 216 216 requiresPostLayoutData |= m_keyboardIsAttached; 217 217 #endif 218 if ( shouldIncludePostLayoutData == IncludePostLayoutDataHint::No && needsLayout&& !requiresPostLayoutData) {218 if ((shouldIncludePostLayoutData == IncludePostLayoutDataHint::No || needsLayout) && !requiresPostLayoutData) { 219 219 result.isMissingPostLayoutData = true; 220 220 return; … … 3256 3256 // Ensure that the next layer tree commit contains up-to-date caret/selection rects. 3257 3257 frameView.frame().selection().setCaretRectNeedsUpdate(); 3258 s endPartialEditorStateAndSchedulePostLayoutUpdate();3258 scheduleFullEditorStateUpdate(); 3259 3259 } 3260 3260 -
trunk/Tools/ChangeLog
r244492 r244494 1 2019-04-21 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Defer EditorState updates until the next layer tree flush in a few additional circumstances 4 https://bugs.webkit.org/show_bug.cgi?id=197145 5 <rdar://problem/50078170> 6 7 Reviewed by Darin Adler. 8 9 Adjusts several editing API tests to wait for a presentation update following a selection change, programmatic 10 focus, or showing the font manager. 11 12 * TestWebKitAPI/Tests/WebKitCocoa/EditorStateTests.mm: 13 (TestWebKitAPI::TEST): 14 * TestWebKitAPI/Tests/WebKitCocoa/WKContentViewTargetForAction.mm: 15 (TEST): 16 * TestWebKitAPI/Tests/mac/FontManagerTests.mm: 17 (TestWebKitAPI::TEST): 18 1 19 2019-04-21 Brian Burg <bburg@apple.com> 2 20 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/EditorStateTests.mm
r242339 r244494 350 350 [webView synchronouslyLoadHTMLString:@"<body style=\"caret-color: red;\" contenteditable=\"true\"></body>"]; 351 351 [webView stringByEvaluatingJavaScript:@"document.body.focus()"]; 352 [webView waitForNextPresentationUpdate]; 352 353 UIView<UITextInputTraits_Private> *textInput = (UIView<UITextInputTraits_Private> *) [webView textInputContentView]; 353 354 UIColor *insertionPointColor = textInput.insertionPointColor; -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKContentViewTargetForAction.mm
r237266 r244494 51 51 [webView becomeFirstResponder]; 52 52 [webView stringByEvaluatingJavaScript:@"selectPlainText()"]; 53 [webView waitForNextPresentationUpdate]; 53 54 54 55 // FIXME: Once this test is running in an application, it should instead use -
trunk/Tools/TestWebKitAPI/Tests/mac/FontManagerTests.mm
r242339 r244494 123 123 124 124 [webView selectWord:nil]; 125 [webView waitForNextPresentationUpdate]; 125 126 [fontManager addFontTrait:menuItemCellForFontAction(NSBoldFontMask).autorelease()]; 126 127 EXPECT_WK_STREQ("bold", [webView stylePropertyAtSelectionStart:@"font-weight"]); … … 154 155 // Select "foo" and increase font size. 155 156 [webView selectWord:nil]; 157 [webView waitForNextPresentationUpdate]; 156 158 [fontManager modifyFont:sizeIncreaseMenuItemCell.get()]; 157 159 [fontManager modifyFont:sizeIncreaseMenuItemCell.get()]; … … 160 162 [webView moveToEndOfParagraph:nil]; 161 163 [webView selectWord:nil]; 164 [webView waitForNextPresentationUpdate]; 162 165 [fontManager modifyFont:sizeDecreaseMenuItemCell.get()]; 163 166 [fontManager modifyFont:sizeDecreaseMenuItemCell.get()]; … … 169 172 [webView moveToBeginningOfParagraph:nil]; 170 173 [webView selectWord:nil]; 174 [webView waitForNextPresentationUpdate]; 171 175 EXPECT_WK_STREQ(@"foo", [webView selectedText]); 172 176 EXPECT_WK_STREQ(@"18px", [webView stylePropertyAtSelectionStart:@"font-size"]); … … 191 195 NSFontPanel *fontPanel = [fontManager fontPanel:YES]; 192 196 [fontPanel setIsVisible:YES]; 197 [webView waitForNextPresentationUpdate]; 193 198 194 199 NSFont *largeHelveticaFont = [NSFont fontWithName:@"Helvetica" size:20]; … … 240 245 NSFontPanel *fontPanel = [fontManager fontPanel:YES]; 241 246 [fontPanel setIsVisible:YES]; 247 [webView waitForNextPresentationUpdate]; 242 248 243 249 auto textDecorationsAroundSelection = [webView] { … … 340 346 colorPanel.color = [NSColor colorWithRed:1 green:0 blue:0 alpha:1]; 341 347 [webView selectWord:nil]; 348 [webView waitForNextPresentationUpdate]; 342 349 [webView changeColor:colorPanel]; 343 350 checkFontColorAtStartAndEndWithInputEvents("rgb(255, 0, 0)"); … … 347 354 colorPanel.color = [NSColor colorWithWhite:1 alpha:0.2]; 348 355 [webView selectNextWord]; 356 [webView waitForNextPresentationUpdate]; 349 357 [webView changeColor:colorPanel]; 350 358 checkFontColorAtStartAndEndWithInputEvents("rgba(255, 255, 255, 0.2)"); … … 461 469 462 470 [webView selectWord:nil]; 471 [webView waitForNextPresentationUpdate]; 463 472 options.shadowWidth = 3; 464 473 options.shadowHeight = -3; … … 477 486 auto webView = webViewForFontManagerTesting(NSFontManager.sharedFontManager, @"<body contenteditable>hello</body>"); 478 487 [webView selectWord:nil]; 488 [webView waitForNextPresentationUpdate]; 479 489 480 490 options.backgroundColor = [NSColor colorWithRed:1 green:0 blue:0 alpha:0.2];
Note: See TracChangeset
for help on using the changeset viewer.