commit | 3857f5dccf0f16288947c8c3c79b2a9a5bbd72b5 | [log] [tgz] |
---|---|---|
author | Manish Jethani <m.jethani@eyeo.com> | Wed Nov 01 16:46:46 2017 |
committer | Commit Bot <commit-bot@chromium.org> | Wed Nov 01 16:46:46 2017 |
tree | 4fc7d7db39c525240e1f4f272abad2b0078b2af0 | |
parent | ae69109e899d4b89e3382f427db664c2180e974e [diff] |
Support @font-face rules in user style sheets @font-face rules in author style sheets are passed back to StyleEngine via ScopedStyleResolver. With crrev.com/c/641294 we started treating style sheets injected by extensions as user style sheets instead. Since user style sheets apply to all scopes, they never go via ScopedStyleResolver but are rather managed by StyleEngine directly. crrev.com/c/641294 broke extensions using custom fonts because StyleEngine fails to account for @font-face rules in user style sheets. Fonts from both user and author style sheets must be maintained in the same font cache. Even though style sheets can be added in any order, @font-face rules in author style sheets must appear after those in user style sheets. In order to achieve this result efficiently, we use a "dirty" flag and refresh the font cache only once per cycle. StyleEngine::ApplyRuleSetChanges may be called twice, once for user style sheets (all scopes) and once for author style sheets (document scope). If fonts have changed in user style sheets, we simply set the dirty flag. If fonts have changed in author style sheets, we set the dirty flag but also then refresh the font cache by first adding all the @font-face rules from the active user style sheets and then re-adding all the new author style sheets. This ensures that the font cache is refreshed only once while the fonts are added in the correct order. BUG=632009,779048 Change-Id: I58c1070af3ecae925e4afb91cbbb7cb00ee187fd Reviewed-on: https://chromium-review.googlesource.com/743642 Commit-Queue: nainar <nainar@chromium.org> Reviewed-by: nainar <nainar@chromium.org> Cr-Commit-Position: refs/heads/master@{#513154}
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure .