Closed
Bug 728723
Opened 13 years ago
Closed 11 years ago
The computed value of all em valued CSS properties on SVG elements should update when font-size prefs change
Categories
(Core :: SVG, defect)
Core
SVG
Tracking
()
RESOLVED
FIXED
mozilla25
People
(Reporter: jwatt, Assigned: heycam)
References
Details
Attachments
(2 files)
There seems to be a problem, where not all em valued properties on SVG elements have their computed value (a px value) updated when font-size prefs change. (This does not seem to be a problem for HTML elements.) Specifically, while the computed value of an em valued word-spacing property updates, the computed value of an em valued margin-bottom property does not.
I'm assuming this has something to do with the way that style is split across various style structs, but I've not been able to track down the problem yet.
It's also worth noting that if the font-size is coming from an explicitly set font-size on an ancestor rather than the default prefs, then there's no problem.
Reporter | ||
Comment 1•13 years ago
|
||
Comment 2•13 years ago
|
||
What's going on is that when you getComputedStyle for a margin we flush out layout and then call GetUsedMargin() on the frame.
When the font size is changed dynamically, we get a style reresolve and a new style context. We end up nsFrame::DidSetStyleContext which does this:
// If we detect a change on margin, padding or border, we store the old
// values on the frame itself between now and reflow, so if someone
// calls GetUsed(Margin|Border|Padding)() before the next reflow, we
// can give an accurate answer.
This caches the old margin _if_it_exists_. That's important, because SVG by default never asks for margin data, and so by default the margin would not exist for SVG. A reflow flush is supposed to get rid of these cached values when nsCSSOffsetState::InitOffsets is called from nsHTMLReflowState initialization. But of course SVG never calls into that code. So when we get the computed style we end up with the cached value we saved, if we saved one at all.
I get exactly the same behavior with changes to font-size in the page, of course. The first time you examine the computed style, no matter how many times font size has changed before that, you get correct values, since we actually go and compute it. After that we always use the cached value. You can see that with the attached testcase: load it, then without clicking on it change your font prefs and watch the alert have the right value. After that, the value sticks around for the remainder of the frame's lifetime.
So the solution is that SVG needs to either not cache the used margin in DidSetStyleContext or needs to actually clear it when it would normally reflow.
Comment 3•13 years ago
|
||
Comment 4•11 years ago
|
||
Conversion to CSS Text has fixed this.
Updated•11 years ago
|
You need to log in
before you can comment on or make changes to this bug.
Description
•