Loading dom/base/AnonymousContent.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -197,5 +197,16 @@ void AnonymousContent::GetComputedStylePropertyValue( aRv = cs->GetPropertyValue(aPropertyName, aResult); } void AnonymousContent::GetTargetIdForEvent(Event& aEvent, DOMString& aResult) { nsCOMPtr<Element> el = do_QueryInterface(aEvent.GetOriginalTarget()); if (el && el->IsInNativeAnonymousSubtree() && mContentNode->Contains(el)) { aResult.SetKnownLiveAtom(el->GetID(), DOMString::eTreatNullAsNull); return; } aResult.SetNull(); } } // namespace dom } // namespace mozilla dom/base/AnonymousContent.h +3 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ #define mozilla_dom_AnonymousContent_h #include "mozilla/dom/Element.h" #include "mozilla/dom/Event.h" #include "nsCycleCollectionParticipant.h" #include "nsICSSDeclaration.h" #include "mozilla/dom/Document.h" Loading Loading @@ -68,6 +69,8 @@ class AnonymousContent final { const nsAString& aPropertyName, DOMString& aResult, ErrorResult& aRv); void GetTargetIdForEvent(Event& aEvent, DOMString& aResult); private: ~AnonymousContent(); RefPtr<Element> mContentNode; Loading dom/webidl/AnonymousContent.webidl +6 −0 Original line number Diff line number Diff line Loading @@ -85,4 +85,10 @@ interface AnonymousContent { [Throws] DOMString? getComputedStylePropertyValue(DOMString elementId, DOMString propertyName); /** * If event's original target is in the anonymous content, this returns the id * attribute value of the target. */ DOMString? getTargetIdForEvent(Event event); }; Loading
dom/base/AnonymousContent.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -197,5 +197,16 @@ void AnonymousContent::GetComputedStylePropertyValue( aRv = cs->GetPropertyValue(aPropertyName, aResult); } void AnonymousContent::GetTargetIdForEvent(Event& aEvent, DOMString& aResult) { nsCOMPtr<Element> el = do_QueryInterface(aEvent.GetOriginalTarget()); if (el && el->IsInNativeAnonymousSubtree() && mContentNode->Contains(el)) { aResult.SetKnownLiveAtom(el->GetID(), DOMString::eTreatNullAsNull); return; } aResult.SetNull(); } } // namespace dom } // namespace mozilla
dom/base/AnonymousContent.h +3 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ #define mozilla_dom_AnonymousContent_h #include "mozilla/dom/Element.h" #include "mozilla/dom/Event.h" #include "nsCycleCollectionParticipant.h" #include "nsICSSDeclaration.h" #include "mozilla/dom/Document.h" Loading Loading @@ -68,6 +69,8 @@ class AnonymousContent final { const nsAString& aPropertyName, DOMString& aResult, ErrorResult& aRv); void GetTargetIdForEvent(Event& aEvent, DOMString& aResult); private: ~AnonymousContent(); RefPtr<Element> mContentNode; Loading
dom/webidl/AnonymousContent.webidl +6 −0 Original line number Diff line number Diff line Loading @@ -85,4 +85,10 @@ interface AnonymousContent { [Throws] DOMString? getComputedStylePropertyValue(DOMString elementId, DOMString propertyName); /** * If event's original target is in the anonymous content, this returns the id * attribute value of the target. */ DOMString? getTargetIdForEvent(Event event); };