From 37576b1895b5703a922d245409ae8cde5c6a7f41 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Wed, 31 May 2017 18:03:33 -0700 Subject: [PATCH] Bug 1346693 - Part 2: stylo: Use namespace ids for content: attr(..); r=heycam MozReview-Commit-ID: HdIffUCLHIy --- layout/reftests/bugs/reftest.list | 2 +- layout/style/ServoBindings.cpp | 17 +++++++++++++++++ layout/style/ServoBindings.h | 4 ++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list index 51b7720d7dda..7fcbd5d43c60 100644 --- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -981,7 +981,7 @@ fuzzy-if(Android,11,17) == 413361-1.html 413361-1-ref.html # bug 1128229 == 414123.xhtml 414123-ref.xhtml == 414638.html 414638-ref.html == 414851-1.html 414851-1-ref.html -fails-if(styloVsGecko||stylo) == 416106-1.xhtml 416106-1-ref.xhtml +== 416106-1.xhtml 416106-1-ref.xhtml == 416752-1.html 416752-1-ref.html == 417178-1.html 417178-1-ref.html == 417246-1.html 417246-1-ref.html diff --git a/layout/style/ServoBindings.cpp b/layout/style/ServoBindings.cpp index 8095de249309..b6d3cf587309 100644 --- a/layout/style/ServoBindings.cpp +++ b/layout/style/ServoBindings.cpp @@ -2239,6 +2239,23 @@ Gecko_AddPropertyToSet(nsCSSPropertyIDSetBorrowedMut aPropertySet, aPropertySet->AddProperty(aProperty); } +int32_t +Gecko_RegisterNamespace(nsIAtom* aNamespace) +{ + int32_t id; + + MOZ_ASSERT(NS_IsMainThread()); + + nsAutoString str; + aNamespace->ToString(str); + nsresult rv = nsContentUtils::NameSpaceManager()->RegisterNameSpace(str, id); + + if (NS_FAILED(rv)) { + return -1; + } + return id; +} + NS_IMPL_FFI_REFCOUNTING(nsCSSFontFaceRule, CSSFontFaceRule); nsCSSCounterStyleRule* diff --git a/layout/style/ServoBindings.h b/layout/style/ServoBindings.h index de179869c585..0db8a3566f96 100644 --- a/layout/style/ServoBindings.h +++ b/layout/style/ServoBindings.h @@ -558,6 +558,10 @@ bool Gecko_MatchStringArgPseudo(RawGeckoElementBorrowed element, void Gecko_AddPropertyToSet(nsCSSPropertyIDSetBorrowedMut, nsCSSPropertyID); +// Register a namespace and get a namespace id. +// Returns -1 on error (OOM) +int32_t Gecko_RegisterNamespace(nsIAtom* ns); + // Style-struct management. #define STYLE_STRUCT(name, checkdata_cb) \ void Gecko_Construct_Default_nsStyle##name( \