Bug 1160724 - Part 1: Resolve a properly parented style context when looking up -moz-binding of a display:none XUL/plugin element. r=dbaron

This commit is contained in:
Cameron McCormack 2015-05-05 14:00:28 +10:00
Родитель 246c8ec28f
Коммит eacf3bc7dd
1 изменённых файлов: 4 добавлений и 6 удалений

Просмотреть файл

@ -139,6 +139,7 @@
#include "mozilla/dom/WindowBinding.h" #include "mozilla/dom/WindowBinding.h"
#include "mozilla/dom/ElementBinding.h" #include "mozilla/dom/ElementBinding.h"
#include "mozilla/dom/VRDevice.h" #include "mozilla/dom/VRDevice.h"
#include "nsComputedDOMStyle.h"
using namespace mozilla; using namespace mozilla;
using namespace mozilla::dom; using namespace mozilla::dom;
@ -385,7 +386,7 @@ Element::GetBindingURL(nsIDocument *aDocument, css::URLValue **aResult)
IsHTMLElement(nsGkAtoms::object) || IsHTMLElement(nsGkAtoms::object) ||
IsHTMLElement(nsGkAtoms::embed) || IsHTMLElement(nsGkAtoms::embed) ||
IsHTMLElement(nsGkAtoms::applet)); IsHTMLElement(nsGkAtoms::applet));
nsIPresShell *shell = aDocument->GetShell(); nsCOMPtr<nsIPresShell> shell = aDocument->GetShell();
if (!shell || GetPrimaryFrame() || !isXULorPluginElement) { if (!shell || GetPrimaryFrame() || !isXULorPluginElement) {
*aResult = nullptr; *aResult = nullptr;
@ -393,11 +394,8 @@ Element::GetBindingURL(nsIDocument *aDocument, css::URLValue **aResult)
} }
// Get the computed -moz-binding directly from the style context // Get the computed -moz-binding directly from the style context
nsPresContext *pctx = shell->GetPresContext(); nsRefPtr<nsStyleContext> sc =
NS_ENSURE_TRUE(pctx, false); nsComputedDOMStyle::GetStyleContextForElementNoFlush(this, nullptr, shell);
nsRefPtr<nsStyleContext> sc = pctx->StyleSet()->ResolveStyleFor(this,
nullptr);
NS_ENSURE_TRUE(sc, false); NS_ENSURE_TRUE(sc, false);
*aResult = sc->StyleDisplay()->mBinding; *aResult = sc->StyleDisplay()->mBinding;