Bug 1698238 return default dictionary from GetUserMediaRequest#getConstraints() if...
[gecko.git] / layout / style / MappedDeclarations.cpp
blobbd3f069b4c3290fe2ffa09099b8a16f521d73bc6
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "MappedDeclarations.h"
9 #include "nsAttrValue.h"
10 #include "nsAttrValueInlines.h"
11 #include "mozilla/dom/Document.h"
12 #include "nsPresContext.h"
14 namespace mozilla {
16 void MappedDeclarations::SetIdentAtomValue(nsCSSPropertyID aId,
17 nsAtom* aValue) {
18 Servo_DeclarationBlock_SetIdentStringValue(mDecl, aId, aValue);
19 if (aId == eCSSProperty__x_lang) {
20 // This forces the lang prefs result to be cached so that we can access them
21 // off main thread during traversal.
23 // FIXME(emilio): Can we move mapped attribute declarations across
24 // documents? Isn't this wrong in that case? This is pretty out of place
25 // anyway.
26 mDocument->ForceCacheLang(aValue);
30 void MappedDeclarations::SetBackgroundImage(const nsAttrValue& aValue) {
31 if (aValue.Type() != nsAttrValue::eURL) {
32 return;
34 nsAutoString str;
35 aValue.ToString(str);
36 nsAutoCString utf8;
37 CopyUTF16toUTF8(str, utf8);
38 Servo_DeclarationBlock_SetBackgroundImage(
39 mDecl, &utf8, mDocument->DefaultStyleAttrURLData());
42 } // namespace mozilla