Giter Site home page Giter Site logo

Comments (4)

BrendanEich avatar BrendanEich commented on May 7, 2024

We do want to avoid loading images that are not presented, though -- see https://bugzilla.mozilla.org/show_bug.cgi?id=689623.

/be

from servo.

pcwalton avatar pcwalton commented on May 7, 2024

There are a couple of things to note here:

  • Sometimes, only layout can determine whether an image is going to be
    displayed at all. This is the case for the CSS background-image property,
    for example.
  • Layout needs to be in charge of loading the images, because we don't want
    to decode an image until it's visible. Gecko made the mistake of decoding
    images immediately regardless of their visibility, and it's the source of a
    lot of complaints about Firefox's memory usage. Let's make sure we do this
    right in Servo.
    On Jul 28, 2012 5:04 PM, "Brian Anderson" <
    [email protected]>
    wrote:

images are loaded by apply_style directly from disk. In order to use the
resource manager to load the image we need to know the url of the current
document (in order to resolve relative paths), and that url isn't available
to the layout task currently.

It seems like layout shouldn't be responsible for loading images anyway,
so something needs to be reconsidered here.


Reply to this email directly or view it on GitHub:
#35

from servo.

bzbarsky avatar bzbarsky commented on May 7, 2024

Note that for background-image the relevant base URI is the base URI of the stylesheet, not of the document (though the two may happen to be equal). So really, only someone who knows what the source of the image is can possibly know what base URI to use for it.

A separate discussion to be had is how we want to represent URIs in servo....

from servo.

brson avatar brson commented on May 7, 2024

OK, I've written an image cache task, with two operations, Prefetch and GetImage, and I've hooked it up to layout, so now images are being loaded through the resource manager.

Right now what happens is that when layout applies a background image style it sends the Prefetch message, at which point the image cache will tell the resource manager to begin loading the file.

Later on, when building the display list, we post the GetImage method, wait for the result and store the image in the display list. It's not until GetImage that the image cache actually does the decoding. Because we wait for the image, we are still doing decoding sequentially. What we really want is to store a future in the display list, but I need to rewrite the futures module for that.

The burrito kitty test works when loading from a local file, but when loading from the network the image doesn't arrive in time so it doesn't display. We'll need to post a reflow message in this case.

from servo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.