From 214f939d125c00714f871a152f23b671571dc515 Mon Sep 17 00:00:00 2001 From: Cameron McCormack Date: Tue, 5 May 2015 14:00:28 +1000 Subject: [PATCH] Bug 1160724 - Part 1: Resolve a properly parented style context when looking up -moz-binding of a display:none XUL/plugin element. r=dbaron --- dom/base/Element.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/dom/base/Element.cpp b/dom/base/Element.cpp index 1643c06e2f5..f54765c6c36 100644 --- a/dom/base/Element.cpp +++ b/dom/base/Element.cpp @@ -139,6 +139,7 @@ #include "mozilla/dom/WindowBinding.h" #include "mozilla/dom/ElementBinding.h" #include "mozilla/dom/VRDevice.h" +#include "nsComputedDOMStyle.h" using namespace mozilla; using namespace mozilla::dom; @@ -385,7 +386,7 @@ Element::GetBindingURL(nsIDocument *aDocument, css::URLValue **aResult) IsHTMLElement(nsGkAtoms::object) || IsHTMLElement(nsGkAtoms::embed) || IsHTMLElement(nsGkAtoms::applet)); - nsIPresShell *shell = aDocument->GetShell(); + nsCOMPtr shell = aDocument->GetShell(); if (!shell || GetPrimaryFrame() || !isXULorPluginElement) { *aResult = nullptr; @@ -393,11 +394,8 @@ Element::GetBindingURL(nsIDocument *aDocument, css::URLValue **aResult) } // Get the computed -moz-binding directly from the style context - nsPresContext *pctx = shell->GetPresContext(); - NS_ENSURE_TRUE(pctx, false); - - nsRefPtr sc = pctx->StyleSet()->ResolveStyleFor(this, - nullptr); + nsRefPtr sc = + nsComputedDOMStyle::GetStyleContextForElementNoFlush(this, nullptr, shell); NS_ENSURE_TRUE(sc, false); *aResult = sc->StyleDisplay()->mBinding;