Bug 1362914 - Drop initial values of properties other than font-size and font-family in serialization of canvas font attribute. r=manishearth

According to the canvas spec [1], we must drop initial values other than
font-size and font-family when we serialize canvas font attribute.
As for font-size and font-family, the default values, '10px sans-serif' [2]
are not dropped at all.

[1] https://html.spec.whatwg.org/multipage/scripting.html#dom-context-2d-font
[2] https://html.spec.whatwg.org/multipage/scripting.html#canvastextdrawingstyles

MozReview-Commit-ID: EyOxzJCQYQl

--HG--
extra : rebase_source : d358a8e97fa7849a320a3619e746a526fe2a8439
This commit is contained in:
Hiroyuki Ikezoe 2017-05-20 07:38:26 +09:00
Родитель 34fd4e6344
Коммит 5c43533704
2 изменённых файлов: 6 добавлений и 3 удалений

Просмотреть файл

@ -2901,9 +2901,7 @@ GetFontStyleForServo(Element* aElement, const nsAString& aFont,
// parsed (including having line-height removed). (Older drafts of
// the spec required font sizes be converted to pixels, but that no
// longer seems to be required.)
Servo_DeclarationBlock_SerializeOneValue(declarations,
eCSSProperty_font,
&aOutUsedFont);
Servo_SerializeFontValueForCanvas(declarations, &aOutUsedFont);
return sc.forget();
}

Просмотреть файл

@ -473,6 +473,11 @@ SERVO_BINDING_FUNC(Servo_StyleSet_GetBaseComputedValuesForElement,
const mozilla::ServoElementSnapshotTable* snapshots,
mozilla::CSSPseudoElementType pseudo_type)
// For canvas font.
SERVO_BINDING_FUNC(Servo_SerializeFontValueForCanvas, void,
RawServoDeclarationBlockBorrowed declarations,
nsAString* buffer)
// Style-struct management.
#define STYLE_STRUCT(name, checkdata_cb) \
struct nsStyle##name; \