Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Issue 1458703010: Mac: Don't repaint scrollbars every frame (Closed)

Created:
5 years, 1 month ago by ccameron
Modified:
5 years ago
Reviewers:
chrishtr, pdr., enne (OOO)
CC:
darktears, blink-reviews, blink-reviews-animation_chromium.org, blink-reviews-api_chromium.org, cc-bugs_chromium.org, chromium-reviews, dglazkov+blink, Eric Willigers, rjwright, shans
Base URL:
https://chromium.googlesource.com/chromium/src.git@master2
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Mac: Don't repaint scrollbars every frame The core issue here is that Blink, when it sees that it needs to change the scrollbar in any way (even just moving the thumb), uses the signal blink::Scrollbar::setNeedsPaintInvalidation(). This will trigger a call to cc::PaintedScrollbarLayer::Update(), which will re-paint all controls into textures and then emit quads the quads for the controls. We often only need to re-arrange the quads for the controls of the scrollbar, not re-paint them. The system that knows whether or not the controls need to be repainted is blink::ScrollbarTheme (because that's the code that knows the theme that will be used to do the painting). Add blink::ScrollbarTheme::shouldRepaintAllPartsOnInvalidation() to indicate if a call to blink::Scrollbar::setNeedsPaintInvalidation() should cause re-painting of all of the controls. If this returns false for a given theme, then methods blink::Scrollbar::setNeedsPaintTrack() and blink::Scrollbar::setNeedsPaintThumb() may be used to specify more granular control. Back in cc::PaintedScrollbarLayer::Update(), use the methods cc::Scrollbar::NeedsPaintPart() to check if re-paint is needed (it is hooked up to the bit that is set by the blink::Scrollbar methods). While we're in the neighborhood, it is worth noting that most of the repainting of scrollbars on Mac is due to the alpha of the thumb or the track changing. Add methods to blink::Scrollbar to query the opacity of the controls, so that we can do the blending at compositing time instead of requiring a repaint. And, while we're in that neighborhood, fix cc::CALayerOverlay's FromTextureQuad function to correctly take into account per-vertex opacity. BUG=549277 TEST= - Set the system to only show scrollbars while scrolling - Open a page with a vertical scrollbar - Scroll to make the scroll thumb appear - Hover the mouse somewhere below the thumb - The thumb should become thicker and the track should appear - After some time, the thumb and the track should fade away TEST= - Open a page with a scrollbar and search (command-F) for some text - Ensure that the ticks on the vertical scrollbar appear CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Committed: https://crrev.com/a54da38a2d8b44643a70b1fbe8297f8fd2365f9c Cr-Commit-Position: refs/heads/master@{#361938}

Patch Set 1 #

Patch Set 2 : Sprinkle in some tests #

Total comments: 15

Patch Set 3 : Feedback, sprinkle more tests #

Patch Set 4 : Add missed file in rebase #

Total comments: 5

Patch Set 5 : Fix tyop #

Total comments: 1

Patch Set 6 : s/Backgroud/Background/ #

Patch Set 7 : Fix typo for real #

Total comments: 6

Patch Set 8 : Remove track opacity #

Total comments: 2

Patch Set 9 : Update comments #

Patch Set 10 : Rebase and resolve #

Unified diffs Side-by-side diffs Delta from patch set Stats (+377 lines, -22 lines) Patch
M cc/BUILD.gn View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -0 lines 0 comments Download
M cc/blink/scrollbar_impl.h View 1 2 3 4 5 6 7 1 chunk +2 lines, -0 lines 0 comments Download
M cc/blink/scrollbar_impl.cc View 1 2 3 4 5 6 7 1 chunk +10 lines, -0 lines 0 comments Download
M cc/cc_tests.gyp View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -0 lines 0 comments Download
M cc/input/scrollbar.h View 1 2 3 4 5 6 7 1 chunk +2 lines, -0 lines 0 comments Download
M cc/layers/painted_scrollbar_layer.h View 1 2 3 4 5 6 7 1 chunk +2 lines, -0 lines 0 comments Download
M cc/layers/painted_scrollbar_layer.cc View 1 2 3 4 5 6 7 8 9 3 chunks +17 lines, -7 lines 0 comments Download
M cc/layers/painted_scrollbar_layer_impl.h View 1 2 3 4 5 6 7 2 chunks +4 lines, -0 lines 0 comments Download
M cc/layers/painted_scrollbar_layer_impl.cc View 1 2 3 4 5 6 7 3 chunks +6 lines, -3 lines 0 comments Download
M cc/layers/painted_scrollbar_layer_impl_unittest.cc View 1 2 3 4 5 6 7 5 chunks +19 lines, -2 lines 0 comments Download
A cc/layers/painted_scrollbar_layer_unittest.cc View 1 2 3 4 1 chunk +87 lines, -0 lines 0 comments Download
M cc/output/ca_layer_overlay.cc View 1 2 3 4 5 6 7 8 9 1 chunk +5 lines, -0 lines 0 comments Download
M cc/test/fake_layer_tree_host.h View 1 3 chunks +9 lines, -0 lines 0 comments Download
M cc/test/fake_layer_tree_host.cc View 1 2 2 chunks +8 lines, -1 line 0 comments Download
M cc/test/fake_scrollbar.h View 1 2 3 4 5 6 7 2 chunks +13 lines, -0 lines 0 comments Download
M cc/test/fake_scrollbar.cc View 1 2 3 4 5 6 7 3 chunks +16 lines, -0 lines 0 comments Download
M cc/trees/layer_tree_host.h View 1 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/frame/FrameView.cpp View 1 2 3 4 5 6 7 1 chunk +3 lines, -1 line 0 comments Download
M third_party/WebKit/Source/platform/exported/WebScrollbarThemeClientImpl.h View 1 2 3 4 5 6 7 1 chunk +4 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/exported/WebScrollbarThemeClientImpl.cpp View 1 2 3 4 5 6 7 1 chunk +20 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/exported/WebScrollbarThemePainter.cpp View 1 2 3 4 5 6 7 3 chunks +19 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.mm View 1 2 3 4 5 6 7 8 5 chunks +24 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/scroll/ScrollableAreaTest.cpp View 1 2 3 4 5 6 7 8 3 chunks +35 lines, -1 line 0 comments Download
M third_party/WebKit/Source/platform/scroll/Scrollbar.h View 1 2 3 4 5 6 7 2 chunks +8 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/scroll/Scrollbar.cpp View 1 2 3 4 5 6 7 2 chunks +6 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/scroll/ScrollbarTheme.h View 1 2 3 4 5 6 7 3 chunks +10 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/scroll/ScrollbarThemeClient.h View 1 2 3 4 5 6 7 1 chunk +5 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/scroll/ScrollbarThemeMacOverlayAPI.h View 1 2 3 4 5 6 7 2 chunks +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/platform/scroll/ScrollbarThemeMacOverlayAPI.mm View 1 2 3 4 5 6 7 4 chunks +11 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/platform/scroll/ScrollbarThemeMock.h View 1 2 1 chunk +3 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/scroll/ScrollbarThemeMock.cpp View 1 2 2 chunks +16 lines, -3 lines 0 comments Download
M third_party/WebKit/public/platform/WebScrollbarThemePainter.h View 1 2 3 4 5 6 7 1 chunk +6 lines, -0 lines 0 comments Download

Messages

Total messages: 31 (11 generated)
ccameron
This is that thing we were discussing on Friday about the scrolling and the sadness. ...
5 years ago (2015-11-23 06:52:32 UTC) #3
chrishtr
This code needs tests. Please also add a bug. Finally, please take a look at ...
5 years ago (2015-11-23 18:59:42 UTC) #5
enne (OOO)
cc end of things looks reasonable to me. https://codereview.chromium.org/1458703010/diff/20001/cc/blink/scrollbar_impl.cc File cc/blink/scrollbar_impl.cc (right): https://codereview.chromium.org/1458703010/diff/20001/cc/blink/scrollbar_impl.cc#newcode76 cc/blink/scrollbar_impl.cc:76: if ...
5 years ago (2015-11-23 19:05:24 UTC) #6
ccameron
Updated, added more tests. From some looks, Aura should be able to use these -- ...
5 years ago (2015-11-24 01:12:05 UTC) #7
enne (OOO)
cc lgtm https://codereview.chromium.org/1458703010/diff/20001/cc/blink/scrollbar_impl.cc File cc/blink/scrollbar_impl.cc (right): https://codereview.chromium.org/1458703010/diff/20001/cc/blink/scrollbar_impl.cc#newcode76 cc/blink/scrollbar_impl.cc:76: if (part == cc::THUMB) On 2015/11/24 at ...
5 years ago (2015-11-24 17:59:18 UTC) #8
ccameron
Thanks -- updated. https://codereview.chromium.org/1458703010/diff/30028/cc/blink/scrollbar_impl.cc File cc/blink/scrollbar_impl.cc (right): https://codereview.chromium.org/1458703010/diff/30028/cc/blink/scrollbar_impl.cc#newcode77 cc/blink/scrollbar_impl.cc:77: return painter_.trackBackgroudNeedsRepaint(); On 2015/11/24 17:59:18, enne ...
5 years ago (2015-11-24 18:48:19 UTC) #10
enne (OOO)
https://codereview.chromium.org/1458703010/diff/30028/cc/blink/scrollbar_impl.cc File cc/blink/scrollbar_impl.cc (right): https://codereview.chromium.org/1458703010/diff/30028/cc/blink/scrollbar_impl.cc#newcode77 cc/blink/scrollbar_impl.cc:77: return painter_.trackBackgroudNeedsRepaint(); On 2015/11/24 at 18:48:19, ccameron wrote: > ...
5 years ago (2015-11-24 18:55:13 UTC) #11
chrishtr
https://codereview.chromium.org/1458703010/diff/20001/third_party/WebKit/Source/platform/scroll/ScrollbarTheme.h File third_party/WebKit/Source/platform/scroll/ScrollbarTheme.h (right): https://codereview.chromium.org/1458703010/diff/20001/third_party/WebKit/Source/platform/scroll/ScrollbarTheme.h#newcode89 third_party/WebKit/Source/platform/scroll/ScrollbarTheme.h:89: virtual float thumbOpacity(const ScrollbarThemeClient*) const { return 1.0f; } ...
5 years ago (2015-11-24 19:02:07 UTC) #12
ccameron
On 2015/11/24 19:02:07, chrishtr wrote: > https://codereview.chromium.org/1458703010/diff/20001/third_party/WebKit/Source/platform/scroll/ScrollbarTheme.h > File third_party/WebKit/Source/platform/scroll/ScrollbarTheme.h (right): > > https://codereview.chromium.org/1458703010/diff/20001/third_party/WebKit/Source/platform/scroll/ScrollbarTheme.h#newcode89 > ...
5 years ago (2015-11-24 19:23:39 UTC) #13
chrishtr
On 2015/11/24 at 19:23:39, ccameron wrote: > On 2015/11/24 19:02:07, chrishtr wrote: > > https://codereview.chromium.org/1458703010/diff/20001/third_party/WebKit/Source/platform/scroll/ScrollbarTheme.h ...
5 years ago (2015-11-24 21:08:29 UTC) #14
chrishtr
https://codereview.chromium.org/1458703010/diff/110001/third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.mm File third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.mm (left): https://codereview.chromium.org/1458703010/diff/110001/third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.mm#oldcode803 third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.mm:803: if (ScrollbarThemeMacCommon::recommendedScrollerStyle() != NSScrollerStyleLegacy) What do the changes here ...
5 years ago (2015-11-24 21:15:12 UTC) #15
ccameron
Updated. I un-did chrishtr's suggestion of saying "trackBackground" instead of "track", because "trackBackground" is not ...
5 years ago (2015-11-25 00:23:02 UTC) #16
chrishtr
In the absence of other tests, can I assume you tested it manually on the ...
5 years ago (2015-11-25 00:28:49 UTC) #17
ccameron
Yeah, I've kicked the tires quite a bit. The other patch that this was sitting ...
5 years ago (2015-11-25 00:34:32 UTC) #18
chrishtr
lgtm
5 years ago (2015-11-25 00:36:08 UTC) #19
ccameron
pdr@, could you OWNERS-ify platform/
5 years ago (2015-11-25 07:37:04 UTC) #21
chrishtr
On 2015/11/25 at 07:37:04, ccameron wrote: > pdr@, could you OWNERS-ify platform/ I'm an OWNER ...
5 years ago (2015-11-25 17:29:26 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1458703010/210001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1458703010/210001
5 years ago (2015-11-27 00:47:19 UTC) #27
commit-bot: I haz the power
Committed patchset #10 (id:210001)
5 years ago (2015-11-27 00:52:44 UTC) #29
commit-bot: I haz the power
5 years ago (2015-11-27 00:54:08 UTC) #31
Message was sent while issue was closed.
Patchset 10 (id:??) landed as
https://crrev.com/a54da38a2d8b44643a70b1fbe8297f8fd2365f9c
Cr-Commit-Position: refs/heads/master@{#361938}

Powered by Google App Engine
This is Rietveld 408576698