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 upAdd separate specified value for keyword font sizes #16016
Conversation
highfive
commented
Mar 18, 2017
|
Heads up! This PR modifies the following files:
|
highfive
commented
Mar 18, 2017
|
r? @upsuper |
| } | ||
| } | ||
|
|
||
| #[derive(Debug, Clone, PartialEq)] | ||
| #[cfg_attr(feature = "servo", derive(HeapSizeOf))] | ||
| pub struct SpecifiedValue(pub specified::LengthOrPercentage); | ||
| pub enum SpecifiedValue { |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
|
d641624
to
1695a2b
|
Please address the comments. |
| @@ -77,8 +80,12 @@ impl VirtualMethods for HTMLFontElement { | |||
| &local_name!("face") => AttrValue::from_atomic(value.into()), | |||
| &local_name!("color") => AttrValue::from_legacy_color(value.into()), | |||
| &local_name!("size") => { | |||
| let length = parse_length(&value); | |||
| AttrValue::Length(value.into(), length) | |||
| let size = parse_size(&value); | |||
This comment has been minimized.
This comment has been minimized.
upsuper
Mar 20, 2017
Member
Could we have a function to share the code here and above? It seems that a function to parse DOMString into AttrValue can be split out.
| } else { | ||
| let ret = match_ignore_ascii_case! {&*input.expect_ident()?, | ||
| "smaller" => FontRelativeLength::Em(0.85), | ||
| "larger" => FontRelativeLength::Em(1.2), |
This comment has been minimized.
This comment has been minimized.
upsuper
Mar 20, 2017
Member
You probably should keep these two as keyword values rather than converting them promptly. CSSOM should get them as keywords given existing browsers' behavior.
| } | ||
|
|
||
| impl SpecifiedValue { | ||
| pub fn from_html_size(size: u8) -> Self { |
This comment has been minimized.
This comment has been minimized.
upsuper
Mar 20, 2017
Member
Probably worth a comment here referring to HTML spec's related section and mentioning
If value is greater than 7, let it be 7.
If value is less than 1, let it be 1.
| Large => "large", | ||
| XLarge => "x-large", | ||
| XXLarge => "xx-large", | ||
| XXXLarge => "", |
This comment has been minimized.
This comment has been minimized.
upsuper
Mar 20, 2017
Member
If this is not going to happen, should we unreachable!() rather than silently return an empty string?
1695a2b
to
fe8338c
|
Updated |
|
@bors-servo r+ |
|
|
Add separate specified value for keyword font sizes In Gecko, these keywords compute to different values depending on the font. See https://bugzilla.mozilla.org/show_bug.cgi?id=1341775 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16016) <!-- Reviewable:end -->
|
|
fe8338c
to
4a7fbfd
|
@bors-servo r=upsuper |
|
|
Add separate specified value for keyword font sizes In Gecko, these keywords compute to different values depending on the font. See https://bugzilla.mozilla.org/show_bug.cgi?id=1341775 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16016) <!-- Reviewable:end -->
|
|
In Gecko, these keywords compute to different values depending on the font. See https://bugzilla.mozilla.org/show_bug.cgi?id=1341775
4a7fbfd
to
c9198d9
|
@bors-servo r=upsuper |
|
|
Add separate specified value for keyword font sizes In Gecko, these keywords compute to different values depending on the font. See https://bugzilla.mozilla.org/show_bug.cgi?id=1341775 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16016) <!-- Reviewable:end -->
|
|
Manishearth commentedMar 18, 2017
•
edited by larsbergstrom
In Gecko, these keywords compute to different values depending on the
font.
See https://bugzilla.mozilla.org/show_bug.cgi?id=1341775
This change is