Skip to content

Web fonts should only be loaded when content actually needs them #8342

Open

Activity

  1. added
    I-perf-slow
    B-interesting-project
    on Nov 5, 2015
  2. added
    B-high-value
    on May 17, 2016
  3. jdm commented on May 17, 2016

    @jdm
    Member

    This in particular makes cnn.com's page load times abysmal, since we have no prioritization or pooling for our network threads, and it ends up launching 356 simultaneous web font requests right after the stylesheets are parsed.

  4. pcwalton commented on May 17, 2016

    @pcwalton
    Contributor

    Fascinating. Thanks for diving into this, @jdm!

  5. charlesvdv commented on Jun 24, 2017

    @charlesvdv
    Contributor

    Hi!

    Since I finished my exams, I'm looking to contribute again to servo. Can I try to tackle this issue? 😄

  6. jdm commented on Jun 24, 2017

    @jdm
    Member

    https://dxr.mozilla.org/servo/rev/a29261dec196ab5c887655e479e503ca6cbb9229/components/layout_thread/lib.rs#390-418 is the code that kicks off the font loads right now. It uses https://dxr.mozilla.org/servo/rev/a29261dec196ab5c887655e479e503ca6cbb9229/components/style/stylesheets/stylesheet.rs#337 to iterate over all of the effective rules in the stylesheet (which I'm pretty sure only means "rules that are not overridden by other rules").

    I think a reasonable solution would be to modify FontCache::handle_add_web_font to only store the font source information without starting any request. Then find_font_web_family will need to be updated to initiate a request if there is information about a font but it has not been requested before.

  7. charlesvdv commented on Jun 24, 2017

    @charlesvdv
    Contributor

    Thanks @jdm I will look into that !

  8. charlesvdv commented on Jun 27, 2017

    @charlesvdv
    Contributor

    @jdm I just finished the parts where the font is downloaded when we call the find_font_in_web_family but I struggle a bit on how I could notify the layout to rebuild itself?

  9. jdm commented on Jun 27, 2017

    @jdm
    Member

    @charlesvdv https://dxr.mozilla.org/servo/rev/4e8cf678bf12c1fa3400454905ae33dabff45bb5/components/layout_thread/lib.rs#634-640 is the code that handles that right now. The layout thread sends font_cache_sender the the font cache, and the font cache sends a message using that sender which the layout thread observes.

  10. added a commit that references this issue on Jun 28, 2017
    a2f1dc6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-layout/uncategorizedB-high-valueB-interesting-projectI-perf-slow

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions