Index: cc/layers/layer.cc |
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc |
index 1eb97f0b3e63c9e850ad0dbfab58ca0eaf1883da..e4bd4cbcf8b8900b42c3e2b9be36d18a4658d210 100644 |
--- a/cc/layers/layer.cc |
+++ b/cc/layers/layer.cc |
@@ -956,18 +956,23 @@ void Layer::AddMainThreadScrollingReasons( |
uint32_t main_thread_scrolling_reasons) { |
DCHECK(IsPropertyChangeAllowed()); |
DCHECK(main_thread_scrolling_reasons); |
- if (main_thread_scrolling_reasons_ == main_thread_scrolling_reasons) |
+ uint32_t new_reasons = |
+ main_thread_scrolling_reasons_ | main_thread_scrolling_reasons; |
+ if (main_thread_scrolling_reasons_ == new_reasons) |
return; |
- main_thread_scrolling_reasons_ |= main_thread_scrolling_reasons; |
+ main_thread_scrolling_reasons_ = new_reasons; |
SetNeedsCommit(); |
} |
-void Layer::ClearMainThreadScrollingReasons() { |
+void Layer::ClearMainThreadScrollingReasons( |
+ uint32_t main_thread_scrolling_reasons_to_clear) { |
DCHECK(IsPropertyChangeAllowed()); |
- if (!main_thread_scrolling_reasons_) |
+ DCHECK(main_thread_scrolling_reasons_to_clear); |
+ uint32_t new_reasons = |
+ ~main_thread_scrolling_reasons_to_clear & main_thread_scrolling_reasons_; |
+ if (new_reasons == main_thread_scrolling_reasons_) |
return; |
- main_thread_scrolling_reasons_ = |
- MainThreadScrollingReason::kNotScrollingOnMain; |
+ main_thread_scrolling_reasons_ = new_reasons; |
SetNeedsCommit(); |
} |