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

Make layout use available image data before querying the image cache. #21931

Merged
merged 1 commit into from Oct 13, 2018

Conversation

Projects
None yet
6 participants
@jdm
Member

jdm commented Oct 12, 2018

These changes make layout more efficient for any page which contains images that have already loaded, since it does not require synchronously querying the image cache thread for each image present. It also makes reloading a page actually display the images that are already in the image cache.


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

This change is Reviewable

@highfive

This comment has been minimized.

highfive commented Oct 12, 2018

Heads up! This PR modifies the following files:

  • @asajeffrey: components/script/dom/node.rs, components/script/dom/htmlimageelement.rs
  • @KiChjang: components/script/dom/node.rs, components/script/dom/htmlimageelement.rs
  • @emilio: components/layout/fragment.rs
@highfive

This comment has been minimized.

highfive commented Oct 12, 2018

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!
  • These commits modify layout and script code, but no tests are modified. Please consider adding a test!

@jdm jdm force-pushed the jdm:reload-images branch from 09d2ebb to 58a38ad Oct 12, 2018

@jdm

This comment has been minimized.

Member

jdm commented Oct 12, 2018

@bors-servo try=wpt

@bors-servo

This comment has been minimized.

Contributor

bors-servo commented Oct 12, 2018

⌛️ Trying commit 58a38ad with merge dffa7af...

bors-servo added a commit that referenced this pull request Oct 12, 2018

Auto merge of #21931 - jdm:reload-images, r=<try>
Make layout use available image data before querying the image cache.

These changes make layout more efficient for any page which contains images that have already loaded, since it does not require synchronously querying the image cache thread for each image present. It also makes reloading a page actually display the images that are already in the image cache.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #21919
- [x] There are tests for these changes

<!-- 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/21931)
<!-- Reviewable:end -->
@jdm

This comment has been minimized.

Member

jdm commented Oct 12, 2018

The test run finished with all tests passing.

@jdm jdm force-pushed the jdm:reload-images branch from 58a38ad to 4ceacbf Oct 12, 2018

@jdm

This comment has been minimized.

Member

jdm commented Oct 12, 2018

Ready for review.

@servo-wpt-sync

This comment has been minimized.

Collaborator

servo-wpt-sync commented Oct 12, 2018

Opened new PR for upstreamable changes.

Completed upstream sync of web-platform-test changes at web-platform-tests/wpt#13492.

@emilio

emilio approved these changes Oct 13, 2018

fn image_data(&self) -> Option<(Option<StdArc<Image>>, Option<ImageMetadata>)> {
unsafe {
self.downcast::<HTMLImageElement>()
.map(|e| e.image_data())

This comment has been minimized.

@emilio

emilio Oct 13, 2018

Member

nit: I think this could just fit in one line.

var i2 = new Image();
i2.src = "3.jpg";
document.body.appendChild(i2);
document.documentElement.classList.remove("reftest-wait");

This comment has been minimized.

@emilio

emilio Oct 13, 2018

Member

FWIW I don't know how useful this test will be in the future. If Servo doesn't have a way to wait for image decoding or something of the sort (on top of reftest-wait) it may eventually need one to avoid displaying the placeholders in reftests and such...

But in any case I guess the test doesn't really harm.

<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<link rel="match" href="available-images-ref.html">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-img-element">
<body>

This comment has been minimized.

@emilio

emilio Oct 13, 2018

Member

nit: no need for <body>

<!doctype html>
<html class="reftest-wait">
<title>Ensure images from available images list are rendered</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">

This comment has been minimized.

@emilio

emilio Oct 13, 2018

Member

nit: I think <meta charset=""> is the preferred way to do this now?

@jdm jdm force-pushed the jdm:reload-images branch from 4ceacbf to 49d2ea4 Oct 13, 2018

@jdm

This comment has been minimized.

Member

jdm commented Oct 13, 2018

@bors-servo r=emilio

@bors-servo

This comment has been minimized.

Contributor

bors-servo commented Oct 13, 2018

📌 Commit 49d2ea4 has been approved by emilio

@servo-wpt-sync

This comment has been minimized.

Collaborator

servo-wpt-sync commented Oct 13, 2018

Transplanted upstreamable changes to existing PR.

Completed upstream sync of web-platform-test changes at web-platform-tests/wpt#13492.

@bors-servo

This comment has been minimized.

Contributor

bors-servo commented Oct 13, 2018

⌛️ Testing commit 49d2ea4 with merge d74f9fa...

bors-servo added a commit that referenced this pull request Oct 13, 2018

Auto merge of #21931 - jdm:reload-images, r=emilio
Make layout use available image data before querying the image cache.

These changes make layout more efficient for any page which contains images that have already loaded, since it does not require synchronously querying the image cache thread for each image present. It also makes reloading a page actually display the images that are already in the image cache.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #21919
- [x] There are tests for these changes

<!-- 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/21931)
<!-- Reviewable:end -->
@bors-servo

This comment has been minimized.

Contributor

bors-servo commented Oct 13, 2018

💔 Test failed - status-taskcluster

@jdm

This comment has been minimized.

Member

jdm commented Oct 13, 2018

@bors-servo retry

@bors-servo

This comment has been minimized.

Contributor

bors-servo commented Oct 13, 2018

💣 Failed to start rebuilding: Unknown error

@bors-servo

This comment has been minimized.

Contributor

bors-servo commented Oct 13, 2018

⌛️ Testing commit 49d2ea4 with merge e4657c1...

bors-servo added a commit that referenced this pull request Oct 13, 2018

Auto merge of #21931 - jdm:reload-images, r=emilio
Make layout use available image data before querying the image cache.

These changes make layout more efficient for any page which contains images that have already loaded, since it does not require synchronously querying the image cache thread for each image present. It also makes reloading a page actually display the images that are already in the image cache.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #21919
- [x] There are tests for these changes

<!-- 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/21931)
<!-- Reviewable:end -->
@bors-servo

This comment has been minimized.

Contributor

bors-servo commented Oct 13, 2018

💔 Test failed - linux-rel-wpt

@jdm

This comment has been minimized.

Member

jdm commented Oct 13, 2018

@bors-servo retry

@bors-servo

This comment has been minimized.

Contributor

bors-servo commented Oct 13, 2018

@bors-servo

This comment has been minimized.

Contributor

bors-servo commented Oct 13, 2018

@bors-servo bors-servo merged commit 49d2ea4 into servo:master Oct 13, 2018

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment