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

Side by Side Diff: third_party/WebKit/Source/core/page/scrolling/ScrollCustomizationCallbacks.cpp

Issue 1840113005: Move viewport actions into an ApplyScroll callback. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/page/scrolling/ScrollCustomizationCallbacks.h" 5 #include "core/page/scrolling/ScrollCustomizationCallbacks.h"
6 6
7 #include "core/page/scrolling/ScrollStateCallback.h" 7 #include "core/page/scrolling/ScrollStateCallback.h"
8 8
9 namespace blink { 9 namespace blink {
10 10
11 void ScrollCustomizationCallbacks::setDistributeScroll(Element* element, ScrollS tateCallback* scrollStateCallback) 11 void ScrollCustomizationCallbacks::setDistributeScroll(Element* element, ScrollS tateCallback* scrollStateCallback)
12 { 12 {
13 m_distributeScrollCallbacks.set(element, scrollStateCallback); 13 m_distributeScrollCallbacks.set(element, scrollStateCallback);
14 } 14 }
15 15
16 ScrollStateCallback* ScrollCustomizationCallbacks::getDistributeScroll(Element* element) 16 ScrollStateCallback* ScrollCustomizationCallbacks::getDistributeScroll(Element* element)
17 { 17 {
18 auto it = m_distributeScrollCallbacks.find(element); 18 auto it = m_distributeScrollCallbacks.find(element);
19 if (it == m_distributeScrollCallbacks.end()) 19 if (it == m_distributeScrollCallbacks.end())
20 return nullptr; 20 return nullptr;
21 return it->value.get(); 21 return it->value.get();
22 } 22 }
23 23
24 void ScrollCustomizationCallbacks::setApplyScroll(Element* element, ScrollStateC allback* scrollStateCallback) 24 void ScrollCustomizationCallbacks::setApplyScroll(Element* element, ScrollStateC allback* scrollStateCallback)
25 { 25 {
26 m_applyScrollCallbacks.set(element, scrollStateCallback); 26 m_applyScrollCallbacks.set(element, scrollStateCallback);
27 } 27 }
28 28
29 void ScrollCustomizationCallbacks::removeApplyScroll(Element* element)
30 {
31 m_applyScrollCallbacks.remove(element);
32 }
33
29 ScrollStateCallback* ScrollCustomizationCallbacks::getApplyScroll(Element* eleme nt) 34 ScrollStateCallback* ScrollCustomizationCallbacks::getApplyScroll(Element* eleme nt)
30 { 35 {
31 auto it = m_applyScrollCallbacks.find(element); 36 auto it = m_applyScrollCallbacks.find(element);
32 if (it == m_applyScrollCallbacks.end()) 37 if (it == m_applyScrollCallbacks.end())
33 return nullptr; 38 return nullptr;
34 return it->value.get(); 39 return it->value.get();
35 } 40 }
36 41
37 #if !ENABLE(OILPAN) 42 #if !ENABLE(OILPAN)
tdresser 2016/04/05 19:31:12 While you're here, can you remove everything with
bokan 2016/04/06 15:21:01 Done.
38 void ScrollCustomizationCallbacks::removeCallbacksForElement(Element* element) 43 void ScrollCustomizationCallbacks::removeCallbacksForElement(Element* element)
39 { 44 {
40 m_applyScrollCallbacks.remove(element); 45 removeApplyScroll(element);
41 m_distributeScrollCallbacks.remove(element); 46 m_distributeScrollCallbacks.remove(element);
42 } 47 }
43 #endif 48 #endif
44 49
45 } // namespace blink 50 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698