Backed out changesets 4d2d510fbd62, 5e51dc838a89, and 652bd77f36c1 (bug 1116714) for Linux opt mochitest-dt orange.
authorRyan VanderMeulen <ryanvm@gmail.com>
Tue, 06 Jan 2015 08:57:43 -0500
changeset 235237 1f32089c6733f9beeced00dc0aced37f5fe0a585
parent 235236 1d470bfb9e47db87db7b1654758a57d670ed8a0d
child 235238 4d91c33b351cabf7fb7bff4575e33d92bad45830
push id355
push usermleibovic@mozilla.com
push dateWed, 07 Jan 2015 02:29:19 +0000
bugs1116714
milestone37.0a1
backs out4d2d510fbd623a3799ffc501b8e3561201f8cc36
5e51dc838a896d4aa649926ae9e763d1a657c169
652bd77f36c180084404def4d0f0748707b2c30e
Backed out changesets 4d2d510fbd62, 5e51dc838a89, and 652bd77f36c1 (bug 1116714) for Linux opt mochitest-dt orange. CLOSED TREE
dom/base/nsDocument.cpp
layout/base/nsCSSFrameConstructor.cpp
layout/generic/nsCanvasFrame.cpp
layout/generic/nsCanvasFrame.h
toolkit/devtools/server/actors/highlighter.js
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -5245,17 +5245,16 @@ already_AddRefed<AnonymousContent>
 nsIDocument::InsertAnonymousContent(Element& aElement, ErrorResult& aRv)
 {
   nsIPresShell* shell = GetShell();
   if (!shell || !shell->GetCanvasFrame()) {
     aRv.Throw(NS_ERROR_UNEXPECTED);
     return nullptr;
   }
 
-  nsAutoScriptBlocker scriptBlocker;
   nsCOMPtr<Element> container = shell->GetCanvasFrame()
                                      ->GetCustomContentContainer();
   if (!container) {
     aRv.Throw(NS_ERROR_UNEXPECTED);
     return nullptr;
   }
 
   // Clone the node to avoid returning a direct reference
@@ -5270,32 +5269,29 @@ nsIDocument::InsertAnonymousContent(Elem
   if (NS_FAILED(rv)) {
     return nullptr;
   }
 
   nsRefPtr<AnonymousContent> anonymousContent =
     new AnonymousContent(clonedElement->AsElement());
   mAnonymousContents.AppendElement(anonymousContent);
 
-  shell->GetCanvasFrame()->ShowCustomContentContainer();
-
   return anonymousContent.forget();
 }
 
 void
 nsIDocument::RemoveAnonymousContent(AnonymousContent& aContent,
                                     ErrorResult& aRv)
 {
   nsIPresShell* shell = GetShell();
   if (!shell || !shell->GetCanvasFrame()) {
     aRv.Throw(NS_ERROR_UNEXPECTED);
     return;
   }
 
-  nsAutoScriptBlocker scriptBlocker;
   nsCOMPtr<Element> container = shell->GetCanvasFrame()
                                      ->GetCustomContentContainer();
   if (!container) {
     aRv.Throw(NS_ERROR_UNEXPECTED);
     return;
   }
 
   // Iterate over know customContents to get and remove the right one
@@ -5311,19 +5307,16 @@ nsIDocument::RemoveAnonymousContent(Anon
       container->RemoveChild(*node, aRv);
       if (aRv.Failed()) {
         return;
       }
 
       break;
     }
   }
-  if (mAnonymousContents.IsEmpty()) {
-    shell->GetCanvasFrame()->HideCustomContentContainer();
-  }
 }
 
 //
 // nsIDOMDocument interface
 //
 DocumentType*
 nsIDocument::GetDoctype() const
 {
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -9288,19 +9288,19 @@ nsCSSFrameConstructor::RecreateFramesFor
 
     if (frame->GetStateBits() & NS_FRAME_ANONYMOUSCONTENTCREATOR_CONTENT) {
       // Recreate the frames for the entire nsIAnonymousContentCreator tree
       // since |frame| or one of its descendants may need an nsStyleContext
       // that associates it to a CSS pseudo-element, and only the
       // nsIAnonymousContentCreator that created this content knows how to make
       // that happen.
       nsIAnonymousContentCreator* acc = nullptr;
-      nsIFrame* ancestor = nsLayoutUtils::GetParentOrPlaceholderFor(frame);
+      nsIFrame* ancestor = frame->GetParent();
       while (!(acc = do_QueryFrame(ancestor))) {
-        ancestor = nsLayoutUtils::GetParentOrPlaceholderFor(ancestor);
+        ancestor = ancestor->GetParent();
       }
       NS_ASSERTION(acc, "Where is the nsIAnonymousContentCreator? We may fail "
                         "to recreate its content correctly");
       // nsSVGUseFrame is special, and we know this is unnecessary for it.
       if (ancestor->GetType() != nsGkAtoms::svgUseFrame) {
         NS_ASSERTION(aContent->IsInNativeAnonymousSubtree(),
                      "Why is NS_FRAME_ANONYMOUSCONTENTCREATOR_CONTENT set?");
         return RecreateFramesForContent(ancestor->GetContent(), aAsyncInsert,
--- a/layout/generic/nsCanvasFrame.cpp
+++ b/layout/generic/nsCanvasFrame.cpp
@@ -48,34 +48,16 @@ NS_NewCanvasFrame(nsIPresShell* aPresShe
 
 NS_IMPL_FRAMEARENA_HELPERS(nsCanvasFrame)
 
 NS_QUERYFRAME_HEAD(nsCanvasFrame)
   NS_QUERYFRAME_ENTRY(nsCanvasFrame)
   NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator)
 NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
 
-void
-nsCanvasFrame::ShowCustomContentContainer()
-{
-  if (mCustomContentContainer) {
-    mCustomContentContainer->UnsetAttr(kNameSpaceID_None, nsGkAtoms::hidden, true);
-  }
-}
-
-void
-nsCanvasFrame::HideCustomContentContainer()
-{
-  if (mCustomContentContainer) {
-    mCustomContentContainer->SetAttr(kNameSpaceID_None, nsGkAtoms::hidden,
-                                     NS_LITERAL_STRING("true"),
-                                     true);
-  }
-}
-
 nsresult
 nsCanvasFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
 {
   if (!mContent) {
     return NS_OK;
   }
 
   nsCOMPtr<nsIDocument> doc = mContent->OwnerDoc();
@@ -139,21 +121,16 @@ nsCanvasFrame::CreateAnonymousContent(ns
 
   // Append all existing AnonymousContent nodes stored at document level if any.
   int32_t anonymousContentCount = doc->GetAnonymousContents().Length();
   for (int32_t i = 0; i < anonymousContentCount; ++i) {
     nsCOMPtr<Element> node = doc->GetAnonymousContents()[i]->GetContentNode();
     mCustomContentContainer->AppendChildTo(node->AsContent(), true);
   }
 
-  // Only create a frame for mCustomContentContainer if it has some children.
-  if (anonymousContentCount <= 0) {
-    HideCustomContentContainer();
-  }
-
   return NS_OK;
 }
 
 void
 nsCanvasFrame::AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements, uint32_t aFilter)
 {
   if (mTouchCaretElement) {
     aElements.AppendElement(mTouchCaretElement);
--- a/layout/generic/nsCanvasFrame.h
+++ b/layout/generic/nsCanvasFrame.h
@@ -99,28 +99,16 @@ public:
     return mSelectionCaretsEndElement;
   }
 
   mozilla::dom::Element* GetCustomContentContainer() const
   {
     return mCustomContentContainer;
   }
 
-  /**
-   * Unhide the CustomContentContainer. This call only has an effect if
-   * mCustomContentContainer is non-null.
-   */
-  void ShowCustomContentContainer();
-
-  /**
-   * Hide the CustomContentContainer. This call only has an effect if
-   * mCustomContentContainer is non-null.
-   */
-  void HideCustomContentContainer();
-
   /** SetHasFocus tells the CanvasFrame to draw with focus ring
    *  @param aHasFocus true to show focus ring, false to hide it
    */
   NS_IMETHOD SetHasFocus(bool aHasFocus);
 
   virtual void BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                                 const nsRect&           aDirtyRect,
                                 const nsDisplayListSet& aLists) MOZ_OVERRIDE;
--- a/toolkit/devtools/server/actors/highlighter.js
+++ b/toolkit/devtools/server/actors/highlighter.js
@@ -416,35 +416,33 @@ let CustomHighlighterFront = protocol.Fr
  *        The tabactor which windows will be used to insert the node
  * @param {Function} nodeBuilder
  *        A function that, when executed, returns a DOM node to be inserted into
  *        the canvasFrame
  */
 function CanvasFrameAnonymousContentHelper(tabActor, nodeBuilder) {
   this.tabActor = tabActor;
   this.nodeBuilder = nodeBuilder;
-  this.anonymousContentDocument = this.tabActor.window.document;
 
   this._insert();
 
   this._onNavigate = this._onNavigate.bind(this);
   events.on(this.tabActor, "navigate", this._onNavigate);
 }
 
 CanvasFrameAnonymousContentHelper.prototype = {
   destroy: function() {
     // If the current window isn't the one the content was inserted into, this
     // will fail, but that's fine.
     try {
-      let doc = this.anonymousContentDocument;
+      let doc = this.tabActor.window.document;
       doc.removeAnonymousContent(this._content);
-    } catch (e) {console.log(e)}
+    } catch (e) {}
     events.off(this.tabActor, "navigate", this._onNavigate);
     this.tabActor = this.nodeBuilder = this._content = null;
-    this.anonymousContentDocument = null;
   },
 
   _insert: function() {
     // Re-insert the content node after page navigation only if the new page
     // isn't XUL.
     if (!isXUL(this.tabActor)) {
       // For now highlighter.css is injected in content as a ua sheet because
       // <style scoped> doesn't work inside anonymous content (see bug 1086532).