merge after backing out changeset 5a5ead36d721 / bug 610796
authorDaniel Holbert <dholbert@cs.stanford.edu>
Tue, 16 Nov 2010 11:24:43 -0800
changeset 57593 c4a3a81c7f5f100829ef2543499fa8ae50b5fa7d
parent 57591 b0d1532292908180f818be63dc1c4a8f9bd58d19 (current diff)
parent 57592 6963912691590c1cd0da331448efc279ca882a60 (diff)
child 57594 da98fe199be07789f077b6902014a95c93198195
push id16997
push userdholbert@mozilla.com
push dateTue, 16 Nov 2010 19:28:58 +0000
treeherdermozilla-central@da98fe199be0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs610796
milestone2.0b8pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
merge after backing out changeset 5a5ead36d721 / bug 610796
--- a/layout/svg/base/src/nsSVGEffects.cpp
+++ b/layout/svg/base/src/nsSVGEffects.cpp
@@ -188,23 +188,16 @@ nsSVGIDRenderingObserver::DoUpdate()
 void
 nsSVGRenderingObserver::InvalidateViaReferencedElement()
 {
   mInObserverList = PR_FALSE;
   DoUpdate();
 }
 
 void
-nsSVGRenderingObserver::NotifyEvictedFromRenderingObserverList()
-{
-  mInObserverList = PR_FALSE; // We've been removed from rendering-obs. list.
-  StopListening();            // Remove ourselves from mutation-obs. list.
-}
-
-void
 nsSVGRenderingObserver::AttributeChanged(nsIDocument* aDocument,
                                          dom::Element* aElement,
                                          PRInt32 aNameSpaceID,
                                          nsIAtom* aAttribute,
                                          PRInt32 aModType)
 {
   // An attribute belonging to the element that we are observing *or one of its
   // descendants* has changed.
@@ -544,31 +537,16 @@ nsSVGRenderingObserverList::InvalidateAl
   // The PL_DHASH_REMOVE in GatherEnumerator drops all our observers here:
   mObservers.EnumerateEntries(GatherEnumerator, &observers);
 
   for (PRUint32 i = 0; i < observers.Length(); ++i) {
     observers[i]->InvalidateViaReferencedElement();
   }
 }
 
-void
-nsSVGRenderingObserverList::RemoveAll()
-{
-  nsAutoTArray<nsSVGRenderingObserver*,10> observers;
-
-  // The PL_DHASH_REMOVE in GatherEnumerator drops all our observers here:
-  mObservers.EnumerateEntries(GatherEnumerator, &observers);
-
-  // Our list is now cleared.  We need to notify the observers we've removed,
-  // so they can update their state & remove themselves as mutation-observers.
-  for (PRUint32 i = 0; i < observers.Length(); ++i) {
-    observers[i]->NotifyEvictedFromRenderingObserverList();
-  }
-}
-
 static void
 DestroyObservers(void *aObject, nsIAtom *aPropertyName,
                  void *aPropertyValue, void *aData)
 {
   delete static_cast<nsSVGRenderingObserverList*>(aPropertyValue);
 }
 
 void
@@ -595,26 +573,16 @@ nsSVGEffects::RemoveRenderingObserver(El
     observerList->Remove(aObserver);
     if (observerList->IsEmpty()) {
       aElement->SetHasRenderingObservers(false);
     }
   }
 }
 
 void
-nsSVGEffects::RemoveAllRenderingObservers(Element *aElement)
-{
-  nsSVGRenderingObserverList *observerList = GetObserverList(aElement);
-  if (observerList) {
-    observerList->RemoveAll();
-    aElement->SetHasRenderingObservers(false);
-  }
-}
-
-void
 nsSVGEffects::InvalidateRenderingObservers(nsIFrame *aFrame)
 {
   NS_ASSERTION(!aFrame->GetPrevContinuation(), "aFrame must be first continuation");
 
   if (!aFrame->GetContent()->IsElement())
     return;
 
   nsSVGRenderingObserverList *observerList =
--- a/layout/svg/base/src/nsSVGEffects.h
+++ b/layout/svg/base/src/nsSVGEffects.h
@@ -75,22 +75,16 @@ public:
 
   // nsIMutationObserver
   NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
   NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
   NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
   NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
 
   void InvalidateViaReferencedElement();
-
-  // When a nsSVGRenderingObserver list gets forcibly cleared, it uses this
-  // callback to notify every observer that's cleared from it, so they can
-  // react.
-  void NotifyEvictedFromRenderingObserverList();
-
   nsIFrame* GetReferencedFrame();
   PRBool IsInObserverList() const { return mInObserverList; }
 
   /**
    * @param aOK this is only for the convenience of callers. We set *aOK to false
    * if this function returns null.
    */
   nsIFrame* GetReferencedFrame(nsIAtom* aFrameType, PRBool* aOK);
@@ -257,22 +251,16 @@ public:
   { return mObservers.Count() == 0; }
 
   /**
    * Drop all our observers, and notify them that we have changed and dropped
    * our reference to them.
    */
   void InvalidateAll();
 
-  /**
-   * Drop all our observers, and notify them that we have dropped our reference
-   * to them.
-   */
-  void RemoveAll();
-
 private:
   nsTHashtable<nsVoidPtrHashKey> mObservers;
 };
 
 class nsSVGEffects {
 public:
   typedef mozilla::dom::Element Element;
   typedef mozilla::FramePropertyDescriptor FramePropertyDescriptor;
@@ -357,22 +345,16 @@ public:
   /**
    * @param aFrame must be a first-continuation.
    */
   static void AddRenderingObserver(Element *aElement, nsSVGRenderingObserver *aObserver);
   /**
    * @param aFrame must be a first-continuation.
    */
   static void RemoveRenderingObserver(Element *aElement, nsSVGRenderingObserver *aObserver);
-
-  /**
-   * Removes all rendering observers from aElement.
-   */
-  static void RemoveAllRenderingObservers(Element *aElement);
-
   /**
    * This can be called on any frame. We invalidate the observers of aFrame's
    * element, if any, or else walk up to the nearest observable SVG parent
    * frame with observers and invalidate them instead.
    *
    * Note that this method is very different to e.g.
    * nsNodeUtils::AttributeChanged which walks up the content node tree all the
    * way to the root node (not stopping if it encounters a non-container SVG
--- a/modules/libpr0n/src/SVGDocumentWrapper.cpp
+++ b/modules/libpr0n/src/SVGDocumentWrapper.cpp
@@ -55,17 +55,16 @@
 #include "nsIXMLContentSink.h"
 #include "nsNetCID.h"
 #include "nsComponentManagerUtils.h"
 #include "nsServiceManagerUtils.h"
 #include "nsSize.h"
 #include "gfxRect.h"
 #include "nsSVGSVGElement.h"
 #include "nsSVGLength2.h"
-#include "nsSVGEffects.h"
 
 using namespace mozilla::dom;
 
 namespace mozilla {
 namespace imagelib {
 
 nsIAtom* SVGDocumentWrapper::kSVGAtom = nsnull; // lazily initialized
 
@@ -294,22 +293,16 @@ SVGDocumentWrapper::OnStopRequest(nsIReq
 
 /** nsIObserver Methods **/
 NS_IMETHODIMP
 SVGDocumentWrapper::Observe(nsISupports* aSubject,
                             const char* aTopic,
                             const PRUnichar *aData)
 {
   if (!strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
-    // Sever ties from rendering observers to helper-doc's root SVG node
-    nsSVGSVGElement* svgElem = GetRootSVGElem();
-    if (svgElem) {
-      nsSVGEffects::RemoveAllRenderingObservers(svgElem);
-    }
-
     // Clean up at XPCOM shutdown time.
     DestroyViewer();
     if (mListener)
       mListener = nsnull;
     if (mLoadGroup)
       mLoadGroup = nsnull;
 
     // Turn off "registered" flag, or else we'll try to unregister when we die.