зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1324700 - Add a function which is equivalent to ResolveStyleForFilter for servo. r=heycam
Also ResolveStyleForFilter is renamed to ResolveFilterStyle for consistency. MozReview-Commit-ID: IEOxNexpnl5 --HG-- extra : rebase_source : bd806654b3e5462b3abb4fc226b3824bc0acb71f
This commit is contained in:
Родитель
1e6deac4e2
Коммит
3f46fb9acf
|
@ -2924,7 +2924,7 @@ CreateFilterDeclaration(const nsAString& aFilter,
|
|||
}
|
||||
|
||||
static already_AddRefed<nsStyleContext>
|
||||
ResolveStyleForFilter(const nsAString& aFilterString,
|
||||
ResolveFilterStyle(const nsAString& aFilterString,
|
||||
nsIPresShell* aPresShell,
|
||||
nsStyleContext* aParentContext,
|
||||
ErrorResult& aError)
|
||||
|
@ -2963,6 +2963,42 @@ ResolveStyleForFilter(const nsAString& aFilterString,
|
|||
return sc.forget();
|
||||
}
|
||||
|
||||
static already_AddRefed<RawServoDeclarationBlock>
|
||||
CreateFilterDeclarationForServo(const nsAString& aFilter,
|
||||
nsIDocument* aDocument)
|
||||
{
|
||||
return CreateDeclarationForServo(eCSSProperty_filter, aFilter, aDocument);
|
||||
}
|
||||
|
||||
static already_AddRefed<ServoComputedValues>
|
||||
ResolveFilterStyleForServo(const nsAString& aFilterString,
|
||||
const ServoComputedValues* aParentStyle,
|
||||
nsIPresShell* aPresShell,
|
||||
ErrorResult& aError)
|
||||
{
|
||||
MOZ_ASSERT(aPresShell->StyleSet()->IsServo());
|
||||
|
||||
RefPtr<RawServoDeclarationBlock> declarations =
|
||||
CreateFilterDeclarationForServo(aFilterString, aPresShell->GetDocument());
|
||||
if (!declarations) {
|
||||
// Refuse to accept the filter, but do not throw an error.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// In addition to unparseable values, the spec says we need to reject
|
||||
// 'inherit' and 'initial'.
|
||||
if (Servo_DeclarationBlock_HasCSSWideKeyword(declarations,
|
||||
eCSSProperty_filter)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ServoStyleSet* styleSet = aPresShell->StyleSet()->AsServo();
|
||||
RefPtr<ServoComputedValues> computedValues =
|
||||
styleSet->ResolveForDeclarations(aParentStyle, declarations);
|
||||
|
||||
return computedValues.forget();
|
||||
}
|
||||
|
||||
bool
|
||||
CanvasRenderingContext2D::ParseFilter(const nsAString& aString,
|
||||
nsTArray<nsStyleFilter>& aFilterChain,
|
||||
|
@ -2990,7 +3026,7 @@ CanvasRenderingContext2D::ParseFilter(const nsAString& aString,
|
|||
}
|
||||
|
||||
RefPtr<nsStyleContext> sc =
|
||||
ResolveStyleForFilter(aString, presShell, parentContext, aError);
|
||||
ResolveFilterStyle(aString, presShell, parentContext, aError);
|
||||
|
||||
if (!sc) {
|
||||
return false;
|
||||
|
|
Загрузка…
Ссылка в новой задаче