Bug 1371130: expose methods to get ::before, ::after, and the other NAC pseudos. r=heycam

MozReview-Commit-ID: JVeQevmjI3j
This commit is contained in:
Emilio Cobos Álvarez 2017-06-18 19:39:57 +02:00
Родитель cbba1b6268
Коммит 1ffa4c98ce
3 изменённых файлов: 35 добавлений и 0 удалений

Просмотреть файл

@ -222,6 +222,37 @@ Gecko_GetDocumentElement(RawGeckoDocumentBorrowed aDoc)
return aDoc->GetDocumentElement();
}
RawGeckoElementBorrowedOrNull
Gecko_GetBeforeOrAfterPseudo(RawGeckoElementBorrowed aElement, bool aIsBefore)
{
MOZ_ASSERT(aElement);
MOZ_ASSERT(aElement->HasProperties());
return aIsBefore
? nsLayoutUtils::GetBeforePseudo(aElement)
: nsLayoutUtils::GetAfterPseudo(aElement);
}
nsTArray<nsIContent*>*
Gecko_GetAnonymousContentForElement(RawGeckoElementBorrowed aElement)
{
nsIAnonymousContentCreator* ac = do_QueryFrame(aElement->GetPrimaryFrame());
if (!ac) {
return nullptr;
}
auto* array = new nsTArray<nsIContent*>();
nsContentUtils::AppendNativeAnonymousChildren(aElement, *array, 0);
return array;
}
void
Gecko_DestroyAnonymousContentList(nsTArray<nsIContent*>* aAnonContent)
{
MOZ_ASSERT(aAnonContent);
delete aAnonContent;
}
StyleChildrenIteratorOwnedOrNull
Gecko_MaybeCreateStyleChildrenIterator(RawGeckoNodeBorrowed aNode)
{

Просмотреть файл

@ -136,6 +136,9 @@ RawGeckoElementBorrowedOrNull Gecko_GetFirstChildElement(RawGeckoElementBorrowed
RawGeckoElementBorrowedOrNull Gecko_GetLastChildElement(RawGeckoElementBorrowed element);
RawGeckoElementBorrowedOrNull Gecko_GetPrevSiblingElement(RawGeckoElementBorrowed element);
RawGeckoElementBorrowedOrNull Gecko_GetNextSiblingElement(RawGeckoElementBorrowed element);
RawGeckoElementBorrowedOrNull Gecko_GetBeforeOrAfterPseudo(RawGeckoElementBorrowed element, bool is_before);
nsTArray<nsIContent*>* Gecko_GetAnonymousContentForElement(RawGeckoElementBorrowed element);
void Gecko_DestroyAnonymousContentList(nsTArray<nsIContent*>* anon_content);
RawGeckoElementBorrowedOrNull Gecko_GetDocumentElement(RawGeckoDocumentBorrowed document);
void Gecko_LoadStyleSheet(mozilla::css::Loader* loader,
mozilla::ServoStyleSheet* parent,

Просмотреть файл

@ -329,6 +329,7 @@ structs-types = [
"mozilla::css::URLValue",
"mozilla::MallocSizeOf",
"mozilla::Side",
"nsIContent",
"RawGeckoAnimationPropertySegment",
"RawGeckoComputedTiming",
"RawGeckoCSSPropertyIDList",