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

Centralize construction of specified url() values in style. #13791

Merged
merged 1 commit into from Nov 10, 2016

Conversation

@emilio
Copy link
Member

emilio commented Oct 16, 2016

This reduces a decent amount of overhead in #13778.

r? @SimonSapin


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • There are tests for these changes OR

This change is Reviewable

@highfive
Copy link

highfive commented Oct 16, 2016

Heads up! This PR modifies the following files:

  • @bholley: components/style/parser.rs, components/style/stylesheets.rs, components/style/values/computed/image.rs, components/style/font_face.rs, components/style/properties/declaration_block.rs, components/style/keyframes.rs, components/style/values/specified/image.rs, components/style/properties/properties.mako.rs, components/style/viewport.rs
  • @fitzgen: components/script/dom/cssstyledeclaration.rs, components/script/dom/element.rs
  • @KiChjang: components/script/dom/cssstyledeclaration.rs, components/script/dom/element.rs
@highfive
Copy link

highfive commented Oct 16, 2016

warning Warning warning

  • These commits modify style, layout, and script code, but no tests are modified. Please consider adding a test!
@SimonSapin
Copy link
Member

SimonSapin commented Oct 17, 2016

I don’t see how this helps. You still need to do that work sooner or later. Worse, it’s possible for two threads to race and both do that work.

@emilio
Copy link
Member Author

emilio commented Oct 17, 2016

Maybe it doesn't show up anymore in the profile because I'm delaying and never getting there (maybe the font panic I'm getting in the demo happens before layout?).

In any case, this is going to be better in the case we don't need to resolve the computed url, for example if the element is not displayed. I'll investigate more though.

@bors-servo
Copy link
Contributor

bors-servo commented Oct 18, 2016

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

@SimonSapin
Copy link
Member

SimonSapin commented Nov 5, 2016

I’m tempted to close this as I don’t think it’s a good idea, but let’s get a second opinion. @pcwalton, what do you think?

@emilio
Copy link
Member Author

emilio commented Nov 6, 2016

Yep, I agree resolving it lazily may not be a good idea.

I'd still like to refcount urls a lot more though, does that seem ok to you @SimonSapin?

@emilio emilio force-pushed the emilio:lazy-url branch from ae43627 to ef6cc69 Nov 9, 2016
@bors-servo
Copy link
Contributor

bors-servo commented Nov 9, 2016

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

@emilio emilio force-pushed the emilio:lazy-url branch 4 times, most recently from bc728ff to 2ed1422 Nov 9, 2016
@emilio emilio changed the title Lazily resolve and refcount the URL in CSS image properties. Centralize construction of specified url() values in style. Nov 9, 2016
@emilio emilio force-pushed the emilio:lazy-url branch from 2ed1422 to 97b6bec Nov 9, 2016
@emilio
Copy link
Member Author

emilio commented Nov 9, 2016

So I ended up refactoring how we handle style urls, so the place is centralized and we can refactor this in the future more easily.

I agree with @SimonSapin we should be bypassing rust-url for data-uris, but I'd prefer to leave that as a followup for now.

r? @SimonSapin

@emilio emilio force-pushed the emilio:lazy-url branch 3 times, most recently from 0b57d83 to 7f7faf8 Nov 9, 2016
@SimonSapin
Copy link
Member

SimonSapin commented Nov 9, 2016

r=me with ToCss impl fixed. (See inline comment.)


Reviewed 15 of 15 files at r1, 4 of 5 files at r2.
Review status: 18 of 19 files reviewed at latest revision, 1 unresolved discussion, some commit checks failed.


components/style/values/specified/url.rs, line 139 at r1 (raw file):

    fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
        if let Some(ref original) = self.original {
            write!(dest, "url(\"{}\")", original)

This needs to use cssparser::serializer::CssStringWriter, for example in case original contains a double quote.


Comments from Reviewable

@emilio emilio force-pushed the emilio:lazy-url branch 2 times, most recently from 1b41c7f to 0197734 Nov 9, 2016
bors-servo added a commit that referenced this pull request Nov 9, 2016
Centralize construction of specified url() values in style.

This reduces a decent amount of overhead in #13778.

r? @SimonSapin
---

<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors

<!-- Either: -->
- [x] There are tests for these changes OR

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/13791)

<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Nov 9, 2016

Testing commit 7ea6f57 with merge c4f5deb...

@bors-servo
Copy link
Contributor

bors-servo commented Nov 9, 2016

💔 Test failed - linux-rel-wpt

@highfive
Copy link

highfive commented Nov 9, 2016

  ▶ FAIL [expected PASS] /_mozilla/css/iframe/simple.html
  └   → /_mozilla/css/iframe/simple.html 6510831f41496e5a48d892ebc20e1815b08e27f2
/_mozilla/css/iframe/simple_ref.html 64daf248c924b7607e2ff04d1bdd7ef623df4cd7
Testing 6510831f41496e5a48d892ebc20e1815b08e27f2 == 64daf248c924b7607e2ff04d1bdd7ef623df4cd7
@emilio
Copy link
Member Author

emilio commented Nov 10, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Nov 10, 2016

Testing commit 7ea6f57 with merge 200180a...

bors-servo added a commit that referenced this pull request Nov 10, 2016
Centralize construction of specified url() values in style.

This reduces a decent amount of overhead in #13778.

r? @SimonSapin

---

<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors

<!-- Either: -->
- [x] There are tests for these changes OR

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/13791)

<!-- Reviewable:end -->
@emilio emilio force-pushed the emilio:lazy-url branch from 7ea6f57 to 5f2e7af Nov 10, 2016
@emilio
Copy link
Member Author

emilio commented Nov 10, 2016

@bors-servo r=SimonSapin

Homu seemed stuck so I rebased.

@bors-servo
Copy link
Contributor

bors-servo commented Nov 10, 2016

📌 Commit 5f2e7af has been approved by SimonSapin

@Ms2ger Ms2ger closed this Nov 10, 2016
@Ms2ger Ms2ger reopened this Nov 10, 2016
@nox
Copy link
Member

nox commented Nov 10, 2016

@bors-servo force clean retry

@emilio
Copy link
Member Author

emilio commented Nov 10, 2016

@bors-servo retry

  • Homu's back
@bors-servo
Copy link
Contributor

bors-servo commented Nov 10, 2016

Testing commit 5f2e7af with merge 164e956...

bors-servo added a commit that referenced this pull request Nov 10, 2016
Centralize construction of specified url() values in style.

This reduces a decent amount of overhead in #13778.

r? @SimonSapin

---

<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors

<!-- Either: -->
- [x] There are tests for these changes OR

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/13791)

<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Nov 10, 2016

@bors-servo bors-servo merged commit 5f2e7af into servo:master Nov 10, 2016
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
@emilio emilio deleted the emilio:lazy-url branch Nov 22, 2016
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.