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

Side by Side Diff: Source/core/dom/Document.h

Issue 206603002: Add EventHandlerRegistry (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Tests now seem to pass. Created 6 years, 9 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 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
9 * Copyright (C) 2011 Google Inc. All rights reserved. 9 * Copyright (C) 2011 Google Inc. All rights reserved.
10 * 10 *
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 InvalidateOnClassAttrChange, 186 InvalidateOnClassAttrChange,
187 InvalidateOnIdNameAttrChange, 187 InvalidateOnIdNameAttrChange,
188 InvalidateOnNameAttrChange, 188 InvalidateOnNameAttrChange,
189 InvalidateOnForAttrChange, 189 InvalidateOnForAttrChange,
190 InvalidateForFormControls, 190 InvalidateForFormControls,
191 InvalidateOnHRefAttrChange, 191 InvalidateOnHRefAttrChange,
192 InvalidateOnAnyAttrChange, 192 InvalidateOnAnyAttrChange,
193 }; 193 };
194 const int numNodeListInvalidationTypes = InvalidateOnAnyAttrChange + 1; 194 const int numNodeListInvalidationTypes = InvalidateOnAnyAttrChange + 1;
195 195
196 typedef HashCountedSet<Node*> TouchEventTargetSet;
197
198 enum DocumentClass { 196 enum DocumentClass {
199 DefaultDocumentClass = 0, 197 DefaultDocumentClass = 0,
200 HTMLDocumentClass = 1, 198 HTMLDocumentClass = 1,
201 XHTMLDocumentClass = 1 << 1, 199 XHTMLDocumentClass = 1 << 1,
202 ImageDocumentClass = 1 << 2, 200 ImageDocumentClass = 1 << 2,
203 PluginDocumentClass = 1 << 3, 201 PluginDocumentClass = 1 << 3,
204 MediaDocumentClass = 1 << 4, 202 MediaDocumentClass = 1 << 4,
205 SVGDocumentClass = 1 << 5, 203 SVGDocumentClass = 1 << 5,
206 XMLDocumentClass = 1 << 6, 204 XMLDocumentClass = 1 << 6,
207 }; 205 };
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
938 void serviceScriptedAnimations(double monotonicAnimationStartTime); 936 void serviceScriptedAnimations(double monotonicAnimationStartTime);
939 937
940 virtual EventTarget* errorEventTarget() OVERRIDE FINAL; 938 virtual EventTarget* errorEventTarget() OVERRIDE FINAL;
941 virtual void logExceptionToConsole(const String& errorMessage, const String& sourceURL, int lineNumber, int columnNumber, PassRefPtr<ScriptCallStack>) OVERR IDE FINAL; 939 virtual void logExceptionToConsole(const String& errorMessage, const String& sourceURL, int lineNumber, int columnNumber, PassRefPtr<ScriptCallStack>) OVERR IDE FINAL;
942 940
943 void initDNSPrefetch(); 941 void initDNSPrefetch();
944 942
945 double lastHandledUserGestureTimestamp() const { return m_lastHandledUserGes tureTimestamp; } 943 double lastHandledUserGestureTimestamp() const { return m_lastHandledUserGes tureTimestamp; }
946 void resetLastHandledUserGestureTimestamp(); 944 void resetLastHandledUserGestureTimestamp();
947 945
948 bool hasTouchEventHandlers() const { return (m_touchEventTargets.get()) ? m_ touchEventTargets->size() : false; }
949
950 // Called when a single touch event handler has been added or removed for a node.
951 // The Node should always be in this Document, except for child Documents wh ich report
952 // themselves to their parent exactly once if they have any touch handlers.
953 // Handlers added/removed from the DOMWindow are reported as the Document.
954 void didAddTouchEventHandler(Node*);
955 void didRemoveTouchEventHandler(Node* handler) { didRemoveTouchEventHandler( handler, false); }
956
957 // Called whenever all touch event handlers have been removed for a node (su ch as when the
958 // node itself is being removed from the document).
959 void didClearTouchEventHandlers(Node* handler) { didRemoveTouchEventHandler( handler, true); }
960
961 const TouchEventTargetSet* touchEventTargets() const { return m_touchEventTa rgets.get(); }
962
963 bool isInDocumentWrite() { return m_writeRecursionDepth > 0; } 946 bool isInDocumentWrite() { return m_writeRecursionDepth > 0; }
964 947
965 IntSize initialViewportSize() const; 948 IntSize initialViewportSize() const;
966 949
967 // There are currently two parallel autosizing implementations: TextAutosize r and FastTextAutosizer. 950 // There are currently two parallel autosizing implementations: TextAutosize r and FastTextAutosizer.
968 // See http://tinyurl.com/chromium-fast-autosizer for more details. 951 // See http://tinyurl.com/chromium-fast-autosizer for more details.
969 TextAutosizer* textAutosizer(); 952 TextAutosizer* textAutosizer();
970 FastTextAutosizer* fastTextAutosizer(); 953 FastTextAutosizer* fastTextAutosizer();
971 954
972 PassRefPtr<Element> createElement(const AtomicString& localName, const Atomi cString& typeExtension, ExceptionState&); 955 PassRefPtr<Element> createElement(const AtomicString& localName, const Atomi cString& typeExtension, ExceptionState&);
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 1119
1137 void clearFocusedElementSoon(); 1120 void clearFocusedElementSoon();
1138 void clearFocusedElementTimerFired(Timer<Document>*); 1121 void clearFocusedElementTimerFired(Timer<Document>*);
1139 1122
1140 void processHttpEquivDefaultStyle(const AtomicString& content); 1123 void processHttpEquivDefaultStyle(const AtomicString& content);
1141 void processHttpEquivRefresh(const AtomicString& content); 1124 void processHttpEquivRefresh(const AtomicString& content);
1142 void processHttpEquivSetCookie(const AtomicString& content); 1125 void processHttpEquivSetCookie(const AtomicString& content);
1143 void processHttpEquivXFrameOptions(const AtomicString& content); 1126 void processHttpEquivXFrameOptions(const AtomicString& content);
1144 void processHttpEquivContentSecurityPolicy(const AtomicString& equiv, const AtomicString& content); 1127 void processHttpEquivContentSecurityPolicy(const AtomicString& equiv, const AtomicString& content);
1145 1128
1146 void didRemoveTouchEventHandler(Node*, bool clearAll);
1147
1148 // Returns true if Document::recalcStyle() needs to be run. 1129 // Returns true if Document::recalcStyle() needs to be run.
1149 bool shouldCallRecalcStyleForDocument(); 1130 bool shouldCallRecalcStyleForDocument();
1150 bool shouldScheduleStyleRecalc(); 1131 bool shouldScheduleStyleRecalc();
1151 1132
1152 DocumentLifecycle m_lifecycle; 1133 DocumentLifecycle m_lifecycle;
1153 1134
1154 bool m_hasNodesWithPlaceholderStyle; 1135 bool m_hasNodesWithPlaceholderStyle;
1155 bool m_needsNotifyRemoveAllPendingStylesheet; 1136 bool m_needsNotifyRemoveAllPendingStylesheet;
1156 bool m_evaluateMediaQueriesOnStyleRecalc; 1137 bool m_evaluateMediaQueriesOnStyleRecalc;
1157 1138
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1308 bool m_didSetReferrerPolicy; 1289 bool m_didSetReferrerPolicy;
1309 ReferrerPolicy m_referrerPolicy; 1290 ReferrerPolicy m_referrerPolicy;
1310 1291
1311 bool m_directionSetOnDocumentElement; 1292 bool m_directionSetOnDocumentElement;
1312 bool m_writingModeSetOnDocumentElement; 1293 bool m_writingModeSetOnDocumentElement;
1313 DocumentTiming m_documentTiming; 1294 DocumentTiming m_documentTiming;
1314 RefPtrWillBePersistent<MediaQueryMatcher> m_mediaQueryMatcher; 1295 RefPtrWillBePersistent<MediaQueryMatcher> m_mediaQueryMatcher;
1315 bool m_writeRecursionIsTooDeep; 1296 bool m_writeRecursionIsTooDeep;
1316 unsigned m_writeRecursionDepth; 1297 unsigned m_writeRecursionDepth;
1317 1298
1318 OwnPtr<TouchEventTargetSet> m_touchEventTargets;
1319
1320 double m_lastHandledUserGestureTimestamp; 1299 double m_lastHandledUserGestureTimestamp;
1321 1300
1322 RefPtr<ScriptedAnimationController> m_scriptedAnimationController; 1301 RefPtr<ScriptedAnimationController> m_scriptedAnimationController;
1323 OwnPtr<MainThreadTaskRunner> m_taskRunner; 1302 OwnPtr<MainThreadTaskRunner> m_taskRunner;
1324 OwnPtr<TextAutosizer> m_textAutosizer; 1303 OwnPtr<TextAutosizer> m_textAutosizer;
1325 OwnPtr<FastTextAutosizer> m_fastTextAutosizer; 1304 OwnPtr<FastTextAutosizer> m_fastTextAutosizer;
1326 1305
1327 RefPtr<CustomElementRegistrationContext> m_registrationContext; 1306 RefPtr<CustomElementRegistrationContext> m_registrationContext;
1328 1307
1329 void elementDataCacheClearTimerFired(Timer<Document>*); 1308 void elementDataCacheClearTimerFired(Timer<Document>*);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1401 inline bool Node::isDocumentNode() const 1380 inline bool Node::isDocumentNode() const
1402 { 1381 {
1403 return this == document(); 1382 return this == document();
1404 } 1383 }
1405 1384
1406 Node* eventTargetNodeForDocument(Document*); 1385 Node* eventTargetNodeForDocument(Document*);
1407 1386
1408 } // namespace WebCore 1387 } // namespace WebCore
1409 1388
1410 #endif // Document_h 1389 #endif // Document_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698