Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add separate specified value for keyword font sizes #16016

Merged
merged 1 commit into from Mar 20, 2017

Conversation

@Manishearth
Copy link
Member

Manishearth commented Mar 18, 2017

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 Reviewable

@highfive
Copy link

highfive commented Mar 18, 2017

Heads up! This PR modifies the following files:

  • @bholley: components/style/properties/longhand/font.mako.rs, components/style/values/specified/length.rs
  • @KiChjang: components/script/dom/element.rs, components/script/dom/htmlfontelement.rs
  • @fitzgen: components/script/dom/element.rs, components/script/dom/htmlfontelement.rs
  • @emilio: components/style/properties/longhand/font.mako.rs, ports/geckolib/glue.rs, components/style/values/specified/length.rs
@highfive
Copy link

highfive commented Mar 18, 2017

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!
  • These commits modify style and script code, but no tests are modified. Please consider adding a test!
@Manishearth
Copy link
Member Author

Manishearth commented Mar 18, 2017

@highfive highfive assigned upsuper and unassigned asajeffrey Mar 18, 2017
}
}

#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct SpecifiedValue(pub specified::LengthOrPercentage);
pub enum SpecifiedValue {

This comment has been minimized.

@wafflespeanut

wafflespeanut Mar 18, 2017

Member

Could use Either?

This comment has been minimized.

@Manishearth

Manishearth Mar 18, 2017

Author Member

No, the ToComputedValue and parse impls are special.

This comment has been minimized.

@wafflespeanut

wafflespeanut Mar 18, 2017

Member

Oops. Never mind :)

@bors-servo
Copy link
Contributor

bors-servo commented Mar 19, 2017

The latest upstream changes (presumably #16014) made this pull request unmergeable. Please resolve the merge conflicts.

@Manishearth Manishearth force-pushed the Manishearth:graft-font-size branch from d641624 to 1695a2b Mar 19, 2017
Copy link
Member

upsuper left a comment

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.

@upsuper

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.

@upsuper

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.

@upsuper

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.

@upsuper

upsuper Mar 20, 2017

Member

If this is not going to happen, should we unreachable!() rather than silently return an empty string?

@Manishearth Manishearth force-pushed the Manishearth:graft-font-size branch from 1695a2b to fe8338c Mar 20, 2017
@Manishearth
Copy link
Member Author

Manishearth commented Mar 20, 2017

Updated

@upsuper
Copy link
Member

upsuper commented Mar 20, 2017

@bors-servo
Copy link
Contributor

bors-servo commented Mar 20, 2017

📌 Commit fe8338c has been approved by upsuper

@bors-servo
Copy link
Contributor

bors-servo commented Mar 20, 2017

Testing commit fe8338c with merge 04dab4a...

bors-servo added a commit that referenced this pull request Mar 20, 2017
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 -->
@bors-servo
Copy link
Contributor

bors-servo commented Mar 20, 2017

💔 Test failed - linux-dev

@Manishearth Manishearth force-pushed the Manishearth:graft-font-size branch from fe8338c to 4a7fbfd Mar 20, 2017
@Manishearth
Copy link
Member Author

Manishearth commented Mar 20, 2017

@bors-servo r=upsuper

@bors-servo
Copy link
Contributor

bors-servo commented Mar 20, 2017

📌 Commit 4a7fbfd has been approved by upsuper

@bors-servo
Copy link
Contributor

bors-servo commented Mar 20, 2017

Testing commit 4a7fbfd with merge 6b2a9d8...

bors-servo added a commit that referenced this pull request Mar 20, 2017
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 -->
@bors-servo
Copy link
Contributor

bors-servo commented Mar 20, 2017

💔 Test failed - linux-rel-wpt

In Gecko, these keywords compute to different values depending on the
font.

See https://bugzilla.mozilla.org/show_bug.cgi?id=1341775
@Manishearth Manishearth force-pushed the Manishearth:graft-font-size branch from 4a7fbfd to c9198d9 Mar 20, 2017
@Manishearth
Copy link
Member Author

Manishearth commented Mar 20, 2017

@bors-servo r=upsuper

@bors-servo
Copy link
Contributor

bors-servo commented Mar 20, 2017

📌 Commit c9198d9 has been approved by upsuper

@bors-servo
Copy link
Contributor

bors-servo commented Mar 20, 2017

Testing commit c9198d9 with merge 50fd39f...

bors-servo added a commit that referenced this pull request Mar 20, 2017
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 -->
@bors-servo
Copy link
Contributor

bors-servo commented Mar 20, 2017

☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css, mac-rel-wpt1, mac-rel-wpt2, windows-msvc-dev
Approved by: upsuper
Pushing 50fd39f to master...

@bors-servo bors-servo merged commit c9198d9 into servo:master Mar 20, 2017
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@Manishearth Manishearth deleted the Manishearth:graft-font-size branch May 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

6 participants
You can’t perform that action at this time.