diff options
author | Moonchild <moonchild@palemoon.org> | 2020-04-17 16:02:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-17 16:02:56 +0200 |
commit | d5102d6beafc2a2a0cec3cc3ee5f7ebde31ae7bf (patch) | |
tree | 2bfef192cbb748b675ce8308c242a376798e265d /dom/base/AnonymousContent.cpp | |
parent | 5caf99795aa81e1fc145b8e937b1ee8197ed2486 (diff) | |
parent | f35aa3e15fedf3cd4ad163d60ab74a9537ca5c82 (diff) | |
download | uxp-d5102d6beafc2a2a0cec3cc3ee5f7ebde31ae7bf.tar.gz |
Merge pull request #1518 from MoonchildProductions/shadowdom-merge
Incremental shadowdom-merge
Diffstat (limited to 'dom/base/AnonymousContent.cpp')
-rw-r--r-- | dom/base/AnonymousContent.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/dom/base/AnonymousContent.cpp b/dom/base/AnonymousContent.cpp index 1df36b0483..aea923f2bd 100644 --- a/dom/base/AnonymousContent.cpp +++ b/dom/base/AnonymousContent.cpp @@ -7,6 +7,7 @@ #include "AnonymousContent.h" #include "mozilla/dom/Element.h" #include "mozilla/dom/AnonymousContentBinding.h" +#include "nsComputedDOMStyle.h" #include "nsCycleCollectionParticipant.h" #include "nsIDocument.h" #include "nsIDOMHTMLCollection.h" @@ -208,5 +209,31 @@ AnonymousContent::WrapObject(JSContext* aCx, return AnonymousContentBinding::Wrap(aCx, this, aGivenProto, aReflector); } +void +AnonymousContent::GetComputedStylePropertyValue(const nsAString& aElementId, + const nsAString& aPropertyName, + DOMString& aResult, + ErrorResult& aRv) +{ + Element* element = GetElementById(aElementId); + if (!element) { + aRv.Throw(NS_ERROR_NOT_AVAILABLE); + return; + } + + nsIPresShell* shell = element->OwnerDoc()->GetShell(); + if (!shell) { + aRv.Throw(NS_ERROR_NOT_AVAILABLE); + return; + } + + RefPtr<nsComputedDOMStyle> cs = + new nsComputedDOMStyle(element, + NS_LITERAL_STRING(""), + element->OwnerDoc(), + nsComputedDOMStyle::eAll); + aRv = cs->GetPropertyValue(aPropertyName, aResult); +} + } // namespace dom } // namespace mozilla |