Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upCorrectly handle local sources for CSS3 fonts #9149
Merged
Conversation
This test tries to add a web font to the `FontCacheTask`. The added web font corresponds to the following CSS font definition: ``` @font-face { font-family: "test family"; src: local(test font face); } ``` This test fails, since `FontCacheTask` tries to get the value for the key "test font face" from `self.web_families`, but previously initialized a value for the key "test family".
The argument to `local()` is not a font family, but the name of a »single font face within a larger family« according to http://www.w3.org/TR/css3-fonts/#src-desc. The previous implementation of `FontCache::run` would panic if the argument to `local()` would not be the name of a font family present in `self.web_families`. That happened since `FontCacheTask` tried to use the argument to `local()` as a key for `self.web_families`, although it previously correctly initialized a value for the `family` field of the `AddWebFont` command.
|
r? @glennw |
|
@bors-servo r+ Thanks! |
|
|
bors-servo
added a commit
that referenced
this pull request
Jan 7, 2016
Correctly handle local sources for CSS3 fonts Currently, servo panics for me when loading something like this: ``` @font-face { font-family: "test family"; src: local(test font face); } ``` That's due to a bug in `FontCacheTask`. `FontCacheTask` tries to get the value for the key "test font face" from `self.web_families`, but previously initialized a value for the key "test family". These two commits add an awkward test and fix the bug by not shadowing the variable `family_name`. Since the argument to `local()` should explicitly not be the name of a font family, the previous variable name was wrong and misleading anyways. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9149) <!-- Reviewable:end -->
|
|
|
@bors-servo retry |
|
|
|
|
|
@bors-servo retry |
|
|
|
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
adrianheine commentedJan 4, 2016
Currently, servo panics for me when loading something like this:
That's due to a bug in
FontCacheTask.FontCacheTasktries to get the value for the key"test font face" from
self.web_families, but previously initialized a value for the key "test family".These two commits add an awkward test and fix the bug by not shadowing the variable
family_name. Since the argument tolocal()should explicitly not be the name of a font family, the previous variable name was wrong and misleading anyways.