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

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: Add test for external handlers. Created 6 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 /* 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 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 void serviceScriptedAnimations(double monotonicAnimationStartTime); 941 void serviceScriptedAnimations(double monotonicAnimationStartTime);
944 942
945 virtual EventTarget* errorEventTarget() OVERRIDE FINAL; 943 virtual EventTarget* errorEventTarget() OVERRIDE FINAL;
946 virtual void logExceptionToConsole(const String& errorMessage, const String& sourceURL, int lineNumber, int columnNumber, PassRefPtr<ScriptCallStack>) OVERR IDE FINAL; 944 virtual void logExceptionToConsole(const String& errorMessage, const String& sourceURL, int lineNumber, int columnNumber, PassRefPtr<ScriptCallStack>) OVERR IDE FINAL;
947 945
948 void initDNSPrefetch(); 946 void initDNSPrefetch();
949 947
950 double lastHandledUserGestureTimestamp() const { return m_lastHandledUserGes tureTimestamp; } 948 double lastHandledUserGestureTimestamp() const { return m_lastHandledUserGes tureTimestamp; }
951 void resetLastHandledUserGestureTimestamp(); 949 void resetLastHandledUserGestureTimestamp();
952 950
953 bool hasTouchEventHandlers() const { return (m_touchEventTargets.get()) ? m_ touchEventTargets->size() : false; }
954
955 // Called when a single touch event handler has been added or removed for a node.
956 // The Node should always be in this Document, except for child Documents wh ich report
957 // themselves to their parent exactly once if they have any touch handlers.
958 // Handlers added/removed from the DOMWindow are reported as the Document.
959 void didAddTouchEventHandler(Node*);
960 void didRemoveTouchEventHandler(Node* handler) { didRemoveTouchEventHandler( handler, false); }
961
962 // Called whenever all touch event handlers have been removed for a node (su ch as when the
963 // node itself is being removed from the document).
964 void didClearTouchEventHandlers(Node* handler) { didRemoveTouchEventHandler( handler, true); }
965
966 const TouchEventTargetSet* touchEventTargets() const { return m_touchEventTa rgets.get(); }
967
968 bool isInDocumentWrite() { return m_writeRecursionDepth > 0; } 951 bool isInDocumentWrite() { return m_writeRecursionDepth > 0; }
969 952
970 IntSize initialViewportSize() const; 953 IntSize initialViewportSize() const;
971 954
972 // There are currently two parallel autosizing implementations: TextAutosize r and FastTextAutosizer. 955 // There are currently two parallel autosizing implementations: TextAutosize r and FastTextAutosizer.
973 // See http://tinyurl.com/chromium-fast-autosizer for more details. 956 // See http://tinyurl.com/chromium-fast-autosizer for more details.
974 TextAutosizer* textAutosizer(); 957 TextAutosizer* textAutosizer();
975 FastTextAutosizer* fastTextAutosizer(); 958 FastTextAutosizer* fastTextAutosizer();
976 959
977 PassRefPtr<Element> createElement(const AtomicString& localName, const Atomi cString& typeExtension, ExceptionState&); 960 PassRefPtr<Element> createElement(const AtomicString& localName, const Atomi cString& typeExtension, ExceptionState&);
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 1125
1143 void clearFocusedElementSoon(); 1126 void clearFocusedElementSoon();
1144 void clearFocusedElementTimerFired(Timer<Document>*); 1127 void clearFocusedElementTimerFired(Timer<Document>*);
1145 1128
1146 void processHttpEquivDefaultStyle(const AtomicString& content); 1129 void processHttpEquivDefaultStyle(const AtomicString& content);
1147 void processHttpEquivRefresh(const AtomicString& content); 1130 void processHttpEquivRefresh(const AtomicString& content);
1148 void processHttpEquivSetCookie(const AtomicString& content); 1131 void processHttpEquivSetCookie(const AtomicString& content);
1149 void processHttpEquivXFrameOptions(const AtomicString& content); 1132 void processHttpEquivXFrameOptions(const AtomicString& content);
1150 void processHttpEquivContentSecurityPolicy(const AtomicString& equiv, const AtomicString& content); 1133 void processHttpEquivContentSecurityPolicy(const AtomicString& equiv, const AtomicString& content);
1151 1134
1152 void didRemoveTouchEventHandler(Node*, bool clearAll);
1153
1154 bool needsRenderTreeUpdate() const; 1135 bool needsRenderTreeUpdate() const;
1155 bool shouldScheduleRenderTreeUpdate() const; 1136 bool shouldScheduleRenderTreeUpdate() const;
1156 1137
1157 DocumentLifecycle m_lifecycle; 1138 DocumentLifecycle m_lifecycle;
1158 1139
1159 bool m_hasNodesWithPlaceholderStyle; 1140 bool m_hasNodesWithPlaceholderStyle;
1160 bool m_needsNotifyRemoveAllPendingStylesheet; 1141 bool m_needsNotifyRemoveAllPendingStylesheet;
1161 bool m_evaluateMediaQueriesOnStyleRecalc; 1142 bool m_evaluateMediaQueriesOnStyleRecalc;
1162 1143
1163 // If we do ignore the pending stylesheet count, then we need to add a boole an 1144 // If we do ignore the pending stylesheet count, then we need to add a boole an
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
1313 bool m_didSetReferrerPolicy; 1294 bool m_didSetReferrerPolicy;
1314 ReferrerPolicy m_referrerPolicy; 1295 ReferrerPolicy m_referrerPolicy;
1315 1296
1316 bool m_directionSetOnDocumentElement; 1297 bool m_directionSetOnDocumentElement;
1317 bool m_writingModeSetOnDocumentElement; 1298 bool m_writingModeSetOnDocumentElement;
1318 DocumentTiming m_documentTiming; 1299 DocumentTiming m_documentTiming;
1319 RefPtrWillBePersistent<MediaQueryMatcher> m_mediaQueryMatcher; 1300 RefPtrWillBePersistent<MediaQueryMatcher> m_mediaQueryMatcher;
1320 bool m_writeRecursionIsTooDeep; 1301 bool m_writeRecursionIsTooDeep;
1321 unsigned m_writeRecursionDepth; 1302 unsigned m_writeRecursionDepth;
1322 1303
1323 OwnPtr<TouchEventTargetSet> m_touchEventTargets;
1324
1325 double m_lastHandledUserGestureTimestamp; 1304 double m_lastHandledUserGestureTimestamp;
1326 1305
1327 RefPtr<ScriptedAnimationController> m_scriptedAnimationController; 1306 RefPtr<ScriptedAnimationController> m_scriptedAnimationController;
1328 OwnPtr<MainThreadTaskRunner> m_taskRunner; 1307 OwnPtr<MainThreadTaskRunner> m_taskRunner;
1329 OwnPtr<TextAutosizer> m_textAutosizer; 1308 OwnPtr<TextAutosizer> m_textAutosizer;
1330 OwnPtr<FastTextAutosizer> m_fastTextAutosizer; 1309 OwnPtr<FastTextAutosizer> m_fastTextAutosizer;
1331 1310
1332 RefPtr<CustomElementRegistrationContext> m_registrationContext; 1311 RefPtr<CustomElementRegistrationContext> m_registrationContext;
1333 1312
1334 void elementDataCacheClearTimerFired(Timer<Document>*); 1313 void elementDataCacheClearTimerFired(Timer<Document>*);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
1407 inline bool Node::isDocumentNode() const 1386 inline bool Node::isDocumentNode() const
1408 { 1387 {
1409 return this == document(); 1388 return this == document();
1410 } 1389 }
1411 1390
1412 Node* eventTargetNodeForDocument(Document*); 1391 Node* eventTargetNodeForDocument(Document*);
1413 1392
1414 } // namespace WebCore 1393 } // namespace WebCore
1415 1394
1416 #endif // Document_h 1395 #endif // Document_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698