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

Side by Side Diff: sky/engine/core/dom/Document.cpp

Issue 879743004: Remove the EventFactory machinery. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « sky/engine/core/dom/Document.h ('k') | sky/engine/core/dom/Document.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 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) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 #include "sky/engine/core/dom/StaticNodeList.h" 72 #include "sky/engine/core/dom/StaticNodeList.h"
73 #include "sky/engine/core/dom/StyleEngine.h" 73 #include "sky/engine/core/dom/StyleEngine.h"
74 #include "sky/engine/core/dom/Text.h" 74 #include "sky/engine/core/dom/Text.h"
75 #include "sky/engine/core/dom/custom/CustomElementMicrotaskRunQueue.h" 75 #include "sky/engine/core/dom/custom/CustomElementMicrotaskRunQueue.h"
76 #include "sky/engine/core/dom/custom/CustomElementRegistrationContext.h" 76 #include "sky/engine/core/dom/custom/CustomElementRegistrationContext.h"
77 #include "sky/engine/core/dom/shadow/ElementShadow.h" 77 #include "sky/engine/core/dom/shadow/ElementShadow.h"
78 #include "sky/engine/core/dom/shadow/ShadowRoot.h" 78 #include "sky/engine/core/dom/shadow/ShadowRoot.h"
79 #include "sky/engine/core/editing/FrameSelection.h" 79 #include "sky/engine/core/editing/FrameSelection.h"
80 #include "sky/engine/core/editing/SpellChecker.h" 80 #include "sky/engine/core/editing/SpellChecker.h"
81 #include "sky/engine/core/events/Event.h" 81 #include "sky/engine/core/events/Event.h"
82 #include "sky/engine/core/events/EventFactory.h"
83 #include "sky/engine/core/events/EventListener.h" 82 #include "sky/engine/core/events/EventListener.h"
84 #include "sky/engine/core/events/HashChangeEvent.h" 83 #include "sky/engine/core/events/HashChangeEvent.h"
85 #include "sky/engine/core/events/PageTransitionEvent.h" 84 #include "sky/engine/core/events/PageTransitionEvent.h"
86 #include "sky/engine/core/events/ScopedEventQueue.h" 85 #include "sky/engine/core/events/ScopedEventQueue.h"
87 #include "sky/engine/core/fetch/ResourceFetcher.h" 86 #include "sky/engine/core/fetch/ResourceFetcher.h"
88 #include "sky/engine/core/frame/FrameConsole.h" 87 #include "sky/engine/core/frame/FrameConsole.h"
89 #include "sky/engine/core/frame/FrameHost.h" 88 #include "sky/engine/core/frame/FrameHost.h"
90 #include "sky/engine/core/frame/FrameView.h" 89 #include "sky/engine/core/frame/FrameView.h"
91 #include "sky/engine/core/frame/LocalDOMWindow.h" 90 #include "sky/engine/core/frame/LocalDOMWindow.h"
92 #include "sky/engine/core/frame/LocalFrame.h" 91 #include "sky/engine/core/frame/LocalFrame.h"
(...skipping 1744 matching lines...) Expand 10 before | Expand all | Expand 10 after
1837 RefPtr<Event> event = Event::create(EventTypeNames::resize); 1836 RefPtr<Event> event = Event::create(EventTypeNames::resize);
1838 event->setTarget(domWindow()); 1837 event->setTarget(domWindow());
1839 ensureScriptedAnimationController().enqueuePerFrameEvent(event.release()); 1838 ensureScriptedAnimationController().enqueuePerFrameEvent(event.release());
1840 } 1839 }
1841 1840
1842 void Document::enqueueMediaQueryChangeListeners(Vector<RefPtr<MediaQueryListList ener> >& listeners) 1841 void Document::enqueueMediaQueryChangeListeners(Vector<RefPtr<MediaQueryListList ener> >& listeners)
1843 { 1842 {
1844 ensureScriptedAnimationController().enqueueMediaQueryChangeListeners(listene rs); 1843 ensureScriptedAnimationController().enqueueMediaQueryChangeListeners(listene rs);
1845 } 1844 }
1846 1845
1847 Document::EventFactorySet& Document::eventFactories()
1848 {
1849 DEFINE_STATIC_LOCAL(EventFactorySet, s_eventFactory, ());
1850 return s_eventFactory;
1851 }
1852
1853 void Document::registerEventFactory(PassOwnPtr<EventFactoryBase> eventFactory)
1854 {
1855 ASSERT(!eventFactories().contains(eventFactory.get()));
1856 eventFactories().add(eventFactory);
1857 }
1858
1859 PassRefPtr<Event> Document::createEvent(const String& eventType, ExceptionState& exceptionState)
1860 {
1861 RefPtr<Event> event = nullptr;
1862 for (EventFactorySet::const_iterator it = eventFactories().begin(); it != ev entFactories().end(); ++it) {
1863 event = (*it)->create(eventType);
1864 if (event)
1865 return event.release();
1866 }
1867 exceptionState.throwDOMException(NotSupportedError, "The provided event type ('" + eventType + "') is invalid.");
1868 return nullptr;
1869 }
1870
1871 void Document::addListenerTypeIfNeeded(const AtomicString& eventType) 1846 void Document::addListenerTypeIfNeeded(const AtomicString& eventType)
1872 { 1847 {
1873 if (eventType == EventTypeNames::animationstart) { 1848 if (eventType == EventTypeNames::animationstart) {
1874 addListenerType(ANIMATIONSTART_LISTENER); 1849 addListenerType(ANIMATIONSTART_LISTENER);
1875 } else if (eventType == EventTypeNames::animationend) { 1850 } else if (eventType == EventTypeNames::animationend) {
1876 addListenerType(ANIMATIONEND_LISTENER); 1851 addListenerType(ANIMATIONEND_LISTENER);
1877 } else if (eventType == EventTypeNames::animationiteration) { 1852 } else if (eventType == EventTypeNames::animationiteration) {
1878 addListenerType(ANIMATIONITERATION_LISTENER); 1853 addListenerType(ANIMATIONITERATION_LISTENER);
1879 } else if (eventType == EventTypeNames::transitionend) { 1854 } else if (eventType == EventTypeNames::transitionend) {
1880 addListenerType(TRANSITIONEND_LISTENER); 1855 addListenerType(TRANSITIONEND_LISTENER);
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
2383 using namespace blink; 2358 using namespace blink;
2384 void showLiveDocumentInstances() 2359 void showLiveDocumentInstances()
2385 { 2360 {
2386 WeakDocumentSet& set = liveDocumentSet(); 2361 WeakDocumentSet& set = liveDocumentSet();
2387 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 2362 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
2388 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it ) { 2363 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it ) {
2389 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut f8().data()); 2364 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut f8().data());
2390 } 2365 }
2391 } 2366 }
2392 #endif 2367 #endif
OLDNEW
« no previous file with comments | « sky/engine/core/dom/Document.h ('k') | sky/engine/core/dom/Document.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698