Chrome ignores all external stylesheets with media queries if none of the media queries is true when the page loads
Reported by
priyamca...@gmail.com,
Apr 12 2017
|
|||||||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36 Example URL: Steps to reproduce the problem: 1. When the screen is 640px or wider, apply an external stylesheet which changes the color of the text 2. Load the page when the browser is at least 640 px wide it changes the color of the text 3. Then resize the browser width to 639 px or smaller it uses the CSS default text color which is right 4. Reload the page when the browser width is smaller than 640 px it uses the CSS default text color but when you resize the browser width to 640 px or wider, it doesn't read the color from external stylesheet What is the expected behavior? When the browser is 640px or wider, apply an external stylesheet which changes the color of the text. Keep your browser width less than 640 px and reload the page. Now when you resize the browser width to 640 px or wider, it should change the color of the text but it is not doing so. What went wrong? Chrome ignores all the external stylesheet with media queries if none of the media query conditions is true when the page loads. Later when you resize the page to meet the media query condition, it won't read the styles from the external stylesheets. Does it occur on multiple sites: Yes Is it a problem with a plugin? No Did this work before? N/A Does this work in other browsers? Yes Chrome version: 57.0.2987.133 Channel: stable OS Version: 6.1 (Windows 7, Windows Server 2008 R2) Flash Version:
,
Apr 13 2017
,
Apr 18 2017
Able to repro on 60.0.3073.0 (Official Build) canary (32-bit) (cohort: 32-Bit) on Windows 10.
,
Apr 18 2017
,
Apr 19 2017
,
Apr 19 2017
,
Apr 20 2017
,
Apr 20 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/7a7892d7272ce168b1db7f4da87ae70d5e23cecc commit 7a7892d7272ce168b1db7f4da87ae70d5e23cecc Author: rune <rune@opera.com> Date: Thu Apr 20 06:12:38 2017 Collect media query results for non-matching stylesheets. Viewport and device dependent media query results are collected after an active stylesheet update happen. The results are collected on the ScopedStyleResolvers and propagated to the CSSGlobalRuleSet. It's necessary that the active stylesheet update causes these media query results to be up-to-date so that e.g. a viewport resize checks these results to detect that we need an active stylesheet update for a given resize. That did not happen when we only added sheets for which the media attrbute did not match, because adding a sheet with a null RuleSet does not affect the computed style and the changed_rule_sets set was empty. Now, if we add or remove a sheet which does not apply, and that sheet has a viewport or device dependent media query, still return kActiveSheetsAppended or kActiveSheetsChanged to trigger the re- collection of those media query results. BUG= 710878 Review-Url: https://codereview.chromium.org/2829873002 Cr-Commit-Position: refs/heads/master@{#465912} [add] https://crrev.com/7a7892d7272ce168b1db7f4da87ae70d5e23cecc/third_party/WebKit/LayoutTests/fast/css/media-attr-non-matching-dynamic.html [modify] https://crrev.com/7a7892d7272ce168b1db7f4da87ae70d5e23cecc/third_party/WebKit/Source/core/css/ActiveStyleSheets.cpp [modify] https://crrev.com/7a7892d7272ce168b1db7f4da87ae70d5e23cecc/third_party/WebKit/Source/core/css/ActiveStyleSheetsTest.cpp [modify] https://crrev.com/7a7892d7272ce168b1db7f4da87ae70d5e23cecc/third_party/WebKit/Source/core/css/CSSStyleSheet.h [modify] https://crrev.com/7a7892d7272ce168b1db7f4da87ae70d5e23cecc/third_party/WebKit/Source/core/dom/StyleEngine.cpp
,
Apr 20 2017
|
|||||||
►
Sign in to add a comment |
|||||||
Comment 1 by priyamca...@gmail.com
, Apr 12 2017257 bytes
257 bytes View Download
23 bytes
23 bytes View Download