summaryrefslogtreecommitdiff
path: root/dom
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-12-20 23:08:47 +0100
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-12-20 23:08:47 +0100
commit58ed1d306526743ee3d37c2add995839c9e8d848 (patch)
tree9d042110d977eea7839bc992d736fdfeb0462f44 /dom
parent0d8fcebf088b052dff710db3f9704d3e2ede7a47 (diff)
downloaduxp-58ed1d306526743ee3d37c2add995839c9e8d848.tar.gz
Issue mcp-graveyard/UXP#1219 - Align computed DOM styles with mainstream behvior.
This updates our behavior for computed DOM styling to no longer return null on elements that have no display, but return a 0-length (empty) style instead and don't throw. For this we stop looking at having a presentation for the style and just look at the document instead. This resolves #1219
Diffstat (limited to 'dom')
-rw-r--r--dom/base/nsGlobalWindow.cpp27
-rw-r--r--dom/smil/nsSMILCSSProperty.cpp8
2 files changed, 3 insertions, 32 deletions
diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp
index 1288b34353..47b46dda06 100644
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -10950,35 +10950,12 @@ nsGlobalWindow::GetComputedStyleHelperOuter(Element& aElt,
{
MOZ_RELEASE_ASSERT(IsOuterWindow());
- if (!mDocShell) {
+ if (!mDoc) {
return nullptr;
}
- nsCOMPtr<nsIPresShell> presShell = mDocShell->GetPresShell();
-
- if (!presShell) {
- // Try flushing frames on our parent in case there's a pending
- // style change that will create the presshell.
- auto* parent = nsGlobalWindow::Cast(GetPrivateParent());
- if (!parent) {
- return nullptr;
- }
-
- parent->FlushPendingNotifications(Flush_Frames);
-
- // Might have killed mDocShell
- if (!mDocShell) {
- return nullptr;
- }
-
- presShell = mDocShell->GetPresShell();
- if (!presShell) {
- return nullptr;
- }
- }
-
RefPtr<nsComputedDOMStyle> compStyle =
- NS_NewComputedDOMStyle(&aElt, aPseudoElt, presShell,
+ NS_NewComputedDOMStyle(&aElt, aPseudoElt, mDoc,
aDefaultStylesOnly ? nsComputedDOMStyle::eDefaultOnly :
nsComputedDOMStyle::eAll);
diff --git a/dom/smil/nsSMILCSSProperty.cpp b/dom/smil/nsSMILCSSProperty.cpp
index 53f3e0fbf7..e745124432 100644
--- a/dom/smil/nsSMILCSSProperty.cpp
+++ b/dom/smil/nsSMILCSSProperty.cpp
@@ -38,14 +38,8 @@ GetCSSComputedValue(Element* aElem,
return false;
}
- nsIPresShell* shell = doc->GetShell();
- if (!shell) {
- NS_WARNING("Unable to look up computed style -- no pres shell");
- return false;
- }
-
RefPtr<nsComputedDOMStyle> computedStyle =
- NS_NewComputedDOMStyle(aElem, EmptyString(), shell);
+ NS_NewComputedDOMStyle(aElem, EmptyString(), doc);
computedStyle->GetPropertyValue(aPropID, aResult);
return true;