stylo: Serialization of font for canvas is different from gecko

RESOLVED FIXED in Firefox 55

Status

()

P2
normal
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: hiro, Assigned: hiro)

Tracking

Trunk
mozilla55
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox55 fixed)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

2 years ago
Gecko returns "10px sans-serif", whereas stylo returns "normal normal normal normal 10px sans-serif".

Below test cases fail because of this bug:

 dom/canvas/test/test_canvas_font_setter.html
 dom/canvas/test/test_canvas.html
(Assignee)

Comment 1

2 years ago
This is caused by the difference of serialization of font shorthand property.
Depends on: 1345218
Assignee: nobody → hikezoe
Priority: -- → P2
(Assignee)

Comment 2

2 years ago
From the canvas spec [1]

 For example, after the following statement:

 context.font = 'italic 400 12px/2 Unknown Font, sans-serif';

 ...the expression context.font would evaluate to the string "italic 12px "Unknown Font", sans-serif". The "400" font-weight doesn't appear because that is the default value. The line-height doesn't appear because it is forced to "normal", the default value.

As per this spec, we need another serialization function to drop default values for canvas.

[1] https://html.spec.whatwg.org/multipage/scripting.html#dom-context-2d-font
Comment hidden (mozreview-request)
Comment hidden (mozreview-request)

Comment 6

2 years ago
mozreview-review
Comment on attachment 8869353 [details]
Bug 1362914 - Factor out PropertyDeclaration only iterator.

https://reviewboard.mozilla.org/r/140996/#review144664
Attachment #8869353 - Flags: review?(manishearth) → review+

Comment 7

2 years ago
mozreview-review
Comment on attachment 8869354 [details]
Bug 1362914 - Drop initial values of properties other than font-size and font-family in serialization of canvas font attribute.

https://reviewboard.mozilla.org/r/140998/#review144668
Attachment #8869354 - Flags: review?(manishearth) → review+
Comment hidden (mozreview-request)
(Assignee)

Updated

2 years ago
Attachment #8869353 - Attachment is obsolete: true

Comment 10

2 years ago
Pushed by hikezoe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/0db843910232
Drop initial values of properties other than font-size and font-family in serialization of canvas font attribute. r=manishearth

Comment 11

2 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/0db843910232
Status: NEW → RESOLVED
Last Resolved: 2 years ago
status-firefox55: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.