зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1397644 part 1 - Implement XUL tree pseudo style resolution for stylo. r=emilio
MozReview-Commit-ID: 5JqvLv3tt5m --HG-- extra : source : 23a7db4b7938b095947abeb41edb0cb6375f95da
This commit is contained in:
Родитель
0acfc35aa7
Коммит
e175680895
|
@ -586,6 +586,13 @@ SERVO_BINDING_FUNC(Servo_ResolvePseudoStyle, ServoStyleContextStrong,
|
|||
bool is_probe,
|
||||
ServoStyleContextBorrowedOrNull inherited_style,
|
||||
RawServoStyleSetBorrowed set)
|
||||
SERVO_BINDING_FUNC(Servo_ComputedValues_ResolveXULTreePseudoStyle,
|
||||
ServoStyleContextStrong,
|
||||
RawGeckoElementBorrowed element,
|
||||
nsAtom* pseudo_tag,
|
||||
ServoStyleContextBorrowed inherited_style,
|
||||
const mozilla::AtomArray* input_word,
|
||||
RawServoStyleSetBorrowed set)
|
||||
SERVO_BINDING_FUNC(Servo_SetExplicitStyle, void,
|
||||
RawGeckoElementBorrowed element,
|
||||
ServoStyleContextBorrowed primary_style)
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "mozilla/AtomArray.h"
|
||||
#include "mozilla/ServoTypes.h"
|
||||
#include "mozilla/ServoBindingTypes.h"
|
||||
#include "mozilla/ServoElementSnapshot.h"
|
||||
|
|
|
@ -142,6 +142,7 @@ whitelist-types = [
|
|||
"RawGecko.*",
|
||||
"mozilla::AnimationPropertySegment",
|
||||
"mozilla::AnonymousCounterStyle",
|
||||
"mozilla::AtomArray",
|
||||
"mozilla::ComputedTiming",
|
||||
"mozilla::ComputedTimingFunction",
|
||||
"mozilla::ComputedTimingFunction::BeforeFlag",
|
||||
|
@ -390,6 +391,7 @@ structs-types = [
|
|||
"mozilla::css::URLValue",
|
||||
"mozilla::css::URLValueData",
|
||||
"mozilla::AnonymousCounterStyle",
|
||||
"mozilla::AtomArray",
|
||||
"mozilla::MallocSizeOf",
|
||||
"mozilla::OriginFlags",
|
||||
"mozilla::UniquePtr",
|
||||
|
|
|
@ -701,6 +701,27 @@ ServoStyleSet::ResolveNonInheritingAnonymousBoxStyle(nsAtom* aPseudoTag)
|
|||
return computedValues.forget();
|
||||
}
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
already_AddRefed<ServoStyleContext>
|
||||
ServoStyleSet::ResolveXULTreePseudoStyle(dom::Element* aParentElement,
|
||||
nsICSSAnonBoxPseudo* aPseudoTag,
|
||||
ServoStyleContext* aParentContext,
|
||||
const AtomArray& aInputWord)
|
||||
{
|
||||
MOZ_ASSERT(nsCSSAnonBoxes::IsTreePseudoElement(aPseudoTag));
|
||||
MOZ_ASSERT(aParentContext);
|
||||
MOZ_ASSERT(!StylistNeedsUpdate());
|
||||
|
||||
return Servo_ComputedValues_ResolveXULTreePseudoStyle(
|
||||
aParentElement,
|
||||
aPseudoTag,
|
||||
aParentContext,
|
||||
&aInputWord,
|
||||
mRawSet.get()
|
||||
).Consume();
|
||||
}
|
||||
#endif
|
||||
|
||||
// manage the set of style sheets in the style set
|
||||
nsresult
|
||||
ServoStyleSet::AppendStyleSheet(SheetType aType,
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#ifndef mozilla_ServoStyleSet_h
|
||||
#define mozilla_ServoStyleSet_h
|
||||
|
||||
#include "mozilla/AtomArray.h"
|
||||
#include "mozilla/EffectCompositor.h"
|
||||
#include "mozilla/EnumeratedArray.h"
|
||||
#include "mozilla/EventStates.h"
|
||||
|
@ -239,6 +240,14 @@ public:
|
|||
already_AddRefed<ServoStyleContext>
|
||||
ResolveNonInheritingAnonymousBoxStyle(nsAtom* aPseudoTag);
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
already_AddRefed<ServoStyleContext>
|
||||
ResolveXULTreePseudoStyle(dom::Element* aParentElement,
|
||||
nsICSSAnonBoxPseudo* aPseudoTag,
|
||||
ServoStyleContext* aParentContext,
|
||||
const AtomArray& aInputWord);
|
||||
#endif
|
||||
|
||||
// manage the set of style sheets in the style set
|
||||
nsresult AppendStyleSheet(SheetType aType, ServoStyleSheet* aSheet);
|
||||
nsresult PrependStyleSheet(SheetType aType, ServoStyleSheet* aSheet);
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#ifndef mozilla_StyleSetHandle_h
|
||||
#define mozilla_StyleSetHandle_h
|
||||
|
||||
#include "mozilla/AtomArray.h"
|
||||
#include "mozilla/EventStates.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/ServoTypes.h"
|
||||
|
@ -29,6 +30,7 @@ class nsBindingManager;
|
|||
class nsCSSCounterStyleRule;
|
||||
struct nsFontFaceRuleContainer;
|
||||
class nsAtom;
|
||||
class nsICSSAnonBoxPseudo;
|
||||
class nsIContent;
|
||||
class nsIDocument;
|
||||
class nsStyleContext;
|
||||
|
@ -144,6 +146,13 @@ public:
|
|||
nsStyleContext* aParentContext);
|
||||
inline already_AddRefed<nsStyleContext>
|
||||
ResolveNonInheritingAnonymousBoxStyle(nsAtom* aPseudoTag);
|
||||
#ifdef MOZ_XUL
|
||||
inline already_AddRefed<nsStyleContext>
|
||||
ResolveXULTreePseudoStyle(dom::Element* aParentElement,
|
||||
nsICSSAnonBoxPseudo* aPseudoTag,
|
||||
nsStyleContext* aParentContext,
|
||||
const AtomArray& aInputWord);
|
||||
#endif
|
||||
inline nsresult AppendStyleSheet(SheetType aType, StyleSheet* aSheet);
|
||||
inline nsresult PrependStyleSheet(SheetType aType, StyleSheet* aSheet);
|
||||
inline nsresult RemoveStyleSheet(SheetType aType, StyleSheet* aSheet);
|
||||
|
|
|
@ -152,6 +152,18 @@ StyleSetHandle::Ptr::ResolveNonInheritingAnonymousBoxStyle(nsAtom* aPseudoTag)
|
|||
FORWARD(ResolveNonInheritingAnonymousBoxStyle, (aPseudoTag));
|
||||
}
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
already_AddRefed<nsStyleContext>
|
||||
StyleSetHandle::Ptr::ResolveXULTreePseudoStyle(dom::Element* aParentElement,
|
||||
nsICSSAnonBoxPseudo* aPseudoTag,
|
||||
nsStyleContext* aParentContext,
|
||||
const AtomArray& aInputWord)
|
||||
{
|
||||
FORWARD_WITH_PARENT(ResolveXULTreePseudoStyle, aParentContext,
|
||||
(aParentElement, aPseudoTag, parent, aInputWord));
|
||||
}
|
||||
#endif
|
||||
|
||||
// manage the set of style sheets in the style set
|
||||
nsresult
|
||||
StyleSetHandle::Ptr::AppendStyleSheet(SheetType aType, StyleSheet* aSheet)
|
||||
|
|
|
@ -79,17 +79,9 @@ nsTreeStyleCache::GetStyleContext(nsPresContext* aPresContext,
|
|||
}
|
||||
if (!result) {
|
||||
// We missed the cache. Resolve this pseudo-style.
|
||||
// XXXheycam ServoStyleSets do not support XUL tree styles.
|
||||
RefPtr<nsStyleContext> newResult;
|
||||
if (aPresContext->StyleSet()->IsServo()) {
|
||||
NS_ERROR("stylo: ServoStyleSets should not support XUL tree styles yet");
|
||||
newResult = aPresContext->StyleSet()->
|
||||
ResolveStyleForPlaceholder();
|
||||
} else {
|
||||
newResult = aPresContext->StyleSet()->AsGecko()->
|
||||
ResolveXULTreePseudoStyle(aContent->AsElement(), aPseudoElement,
|
||||
aContext->AsGecko(), aInputWord);
|
||||
}
|
||||
RefPtr<nsStyleContext> newResult = aPresContext->StyleSet()->
|
||||
ResolveXULTreePseudoStyle(aContent->AsElement(),
|
||||
aPseudoElement, aContext, aInputWord);
|
||||
|
||||
// Put the style context in our table, transferring the owning reference to the table.
|
||||
if (!mCache) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче