RESOLVED FIXED 142015
[WK2] REGRESSION(r180465): WebKit::WebPage::editorState() triggers a layout
https://bugs.webkit.org/show_bug.cgi?id=142015
Summary [WK2] REGRESSION(r180465): WebKit::WebPage::editorState() triggers a layout
Ryosuke Niwa
Reported 2015-02-25 03:10:07 PST
After http://trac.webkit.org/changeset/180465/, we syncrhnously trigger layout upon every selection change.
Attachments
WIP Patch (8.24 KB, patch)
2015-02-25 14:53 PST, Chris Dumez
buildbot: commit-queue-
Archive of layout-test-results from ews105 for mac-mavericks-wk2 (793.59 KB, application/zip)
2015-02-25 15:13 PST, Build Bot
no flags
WIP Patch (11.28 KB, patch)
2015-02-25 15:42 PST, Chris Dumez
no flags
WIP Patch (14.06 KB, patch)
2015-02-25 15:57 PST, Chris Dumez
buildbot: commit-queue-
Archive of layout-test-results from ews104 for mac-mavericks-wk2 (826.16 KB, application/zip)
2015-02-25 16:30 PST, Build Bot
no flags
WIP Patch (14.34 KB, patch)
2015-02-25 16:53 PST, Chris Dumez
buildbot: commit-queue-
Archive of layout-test-results from ews106 for mac-mavericks-wk2 (694.77 KB, application/zip)
2015-02-25 17:49 PST, Build Bot
no flags
Patch3 (15.12 KB, patch)
2015-02-26 17:05 PST, Enrica Casucci
ap: review+
Radar WebKit Bug Importer
Comment 1 2015-02-25 03:11:34 PST
Sam Weinig
Comment 2 2015-02-25 08:32:28 PST
From the patch (and I might be reading it wrong), it looks like we had this behavior already on iOS, so it is regression only on Mac. Is that correct?
Ryosuke Niwa
Comment 3 2015-02-25 10:00:42 PST
(In reply to comment #2) > From the patch (and I might be reading it wrong), it looks like we had this > behavior already on iOS, so it is regression only on Mac. Is that correct? Yes but that code was added in http://trac.webkit.org/changeset/171015 so this could still be a regression since our last release...
Enrica Casucci
Comment 4 2015-02-25 10:13:09 PST
(In reply to comment #3) > (In reply to comment #2) > > From the patch (and I might be reading it wrong), it looks like we had this > > behavior already on iOS, so it is regression only on Mac. Is that correct? > > Yes but that code was added in http://trac.webkit.org/changeset/171015 so > this could still be a regression since our last release... How can we return this type of information without layout?
Sam Weinig
Comment 5 2015-02-25 10:17:15 PST
(In reply to comment #4) > (In reply to comment #3) > > (In reply to comment #2) > > > From the patch (and I might be reading it wrong), it looks like we had this > > > behavior already on iOS, so it is regression only on Mac. Is that correct? > > > > Yes but that code was added in http://trac.webkit.org/changeset/171015 so > > this could still be a regression since our last release... > > How can we return this type of information without layout? I am not sure that is necessarily the right question. We might want to look at this a bit more removed, and consider if we really need to grab this information everytime the selection changes, or whether we can wait until the next style recalc/layout happens to tell the UIProcess that the editor state has changed.
Ryosuke Niwa
Comment 6 2015-02-25 10:20:49 PST
(In reply to comment #4) > (In reply to comment #3) > > (In reply to comment #2) > > > From the patch (and I might be reading it wrong), it looks like we had this > > > behavior already on iOS, so it is regression only on Mac. Is that correct? > > > > Yes but that code was added in http://trac.webkit.org/changeset/171015 so > > this could still be a regression since our last release... > > How can we return this type of information without layout? I don't think we can. I think we should instead delay when the font information is fetched. Right now, we seem to be updating it each time selection changes within a single task (e.g. when JS modifies it multiple times) but we shouldn't have to do that because font panel, keyboard, etc... won't be interacting with users faster than 60fps.
Chris Dumez
Comment 7 2015-02-25 14:53:09 PST
Created attachment 247349 [details] WIP Patch
Build Bot
Comment 8 2015-02-25 15:13:37 PST
Comment on attachment 247349 [details] WIP Patch Attachment 247349 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/5953856059998208 New failing tests: platform/mac/editing/input/selection-change-closes-typing-2.html platform/mac/editing/input/selection-change-closes-typing.html editing/secure-input/password-input-focusing.html
Build Bot
Comment 9 2015-02-25 15:13:40 PST
Created attachment 247351 [details] Archive of layout-test-results from ews105 for mac-mavericks-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews105 Port: mac-mavericks-wk2 Platform: Mac OS X 10.9.5
Chris Dumez
Comment 10 2015-02-25 15:35:28 PST
I see a 31% progression on Speedometer locally with my WIP patch.
Chris Dumez
Comment 11 2015-02-25 15:42:48 PST
Created attachment 247353 [details] WIP Patch
Chris Dumez
Comment 12 2015-02-25 15:57:25 PST
Created attachment 247357 [details] WIP Patch
Build Bot
Comment 13 2015-02-25 16:30:53 PST
Comment on attachment 247357 [details] WIP Patch Attachment 247357 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/5103672115593216 New failing tests: editing/secure-input/password-input-focusing.html
Build Bot
Comment 14 2015-02-25 16:30:58 PST
Created attachment 247362 [details] Archive of layout-test-results from ews104 for mac-mavericks-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews104 Port: mac-mavericks-wk2 Platform: Mac OS X 10.9.5
Chris Dumez
Comment 15 2015-02-25 16:53:49 PST
Created attachment 247366 [details] WIP Patch
Build Bot
Comment 16 2015-02-25 17:49:44 PST
Comment on attachment 247366 [details] WIP Patch Attachment 247366 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/6710393611223040 New failing tests: platform/mac/editing/input/selection-change-closes-typing-2.html platform/mac/editing/input/selection-change-closes-typing.html editing/secure-input/password-input-focusing.html
Build Bot
Comment 17 2015-02-25 17:49:47 PST
Created attachment 247375 [details] Archive of layout-test-results from ews106 for mac-mavericks-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews106 Port: mac-mavericks-wk2 Platform: Mac OS X 10.9.5
Enrica Casucci
Comment 18 2015-02-26 17:05:59 PST
WebKit Commit Bot
Comment 19 2015-02-26 17:07:50 PST
Attachment 247469 [details] did not pass style-queue: ERROR: Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm:333: Extra space before ( in function call [whitespace/parens] [4] ERROR: Source/WebKit2/UIProcess/WebPageProxy.h:543: Extra space before ( in function call [whitespace/parens] [4] ERROR: Source/WebKit2/UIProcess/API/mac/WKView.mm:2522: When wrapping a line, only indent 4 spaces. [whitespace/indent] [3] ERROR: Source/WebKit2/UIProcess/API/mac/WKView.mm:2523: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] ERROR: Source/WebKit2/UIProcess/API/mac/WKView.mm:2524: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] Total errors found: 5 in 8 files If any of these errors are false positives, please file a bug against check-webkit-style.
Chris Dumez
Comment 20 2015-02-26 17:13:45 PST
Comment on attachment 247469 [details] Patch3 Looks good and I have confirmed that it fixes the perf regression locally. I'll let a WK2 Owner review this though.
Alexey Proskuryakov
Comment 21 2015-02-27 10:28:07 PST
Comment on attachment 247469 [details] Patch3 View in context: https://bugs.webkit.org/attachment.cgi?id=247469&action=review > Source/WebKit2/UIProcess/API/mac/WKView.mm:748 > + _data->_page->fontAtSelection([self](const String& fontName, double fontSize, bool selectionHasMultipleFonts, CallbackBase::Error error) { Do we actually need to capture self here? > Source/WebKit2/UIProcess/API/mac/WKView.mm:750 > + NSFont *font = [NSFont fontWithName:fontName size:fontSize]; > + [[NSFontManager sharedFontManager] setSelectedFont:font isMultiple:selectionHasMultipleFonts]; Should we bail out if there was no font found (e.g. an SVG font or another loadable font is in use)?
Enrica Casucci
Comment 22 2015-02-27 10:48:21 PST
(In reply to comment #21) > Comment on attachment 247469 [details] > Patch3 > > View in context: > https://bugs.webkit.org/attachment.cgi?id=247469&action=review > > > Source/WebKit2/UIProcess/API/mac/WKView.mm:748 > > + _data->_page->fontAtSelection([self](const String& fontName, double fontSize, bool selectionHasMultipleFonts, CallbackBase::Error error) { > > Do we actually need to capture self here? No, I'll remove it. > > > Source/WebKit2/UIProcess/API/mac/WKView.mm:750 > > + NSFont *font = [NSFont fontWithName:fontName size:fontSize]; > > + [[NSFontManager sharedFontManager] setSelectedFont:font isMultiple:selectionHasMultipleFonts]; > > Should we bail out if there was no font found (e.g. an SVG font or another > loadable font is in use)? Yes, there is no point in calling the font manager. thanks for the review.
Enrica Casucci
Comment 23 2015-02-27 10:51:01 PST
Committed revision 180768.
Note You need to log in before you can comment on or make changes to this bug.