summaryrefslogtreecommitdiffstats
path: root/dom/base/AnonymousContent.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dom/base/AnonymousContent.cpp')
-rw-r--r--dom/base/AnonymousContent.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/dom/base/AnonymousContent.cpp b/dom/base/AnonymousContent.cpp
index 1df36b048..aea923f2b 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