2018-06-22 19:48:42 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2018-11-13 01:20:52 +03:00
|
|
|
#include "MappedDeclarations.h"
|
|
|
|
|
|
|
|
#include "nsAttrValue.h"
|
2018-12-05 05:03:04 +03:00
|
|
|
#include "nsAttrValueInlines.h"
|
2019-01-02 16:05:23 +03:00
|
|
|
#include "mozilla/dom/Document.h"
|
2018-11-13 01:20:52 +03:00
|
|
|
#include "nsPresContext.h"
|
2018-06-22 19:48:42 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
void MappedDeclarations::SetIdentAtomValue(nsCSSPropertyID aId,
|
|
|
|
nsAtom* aValue) {
|
|
|
|
Servo_DeclarationBlock_SetIdentStringValue(mDecl, aId, aValue);
|
|
|
|
if (aId == eCSSProperty__x_lang) {
|
|
|
|
// This forces the lang prefs result to be cached so that we can access them
|
|
|
|
// off main thread during traversal.
|
|
|
|
//
|
|
|
|
// FIXME(emilio): Can we move mapped attribute declarations across
|
|
|
|
// documents? Isn't this wrong in that case? This is pretty out of place
|
|
|
|
// anyway.
|
2019-01-18 16:43:06 +03:00
|
|
|
mDocument->ForceCacheLang(aValue);
|
2018-06-22 19:48:42 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void MappedDeclarations::SetBackgroundImage(const nsAttrValue& aValue) {
|
|
|
|
if (aValue.Type() != nsAttrValue::eURL) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// FIXME(emilio): Going through URL parsing again seems slightly wasteful.
|
|
|
|
nsAutoString str;
|
|
|
|
aValue.ToString(str);
|
|
|
|
Servo_DeclarationBlock_SetBackgroundImage(
|
2019-03-30 23:18:33 +03:00
|
|
|
mDecl, &str, mDocument->DefaultStyleAttrURLData());
|
2018-06-22 19:48:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace mozilla
|