WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
work in progress
wip46936 (text/plain), 7.71 KB, created by
Ryosuke Niwa
on 2010-11-16 17:07:38 PST
(
hide
)
Description:
work in progress
Filename:
MIME Type:
Creator:
Ryosuke Niwa
Created:
2010-11-16 17:07:38 PST
Size:
7.71 KB
patch
obsolete
>Index: WebCore/dom/Element.cpp >=================================================================== >--- WebCore/dom/Element.cpp (revision 72130) >+++ WebCore/dom/Element.cpp (working copy) >@@ -1165,7 +1165,7 @@ > if (!document()->hasListenerType(Document::DOMATTRMODIFIED_LISTENER)) > return; > ExceptionCode ec = 0; >- dispatchEvent(MutationEvent::create(DOMAttrModifiedEvent, true, attr, attr->value(), >+ dispatchMutationEvent(MutationEvent::create(DOMAttrModifiedEvent, true, attr, attr->value(), > attr->value(), document()->attrName(attr->id()), MutationEvent::REMOVAL), ec); > #endif > } >@@ -1178,7 +1178,7 @@ > if (!document()->hasListenerType(Document::DOMATTRMODIFIED_LISTENER)) > return; > ExceptionCode ec = 0; >- dispatchEvent(MutationEvent::create(DOMAttrModifiedEvent, true, attr, attr->value(), >+ dispatchMutationEvent(MutationEvent::create(DOMAttrModifiedEvent, true, attr, attr->value(), > attr->value(), document()->attrName(attr->id()), MutationEvent::ADDITION), ec); > #endif > } >Index: WebCore/dom/Node.h >=================================================================== >--- WebCore/dom/Node.h (revision 72130) >+++ WebCore/dom/Node.h (working copy) >@@ -517,6 +517,7 @@ > > using EventTarget::dispatchEvent; > virtual bool dispatchEvent(PassRefPtr<Event>); >+ virtual void dispatchMutationEvent(PassRefPtr<Event>); > > bool dispatchGenericEvent(PassRefPtr<Event>); > virtual void handleLocalEvents(Event*); >Index: WebCore/dom/ContainerNode.cpp >=================================================================== >--- WebCore/dom/ContainerNode.cpp (revision 72130) >+++ WebCore/dom/ContainerNode.cpp (working copy) >@@ -1027,12 +1027,12 @@ > RefPtr<Document> document = child->document(); > > if (c->parentNode() && document->hasListenerType(Document::DOMNODEINSERTED_LISTENER)) >- c->dispatchEvent(MutationEvent::create(eventNames().DOMNodeInsertedEvent, true, c->parentNode())); >+ c->dispatchMutationEvent(MutationEvent::create(eventNames().DOMNodeInsertedEvent, true, c->parentNode())); > > // dispatch the DOMNodeInsertedIntoDocument event to all descendants > if (c->inDocument() && document->hasListenerType(Document::DOMNODEINSERTEDINTODOCUMENT_LISTENER)) { > for (; c; c = c->traverseNextNode(child)) >- c->dispatchEvent(MutationEvent::create(eventNames().DOMNodeInsertedIntoDocumentEvent, false)); >+ c->dispatchMutationEvent(MutationEvent::create(eventNames().DOMNodeInsertedIntoDocumentEvent, false)); > } > } > >@@ -1049,12 +1049,12 @@ > > // dispatch pre-removal mutation events > if (c->parentNode() && document->hasListenerType(Document::DOMNODEREMOVED_LISTENER)) >- c->dispatchEvent(MutationEvent::create(eventNames().DOMNodeRemovedEvent, true, c->parentNode())); >+ c->dispatchMutationEvent(MutationEvent::create(eventNames().DOMNodeRemovedEvent, true, c->parentNode())); > > // dispatch the DOMNodeRemovedFromDocument event to all descendants > if (c->inDocument() && document->hasListenerType(Document::DOMNODEREMOVEDFROMDOCUMENT_LISTENER)) { > for (; c; c = c->traverseNextNode(child)) >- c->dispatchEvent(MutationEvent::create(eventNames().DOMNodeRemovedFromDocumentEvent, false)); >+ c->dispatchMutationEvent(MutationEvent::create(eventNames().DOMNodeRemovedFromDocumentEvent, false)); > } > } > >Index: WebCore/dom/Node.cpp >=================================================================== >--- WebCore/dom/Node.cpp (revision 72130) >+++ WebCore/dom/Node.cpp (working copy) >@@ -2550,6 +2550,17 @@ > return dispatchGenericEvent(event.release()); > } > >+void Node::dispatchMutationEvent(PassRefPtr<Event> prpEvent) >+{ >+ RefPtr<Event> event = prpEvent; >+ >+ event->setTarget(eventTargetRespectingSVGTargetRules(this)); >+ >+ if (Frame* frame = document()->frame()) >+ if (Page* page = frame->page()) >+ page->appendAsyncEvent(event); >+} >+ > static const EventContext* topEventContext(const Vector<EventContext>& ancestors) > { > return ancestors.isEmpty() ? 0 : &ancestors.last(); >@@ -2664,7 +2675,7 @@ > if (!document()->hasListenerType(Document::DOMSUBTREEMODIFIED_LISTENER)) > return; > >- dispatchEvent(MutationEvent::create(eventNames().DOMSubtreeModifiedEvent, true)); >+ dispatchMutationEvent(MutationEvent::create(eventNames().DOMSubtreeModifiedEvent, true)); > } > > void Node::dispatchUIEvent(const AtomicString& eventType, int detail, PassRefPtr<Event> underlyingEvent) >Index: WebCore/dom/CharacterData.cpp >=================================================================== >--- WebCore/dom/CharacterData.cpp (revision 72130) >+++ WebCore/dom/CharacterData.cpp (working copy) >@@ -196,7 +196,7 @@ > if (parentNode()) > parentNode()->childrenChanged(); > if (document()->hasListenerType(Document::DOMCHARACTERDATAMODIFIED_LISTENER)) >- dispatchEvent(MutationEvent::create(eventNames().DOMCharacterDataModifiedEvent, true, 0, prevValue, m_data)); >+ dispatchMutationEvent(MutationEvent::create(eventNames().DOMCharacterDataModifiedEvent, true, 0, prevValue, m_data)); > dispatchSubtreeModifiedEvent(); > #if ENABLE(INSPECTOR) > InspectorInstrumentation::characterDataModified(document(), this); >Index: WebCore/page/Page.h >=================================================================== >--- WebCore/page/Page.h (revision 72130) >+++ WebCore/page/Page.h (working copy) >@@ -23,6 +23,7 @@ > > #include "FrameLoaderTypes.h" > #include "PlatformString.h" >+#include "Timer.h" > #include "ViewportArguments.h" > #include <wtf/Forward.h> > #include <wtf/HashSet.h> >@@ -52,6 +53,7 @@ > class DragClient; > class DragController; > class EditorClient; >+ class Event; > class FocusController; > class Frame; > class GeolocationClient; >@@ -273,6 +275,9 @@ > void setJavaScriptURLsAreAllowed(bool); > bool javaScriptURLsAreAllowed() const; > >+ void appendAsyncEvent(PassRefPtr<Event>); >+ void asyncEventTimerFired(Timer<Page>*); >+ > // Don't allow more than a certain number of frames in a page. > // This seems like a reasonable upper bound, and otherwise mutually > // recursive frameset pages can quickly bring the program to its knees >@@ -322,6 +327,8 @@ > > OwnPtr<BackForwardController> m_backForwardController; > RefPtr<Frame> m_mainFrame; >+ Timer<Page> m_asyncEventTimer; >+ Vector<RefPtr<Event> > m_pendingEvents; > > RefPtr<HistoryItem> m_globalHistoryItem; > >Index: WebCore/page/Page.cpp >=================================================================== >--- WebCore/page/Page.cpp (revision 72130) >+++ WebCore/page/Page.cpp (working copy) >@@ -155,6 +155,7 @@ > , m_settings(adoptPtr(new Settings(this))) > , m_progress(adoptPtr(new ProgressTracker)) > , m_backForwardController(adoptPtr(new BackForwardController(this, pageClients.backForwardClient))) >+ , m_asyncEventTimer(this, &Page::asyncEventTimerFired) > , m_theme(RenderTheme::themeForPage(this)) > , m_editorClient(pageClients.editorClient) > , m_frameCount(0) >@@ -844,6 +845,28 @@ > return m_javaScriptURLsAreAllowed; > } > >+void Page::appendAsyncEvent(PassRefPtr<Event> event) >+{ >+ m_pendingEvents.append(event); >+ if (!m_asyncEventTimer.isActive()) >+ m_asyncEventTimer.startOneShot(0); >+} >+ >+void Page::asyncEventTimerFired(Timer<Page>*) >+{ >+ Vector<RefPtr<Event> > pendingEvents; >+ ExceptionCode ec = 0; >+ >+ m_pendingEvents.swap(pendingEvents); >+ size_t count = pendingEvents.size(); >+ for (size_t i = 0; i < count; ++i) { >+ EventTarget* target = pendingEvents[i]->target(); >+ if (!target || !target->toNode()) >+ return; >+ target->toNode()->dispatchEvent(pendingEvents[i].release(), ec); >+ } >+} >+ > #if ENABLE(INPUT_SPEECH) > SpeechInput* Page::speechInput() > {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 46936
:
74066
|
74172
|
75079
|
75584