Title: [155315] trunk/Source/WebCore
Revision
155315
Author
[email protected]
Date
2013-09-08 14:10:59 -0700 (Sun, 08 Sep 2013)

Log Message

FrameView::scheduleEvent() is over-engineered.
<https://webkit.org/b/121004>

Reviewed by Antti Koivisto.

Remove gratuitous FrameActionScheduler class that was really only being used
to defer the occassional "overflowchanged" event until layout had finished.

* CMakeLists.txt:
* GNUmakefile.list.am:
* Target.pri:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* page/FrameActionScheduler.cpp:
* page/FrameActionScheduler.h:

    Removed FrameActionScheduler.

* page/FrameView.h:
* page/FrameView.cpp:
(WebCore::FrameView::FrameView):
(WebCore::FrameView::~FrameView):
(WebCore::FrameView::layout):
(WebCore::FrameView::ScheduledEvent::ScheduledEvent):
(WebCore::FrameView::scheduleEvent):
(WebCore::FrameView::pauseScheduledEvents):
(WebCore::FrameView::resumeScheduledEvents):
(WebCore::FrameView::performPostLayoutTasks):
(WebCore::FrameView::updateOverflowStatus):

    Replaced it with a Vector<ScheduledEvent> and a suppression counter.
    A ScheduledEvent is just a { Node, Event } pair.

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/CMakeLists.txt (155314 => 155315)


--- trunk/Source/WebCore/CMakeLists.txt	2013-09-08 20:58:56 UTC (rev 155314)
+++ trunk/Source/WebCore/CMakeLists.txt	2013-09-08 21:10:59 UTC (rev 155315)
@@ -1732,7 +1732,6 @@
     page/FeatureObserver.cpp
     page/FocusController.cpp
     page/Frame.cpp
-    page/FrameActionScheduler.cpp
     page/FrameDestructionObserver.cpp
     page/FrameTree.cpp
     page/FrameView.cpp

Modified: trunk/Source/WebCore/ChangeLog (155314 => 155315)


--- trunk/Source/WebCore/ChangeLog	2013-09-08 20:58:56 UTC (rev 155314)
+++ trunk/Source/WebCore/ChangeLog	2013-09-08 21:10:59 UTC (rev 155315)
@@ -1,3 +1,39 @@
+2013-09-08  Andreas Kling  <[email protected]>
+
+        FrameView::scheduleEvent() is over-engineered.
+        <https://webkit.org/b/121004>
+
+        Reviewed by Antti Koivisto.
+
+        Remove gratuitous FrameActionScheduler class that was really only being used
+        to defer the occassional "overflowchanged" event until layout had finished.
+
+        * CMakeLists.txt:
+        * GNUmakefile.list.am:
+        * Target.pri:
+        * WebCore.vcxproj/WebCore.vcxproj:
+        * WebCore.vcxproj/WebCore.vcxproj.filters:
+        * WebCore.xcodeproj/project.pbxproj:
+        * page/FrameActionScheduler.cpp:
+        * page/FrameActionScheduler.h:
+
+            Removed FrameActionScheduler.
+
+        * page/FrameView.h:
+        * page/FrameView.cpp:
+        (WebCore::FrameView::FrameView):
+        (WebCore::FrameView::~FrameView):
+        (WebCore::FrameView::layout):
+        (WebCore::FrameView::ScheduledEvent::ScheduledEvent):
+        (WebCore::FrameView::scheduleEvent):
+        (WebCore::FrameView::pauseScheduledEvents):
+        (WebCore::FrameView::resumeScheduledEvents):
+        (WebCore::FrameView::performPostLayoutTasks):
+        (WebCore::FrameView::updateOverflowStatus):
+
+            Replaced it with a Vector<ScheduledEvent> and a suppression counter.
+            A ScheduledEvent is just a { Node, Event } pair.
+
 2013-09-08  Anders Carlsson  <[email protected]>
 
         Move WTF::notFound to Vector.h and delete NotFound.h

Modified: trunk/Source/WebCore/GNUmakefile.list.am (155314 => 155315)


--- trunk/Source/WebCore/GNUmakefile.list.am	2013-09-08 20:58:56 UTC (rev 155314)
+++ trunk/Source/WebCore/GNUmakefile.list.am	2013-09-08 21:10:59 UTC (rev 155315)
@@ -4178,8 +4178,6 @@
 	Source/WebCore/page/FocusDirection.h \
 	Source/WebCore/page/Frame.cpp \
 	Source/WebCore/page/Frame.h \
-	Source/WebCore/page/FrameActionScheduler.cpp \
-	Source/WebCore/page/FrameActionScheduler.h \
 	Source/WebCore/page/FrameDestructionObserver.cpp \
 	Source/WebCore/page/FrameDestructionObserver.h \
 	Source/WebCore/page/FrameTree.cpp \

Modified: trunk/Source/WebCore/Target.pri (155314 => 155315)


--- trunk/Source/WebCore/Target.pri	2013-09-08 20:58:56 UTC (rev 155314)
+++ trunk/Source/WebCore/Target.pri	2013-09-08 21:10:59 UTC (rev 155315)
@@ -908,7 +908,6 @@
     page/FeatureObserver.cpp \
     page/FocusController.cpp \
     page/Frame.cpp \
-    page/FrameActionScheduler.cpp \
     page/FrameDestructionObserver.cpp \
     page/FrameTree.cpp \
     page/FrameView.cpp \

Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (155314 => 155315)


--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2013-09-08 20:58:56 UTC (rev 155314)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2013-09-08 21:10:59 UTC (rev 155315)
@@ -7177,7 +7177,6 @@
     <ClCompile Include="..\page\FeatureObserver.cpp" />
     <ClCompile Include="..\page\FocusController.cpp" />
     <ClCompile Include="..\page\Frame.cpp" />
-    <ClCompile Include="..\page\FrameActionScheduler.cpp" />
     <ClCompile Include="..\page\FrameDestructionObserver.cpp" />
     <ClCompile Include="..\page\FrameTree.cpp" />
     <ClCompile Include="..\page\FrameView.cpp" />
@@ -19086,7 +19085,6 @@
     <ClInclude Include="..\page\FocusController.h" />
     <ClInclude Include="..\page\FocusDirection.h" />
     <ClInclude Include="..\page\Frame.h" />
-    <ClInclude Include="..\page\FrameActionScheduler.h" />
     <ClInclude Include="..\page\FrameDestructionObserver.h" />
     <ClInclude Include="..\page\FrameTree.h" />
     <ClInclude Include="..\page\FrameView.h" />
@@ -21450,4 +21448,4 @@
   <ImportGroup Label="ExtensionTargets">
     <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
   </ImportGroup>
-</Project>
\ No newline at end of file
+</Project>

Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (155314 => 155315)


--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters	2013-09-08 20:58:56 UTC (rev 155314)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters	2013-09-08 21:10:59 UTC (rev 155315)
@@ -768,9 +768,6 @@
     <ClCompile Include="..\page\Frame.cpp">
       <Filter>page</Filter>
     </ClCompile>
-    <ClCompile Include="..\page\FrameActionScheduler.cpp">
-      <Filter>page</Filter>
-    </ClCompile>
     <ClCompile Include="..\page\FrameDestructionObserver.cpp">
       <Filter>page</Filter>
     </ClCompile>
@@ -7747,9 +7744,6 @@
     <ClInclude Include="..\page\Frame.h">
       <Filter>page</Filter>
     </ClInclude>
-    <ClInclude Include="..\page\FrameActionScheduler.h">
-      <Filter>page</Filter>
-    </ClInclude>
     <ClInclude Include="..\page\FrameDestructionObserver.h">
       <Filter>page</Filter>
     </ClInclude>
@@ -15881,4 +15875,4 @@
       <Filter>platform\win</Filter>
     </MASM>
   </ItemGroup>
-</Project>
\ No newline at end of file
+</Project>

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (155314 => 155315)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2013-09-08 20:58:56 UTC (rev 155314)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2013-09-08 21:10:59 UTC (rev 155315)
@@ -3548,8 +3548,6 @@
 		A7A78CD51532BA62006C21E4 /* ContainerNodeAlgorithms.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7A78CD41532BA62006C21E4 /* ContainerNodeAlgorithms.cpp */; };
 		A7AD2F870EC89D07008AB002 /* LinkHash.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7AD2F850EC89D07008AB002 /* LinkHash.cpp */; };
 		A7AD2F880EC89D07008AB002 /* LinkHash.h in Headers */ = {isa = PBXBuildFile; fileRef = A7AD2F860EC89D07008AB002 /* LinkHash.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		A7B070D2130A409C00A3763C /* FrameActionScheduler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7B070D0130A409C00A3763C /* FrameActionScheduler.cpp */; };
-		A7B070D3130A409C00A3763C /* FrameActionScheduler.h in Headers */ = {isa = PBXBuildFile; fileRef = A7B070D1130A409C00A3763C /* FrameActionScheduler.h */; };
 		A7B6E69F0B291A9600D0529F /* DragData.h in Headers */ = {isa = PBXBuildFile; fileRef = A7B6E69D0B291A9600D0529F /* DragData.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A7B761A1161EE526002083D3 /* StyleScopeResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = A7B7619F161EE526002083D3 /* StyleScopeResolver.h */; };
 		A7BBE26611AFB3F20005EA03 /* JSHTMLMeterElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7BBE26411AFB3F20005EA03 /* JSHTMLMeterElement.cpp */; };
@@ -10143,8 +10141,6 @@
 		A7A78CD41532BA62006C21E4 /* ContainerNodeAlgorithms.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContainerNodeAlgorithms.cpp; sourceTree = "<group>"; };
 		A7AD2F850EC89D07008AB002 /* LinkHash.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LinkHash.cpp; sourceTree = "<group>"; };
 		A7AD2F860EC89D07008AB002 /* LinkHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LinkHash.h; sourceTree = "<group>"; };
-		A7B070D0130A409C00A3763C /* FrameActionScheduler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FrameActionScheduler.cpp; sourceTree = "<group>"; };
-		A7B070D1130A409C00A3763C /* FrameActionScheduler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FrameActionScheduler.h; sourceTree = "<group>"; };
 		A7B4EA6814C9348400C8F5BF /* JSMallocStatistics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMallocStatistics.cpp; sourceTree = "<group>"; };
 		A7B4EA6914C9348400C8F5BF /* JSMallocStatistics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMallocStatistics.h; sourceTree = "<group>"; };
 		A7B4EA7814C9348400C8F5BF /* JSInternalSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSInternalSettings.cpp; sourceTree = "<group>"; };
@@ -15168,8 +15164,6 @@
 				062287830B4DB322000C34DF /* FocusDirection.h */,
 				65BF02290974816300C43196 /* Frame.cpp */,
 				65BF022A0974816300C43196 /* Frame.h */,
-				A7B070D0130A409C00A3763C /* FrameActionScheduler.cpp */,
-				A7B070D1130A409C00A3763C /* FrameActionScheduler.h */,
 				974A862014B7ADBB003FDC76 /* FrameDestructionObserver.cpp */,
 				974A862114B7ADBB003FDC76 /* FrameDestructionObserver.h */,
 				65A21482097A3F5300B9050A /* FrameTree.cpp */,
@@ -22339,7 +22333,6 @@
 				41885B9311B6FDA6003383BB /* FormSubmission.h in Headers */,
 				A853123D11D0471B00D4D077 /* FragmentScriptingPermission.h in Headers */,
 				65BF022F0974816300C43196 /* Frame.h in Headers */,
-				A7B070D3130A409C00A3763C /* FrameActionScheduler.h in Headers */,
 				974A862314B7ADBB003FDC76 /* FrameDestructionObserver.h in Headers */,
 				656D373C0ADBA5DE00A4554D /* FrameLoader.h in Headers */,
 				656D373E0ADBA5DE00A4554D /* FrameLoaderClient.h in Headers */,
@@ -25600,7 +25593,6 @@
 				656D373B0ADBA5DE00A4554D /* FormState.cpp in Sources */,
 				41885B9411B6FDA6003383BB /* FormSubmission.cpp in Sources */,
 				65BF022E0974816300C43196 /* Frame.cpp in Sources */,
-				A7B070D2130A409C00A3763C /* FrameActionScheduler.cpp in Sources */,
 				974A862214B7ADBB003FDC76 /* FrameDestructionObserver.cpp in Sources */,
 				932E16090AF578340025F408 /* FrameLoader.cpp in Sources */,
 				D000EBA211BDAFD400C47726 /* FrameLoaderStateMachine.cpp in Sources */,

Deleted: trunk/Source/WebCore/page/FrameActionScheduler.cpp (155314 => 155315)


--- trunk/Source/WebCore/page/FrameActionScheduler.cpp	2013-09-08 20:58:56 UTC (rev 155314)
+++ trunk/Source/WebCore/page/FrameActionScheduler.cpp	2013-09-08 21:10:59 UTC (rev 155315)
@@ -1,111 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "FrameActionScheduler.h"
-
-#include "Event.h"
-#include "ExceptionCodePlaceholder.h"
-#include "Node.h"
-#include <wtf/Vector.h>
-
-namespace WebCore {
-
-class EventFrameAction : public FrameAction {
-public:
-    EventFrameAction(PassRefPtr<Event> event, PassRefPtr<Node> target)
-        : m_event(event)
-        , m_eventTarget(target)
-    {
-    }
-
-    virtual void fire()
-    {
-        // Only dispatch events to nodes that are in the document
-        if (m_eventTarget->inDocument())
-            m_eventTarget->dispatchEvent(m_event, IGNORE_EXCEPTION);
-    }
-
-private:
-    RefPtr<Event> m_event;
-    RefPtr<Node> m_eventTarget;
-};
-
-FrameActionScheduler::FrameActionScheduler()
-    : m_enqueueActions(0)
-{
-}
-
-FrameActionScheduler::~FrameActionScheduler()
-{
-    clear();
-}
-
-bool FrameActionScheduler::isEmpty() const
-{
-    return m_scheduledActions.isEmpty();
-}
-
-void FrameActionScheduler::clear()
-{
-    m_scheduledActions.clear();
-    m_enqueueActions = 0;
-}
-
-void FrameActionScheduler::pause()
-{
-    ASSERT(isEmpty() || m_enqueueActions);
-    m_enqueueActions++;
-}
-
-void FrameActionScheduler::resume()
-{
-    m_enqueueActions--;
-    if (!m_enqueueActions)
-        dispatch();
-    ASSERT(isEmpty() || m_enqueueActions);
-}
-
-void FrameActionScheduler::dispatch()
-{
-    Vector< OwnPtr<FrameAction> > snapshot;
-    m_scheduledActions.swap(snapshot);
-    
-    for (Vector< OwnPtr<FrameAction> >::iterator i = snapshot.begin(); i != snapshot.end(); ++i)
-        (*i)->fire();
-}
-
-void FrameActionScheduler::scheduleAction(PassOwnPtr<FrameAction> action)
-{
-    m_scheduledActions.append(action);
-}
-
-void FrameActionScheduler::scheduleEvent(PassRefPtr<Event> event, PassRefPtr<Node> eventTarget)
-{
-    scheduleAction(adoptPtr(new EventFrameAction(event, eventTarget)));
-}
-
-
-} // namespace WebCore

Deleted: trunk/Source/WebCore/page/FrameActionScheduler.h (155314 => 155315)


--- trunk/Source/WebCore/page/FrameActionScheduler.h	2013-09-08 20:58:56 UTC (rev 155314)
+++ trunk/Source/WebCore/page/FrameActionScheduler.h	2013-09-08 21:10:59 UTC (rev 155315)
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef FrameActionScheduler_h
-#define FrameActionScheduler_h
-
-#include <wtf/FastMalloc.h>
-#include <wtf/Noncopyable.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
-#include <wtf/Vector.h>
-
-namespace WebCore {
-
-class Node;
-class Event;
-
-class FrameAction {
-    WTF_MAKE_FAST_ALLOCATED;
-    WTF_MAKE_NONCOPYABLE(FrameAction);
-public:
-    FrameAction() {}
-    virtual ~FrameAction() {}
-    virtual void fire() = 0;
-};
-
-class FrameActionScheduler {
-    WTF_MAKE_FAST_ALLOCATED;
-public:
-    FrameActionScheduler();
-    ~FrameActionScheduler();
-
-    bool isEmpty() const;
-    bool isScheduled() const { return 0 < m_enqueueActions; }
-    void clear();
-    void pause();
-    void resume();
-
-    void scheduleAction(PassOwnPtr<FrameAction>);
-    void scheduleEvent(PassRefPtr<Event>, PassRefPtr<Node>);
-
-private:
-    void dispatch();
-
-    unsigned m_enqueueActions;
-    Vector< OwnPtr<FrameAction> > m_scheduledActions;
-};
-
-} // namespace WebCore
-
-#endif // FrameActionScheduler_h

Modified: trunk/Source/WebCore/page/FrameView.cpp (155314 => 155315)


--- trunk/Source/WebCore/page/FrameView.cpp	2013-09-08 20:58:56 UTC (rev 155314)
+++ trunk/Source/WebCore/page/FrameView.cpp	2013-09-08 21:10:59 UTC (rev 155315)
@@ -42,7 +42,6 @@
 #include "FontCache.h"
 #include "FontLoader.h"
 #include "Frame.h"
-#include "FrameActionScheduler.h"
 #include "FrameLoader.h"
 #include "FrameLoaderClient.h"
 #include "FrameSelection.h"
@@ -180,7 +179,6 @@
     , m_isTransparent(false)
     , m_baseBackgroundColor(Color::white)
     , m_mediaType("screen")
-    , m_actionScheduler(adoptPtr(new FrameActionScheduler))
     , m_overflowStatusDirty(true)
     , m_viewportRenderer(0)
     , m_wasScrolledByUser(false)
@@ -202,6 +200,7 @@
     , m_milestonesPendingPaint(0)
     , m_visualUpdatesAllowedByClient(true)
     , m_scrollPinningBehavior(DoNotPin)
+    , m_scheduledEventSuppressionCount(0)
 {
     init();
 
@@ -230,7 +229,8 @@
 {
     if (m_postLayoutTasksTimer.isActive()) {
         m_postLayoutTasksTimer.stop();
-        m_actionScheduler->clear();
+        m_scheduledEventSuppressionCount = 0;
+        m_scheduledEvents.clear();
     }
     
     removeFromAXObjectCache();
@@ -244,7 +244,7 @@
     setHasVerticalScrollbar(false);
     
     ASSERT(!m_scrollCorner);
-    ASSERT(m_actionScheduler->isEmpty());
+    ASSERT(m_scheduledEvents.isEmpty());
 
     ASSERT(frame().view() != this || !frame().contentRenderer());
     RenderPart* renderer = frame().ownerRenderer();
@@ -1262,7 +1262,7 @@
 
         layer = root->enclosingLayer();
 
-        m_actionScheduler->pause();
+        pauseScheduledEvents();
 
         {
             bool disableLayoutState = false;
@@ -1328,7 +1328,9 @@
         updateOverflowStatus(layoutWidth() < contentsWidth(),
                              layoutHeight() < contentsHeight());
 
-    if (!m_postLayoutTasksTimer.isActive()) {
+    if (m_postLayoutTasksTimer.isActive())
+        resumeScheduledEvents();
+    else {
         if (!m_inSynchronousPostLayout) {
             if (inChildFrameLayoutWithFrameFlattening) {
                 if (RenderView* renderView = this->renderView())
@@ -1348,12 +1350,10 @@
             // we call it through the timer here.
             m_postLayoutTasksTimer.startOneShot(0);
             if (needsLayout()) {
-                m_actionScheduler->pause();
+                pauseScheduledEvents();
                 layout();
             }
         }
-    } else {
-        m_actionScheduler->resume();
     }
 
     InspectorInstrumentation::didLayout(cookie, root);
@@ -2574,19 +2574,40 @@
     return true;
 }
 
+struct FrameView::ScheduledEvent {
+    ScheduledEvent(PassRefPtr<Event> e, PassRefPtr<Node> t) : event(e), target(t) { }
+    RefPtr<Event> event;
+    RefPtr<Node> target;
+};
+
 void FrameView::scheduleEvent(PassRefPtr<Event> event, PassRefPtr<Node> eventTarget)
 {
-    m_actionScheduler->scheduleEvent(event, eventTarget);
+    if (!m_scheduledEventSuppressionCount) {
+        eventTarget->dispatchEvent(event, IGNORE_EXCEPTION);
+        return;
+    }
+    m_scheduledEvents.append(ScheduledEvent(event, eventTarget));
 }
 
 void FrameView::pauseScheduledEvents()
 {
-    m_actionScheduler->pause();
+    ++m_scheduledEventSuppressionCount;
 }
 
 void FrameView::resumeScheduledEvents()
 {
-    m_actionScheduler->resume();
+    ASSERT(m_scheduledEventSuppressionCount);
+    --m_scheduledEventSuppressionCount;
+    if (m_scheduledEventSuppressionCount)
+        return;
+
+    Vector<ScheduledEvent> eventsToDispatch = std::move(m_scheduledEvents);
+    for (auto it = eventsToDispatch.begin(), end = eventsToDispatch.end(); it != end; ++it) {
+        ScheduledEvent& scheduledEvent = *it;
+        if (!scheduledEvent.target->inDocument())
+            continue;
+        scheduledEvent.target->dispatchEvent(scheduledEvent.event.release(), IGNORE_EXCEPTION);
+    }
 }
 
 void FrameView::scrollToAnchor()
@@ -2778,7 +2799,7 @@
 
     scrollToAnchor();
 
-    m_actionScheduler->resume();
+    resumeScheduledEvents();
 
     sendResizeEventIfNeeded();
 }
@@ -2968,7 +2989,7 @@
         m_horizontalOverflow = horizontalOverflow;
         m_verticalOverflow = verticalOverflow;
         
-        m_actionScheduler->scheduleEvent(OverflowEvent::create(horizontalOverflowChanged, horizontalOverflow,
+        scheduleEvent(OverflowEvent::create(horizontalOverflowChanged, horizontalOverflow,
             verticalOverflowChanged, verticalOverflow),
             m_viewportRenderer->node());
     }

Modified: trunk/Source/WebCore/page/FrameView.h (155314 => 155315)


--- trunk/Source/WebCore/page/FrameView.h	2013-09-08 20:58:56 UTC (rev 155314)
+++ trunk/Source/WebCore/page/FrameView.h	2013-09-08 21:10:59 UTC (rev 155315)
@@ -43,7 +43,6 @@
 class Event;
 class FloatSize;
 class Frame;
-class FrameActionScheduler;
 class HTMLFrameOwnerElement;
 class KURL;
 class Node;
@@ -587,8 +586,6 @@
     String m_mediaType;
     String m_mediaTypeWhenNotPrinting;
 
-    OwnPtr<FrameActionScheduler> m_actionScheduler;
-
     bool m_overflowStatusDirty;
     bool m_horizontalOverflow;
     bool m_verticalOverflow;    
@@ -670,6 +667,11 @@
     bool m_visualUpdatesAllowedByClient;
     
     ScrollPinningBehavior m_scrollPinningBehavior;
+
+    unsigned m_scheduledEventSuppressionCount;
+
+    struct ScheduledEvent;
+    Vector<ScheduledEvent> m_scheduledEvents;
 };
 
 inline void FrameView::incrementVisuallyNonEmptyCharacterCount(unsigned count)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to