Title: [169201] branches/safari-537.77-branch/Source/WebCore

Diff

Modified: branches/safari-537.77-branch/Source/WebCore/CMakeLists.txt (169200 => 169201)


--- branches/safari-537.77-branch/Source/WebCore/CMakeLists.txt	2014-05-22 14:57:59 UTC (rev 169200)
+++ branches/safari-537.77-branch/Source/WebCore/CMakeLists.txt	2014-05-22 15:46:51 UTC (rev 169201)
@@ -1738,7 +1738,6 @@
     page/FeatureObserver.cpp
     page/FocusController.cpp
     page/Frame.cpp
-    page/FrameActionScheduler.cpp
     page/FrameDestructionObserver.cpp
     page/FrameTree.cpp
     page/FrameView.cpp

Modified: branches/safari-537.77-branch/Source/WebCore/ChangeLog (169200 => 169201)


--- branches/safari-537.77-branch/Source/WebCore/ChangeLog	2014-05-22 14:57:59 UTC (rev 169200)
+++ branches/safari-537.77-branch/Source/WebCore/ChangeLog	2014-05-22 15:46:51 UTC (rev 169201)
@@ -1,3 +1,43 @@
+2014-05-22  Lucas Forschler  <[email protected]>
+
+        Merge r155315
+
+    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.
+
 2014-05-19  Lucas Forschler  <[email protected]>
 
         erge r169098

Modified: branches/safari-537.77-branch/Source/WebCore/GNUmakefile.list.am (169200 => 169201)


--- branches/safari-537.77-branch/Source/WebCore/GNUmakefile.list.am	2014-05-22 14:57:59 UTC (rev 169200)
+++ branches/safari-537.77-branch/Source/WebCore/GNUmakefile.list.am	2014-05-22 15:46:51 UTC (rev 169201)
@@ -4217,8 +4217,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: branches/safari-537.77-branch/Source/WebCore/Target.pri (169200 => 169201)


--- branches/safari-537.77-branch/Source/WebCore/Target.pri	2014-05-22 14:57:59 UTC (rev 169200)
+++ branches/safari-537.77-branch/Source/WebCore/Target.pri	2014-05-22 15:46:51 UTC (rev 169201)
@@ -916,7 +916,6 @@
     page/FeatureObserver.cpp \
     page/FocusController.cpp \
     page/Frame.cpp \
-    page/FrameActionScheduler.cpp \
     page/FrameDestructionObserver.cpp \
     page/FrameTree.cpp \
     page/FrameView.cpp \

Modified: branches/safari-537.77-branch/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (169200 => 169201)


--- branches/safari-537.77-branch/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2014-05-22 14:57:59 UTC (rev 169200)
+++ branches/safari-537.77-branch/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2014-05-22 15:46:51 UTC (rev 169201)
@@ -6784,7 +6784,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" />
@@ -18606,7 +18605,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" />
@@ -20929,4 +20927,4 @@
   <ImportGroup Label="ExtensionTargets">
     <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
   </ImportGroup>
-</Project>
\ No newline at end of file
+</Project>

Modified: branches/safari-537.77-branch/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (169200 => 169201)


--- branches/safari-537.77-branch/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters	2014-05-22 14:57:59 UTC (rev 169200)
+++ branches/safari-537.77-branch/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters	2014-05-22 15:46:51 UTC (rev 169201)
@@ -759,9 +759,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>
@@ -7446,9 +7443,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>
@@ -15238,4 +15232,4 @@
       <Filter>plugins\win</Filter>
     </MASM>
   </ItemGroup>
-</Project>
\ No newline at end of file
+</Project>

Modified: branches/safari-537.77-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj (169200 => 169201)


--- branches/safari-537.77-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2014-05-22 14:57:59 UTC (rev 169200)
+++ branches/safari-537.77-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2014-05-22 15:46:51 UTC (rev 169201)
@@ -3431,8 +3431,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 */; };
@@ -9886,8 +9884,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>"; };
@@ -14720,8 +14716,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 */,
@@ -21837,7 +21831,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 */,
@@ -25028,7 +25021,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: branches/safari-537.77-branch/Source/WebCore/page/FrameActionScheduler.cpp (169200 => 169201)


--- branches/safari-537.77-branch/Source/WebCore/page/FrameActionScheduler.cpp	2014-05-22 14:57:59 UTC (rev 169200)
+++ branches/safari-537.77-branch/Source/WebCore/page/FrameActionScheduler.cpp	2014-05-22 15:46:51 UTC (rev 169201)
@@ -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: branches/safari-537.77-branch/Source/WebCore/page/FrameActionScheduler.h (169200 => 169201)


--- branches/safari-537.77-branch/Source/WebCore/page/FrameActionScheduler.h	2014-05-22 14:57:59 UTC (rev 169200)
+++ branches/safari-537.77-branch/Source/WebCore/page/FrameActionScheduler.h	2014-05-22 15:46:51 UTC (rev 169201)
@@ -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/FastAllocBase.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: branches/safari-537.77-branch/Source/WebCore/page/FrameView.cpp (169200 => 169201)


--- branches/safari-537.77-branch/Source/WebCore/page/FrameView.cpp	2014-05-22 14:57:59 UTC (rev 169200)
+++ branches/safari-537.77-branch/Source/WebCore/page/FrameView.cpp	2014-05-22 15:46:51 UTC (rev 169201)
@@ -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"
@@ -179,7 +178,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)
@@ -204,6 +202,7 @@
 #endif
     , m_visualUpdatesAllowedByClient(true)
     , m_scrollPinningBehavior(DoNotPin)
+    , m_scheduledEventSuppressionCount(0)
 {
     init();
 
@@ -240,7 +239,8 @@
 {
     if (m_postLayoutTasksTimer.isActive()) {
         m_postLayoutTasksTimer.stop();
-        m_actionScheduler->clear();
+        m_scheduledEventSuppressionCount = 0;
+        m_scheduledEvents.clear();
     }
     
     removeFromAXObjectCache();
@@ -254,7 +254,7 @@
     setHasVerticalScrollbar(false);
     
     ASSERT(!m_scrollCorner);
-    ASSERT(m_actionScheduler->isEmpty());
+    ASSERT(m_scheduledEvents.isEmpty());
 
     if (m_frame) {
         ASSERT(m_frame->view() != this || !m_frame->contentRenderer());
@@ -1293,7 +1293,7 @@
 
         layer = root->enclosingLayer();
 
-        m_actionScheduler->pause();
+        pauseScheduledEvents();
 
         {
             bool disableLayoutState = false;
@@ -1361,7 +1361,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())
@@ -1381,12 +1383,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);
@@ -2602,19 +2602,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()
@@ -2810,7 +2831,7 @@
 
     scrollToAnchor();
 
-    m_actionScheduler->resume();
+    resumeScheduledEvents();
 
     sendResizeEventIfNeeded();
 }
@@ -3002,7 +3023,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: branches/safari-537.77-branch/Source/WebCore/page/FrameView.h (169200 => 169201)


--- branches/safari-537.77-branch/Source/WebCore/page/FrameView.h	2014-05-22 14:57:59 UTC (rev 169200)
+++ branches/safari-537.77-branch/Source/WebCore/page/FrameView.h	2014-05-22 15:46:51 UTC (rev 169201)
@@ -42,7 +42,6 @@
 class Element;
 class Event;
 class FloatSize;
-class FrameActionScheduler;
 class KURL;
 class Node;
 class Page;
@@ -583,8 +582,6 @@
     String m_mediaType;
     String m_mediaTypeWhenNotPrinting;
 
-    OwnPtr<FrameActionScheduler> m_actionScheduler;
-
     bool m_overflowStatusDirty;
     bool m_horizontalOverflow;
     bool m_verticalOverflow;    
@@ -666,6 +663,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