Title: [103130] trunk
Revision
103130
Author
beid...@apple.com
Date
2011-12-16 16:32:40 -0800 (Fri, 16 Dec 2011)

Log Message

<rdar://problem/10576732> and https://bugs.webkit.org/show_bug.cgi?id=74533
REGRESSION(r102619): Reproducible crash closing window with video + poster image inside an object element

Reviewed by Darin Adler.

Source/WebCore: 

Test: media/crash-closing-page-with-media-as-plugin-fallback.html

At some point documentWillBecomeInactive() was overloaded to not only notify elements they were going in to the page
cache but also do some other work that was necessary during Document teardown.

This crash occurs because we're notifying elements they're going in to the page cache at document teardown, so this
patch breaks that work back out in to a separate function.

* dom/Document.cpp:
(WebCore::Document::detach): Remove obsolete comment.
(WebCore::Document::documentWillBecomeInactive): Handle only accelerated compositing cleanup.
(WebCore::Document::documentWillSuspendForPageCache): Call documentWillBecomeInactive before notifying elements of suspension.
(WebCore::Document::documentDidResumeFromPageCache):
(WebCore::Document::registerForPageCacheSuspensionCallbacks):
(WebCore::Document::unregisterForPageCacheSuspensionCallbacks):
* dom/Document.h:

* history/CachedFrame.cpp:
(WebCore::CachedFrameBase::restore): Call the renamed documentDidResumeFromPageCache.
(WebCore::CachedFrame::CachedFrame): Call documentWillSuspendForPageCache instead of documentDidBecomeInactive.

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::commitProvisionalLoad): Call the renamed documentDidResumeFromPageCache.

* dom/Element.h:
(WebCore::Element::documentWillSuspendForPageCache): Renamed from documentWillBecomeInactive()
(WebCore::Element::documentDidResumeFromPageCache): Renamed from documentDidBecomeActive()

Change to the renamed registration and callbacks functions in the handful of classes that use them:
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::~HTMLFormElement):
(WebCore::HTMLFormElement::parseMappedAttribute):
(WebCore::HTMLFormElement::documentDidResumeFromPageCache):
(WebCore::HTMLFormElement::willMoveToNewOwnerDocument):
(WebCore::HTMLFormElement::didMoveToNewOwnerDocument):
* html/HTMLFormElement.h:

* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::~HTMLInputElement):
(WebCore::HTMLInputElement::updateType):
(WebCore::HTMLInputElement::parseMappedAttribute):
(WebCore::HTMLInputElement::needsSuspensionCallback):
(WebCore::HTMLInputElement::registerForSuspensionCallbackIfNeeded):
(WebCore::HTMLInputElement::unregisterForSuspensionCallbackIfNeeded):
(WebCore::HTMLInputElement::documentDidResumeFromPageCache):
(WebCore::HTMLInputElement::willMoveToNewOwnerDocument):
(WebCore::HTMLInputElement::didMoveToNewOwnerDocument):
* html/HTMLInputElement.h:

* html/HTMLPlugInImageElement.cpp:
(WebCore::HTMLPlugInImageElement::~HTMLPlugInImageElement):
(WebCore::HTMLPlugInImageElement::createRenderer):
(WebCore::HTMLPlugInImageElement::willMoveToNewOwnerDocument):
(WebCore::HTMLPlugInImageElement::didMoveToNewOwnerDocument):
(WebCore::HTMLPlugInImageElement::documentWillSuspendForPageCache):
(WebCore::HTMLPlugInImageElement::documentDidResumeFromPageCache):
* html/HTMLPlugInImageElement.h:

* svg/SVGSVGElement.cpp:
(WebCore::SVGSVGElement::SVGSVGElement):
(WebCore::SVGSVGElement::~SVGSVGElement):
(WebCore::SVGSVGElement::willMoveToNewOwnerDocument):
(WebCore::SVGSVGElement::didMoveToNewOwnerDocument):
(WebCore::SVGSVGElement::documentWillSuspendForPageCache):
(WebCore::SVGSVGElement::documentDidResumeFromPageCache):
* svg/SVGSVGElement.h:

LayoutTests: 

* media/crash-closing-page-with-media-as-plugin-fallback-expected.txt: Added.
* media/crash-closing-page-with-media-as-plugin-fallback.html: Added.
* media/resources/video-with-poster-as-object-fallback.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (103129 => 103130)


--- trunk/LayoutTests/ChangeLog	2011-12-17 00:27:33 UTC (rev 103129)
+++ trunk/LayoutTests/ChangeLog	2011-12-17 00:32:40 UTC (rev 103130)
@@ -1,3 +1,14 @@
+2011-12-16  Brady Eidson  <beid...@apple.com>
+
+        <rdar://problem/10576732> and https://bugs.webkit.org/show_bug.cgi?id=74533
+        REGRESSION(r102619): Reproducible crash closing window with video + poster image inside an object element
+
+        Reviewed by Darin Adler.
+
+        * media/crash-closing-page-with-media-as-plugin-fallback-expected.txt: Added.
+        * media/crash-closing-page-with-media-as-plugin-fallback.html: Added.
+        * media/resources/video-with-poster-as-object-fallback.html: Added.
+
 2011-12-16  Mikhail Naganov  <mnaga...@chromium.org>
 
         [Qt] Add platform-specific test results after r103073

Added: trunk/LayoutTests/media/crash-closing-page-with-media-as-plugin-fallback-expected.txt (0 => 103130)


--- trunk/LayoutTests/media/crash-closing-page-with-media-as-plugin-fallback-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/media/crash-closing-page-with-media-as-plugin-fallback-expected.txt	2011-12-17 00:32:40 UTC (rev 103130)
@@ -0,0 +1,6 @@
+This test makes sure that closing a window with a video element that has a poster image doesn't crash (radar 10576732 and https://bugs.webkit.org/show_bug.cgi?id=74533)
+If it doesn't crash, it passes.
+Click here to open test window
+Closed the window without crashing!
+
+

Added: trunk/LayoutTests/media/crash-closing-page-with-media-as-plugin-fallback.html (0 => 103130)


--- trunk/LayoutTests/media/crash-closing-page-with-media-as-plugin-fallback.html	                        (rev 0)
+++ trunk/LayoutTests/media/crash-closing-page-with-media-as-plugin-fallback.html	2011-12-17 00:32:40 UTC (rev 103130)
@@ -0,0 +1,41 @@
+<script>
+var childWindow;
+</script>
+This test makes sure that closing a window with a video element that has a poster image doesn't crash (radar 10576732 and https://bugs.webkit.org/show_bug.cgi?id=74533)<br>
+If it doesn't crash, it passes.<br>
+<button id="button" _onclick_="childWindow = window.open('resources/video-with-poster-as-object-fallback.html')">
+    Click here to open test window
+</button><br>
+<div id="result"></div><br>
+
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+    layoutTestController.overridePreference("WebKitUsesPageCachePreferenceKey", 1);
+    layoutTestController.overridePreference("WebKitPageCacheSupportsPluginsPreferenceKey", 1);
+    layoutTestController.setCanOpenWindows(true);
+    layoutTestController.setCloseRemainingWindowsWhenComplete(true);
+    var button = document.getElementById("button");
+    eventSender.mouseMoveTo(button.offsetParent.offsetLeft + button.offsetLeft + button.offsetWidth / 2, button.offsetParent.offsetTop +  button.offsetTop + button.offsetHeight / 2);
+    eventSender.mouseDown();
+    eventSender.mouseUp();
+}
+
+function childLoaded()
+{
+    childWindow.close();
+    setTimeout("checkClosed()", 0);
+}
+
+function checkClosed()
+{
+    if (childWindow.closed) {
+        document.getElementById("result").innerText = "Closed the window without crashing!";
+        if (window.layoutTestController)
+            setTimeout("layoutTestController.notifyDone();", 0);
+    }
+    setTimeout("checkClosed()", 0);
+}
+
+</script>

Added: trunk/LayoutTests/media/resources/video-with-poster-as-object-fallback.html (0 => 103130)


--- trunk/LayoutTests/media/resources/video-with-poster-as-object-fallback.html	                        (rev 0)
+++ trunk/LayoutTests/media/resources/video-with-poster-as-object-fallback.html	2011-12-17 00:32:40 UTC (rev 103130)
@@ -0,0 +1,10 @@
+<script src=""
+<body _onload_="opener.childLoaded()">
+<object height="500" width="500">
+<video id="theVideo" controls="controls" poster="../content/abe.png" preload="auto">
+</video>
+<script>
+document.getElementById("theVideo").src = "" '../content/counting');
+</script>
+</object>
+</body>

Modified: trunk/Source/WebCore/ChangeLog (103129 => 103130)


--- trunk/Source/WebCore/ChangeLog	2011-12-17 00:27:33 UTC (rev 103129)
+++ trunk/Source/WebCore/ChangeLog	2011-12-17 00:32:40 UTC (rev 103130)
@@ -1,3 +1,77 @@
+2011-12-16  Brady Eidson  <beid...@apple.com>
+
+        <rdar://problem/10576732> and https://bugs.webkit.org/show_bug.cgi?id=74533
+        REGRESSION(r102619): Reproducible crash closing window with video + poster image inside an object element
+
+        Reviewed by Darin Adler.
+
+        Test: media/crash-closing-page-with-media-as-plugin-fallback.html
+
+        At some point documentWillBecomeInactive() was overloaded to not only notify elements they were going in to the page
+        cache but also do some other work that was necessary during Document teardown.
+
+        This crash occurs because we're notifying elements they're going in to the page cache at document teardown, so this
+        patch breaks that work back out in to a separate function.
+
+        * dom/Document.cpp:
+        (WebCore::Document::detach): Remove obsolete comment.
+        (WebCore::Document::documentWillBecomeInactive): Handle only accelerated compositing cleanup.
+        (WebCore::Document::documentWillSuspendForPageCache): Call documentWillBecomeInactive before notifying elements of suspension.
+        (WebCore::Document::documentDidResumeFromPageCache):
+        (WebCore::Document::registerForPageCacheSuspensionCallbacks):
+        (WebCore::Document::unregisterForPageCacheSuspensionCallbacks):
+        * dom/Document.h:
+
+        * history/CachedFrame.cpp:
+        (WebCore::CachedFrameBase::restore): Call the renamed documentDidResumeFromPageCache.
+        (WebCore::CachedFrame::CachedFrame): Call documentWillSuspendForPageCache instead of documentDidBecomeInactive.
+
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::commitProvisionalLoad): Call the renamed documentDidResumeFromPageCache.
+
+        * dom/Element.h:
+        (WebCore::Element::documentWillSuspendForPageCache): Renamed from documentWillBecomeInactive()
+        (WebCore::Element::documentDidResumeFromPageCache): Renamed from documentDidBecomeActive()
+
+        Change to the renamed registration and callbacks functions in the handful of classes that use them:
+        * html/HTMLFormElement.cpp:
+        (WebCore::HTMLFormElement::~HTMLFormElement):
+        (WebCore::HTMLFormElement::parseMappedAttribute):
+        (WebCore::HTMLFormElement::documentDidResumeFromPageCache):
+        (WebCore::HTMLFormElement::willMoveToNewOwnerDocument):
+        (WebCore::HTMLFormElement::didMoveToNewOwnerDocument):
+        * html/HTMLFormElement.h:
+
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::~HTMLInputElement):
+        (WebCore::HTMLInputElement::updateType):
+        (WebCore::HTMLInputElement::parseMappedAttribute):
+        (WebCore::HTMLInputElement::needsSuspensionCallback):
+        (WebCore::HTMLInputElement::registerForSuspensionCallbackIfNeeded):
+        (WebCore::HTMLInputElement::unregisterForSuspensionCallbackIfNeeded):
+        (WebCore::HTMLInputElement::documentDidResumeFromPageCache):
+        (WebCore::HTMLInputElement::willMoveToNewOwnerDocument):
+        (WebCore::HTMLInputElement::didMoveToNewOwnerDocument):
+        * html/HTMLInputElement.h:
+
+        * html/HTMLPlugInImageElement.cpp:
+        (WebCore::HTMLPlugInImageElement::~HTMLPlugInImageElement):
+        (WebCore::HTMLPlugInImageElement::createRenderer):
+        (WebCore::HTMLPlugInImageElement::willMoveToNewOwnerDocument):
+        (WebCore::HTMLPlugInImageElement::didMoveToNewOwnerDocument):
+        (WebCore::HTMLPlugInImageElement::documentWillSuspendForPageCache):
+        (WebCore::HTMLPlugInImageElement::documentDidResumeFromPageCache):
+        * html/HTMLPlugInImageElement.h:
+
+        * svg/SVGSVGElement.cpp:
+        (WebCore::SVGSVGElement::SVGSVGElement):
+        (WebCore::SVGSVGElement::~SVGSVGElement):
+        (WebCore::SVGSVGElement::willMoveToNewOwnerDocument):
+        (WebCore::SVGSVGElement::didMoveToNewOwnerDocument):
+        (WebCore::SVGSVGElement::documentWillSuspendForPageCache):
+        (WebCore::SVGSVGElement::documentDidResumeFromPageCache):
+        * svg/SVGSVGElement.h:
+
 2011-12-16  Eric Penner  <epen...@google.com>
 
         [chromium] Need to prepaint tiles in TiledLayerChromium

Modified: trunk/Source/WebCore/dom/Document.cpp (103129 => 103130)


--- trunk/Source/WebCore/dom/Document.cpp	2011-12-17 00:27:33 UTC (rev 103129)
+++ trunk/Source/WebCore/dom/Document.cpp	2011-12-17 00:32:40 UTC (rev 103130)
@@ -1844,8 +1844,6 @@
 
     RenderObject* render = renderer();
 
-    // Send out documentWillBecomeInactive() notifications to registered elements,
-    // in order to stop media elements
     documentWillBecomeInactive();
 
 #if ENABLE(SHARED_WORKERS)
@@ -3919,25 +3917,30 @@
     }
 }
 
-void Document::documentWillBecomeInactive() 
+void Document::documentWillBecomeInactive()
 {
 #if USE(ACCELERATED_COMPOSITING)
     if (renderer())
         renderView()->willMoveOffscreen();
 #endif
+}
 
-    HashSet<Element*>::iterator end = m_documentActivationCallbackElements.end();
-    for (HashSet<Element*>::iterator i = m_documentActivationCallbackElements.begin(); i != end; ++i)
-        (*i)->documentWillBecomeInactive();
+void Document::documentWillSuspendForPageCache()
+{
+    documentWillBecomeInactive();
+
+    HashSet<Element*>::iterator end = m_documentSuspensionCallbackElements.end();
+    for (HashSet<Element*>::iterator i = m_documentSuspensionCallbackElements.begin(); i != end; ++i)
+        (*i)->documentWillSuspendForPageCache();
 }
 
-void Document::documentDidBecomeActive() 
+void Document::documentDidResumeFromPageCache() 
 {
     Vector<Element*> elements;
-    copyToVector(m_documentActivationCallbackElements, elements);
+    copyToVector(m_documentSuspensionCallbackElements, elements);
     Vector<Element*>::iterator end = elements.end();
     for (Vector<Element*>::iterator i = elements.begin(); i != end; ++i)
-        (*i)->documentDidBecomeActive();
+        (*i)->documentDidResumeFromPageCache();
 
 #if USE(ACCELERATED_COMPOSITING)
     if (renderer())
@@ -3951,14 +3954,14 @@
     m_frame->loader()->client()->dispatchDidBecomeFrameset(isFrameSet());
 }
 
-void Document::registerForDocumentActivationCallbacks(Element* e)
+void Document::registerForPageCacheSuspensionCallbacks(Element* e)
 {
-    m_documentActivationCallbackElements.add(e);
+    m_documentSuspensionCallbackElements.add(e);
 }
 
-void Document::unregisterForDocumentActivationCallbacks(Element* e)
+void Document::unregisterForPageCacheSuspensionCallbacks(Element* e)
 {
-    m_documentActivationCallbackElements.remove(e);
+    m_documentSuspensionCallbackElements.remove(e);
 }
 
 void Document::mediaVolumeDidChange() 

Modified: trunk/Source/WebCore/dom/Document.h (103129 => 103130)


--- trunk/Source/WebCore/dom/Document.h	2011-12-17 00:27:33 UTC (rev 103129)
+++ trunk/Source/WebCore/dom/Document.h	2011-12-17 00:32:40 UTC (rev 103130)
@@ -970,13 +970,15 @@
 
     bool inPageCache() const { return m_inPageCache; }
     void setInPageCache(bool flag);
-    
-    // Elements can register themselves for the "documentWillBecomeInactive()" and  
-    // "documentDidBecomeActive()" callbacks
-    void registerForDocumentActivationCallbacks(Element*);
-    void unregisterForDocumentActivationCallbacks(Element*);
+
+    // Elements can register themselves for the "documentWillSuspendForPageCache()" and  
+    // "documentDidResumeFromPageCache()" callbacks
+    void registerForPageCacheSuspensionCallbacks(Element*);
+    void unregisterForPageCacheSuspensionCallbacks(Element*);
+
     void documentWillBecomeInactive();
-    void documentDidBecomeActive();
+    void documentWillSuspendForPageCache();
+    void documentDidResumeFromPageCache();
 
     void registerForMediaVolumeCallbacks(Element*);
     void unregisterForMediaVolumeCallbacks(Element*);
@@ -1391,7 +1393,7 @@
     bool m_inPageCache;
     Vector<IconURL> m_iconURLs;
 
-    HashSet<Element*> m_documentActivationCallbackElements;
+    HashSet<Element*> m_documentSuspensionCallbackElements;
     HashSet<Element*> m_mediaVolumeCallbackElements;
     HashSet<Element*> m_privateBrowsingStateChangedElements;
 

Modified: trunk/Source/WebCore/dom/Element.h (103129 => 103130)


--- trunk/Source/WebCore/dom/Element.h	2011-12-17 00:27:33 UTC (rev 103129)
+++ trunk/Source/WebCore/dom/Element.h	2011-12-17 00:32:40 UTC (rev 103130)
@@ -271,8 +271,8 @@
     void setMinimumSizeForResizing(const LayoutSize&);
 
     // Use Document::registerForDocumentActivationCallbacks() to subscribe to these
-    virtual void documentWillBecomeInactive() { }
-    virtual void documentDidBecomeActive() { }
+    virtual void documentWillSuspendForPageCache() { }
+    virtual void documentDidResumeFromPageCache() { }
 
     // Use Document::registerForMediaVolumeCallbacks() to subscribe to this
     virtual void mediaVolumeDidChange() { }

Modified: trunk/Source/WebCore/history/CachedFrame.cpp (103129 => 103130)


--- trunk/Source/WebCore/history/CachedFrame.cpp	2011-12-17 00:27:33 UTC (rev 103129)
+++ trunk/Source/WebCore/history/CachedFrame.cpp	2011-12-17 00:32:40 UTC (rev 103130)
@@ -137,7 +137,7 @@
         m_document->page()->chrome()->client()->needTouchEvents(true);
 #endif
 
-    m_document->documentDidBecomeActive();
+    m_document->documentDidResumeFromPageCache();
 }
 
 CachedFrame::CachedFrame(Frame* frame)
@@ -169,7 +169,7 @@
     // Suspending must also happen after we've recursed over child frames, in case
     // those create more objects.
     // FIXME: It's still possible to have objects created after suspending in some cases, see http://webkit.org/b/53733 for more details.
-    m_document->documentWillBecomeInactive();
+    m_document->documentWillSuspendForPageCache();
     m_document->suspendScriptedAnimationControllerCallbacks();
     m_document->suspendActiveDOMObjects(ActiveDOMObject::DocumentWillBecomeInactive);
     m_cachedFrameScriptData = adoptPtr(new ScriptCachedFrameData(frame));

Modified: trunk/Source/WebCore/html/HTMLFormElement.cpp (103129 => 103130)


--- trunk/Source/WebCore/html/HTMLFormElement.cpp	2011-12-17 00:27:33 UTC (rev 103129)
+++ trunk/Source/WebCore/html/HTMLFormElement.cpp	2011-12-17 00:32:40 UTC (rev 103130)
@@ -92,7 +92,7 @@
 HTMLFormElement::~HTMLFormElement()
 {
     if (!shouldAutocomplete())
-        document()->unregisterForDocumentActivationCallbacks(this);
+        document()->unregisterForPageCacheSuspensionCallbacks(this);
 
     for (unsigned i = 0; i < m_associatedElements.size(); ++i)
         m_associatedElements[i]->formDestroyed();
@@ -377,9 +377,9 @@
         m_attributes.setAcceptCharset(attr->value());
     else if (attr->name() == autocompleteAttr) {
         if (!shouldAutocomplete())
-            document()->registerForDocumentActivationCallbacks(this);
+            document()->registerForPageCacheSuspensionCallbacks(this);
         else
-            document()->unregisterForDocumentActivationCallbacks(this);
+            document()->unregisterForPageCacheSuspensionCallbacks(this);
     } else if (attr->name() == onsubmitAttr)
         setAttributeEventListener(eventNames().submitEvent, createAttributeEventListener(this, attr));
     else if (attr->name() == onresetAttr)
@@ -636,7 +636,7 @@
         addElementAlias(static_cast<HTMLFormControlElement*>(namedItems.first().get()), name);
 }
 
-void HTMLFormElement::documentDidBecomeActive()
+void HTMLFormElement::documentDidResumeFromPageCache()
 {
     ASSERT(!shouldAutocomplete());
 
@@ -649,14 +649,14 @@
 void HTMLFormElement::willMoveToNewOwnerDocument()
 {
     if (!shouldAutocomplete())
-        document()->unregisterForDocumentActivationCallbacks(this);
+        document()->unregisterForPageCacheSuspensionCallbacks(this);
     HTMLElement::willMoveToNewOwnerDocument();
 }
 
 void HTMLFormElement::didMoveToNewOwnerDocument()
 {
     if (!shouldAutocomplete())
-        document()->registerForDocumentActivationCallbacks(this);
+        document()->registerForPageCacheSuspensionCallbacks(this);
     HTMLElement::didMoveToNewOwnerDocument();
 }
 

Modified: trunk/Source/WebCore/html/HTMLFormElement.h (103129 => 103130)


--- trunk/Source/WebCore/html/HTMLFormElement.h	2011-12-17 00:27:33 UTC (rev 103129)
+++ trunk/Source/WebCore/html/HTMLFormElement.h	2011-12-17 00:32:40 UTC (rev 103130)
@@ -126,7 +126,7 @@
 
     virtual bool isURLAttribute(Attribute*) const;
 
-    virtual void documentDidBecomeActive();
+    virtual void documentDidResumeFromPageCache();
 
     virtual void willMoveToNewOwnerDocument();
     virtual void didMoveToNewOwnerDocument();

Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (103129 => 103130)


--- trunk/Source/WebCore/html/HTMLInputElement.cpp	2011-12-17 00:27:33 UTC (rev 103129)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp	2011-12-17 00:32:40 UTC (rev 103130)
@@ -114,8 +114,8 @@
 
 HTMLInputElement::~HTMLInputElement()
 {
-    if (needsActivationCallback())
-        document()->unregisterForDocumentActivationCallbacks(this);
+    if (needsSuspensionCallback())
+        document()->unregisterForPageCacheSuspensionCallbacks(this);
 
     document()->checkedRadioButtons().removeButton(this);
 
@@ -562,7 +562,7 @@
         detach();
 
     bool didStoreValue = m_inputType->storesValueSeparateFromAttribute();
-    bool neededActivationCallback = needsActivationCallback();
+    bool neededSuspensionCallback = needsSuspensionCallback();
     bool didRespectHeightAndWidth = m_inputType->shouldRespectHeightAndWidthAttributes();
 
     m_inputType->destroyShadowSubtree();
@@ -587,10 +587,10 @@
 
     m_wasModifiedByUser = false;
 
-    if (neededActivationCallback)
-        unregisterForActivationCallbackIfNeeded();
+    if (neededSuspensionCallback)
+        unregisterForSuspensionCallbackIfNeeded();
     else
-        registerForActivationCallbackIfNeeded();
+        registerForSuspensionCallbackIfNeeded();
 
     if (didRespectHeightAndWidth != m_inputType->shouldRespectHeightAndWidthAttributes()) {
         NamedNodeMap* map = attributeMap();
@@ -735,7 +735,7 @@
     } else if (attr->name() == autocompleteAttr) {
         if (equalIgnoringCase(attr->value(), "off")) {
             m_autocomplete = Off;
-            registerForActivationCallbackIfNeeded();
+            registerForSuspensionCallbackIfNeeded();
         } else {
             bool needsToUnregister = m_autocomplete == Off;
 
@@ -745,7 +745,7 @@
                 m_autocomplete = On;
 
             if (needsToUnregister)
-                unregisterForActivationCallbackIfNeeded();
+                unregisterForSuspensionCallbackIfNeeded();
         }
     } else if (attr->name() == typeAttr) {
         updateType();
@@ -1462,21 +1462,21 @@
     return m_inputType->supportsRangeLimitation() && (rangeUnderflow(value()) || rangeOverflow(value()));
 }
 
-bool HTMLInputElement::needsActivationCallback()
+bool HTMLInputElement::needsSuspensionCallback()
 {
     return m_autocomplete == Off || m_inputType->shouldResetOnDocumentActivation();
 }
 
-void HTMLInputElement::registerForActivationCallbackIfNeeded()
+void HTMLInputElement::registerForSuspensionCallbackIfNeeded()
 {
-    if (needsActivationCallback())
-        document()->registerForDocumentActivationCallbacks(this);
+    if (needsSuspensionCallback())
+        document()->registerForPageCacheSuspensionCallbacks(this);
 }
 
-void HTMLInputElement::unregisterForActivationCallbackIfNeeded()
+void HTMLInputElement::unregisterForSuspensionCallbackIfNeeded()
 {
-    if (!needsActivationCallback())
-        document()->unregisterForDocumentActivationCallbacks(this);
+    if (!needsSuspensionCallback())
+        document()->unregisterForPageCacheSuspensionCallbacks(this);
 }
 
 bool HTMLInputElement::isRequiredFormControl() const
@@ -1499,9 +1499,9 @@
     dispatchEvent(Event::create(eventNames().searchEvent, true, false));
 }
 
-void HTMLInputElement::documentDidBecomeActive()
+void HTMLInputElement::documentDidResumeFromPageCache()
 {
-    ASSERT(needsActivationCallback());
+    ASSERT(needsSuspensionCallback());
     reset();
 }
 
@@ -1510,8 +1510,8 @@
     m_inputType->willMoveToNewOwnerDocument();
 
     // Always unregister for cache callbacks when leaving a document, even if we would otherwise like to be registered
-    if (needsActivationCallback())
-        document()->unregisterForDocumentActivationCallbacks(this);
+    if (needsSuspensionCallback())
+        document()->unregisterForPageCacheSuspensionCallbacks(this);
 
     document()->checkedRadioButtons().removeButton(this);
 
@@ -1520,7 +1520,7 @@
 
 void HTMLInputElement::didMoveToNewOwnerDocument()
 {
-    registerForActivationCallbackIfNeeded();
+    registerForSuspensionCallbackIfNeeded();
 
     HTMLTextFormControlElement::didMoveToNewOwnerDocument();
 }

Modified: trunk/Source/WebCore/html/HTMLInputElement.h (103129 => 103130)


--- trunk/Source/WebCore/html/HTMLInputElement.h	2011-12-17 00:27:33 UTC (rev 103129)
+++ trunk/Source/WebCore/html/HTMLInputElement.h	2011-12-17 00:32:40 UTC (rev 103130)
@@ -298,13 +298,13 @@
     virtual bool isInRange() const;
     virtual bool isOutOfRange() const;
 
-    virtual void documentDidBecomeActive();
+    virtual void documentDidResumeFromPageCache();
 
     virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
 
-    bool needsActivationCallback();
-    void registerForActivationCallbackIfNeeded();
-    void unregisterForActivationCallbackIfNeeded();
+    bool needsSuspensionCallback();
+    void registerForSuspensionCallbackIfNeeded();
+    void unregisterForSuspensionCallbackIfNeeded();
 
     bool supportsMaxLength() const { return isTextType(); }
     bool isTextType() const;

Modified: trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp (103129 => 103130)


--- trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp	2011-12-17 00:27:33 UTC (rev 103129)
+++ trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp	2011-12-17 00:32:40 UTC (rev 103130)
@@ -51,7 +51,7 @@
 HTMLPlugInImageElement::~HTMLPlugInImageElement()
 {
     if (m_needsDocumentActivationCallbacks)
-        document()->unregisterForDocumentActivationCallbacks(this);
+        document()->unregisterForPageCacheSuspensionCallbacks(this);
 }
 
 RenderEmbeddedObject* HTMLPlugInImageElement::renderEmbeddedObject() const
@@ -127,7 +127,7 @@
     // inactive or reactivates so it can clear the renderer before going into the page cache.
     if (!m_needsDocumentActivationCallbacks) {
         m_needsDocumentActivationCallbacks = true;
-        document()->registerForDocumentActivationCallbacks(this);
+        document()->registerForPageCacheSuspensionCallbacks(this);
     }
     
     // Fallback content breaks the DOM->Renderer class relationship of this
@@ -205,7 +205,7 @@
 void HTMLPlugInImageElement::willMoveToNewOwnerDocument()
 {
     if (m_needsDocumentActivationCallbacks)
-        document()->unregisterForDocumentActivationCallbacks(this);
+        document()->unregisterForPageCacheSuspensionCallbacks(this);
 
     if (m_imageLoader)
         m_imageLoader->elementWillMoveToNewOwnerDocument();
@@ -216,12 +216,12 @@
 void HTMLPlugInImageElement::didMoveToNewOwnerDocument()
 {
     if (m_needsDocumentActivationCallbacks)
-        document()->registerForDocumentActivationCallbacks(this);   
+        document()->registerForPageCacheSuspensionCallbacks(this);   
     
     HTMLPlugInElement::didMoveToNewOwnerDocument();
 }
 
-void HTMLPlugInImageElement::documentWillBecomeInactive()
+void HTMLPlugInImageElement::documentWillSuspendForPageCache()
 {
     if (RenderStyle* rs = renderStyle()) {
         m_customStyleForPageCache = RenderStyle::clone(rs);
@@ -233,10 +233,10 @@
     if (m_customStyleForPageCache)
         recalcStyle(Force);
         
-    HTMLPlugInElement::documentWillBecomeInactive();
+    HTMLPlugInElement::documentWillSuspendForPageCache();
 }
 
-void HTMLPlugInImageElement::documentDidBecomeActive()
+void HTMLPlugInImageElement::documentDidResumeFromPageCache()
 {
     clearHasCustomStyleForRenderer();
 
@@ -245,7 +245,7 @@
         recalcStyle(Force);
     }
     
-    HTMLPlugInElement::documentDidBecomeActive();
+    HTMLPlugInElement::documentDidResumeFromPageCache();
 }
 
 PassRefPtr<RenderStyle> HTMLPlugInImageElement::customStyleForRenderer()

Modified: trunk/Source/WebCore/html/HTMLPlugInImageElement.h (103129 => 103130)


--- trunk/Source/WebCore/html/HTMLPlugInImageElement.h	2011-12-17 00:27:33 UTC (rev 103129)
+++ trunk/Source/WebCore/html/HTMLPlugInImageElement.h	2011-12-17 00:32:40 UTC (rev 103130)
@@ -77,8 +77,8 @@
     virtual void willMoveToNewOwnerDocument() OVERRIDE;
     virtual void didMoveToNewOwnerDocument() OVERRIDE;
     
-    virtual void documentWillBecomeInactive() OVERRIDE;
-    virtual void documentDidBecomeActive() OVERRIDE;
+    virtual void documentWillSuspendForPageCache() OVERRIDE;
+    virtual void documentDidResumeFromPageCache() OVERRIDE;
 
     virtual PassRefPtr<RenderStyle> customStyleForRenderer() OVERRIDE;
 

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (103129 => 103130)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2011-12-17 00:27:33 UTC (rev 103129)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2011-12-17 00:32:40 UTC (rev 103130)
@@ -1805,7 +1805,7 @@
         history()->updateForClientRedirect();
 
     if (m_loadingFromCachedPage) {
-        m_frame->document()->documentDidBecomeActive();
+        m_frame->document()->documentDidResumeFromPageCache();
         
         // Force a layout to update view size and thereby update scrollbars.
         m_frame->view()->forceLayout();

Modified: trunk/Source/WebCore/svg/SVGSVGElement.cpp (103129 => 103130)


--- trunk/Source/WebCore/svg/SVGSVGElement.cpp	2011-12-17 00:27:33 UTC (rev 103129)
+++ trunk/Source/WebCore/svg/SVGSVGElement.cpp	2011-12-17 00:32:40 UTC (rev 103130)
@@ -90,7 +90,7 @@
 {
     ASSERT(hasTagName(SVGNames::svgTag));
     registerAnimatedPropertiesForSVGSVGElement();
-    doc->registerForDocumentActivationCallbacks(this);
+    doc->registerForPageCacheSuspensionCallbacks(this);
 }
 
 PassRefPtr<SVGSVGElement> SVGSVGElement::create(const QualifiedName& tagName, Document* document)
@@ -100,7 +100,7 @@
 
 SVGSVGElement::~SVGSVGElement()
 {
-    document()->unregisterForDocumentActivationCallbacks(this);
+    document()->unregisterForPageCacheSuspensionCallbacks(this);
     // There are cases where removedFromDocument() is not called.
     // see ContainerNode::removeAllChildren, called by its destructor.
     document()->accessSVGExtensions()->removeTimeContainer(this);
@@ -108,13 +108,13 @@
 
 void SVGSVGElement::willMoveToNewOwnerDocument()
 {
-    document()->unregisterForDocumentActivationCallbacks(this);
+    document()->unregisterForPageCacheSuspensionCallbacks(this);
     SVGStyledLocatableElement::willMoveToNewOwnerDocument();
 }
 
 void SVGSVGElement::didMoveToNewOwnerDocument()
 {
-    document()->registerForDocumentActivationCallbacks(this);
+    document()->registerForPageCacheSuspensionCallbacks(this);
     SVGStyledLocatableElement::didMoveToNewOwnerDocument();
 }
 
@@ -657,12 +657,12 @@
         RenderSVGResource::markForLayoutAndParentResourceInvalidation(object);
 }
     
-void SVGSVGElement::documentWillBecomeInactive()
+void SVGSVGElement::documentWillSuspendForPageCache()
 {
     pauseAnimations();
 }
 
-void SVGSVGElement::documentDidBecomeActive()
+void SVGSVGElement::documentDidResumeFromPageCache()
 {
     unpauseAnimations();
 }

Modified: trunk/Source/WebCore/svg/SVGSVGElement.h (103129 => 103130)


--- trunk/Source/WebCore/svg/SVGSVGElement.h	2011-12-17 00:27:33 UTC (rev 103129)
+++ trunk/Source/WebCore/svg/SVGSVGElement.h	2011-12-17 00:32:40 UTC (rev 103130)
@@ -171,8 +171,8 @@
     virtual void synchronizeRequiredExtensions() { SVGTests::synchronizeRequiredExtensions(this); }
     virtual void synchronizeSystemLanguage() { SVGTests::synchronizeSystemLanguage(this); }
 
-    virtual void documentWillBecomeInactive();
-    virtual void documentDidBecomeActive();
+    virtual void documentWillSuspendForPageCache();
+    virtual void documentDidResumeFromPageCache();
 
     virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to