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

style: support calc() in color functions. #19457

Merged
merged 3 commits into from Dec 5, 2017
Merged

Conversation

@emilio
Copy link
Member

emilio commented Dec 1, 2017

@highfive
Copy link

highfive commented Dec 1, 2017

Heads up! This PR modifies the following files:

  • @bholley: components/style/Cargo.toml, components/style/values/specified/color.rs, components/selectors/Cargo.toml, components/style/error_reporting.rs, components/style/values/specified/angle.rs and 3 more
  • @asajeffrey: components/script_layout_interface/Cargo.toml, components/script/Cargo.toml
  • @canaltinova: components/style/Cargo.toml, components/style/values/specified/color.rs, components/style/error_reporting.rs, components/style/values/specified/angle.rs, components/style/values/specified/calc.rs
  • @fitzgen: components/script_layout_interface/Cargo.toml, components/script/Cargo.toml
  • @KiChjang: components/script_layout_interface/Cargo.toml, components/script/Cargo.toml
@highfive
Copy link

highfive commented Dec 1, 2017

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!
@emilio
Copy link
Member Author

emilio commented Dec 1, 2017

@highfive highfive assigned SimonSapin and unassigned pcwalton Dec 1, 2017
@@ -4552,7 +4552,16 @@ pub unsafe extern "C" fn Servo_SelectorList_Drop(list: RawServoSelectorListOwned
fn parse_color(value: &str) -> Result<specified::Color, ()> {

This comment has been minimized.

@SimonSapin

SimonSapin Dec 2, 2017

Member

Is every use of this function intended to support full CSS syntax, including calc? I traced one use back to aBGColor in DocumentRendererChild::RenderDocument. Is that <body bgcolor>? https://html.spec.whatwg.org/multipage/#the-page links to https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#rules-for-parsing-a-legacy-colour-value

This comment has been minimized.

@emilio

emilio Dec 2, 2017

Author Member

It is not, that's handled from nsAttrValue::ParseColor (https://searchfox.org/mozilla-central/rev/0b613c3887789f7786cd3131dfe9648398f4a6ac/dom/html/HTMLBodyElement.cpp#58).

That seems to be the default background color to render in a child process if there's no content.

The only web-exposed use of this is CanvasGradient::AddColorStop, and the spec for that is:

https://html.spec.whatwg.org/multipage/#dom-canvasgradient-addcolorstop

Which says to parse as a CSS <color> value, that is, with calc().

@bors-servo
Copy link
Contributor

bors-servo commented Dec 2, 2017

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

@emilio emilio force-pushed the emilio:color-calc branch 2 times, most recently from 389e8d5 to d39b896 Dec 2, 2017
@emilio
Copy link
Member Author

emilio commented Dec 2, 2017

@bors-servo
Copy link
Contributor

bors-servo commented Dec 2, 2017

Trying commit d39b896 with merge 3c61213...

bors-servo added a commit that referenced this pull request Dec 2, 2017
style: support calc() in color functions.

Depends on #19456 and servo/rust-cssparser#207.

<!-- 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/19457)
<!-- Reviewable:end -->
@emilio emilio removed the S-needs-rebase label Dec 2, 2017
@emilio emilio force-pushed the emilio:color-calc branch from d39b896 to ad12a1f Dec 2, 2017
@emilio
Copy link
Member Author

emilio commented Dec 2, 2017

@bors-servo
Copy link
Contributor

bors-servo commented Dec 2, 2017

Trying commit ad12a1f with merge 82eeb01...

bors-servo added a commit that referenced this pull request Dec 2, 2017
style: support calc() in color functions.

Depends on #19456 and servo/rust-cssparser#207.

<!-- 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/19457)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Dec 2, 2017

@emilio
Copy link
Member Author

emilio commented Dec 2, 2017

Sigh, I expected tests to be there already... I'll write some.

@emilio emilio force-pushed the emilio:color-calc branch from ad12a1f to 3cd75d1 Dec 2, 2017
@SimonSapin
Copy link
Member

SimonSapin commented Dec 4, 2017

r+ with one last change


Reviewed 14 of 14 files at r1, 1 of 1 files at r2, 1 of 4 files at r3, 7 of 7 files at r6.
Review status: all files reviewed at latest revision, 1 unresolved discussion.


components/style/values/specified/color.rs, line 162 at r6 (raw file):

                    CSSParserColor::RGBA(rgba) => Color::Numeric {
                        parsed: rgba,
                        authored: authored.map(|s| s.to_lowercase().into_boxed_str()),

This probably doesn’t make a difference in behavior since all valid color keywords are ASCII, but this should be to_ascii_lowercase.


Comments from Reviewable

@emilio emilio force-pushed the emilio:color-calc branch from 3cd75d1 to a0d7f36 Dec 4, 2017
@emilio
Copy link
Member Author

emilio commented Dec 4, 2017

@bors-servo r=SimonSapin

@bors-servo
Copy link
Contributor

bors-servo commented Dec 4, 2017

📌 Commit a0d7f36 has been approved by SimonSapin

@bors-servo
Copy link
Contributor

bors-servo commented Dec 5, 2017

Testing commit a0d7f36 with merge 5b9c595...

bors-servo added a commit that referenced this pull request Dec 5, 2017
style: support calc() in color functions.

Depends on #19456 and servo/rust-cssparser#207.

Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=984021

<!-- 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/19457)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Dec 5, 2017

💔 Test failed - linux-dev

@bors-servo
Copy link
Contributor

bors-servo commented Dec 5, 2017

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

emilio added 3 commits Dec 1, 2017
@emilio emilio force-pushed the emilio:color-calc branch from a0d7f36 to 23d69ea Dec 5, 2017
@emilio
Copy link
Member Author

emilio commented Dec 5, 2017

@bors-servo r=SimonSapin p=1

@bors-servo
Copy link
Contributor

bors-servo commented Dec 5, 2017

📌 Commit 23d69ea has been approved by SimonSapin

@bors-servo
Copy link
Contributor

bors-servo commented Dec 5, 2017

Testing commit 23d69ea with merge 3cef09a...

bors-servo added a commit that referenced this pull request Dec 5, 2017
style: support calc() in color functions.

Depends on #19456 and servo/rust-cssparser#207.

Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=984021

<!-- 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/19457)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Dec 5, 2017

@bors-servo bors-servo merged commit 23d69ea into servo:master Dec 5, 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
jdm added a commit to web-platform-tests/wpt that referenced this pull request Jan 4, 2018
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

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