Merge inbound to mozilla-central. a=merge
authorBrindusan Cristian <cbrindusan@mozilla.com>
Tue, 02 Apr 2019 18:47:16 +0300
changeset 467569 92d1c344e7c53af9b8ad8a4192d93478f71ba5cf
parent 467568 2eb225d3082f82b45ddb42951069d01821903e72 (current diff)
parent 467516 bd1a81666a6bb95b89eb72dce23a340335483ac2 (diff)
child 467570 a6c6359636f707359a67830c6fd1dc227543689b
child 467617 9d343e5ad00b39fdd5d2d925393e1b985435ed6d
push id112633
push usercbrindusan@mozilla.com
push dateTue, 02 Apr 2019 15:52:18 +0000
treeherdermozilla-inbound@a6c6359636f7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge inbound to mozilla-central. a=merge
--- a/dom/base/AnonymousContent.cpp
+++ b/dom/base/AnonymousContent.cpp
@@ -192,10 +192,21 @@ void AnonymousContent::GetComputedStyleP
   }
 
   RefPtr<nsComputedDOMStyle> cs =
       new nsComputedDOMStyle(element, NS_LITERAL_STRING(""),
                              element->OwnerDoc(), nsComputedDOMStyle::eAll);
   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
--- a/dom/base/AnonymousContent.h
+++ b/dom/base/AnonymousContent.h
@@ -3,16 +3,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_dom_AnonymousContent_h
 #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"
 
 namespace mozilla {
 namespace dom {
 
 class Element;
@@ -63,16 +64,18 @@ class AnonymousContent final {
   void SetCutoutRectsForElement(const nsAString& aElementId,
                                 const Sequence<OwningNonNull<DOMRect>>& aRects,
                                 ErrorResult& aError);
 
   void GetComputedStylePropertyValue(const nsAString& aElementId,
                                      const nsAString& aPropertyName,
                                      DOMString& aResult, ErrorResult& aRv);
 
+  void GetTargetIdForEvent(Event& aEvent, DOMString& aResult);
+
  private:
   ~AnonymousContent();
   RefPtr<Element> mContentNode;
 };
 
 }  // namespace dom
 }  // namespace mozilla
 
--- a/dom/webidl/AnonymousContent.webidl
+++ b/dom/webidl/AnonymousContent.webidl
@@ -80,9 +80,15 @@ interface AnonymousContent {
 
   /**
    * Get the computed value of a property on an element inside this custom
    * anonymous content.
    */
   [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);
 };