Bug 1410624: Add a Document::elements_with_id API. r=xidorn
authorEmilio Cobos Álvarez <emilio@crisal.io>
Fri, 27 Oct 2017 11:45:34 +0200
changeset 443451 8b2b76c7fe9ff7b8855435ce89158acc6ec05d67
parent 443450 cea3b79ef85fc0220514d5b1848a9ffa13fb21a0
child 443452 ab10dee6754602dc43038618032c2a6b06396661
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersxidorn
bugs1410624
milestone58.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
Bug 1410624: Add a Document::elements_with_id API. r=xidorn MozReview-Commit-ID: BNtbJp0RI68
layout/style/ServoBindings.cpp
layout/style/ServoBindings.h
layout/style/ServoBindings.toml
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -2866,8 +2866,17 @@ Gecko_ContentList_AppendAll(
   MOZ_ASSERT(aList);
 
   aList->SetCapacity(aLength);
 
   for (size_t i = 0; i < aLength; ++i) {
     aList->AppendElement(const_cast<Element*>(aElements[i]));
   }
 }
+
+const nsTArray<Element*>*
+Gecko_GetElementsWithId(const nsIDocument* aDocument, nsAtom* aId)
+{
+  MOZ_ASSERT(aDocument);
+  MOZ_ASSERT(aId);
+
+  return aDocument->GetAllElementsForId(nsDependentAtomString(aId));
+}
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -712,11 +712,15 @@ void Gecko_ReportUnexpectedCSSError(mozi
                                     uint32_t lineNumber,
                                     uint32_t colNumber);
 
 // DOM APIs.
 void Gecko_ContentList_AppendAll(nsSimpleContentList* aContentList,
                                  const RawGeckoElement** aElements,
                                  size_t aLength);
 
+const nsTArray<mozilla::dom::Element*>* Gecko_GetElementsWithId(
+    const nsIDocument* aDocument,
+    nsAtom* aId);
+
 } // extern "C"
 
 #endif // mozilla_ServoBindings_h
--- a/layout/style/ServoBindings.toml
+++ b/layout/style/ServoBindings.toml
@@ -470,16 +470,17 @@ structs-types = [
     "nsIDocument",
     "nsIDocument_DocumentTheme",
     "nsSimpleContentList",
     "RawGeckoAnimationPropertySegment",
     "RawGeckoComputedTiming",
     "RawGeckoCSSPropertyIDList",
     "RawGeckoDocument",
     "RawGeckoElement",
+    "Element",
     "RawGeckoKeyframeList",
     "RawGeckoPropertyValuePairList",
     "RawGeckoComputedKeyframeValuesList",
     "RawGeckoFontFaceRuleList",
     "RawGeckoNode",
     "RawServoAnimationValue",
     "RawGeckoServoAnimationValueList",
     "RawServoMediaList",