Add a quirk for applications that depend on the relative ordering of progressComplete...
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 May 2012 00:21:25 +0000 (00:21 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 May 2012 00:21:25 +0000 (00:21 +0000)
https://bugs.webkit.org/show_bug.cgi?id=87178
<rdar://problem/11468434>

Reviewed by Maciej Stachowiak.

Some applications depend on the relative ordering of progressCompleted/didFinishLoad, which was changed
to be more correct in http://trac.webkit.org/changeset/94105. For applications built before 94105, we can
provide the old behavior. For the time being, this will only apply to Mail.app.

No new tests, will not affect behavior for any application except Mail.

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::checkLoadCompleteForThisFrame):
* page/Settings.cpp:
(WebCore::Settings::Settings):
* page/Settings.h:
(WebCore::Settings::setNeedsDidFinishLoadOrderQuirk):
(WebCore::Settings::needsDidFinishLoadOrderQuirk):

Add plumbing for the quirk to flip the relative ordering of progressCompleted/didFinishLoad back
to the behavior before http://trac.webkit.org/changeset/94105. Make it apply to any Mail.app linked
against WebKit before that revision.

* Misc/WebKitVersionChecks.h:
* WebView/WebView.mm:
(-[WebView _needsDidFinishLoadOrderQuirk]):
(-[WebView _preferencesChanged:]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@118086 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/page/Settings.cpp
Source/WebCore/page/Settings.h
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/Misc/WebKitVersionChecks.h
Source/WebKit/mac/WebView/WebView.mm

index 069eddd..0324117 100644 (file)
@@ -1,3 +1,25 @@
+2012-05-22  Tim Horton  <timothy_horton@apple.com>
+
+        Add a quirk for applications that depend on the relative ordering of progressCompleted/didFinishLoad
+        https://bugs.webkit.org/show_bug.cgi?id=87178
+        <rdar://problem/11468434>
+
+        Reviewed by Maciej Stachowiak.
+
+        Some applications depend on the relative ordering of progressCompleted/didFinishLoad, which was changed
+        to be more correct in http://trac.webkit.org/changeset/94105. For applications built before 94105, we can
+        provide the old behavior. For the time being, this will only apply to Mail.app.
+
+        No new tests, will not affect behavior for any application except Mail.
+
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
+        * page/Settings.cpp:
+        (WebCore::Settings::Settings):
+        * page/Settings.h:
+        (WebCore::Settings::setNeedsDidFinishLoadOrderQuirk):
+        (WebCore::Settings::needsDidFinishLoadOrderQuirk):
+
 2012-05-22  Alexis Menard  <alexis.menard@openbossa.org>
 
         Move some CSS regions properties to CSSParser::isValidKeywordPropertyAndValue.
index 548aa2c..d36d110 100644 (file)
@@ -2017,6 +2017,8 @@ void FrameLoader::checkLoadCompleteForThisFrame()
 {
     ASSERT(m_client->hasWebView());
 
+    Settings* settings = m_frame->settings();
+
     switch (m_state) {
         case FrameStateProvisional: {
             if (m_delegateIsHandlingProvisionalLoadError)
@@ -2091,11 +2093,13 @@ void FrameLoader::checkLoadCompleteForThisFrame()
             if (m_stateMachine.creatingInitialEmptyDocument() || !m_stateMachine.committedFirstRealDocumentLoad())
                 return;
 
-            if (Page* page = m_frame->page()) {
-                page->progress()->progressCompleted(m_frame);
+            if (!settings->needsDidFinishLoadOrderQuirk()) {
+                if (Page* page = m_frame->page()) {
+                    page->progress()->progressCompleted(m_frame);
 
-                if (m_frame == page->mainFrame())
-                    page->resetRelevantPaintedObjectCounter();
+                    if (m_frame == page->mainFrame())
+                        page->resetRelevantPaintedObjectCounter();
+                }
             }
 
             const ResourceError& error = dl->mainDocumentError();
@@ -2109,6 +2113,15 @@ void FrameLoader::checkLoadCompleteForThisFrame()
                 loadingEvent = AXObjectCache::AXLoadingFinished;
             }
 
+            if (settings->needsDidFinishLoadOrderQuirk()) {
+                if (Page* page = m_frame->page()) {
+                    page->progress()->progressCompleted(m_frame);
+
+                    if (m_frame == page->mainFrame())
+                        page->resetRelevantPaintedObjectCounter();
+                }
+            }
+
             // Notify accessibility.
             if (AXObjectCache::accessibilityEnabled())
                 m_frame->document()->axObjectCache()->frameLoadingEventNotification(m_frame, loadingEvent);
index a0bddcb..780da59 100644 (file)
@@ -267,6 +267,7 @@ Settings::Settings(Page* page)
     , m_shouldRespectImageOrientation(false)
     , m_wantsBalancedSetDefersLoadingBehavior(false)
     , m_requestAnimationFrameEnabled(true)
+    , m_needsDidFinishLoadOrderQuirk(false)
     , m_loadsImagesAutomaticallyTimer(this, &Settings::loadsImagesAutomaticallyTimerFired)
     , m_incrementalRenderingSuppressionTimeoutInSeconds(defaultIncrementalRenderingSuppressionTimeoutInSeconds)
 {
index 17ec2fd..be4b0ef 100644 (file)
@@ -567,6 +567,9 @@ namespace WebCore {
         void setRequestAnimationFrameEnabled(bool enabled) { m_requestAnimationFrameEnabled = enabled; }
         bool requestAnimationFrameEnabled() const { return m_requestAnimationFrameEnabled; }
 
+        void setNeedsDidFinishLoadOrderQuirk(bool needsQuirk) { m_needsDidFinishLoadOrderQuirk = needsQuirk; }
+        bool needsDidFinishLoadOrderQuirk() const { return m_needsDidFinishLoadOrderQuirk; }
+
 #if USE(JSC)
         static void setShouldRespectPriorityInCSSAttributeSetters(bool);
         static bool shouldRespectPriorityInCSSAttributeSetters();
@@ -733,6 +736,7 @@ namespace WebCore {
         bool m_shouldRespectImageOrientation : 1;
         bool m_wantsBalancedSetDefersLoadingBehavior : 1;
         bool m_requestAnimationFrameEnabled : 1;
+        bool m_needsDidFinishLoadOrderQuirk : 1;
 
         Timer<Settings> m_loadsImagesAutomaticallyTimer;
         void loadsImagesAutomaticallyTimerFired(Timer<Settings>*);
index 271883c..1645c40 100644 (file)
@@ -1,3 +1,20 @@
+2012-05-22  Tim Horton  <timothy_horton@apple.com>
+
+        Add a quirk for applications that depend on the relative ordering of progressCompleted/didFinishLoad
+        https://bugs.webkit.org/show_bug.cgi?id=87178
+        <rdar://problem/11468434>
+
+        Reviewed by Maciej Stachowiak.
+
+        Add plumbing for the quirk to flip the relative ordering of progressCompleted/didFinishLoad back
+        to the behavior before http://trac.webkit.org/changeset/94105. Make it apply to any Mail.app linked
+        against WebKit before that revision.
+
+        * Misc/WebKitVersionChecks.h:
+        * WebView/WebView.mm:
+        (-[WebView _needsDidFinishLoadOrderQuirk]):
+        (-[WebView _preferencesChanged:]):
+
 2012-05-21  Gavin Barraclough  <barraclough@apple.com>
 
         Disable private names by default in WebCore
index a772424..64d587a 100644 (file)
@@ -56,6 +56,7 @@
 #define WEBKIT_FIRST_VERSION_WITHOUT_LINK_ELEMENT_TEXT_CSS_QUIRK 0x02130200 // 531.2.0
 #define WEBKIT_FIRST_VERSION_WITH_HTML5_PARSER 0x02160900 // 534.9.0
 #define WEBKIT_FIRST_VERSION_WITH_GET_MATCHED_CSS_RULES_RESTRICTIONS 0x02160B00 // 534.11.0
+#define WEBKIT_FIRST_VERSION_WITH_CORRECT_DID_FINISH_LOAD_ORDER 0x02170304 // 535.3.4
 #define WEBKIT_FIRST_VERSION_WITH_CSS_ATTRIBUTE_SETTERS_IGNORING_PRIORITY 0x02170D00 // 535.13.0
 
 #ifdef __cplusplus
index 8a383f5..c93823a 100644 (file)
@@ -1354,6 +1354,12 @@ static bool fastDocumentTeardownEnabled()
     return needsQuirk;
 }
 
+static bool needsDidFinishLoadOrderQuirk()
+{
+    static bool needsQuirk = !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_CORRECT_DID_FINISH_LOAD_ORDER) && applicationIsAppleMail();
+    return needsQuirk;
+}
+
 static bool needsSelfRetainWhileLoadingQuirk()
 {
     static bool needsQuirk = applicationIsAperture();
@@ -1536,6 +1542,7 @@ static bool needsSelfRetainWhileLoadingQuirk()
     settings->setShouldRespectImageOrientation([preferences shouldRespectImageOrientation]);
     settings->setNeedsIsLoadingInAPISenseQuirk([self _needsIsLoadingInAPISenseQuirk]);
     settings->setRequestAnimationFrameEnabled([preferences requestAnimationFrameEnabled]);
+    settings->setNeedsDidFinishLoadOrderQuirk(needsDidFinishLoadOrderQuirk());
     
     NSTimeInterval timeout = [preferences incrementalRenderingSuppressionTimeoutInSeconds];
     if (timeout > 0)