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

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

Issue 1236913004: Expose scroll customization for touch to JS (behind REF). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Change map value to WeakMember, remove Document hack. Created 5 years, 3 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "config.h"
6 #include "core/page/scrolling/ScrollCustomizationCallbacks.h"
7
8 #include "core/page/scrolling/ScrollStateCallback.h"
9 #include "wtf/Deque.h"
10
11 namespace blink {
12
13 void ScrollCustomizationCallbacks::setDistributeScroll(Element* element, ScrollS tateCallback* scrollStateCallback)
14 {
15 m_distributeScrollCallbacks.set(element, scrollStateCallback);
16 }
17
18 ScrollStateCallback* ScrollCustomizationCallbacks::getDistributeScroll(Element* element)
19 {
20 auto it = m_distributeScrollCallbacks.find(element);
21 if (it == m_distributeScrollCallbacks.end())
22 return nullptr;
23 return it->value.get();
24 }
25
26 void ScrollCustomizationCallbacks::setApplyScroll(Element* element, ScrollStateC allback* scrollStateCallback)
27 {
28 m_applyScrollCallbacks.set(element, scrollStateCallback);
29 }
30
31 ScrollStateCallback* ScrollCustomizationCallbacks::getApplyScroll(Element* eleme nt)
32 {
33 auto it = m_applyScrollCallbacks.find(element);
34 if (it == m_applyScrollCallbacks.end())
35 return nullptr;
36 return it->value.get();
37 }
38
39 void ScrollCustomizationCallbacks::removeAllCallbacksForDocument(Document* docum ent)
haraken 2015/08/27 00:49:40 Can we remove this?
tdresser 2015/08/27 20:48:40 Done.
40 {
41 Deque<Element*> applyScrollCallbacksToRemove;
42 for (auto it : m_applyScrollCallbacks) {
43 if (&it.key->document() == document)
44 applyScrollCallbacksToRemove.append(it.key);
45 }
46 Deque<Element*> distributeScrollCallbacksToRemove;
47 for (auto it : m_distributeScrollCallbacks) {
48 if (&it.key->document() == document)
49 distributeScrollCallbacksToRemove.append(it.key);
50 }
51
52 m_applyScrollCallbacks.removeAll(applyScrollCallbacksToRemove);
53 m_distributeScrollCallbacks.removeAll(distributeScrollCallbacksToRemove);
54 }
55
56 #if !ENABLE(OILPAN)
57 void ScrollCustomizationCallbacks::removeCallbacksForElement(Element* element)
58 {
59 m_applyScrollCallbacks.remove(element);
60 m_distributeScrollCallbacks.remove(element);
61 }
62 #endif
63
64 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698