[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

abarth at webkit.org abarth at webkit.org
Wed Dec 22 14:42:27 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 41c93443ff617296d00b42de15eeda553aa5ed30
Author: abarth at webkit.org <abarth at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Oct 18 02:59:32 2010 +0000

    2010-10-17  Adam Barth  <abarth at webkit.org>
    
            Reviewed by Dimitri Glazkov.
    
            Remove explicit passing of user gesture in NavigationScheduler
            https://bugs.webkit.org/show_bug.cgi?id=47786
    
            As requested by Mr. Glazkov, remove more explicit passing of the user
            gesture state.  We now use a static to pass this information around.
    
            * bindings/generic/BindingFrame.h:
            (WebCore::::navigateIfAllowed):
            * bindings/js/JSDOMWindowCustom.cpp:
            (WebCore::JSDOMWindow::setLocation):
            * bindings/js/JSLocationCustom.cpp:
            (WebCore::JSLocation::reload):
            * bindings/v8/custom/V8LocationCustom.cpp:
            (WebCore::V8Location::reloadCallback):
            * inspector/InspectorController.cpp:
            (WebCore::InspectorController::setResourceTrackingEnabled):
            (WebCore::InspectorController::reloadPage):
            * loader/NavigationScheduler.cpp:
            (WebCore::ScheduledNavigation::ScheduledNavigation):
            (WebCore::ScheduledURLNavigation::ScheduledURLNavigation):
            (WebCore::ScheduledRedirect::ScheduledRedirect):
            (WebCore::ScheduledLocationChange::ScheduledLocationChange):
            (WebCore::ScheduledRefresh::ScheduledRefresh):
            (WebCore::ScheduledHistoryNavigation::ScheduledHistoryNavigation):
            (WebCore::ScheduledFormSubmission::ScheduledFormSubmission):
            (WebCore::NavigationScheduler::scheduleRedirect):
            (WebCore::NavigationScheduler::mustLockBackForwardList):
            (WebCore::NavigationScheduler::scheduleLocationChange):
            (WebCore::NavigationScheduler::scheduleFormSubmission):
            (WebCore::NavigationScheduler::scheduleRefresh):
            (WebCore::NavigationScheduler::scheduleHistoryNavigation):
            * loader/NavigationScheduler.h:
            * loader/SubframeLoader.cpp:
            (WebCore::SubframeLoader::loadOrRedirectSubframe):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69938 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index a160067..0d19e40 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,42 @@
+2010-10-17  Adam Barth  <abarth at webkit.org>
+
+        Reviewed by Dimitri Glazkov.
+
+        Remove explicit passing of user gesture in NavigationScheduler
+        https://bugs.webkit.org/show_bug.cgi?id=47786
+
+        As requested by Mr. Glazkov, remove more explicit passing of the user
+        gesture state.  We now use a static to pass this information around.
+
+        * bindings/generic/BindingFrame.h:
+        (WebCore::::navigateIfAllowed):
+        * bindings/js/JSDOMWindowCustom.cpp:
+        (WebCore::JSDOMWindow::setLocation):
+        * bindings/js/JSLocationCustom.cpp:
+        (WebCore::JSLocation::reload):
+        * bindings/v8/custom/V8LocationCustom.cpp:
+        (WebCore::V8Location::reloadCallback):
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::setResourceTrackingEnabled):
+        (WebCore::InspectorController::reloadPage):
+        * loader/NavigationScheduler.cpp:
+        (WebCore::ScheduledNavigation::ScheduledNavigation):
+        (WebCore::ScheduledURLNavigation::ScheduledURLNavigation):
+        (WebCore::ScheduledRedirect::ScheduledRedirect):
+        (WebCore::ScheduledLocationChange::ScheduledLocationChange):
+        (WebCore::ScheduledRefresh::ScheduledRefresh):
+        (WebCore::ScheduledHistoryNavigation::ScheduledHistoryNavigation):
+        (WebCore::ScheduledFormSubmission::ScheduledFormSubmission):
+        (WebCore::NavigationScheduler::scheduleRedirect):
+        (WebCore::NavigationScheduler::mustLockBackForwardList):
+        (WebCore::NavigationScheduler::scheduleLocationChange):
+        (WebCore::NavigationScheduler::scheduleFormSubmission):
+        (WebCore::NavigationScheduler::scheduleRefresh):
+        (WebCore::NavigationScheduler::scheduleHistoryNavigation):
+        * loader/NavigationScheduler.h:
+        * loader/SubframeLoader.cpp:
+        (WebCore::SubframeLoader::loadOrRedirectSubframe):
+
 2010-10-17  Julien Chaffraix  <jchaffraix at codeaurora.org>
 
         Reviewed by Andreas Kling.
diff --git a/WebCore/bindings/generic/BindingFrame.h b/WebCore/bindings/generic/BindingFrame.h
index 8c7285e..d41206c 100644
--- a/WebCore/bindings/generic/BindingFrame.h
+++ b/WebCore/bindings/generic/BindingFrame.h
@@ -49,7 +49,7 @@ void BindingFrame<Binding>::navigateIfAllowed(State<Binding>* state, Frame* fram
     if (!activeFrame)
         return;
     if (!protocolIsJavaScript(url) || state->allowsAccessFromFrame(frame))
-        frame->navigationScheduler()->scheduleLocationChange(url.string(), activeFrame->loader()->outgoingReferrer(), lockHistory, lockBackForwardList, state->processingUserGesture());
+        frame->navigationScheduler()->scheduleLocationChange(url.string(), activeFrame->loader()->outgoingReferrer(), lockHistory, lockBackForwardList);
 }
 
 } // namespace WebCore
diff --git a/WebCore/bindings/js/JSDOMWindowCustom.cpp b/WebCore/bindings/js/JSDOMWindowCustom.cpp
index ebfcb8a..ecb37f3 100644
--- a/WebCore/bindings/js/JSDOMWindowCustom.cpp
+++ b/WebCore/bindings/js/JSDOMWindowCustom.cpp
@@ -512,7 +512,7 @@ void JSDOMWindow::setLocation(ExecState* exec, JSValue value)
 
     if (!protocolIsJavaScript(url) || allowsAccessFrom(exec)) {
         // We want a new history item if this JS was called via a user gesture
-        frame->navigationScheduler()->scheduleLocationChange(url, lexicalFrame->loader()->outgoingReferrer(), !lexicalFrame->script()->anyPageIsProcessingUserGesture(), false, processingUserGesture());
+        frame->navigationScheduler()->scheduleLocationChange(url, lexicalFrame->loader()->outgoingReferrer(), !lexicalFrame->script()->anyPageIsProcessingUserGesture(), false);
     }
 }
 
diff --git a/WebCore/bindings/js/JSLocationCustom.cpp b/WebCore/bindings/js/JSLocationCustom.cpp
index b255029..b00249f 100644
--- a/WebCore/bindings/js/JSLocationCustom.cpp
+++ b/WebCore/bindings/js/JSLocationCustom.cpp
@@ -313,7 +313,7 @@ JSValue JSLocation::reload(ExecState* exec)
         return jsUndefined();
 
     if (!protocolIsJavaScript(frame->loader()->url()))
-        frame->navigationScheduler()->scheduleRefresh(processingUserGesture());
+        frame->navigationScheduler()->scheduleRefresh();
     return jsUndefined();
 }
 
diff --git a/WebCore/bindings/v8/custom/V8LocationCustom.cpp b/WebCore/bindings/v8/custom/V8LocationCustom.cpp
index 225dcdd..34c7e28 100644
--- a/WebCore/bindings/v8/custom/V8LocationCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8LocationCustom.cpp
@@ -282,7 +282,7 @@ v8::Handle<v8::Value> V8Location::reloadCallback(const v8::Arguments& args)
         return v8::Undefined();
 
     if (!protocolIsJavaScript(frame->loader()->url()))
-        frame->navigationScheduler()->scheduleRefresh(processingUserGesture());
+        frame->navigationScheduler()->scheduleRefresh();
     return v8::Undefined();
 }
 
diff --git a/WebCore/inspector/InspectorController.cpp b/WebCore/inspector/InspectorController.cpp
index 849cecd..4d83929 100644
--- a/WebCore/inspector/InspectorController.cpp
+++ b/WebCore/inspector/InspectorController.cpp
@@ -1162,7 +1162,7 @@ void InspectorController::setResourceTrackingEnabled(bool enable, bool always, b
     m_state->setBoolean(InspectorState::resourceTrackingEnabled, enable);
 
     if (enable)
-        m_inspectedPage->mainFrame()->navigationScheduler()->scheduleRefresh(true);
+        reloadPage();
 }
 
 void InspectorController::ensureSettingsLoaded()
@@ -2122,7 +2122,9 @@ bool InspectorController::resourceContentForURL(const KURL& url, Document* frame
 
 void InspectorController::reloadPage()
 {
-    m_inspectedPage->mainFrame()->navigationScheduler()->scheduleRefresh(true);
+    // FIXME: Why do we set the user gesture indicator here?
+    UserGestureIndicator indicator(DefinitelyProcessingUserGesture);
+    m_inspectedPage->mainFrame()->navigationScheduler()->scheduleRefresh();
 }
 
 } // namespace WebCore
diff --git a/WebCore/loader/NavigationScheduler.cpp b/WebCore/loader/NavigationScheduler.cpp
index 586d348..98f21fe 100644
--- a/WebCore/loader/NavigationScheduler.cpp
+++ b/WebCore/loader/NavigationScheduler.cpp
@@ -53,13 +53,13 @@ namespace WebCore {
 
 class ScheduledNavigation : public Noncopyable {
 public:
-    ScheduledNavigation(double delay, bool lockHistory, bool lockBackForwardList, bool wasDuringLoad, bool isLocationChange, bool wasUserGesture)
+    ScheduledNavigation(double delay, bool lockHistory, bool lockBackForwardList, bool wasDuringLoad, bool isLocationChange)
         : m_delay(delay)
         , m_lockHistory(lockHistory)
         , m_lockBackForwardList(lockBackForwardList)
         , m_wasDuringLoad(wasDuringLoad)
         , m_isLocationChange(isLocationChange)
-        , m_wasUserGesture(wasUserGesture)
+        , m_wasUserGesture(ScriptController::processingUserGesture())
     {
     }
     virtual ~ScheduledNavigation() { }
@@ -88,8 +88,8 @@ private:
 
 class ScheduledURLNavigation : public ScheduledNavigation {
 public:
-    ScheduledURLNavigation(double delay, const String& url, const String& referrer, bool lockHistory, bool lockBackForwardList, bool wasUserGesture, bool duringLoad, bool isLocationChange)
-        : ScheduledNavigation(delay, lockHistory, lockBackForwardList, duringLoad, isLocationChange, wasUserGesture)
+    ScheduledURLNavigation(double delay, const String& url, const String& referrer, bool lockHistory, bool lockBackForwardList, bool duringLoad, bool isLocationChange)
+        : ScheduledNavigation(delay, lockHistory, lockBackForwardList, duringLoad, isLocationChange)
         , m_url(url)
         , m_referrer(referrer)
         , m_haveToldClient(false)
@@ -128,22 +128,26 @@ private:
 
 class ScheduledRedirect : public ScheduledURLNavigation {
 public:
-    ScheduledRedirect(double delay, const String& url, bool lockHistory, bool lockBackForwardList, bool wasUserGesture)
-        : ScheduledURLNavigation(delay, url, String(), lockHistory, lockBackForwardList, wasUserGesture, false, false) { }
+    ScheduledRedirect(double delay, const String& url, bool lockHistory, bool lockBackForwardList)
+        : ScheduledURLNavigation(delay, url, String(), lockHistory, lockBackForwardList, false, false)
+    {
+    }
 
     virtual bool shouldStartTimer(Frame* frame) { return frame->loader()->allAncestorsAreComplete(); }
 };
 
 class ScheduledLocationChange : public ScheduledURLNavigation {
 public:
-    ScheduledLocationChange(const String& url, const String& referrer, bool lockHistory, bool lockBackForwardList, bool wasUserGesture, bool duringLoad)
-        : ScheduledURLNavigation(0.0, url, referrer, lockHistory, lockBackForwardList, wasUserGesture, duringLoad, true) { }
+    ScheduledLocationChange(const String& url, const String& referrer, bool lockHistory, bool lockBackForwardList, bool duringLoad)
+        : ScheduledURLNavigation(0.0, url, referrer, lockHistory, lockBackForwardList, duringLoad, true) { }
 };
 
 class ScheduledRefresh : public ScheduledURLNavigation {
 public:
-    ScheduledRefresh(const String& url, const String& referrer, bool wasUserGesture)
-        : ScheduledURLNavigation(0.0, url, referrer, true, true, wasUserGesture, false, true) { }
+    ScheduledRefresh(const String& url, const String& referrer)
+        : ScheduledURLNavigation(0.0, url, referrer, true, true, false, true)
+    {
+    }
 
     virtual void fire(Frame* frame)
     {
@@ -154,7 +158,11 @@ public:
 
 class ScheduledHistoryNavigation : public ScheduledNavigation {
 public:
-    explicit ScheduledHistoryNavigation(int historySteps, bool wasUserGesture) : ScheduledNavigation(0, false, false, false, true, wasUserGesture), m_historySteps(historySteps) { }
+    explicit ScheduledHistoryNavigation(int historySteps)
+        : ScheduledNavigation(0, false, false, false, true)
+        , m_historySteps(historySteps)
+    {
+    }
 
     virtual void fire(Frame* frame)
     {
@@ -178,8 +186,8 @@ private:
 
 class ScheduledFormSubmission : public ScheduledNavigation {
 public:
-    ScheduledFormSubmission(PassRefPtr<FormSubmission> submission, bool lockBackForwardList, bool duringLoad, bool wasUserGesture)
-        : ScheduledNavigation(0, submission->lockHistory(), lockBackForwardList, duringLoad, true, wasUserGesture)
+    ScheduledFormSubmission(PassRefPtr<FormSubmission> submission, bool lockBackForwardList, bool duringLoad)
+        : ScheduledNavigation(0, submission->lockHistory(), lockBackForwardList, duringLoad, true)
         , m_submission(submission)
         , m_haveToldClient(false)
     {
@@ -258,14 +266,14 @@ void NavigationScheduler::scheduleRedirect(double delay, const String& url)
 
     // We want a new back/forward list item if the refresh timeout is > 1 second.
     if (!m_redirect || delay <= m_redirect->delay())
-        schedule(adoptPtr(new ScheduledRedirect(delay, url, true, delay <= 1, false)));
+        schedule(adoptPtr(new ScheduledRedirect(delay, url, true, delay <= 1)));
 }
 
-bool NavigationScheduler::mustLockBackForwardList(Frame* targetFrame, bool wasUserGesture)
+bool NavigationScheduler::mustLockBackForwardList(Frame* targetFrame)
 {
     // Non-user navigation before the page has finished firing onload should not create a new back/forward item.
     // See https://webkit.org/b/42861 for the original motivation for this.    
-    if (!wasUserGesture && targetFrame->loader()->documentLoader() && !targetFrame->loader()->documentLoader()->wasOnloadHandled())
+    if (!ScriptController::processingUserGesture() && targetFrame->loader()->documentLoader() && !targetFrame->loader()->documentLoader()->wasOnloadHandled())
         return true;
     
     // Navigation of a subframe during loading of an ancestor frame does not create a new back/forward item.
@@ -279,14 +287,14 @@ bool NavigationScheduler::mustLockBackForwardList(Frame* targetFrame, bool wasUs
     return false;
 }
 
-void NavigationScheduler::scheduleLocationChange(const String& url, const String& referrer, bool lockHistory, bool lockBackForwardList, bool wasUserGesture)
+void NavigationScheduler::scheduleLocationChange(const String& url, const String& referrer, bool lockHistory, bool lockBackForwardList)
 {
     if (!m_frame->page())
         return;
     if (url.isEmpty())
         return;
 
-    lockBackForwardList = lockBackForwardList || mustLockBackForwardList(m_frame, wasUserGesture);
+    lockBackForwardList = lockBackForwardList || mustLockBackForwardList(m_frame);
 
     FrameLoader* loader = m_frame->loader();
     
@@ -302,7 +310,7 @@ void NavigationScheduler::scheduleLocationChange(const String& url, const String
     // This may happen when a frame changes the location of another frame.
     bool duringLoad = !loader->stateMachine()->committedFirstRealDocumentLoad();
 
-    schedule(adoptPtr(new ScheduledLocationChange(url, referrer, lockHistory, lockBackForwardList, wasUserGesture, duringLoad)));
+    schedule(adoptPtr(new ScheduledLocationChange(url, referrer, lockHistory, lockBackForwardList, duringLoad)));
 }
 
 void NavigationScheduler::scheduleFormSubmission(PassRefPtr<FormSubmission> submission)
@@ -319,13 +327,14 @@ void NavigationScheduler::scheduleFormSubmission(PassRefPtr<FormSubmission> subm
     // If this is a child frame and the form submission was triggered by a script, lock the back/forward list
     // to match IE and Opera.
     // See https://bugs.webkit.org/show_bug.cgi?id=32383 for the original motivation for this.
-    bool isUserGesture = m_frame->loader()->isProcessingUserGesture();
-    bool lockBackForwardList = mustLockBackForwardList(m_frame, isUserGesture) || (submission->state()->formSubmissionTrigger() == SubmittedByJavaScript && m_frame->tree()->parent() && !isUserGesture);
+    bool lockBackForwardList = mustLockBackForwardList(m_frame)
+        || (submission->state()->formSubmissionTrigger() == SubmittedByJavaScript
+            && m_frame->tree()->parent() && !ScriptController::processingUserGesture());
 
-    schedule(adoptPtr(new ScheduledFormSubmission(submission, lockBackForwardList, duringLoad, isUserGesture)));
+    schedule(adoptPtr(new ScheduledFormSubmission(submission, lockBackForwardList, duringLoad)));
 }
 
-void NavigationScheduler::scheduleRefresh(bool wasUserGesture)
+void NavigationScheduler::scheduleRefresh()
 {
     if (!m_frame->page())
         return;
@@ -333,7 +342,7 @@ void NavigationScheduler::scheduleRefresh(bool wasUserGesture)
     if (url.isEmpty())
         return;
 
-    schedule(adoptPtr(new ScheduledRefresh(url.string(), m_frame->loader()->outgoingReferrer(), wasUserGesture)));
+    schedule(adoptPtr(new ScheduledRefresh(url.string(), m_frame->loader()->outgoingReferrer())));
 }
 
 void NavigationScheduler::scheduleHistoryNavigation(int steps)
@@ -350,7 +359,7 @@ void NavigationScheduler::scheduleHistoryNavigation(int steps)
     }
 
     // In all other cases, schedule the history traversal to occur asynchronously.
-    schedule(adoptPtr(new ScheduledHistoryNavigation(steps, m_frame->loader()->isProcessingUserGesture())));
+    schedule(adoptPtr(new ScheduledHistoryNavigation(steps)));
 }
 
 void NavigationScheduler::timerFired(Timer<NavigationScheduler>*)
diff --git a/WebCore/loader/NavigationScheduler.h b/WebCore/loader/NavigationScheduler.h
index f96f9cb..3bf5010 100644
--- a/WebCore/loader/NavigationScheduler.h
+++ b/WebCore/loader/NavigationScheduler.h
@@ -56,9 +56,9 @@ public:
     bool locationChangePending();
 
     void scheduleRedirect(double delay, const String& url);
-    void scheduleLocationChange(const String& url, const String& referrer, bool lockHistory = true, bool lockBackForwardList = true, bool userGesture = false);
+    void scheduleLocationChange(const String& url, const String& referrer, bool lockHistory = true, bool lockBackForwardList = true);
     void scheduleFormSubmission(PassRefPtr<FormSubmission>);
-    void scheduleRefresh(bool userGesture = false);
+    void scheduleRefresh();
     void scheduleHistoryNavigation(int steps);
 
     void startTimer();
@@ -70,7 +70,7 @@ private:
     void timerFired(Timer<NavigationScheduler>*);
     void schedule(PassOwnPtr<ScheduledNavigation>);
 
-    static bool mustLockBackForwardList(Frame* targetFrame, bool mustLockIfDuringLoad);
+    static bool mustLockBackForwardList(Frame* targetFrame);
 
     Frame* m_frame;
     Timer<NavigationScheduler> m_timer;
diff --git a/WebCore/loader/SubframeLoader.cpp b/WebCore/loader/SubframeLoader.cpp
index d5d0e46..f73646b 100644
--- a/WebCore/loader/SubframeLoader.cpp
+++ b/WebCore/loader/SubframeLoader.cpp
@@ -239,7 +239,7 @@ Frame* SubframeLoader::loadOrRedirectSubframe(HTMLFrameOwnerElement* ownerElemen
 {
     Frame* frame = ownerElement->contentFrame();
     if (frame)
-        frame->navigationScheduler()->scheduleLocationChange(url.string(), m_frame->loader()->outgoingReferrer(), lockHistory, lockBackForwardList, m_frame->loader()->isProcessingUserGesture());
+        frame->navigationScheduler()->scheduleLocationChange(url.string(), m_frame->loader()->outgoingReferrer(), lockHistory, lockBackForwardList);
     else
         frame = loadSubframe(ownerElement, url, frameName, m_frame->loader()->outgoingReferrer());
     return frame;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list