New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 677963 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
NOT IN USE
Closed: Jan 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 1
Type: Bug-Regression



Sign in to add a comment

CSS media queries broken in HTML imports

Reported by a...@scirra.com, Jan 3 2017

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2970.0 Safari/537.36

Steps to reproduce the problem:
1. Visit https://www.scirra.com/labs/bugs/mediabug/
2. Resize the window to be <500px

What is the expected behavior?
Red square changes to a smaller blue square when (max-width: 500px) media query applies.

What went wrong?
Square always displays as a smaller blue square. It works as if the media query is always true, even when the window is wider than 500px.

Did this work before? Yes Stable 55.0.2883.87 is not affected

Does this work in other browsers? Yes

Chrome version: 57.0.2970.0  Channel: canary
OS Version: 10.0
Flash Version: Shockwave Flash 24.0 r0

The media query works normally if directly included via <link rel="stylesheet">. The problem occurs when it is included via a HTML import (i.e. <link rel="import">, and the import document uses <link rel="stylesheet">).
 

Comment 1 by shans@chromium.org, Jan 3 2017

Labels: -Pri-2 M-57 Needs-Bisect Pri-1
Owner: meade@chromium.org
Status: Assigned (was: Unconfirmed)
On OSX, working in 57.0.2950.4 but failing in 57.0.2970.0

Comment 2 by r...@opera.com, Jan 3 2017

Cc: meade@chromium.org
Owner: r...@opera.com
I'd be surprised if this was not caused by me.

Comment 3 by ajha@chromium.org, Jan 4 2017

Cc: ajha@chromium.org
Labels: -Needs-Bisect hasbisect-per-revision ReleaseBlock-Stable OS-Linux OS-Mac
Able to reproduce the issue on the latest canary(57.0.2970.0) on Windows-10, Mac OS 10.12.2 and Linux Ubuntu 14.04. 

Regressed in M-57.

Last good build: 57.0.2953.0
First bad build: 57.0.2954.0

Changelog:
==========
https://chromium.googlesource.com/chromium/src/+log/206fee6c2a7ddb33c400a56adda7f53bf62157c2..90d4ea3d543f0031769b3aacac2d3e084b95fb7d

Indeed rune's change: https://codereview.chromium.org/2557533005.

Comment 4 by r...@opera.com, Jan 5 2017

Status: Started (was: Assigned)
Project Member

Comment 6 by bugdroid1@chromium.org, Jan 6 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/97c98f168ee37c3c114f85fb40cf893e75a4615b

commit 97c98f168ee37c3c114f85fb40cf893e75a4615b
Author: rune <rune@opera.com>
Date: Fri Jan 06 07:55:23 2017

Use master StyleEngine to evaluate MQ in html imports.

The StyleEngine for html import documents does not have a Frame which
means size media queries will always evaluate to true. We incorrectly
replaced a passed-in master document StyleEngine with the StyleEngine
from the DocumentStyleSheetCollection in https://crrev.com/90d4ea3d
That was wrong for evaluating media queries.

R=meade@chromium.org
BUG= 677963 

Review-Url: https://codereview.chromium.org/2618803002
Cr-Commit-Position: refs/heads/master@{#441899}

[add] https://crrev.com/97c98f168ee37c3c114f85fb40cf893e75a4615b/third_party/WebKit/LayoutTests/fast/css/media-query-in-html-import.html
[modify] https://crrev.com/97c98f168ee37c3c114f85fb40cf893e75a4615b/third_party/WebKit/Source/core/dom/DocumentStyleSheetCollection.cpp
[modify] https://crrev.com/97c98f168ee37c3c114f85fb40cf893e75a4615b/third_party/WebKit/Source/core/dom/DocumentStyleSheetCollection.h
[modify] https://crrev.com/97c98f168ee37c3c114f85fb40cf893e75a4615b/third_party/WebKit/Source/core/dom/ShadowTreeStyleSheetCollection.cpp
[modify] https://crrev.com/97c98f168ee37c3c114f85fb40cf893e75a4615b/third_party/WebKit/Source/core/dom/ShadowTreeStyleSheetCollection.h
[modify] https://crrev.com/97c98f168ee37c3c114f85fb40cf893e75a4615b/third_party/WebKit/Source/core/dom/StyleEngine.cpp
[modify] https://crrev.com/97c98f168ee37c3c114f85fb40cf893e75a4615b/third_party/WebKit/Source/core/dom/StyleEngine.h

Comment 7 by r...@opera.com, Jan 6 2017

Status: Fixed (was: Started)

Comment 8 by a...@scirra.com, Jan 6 2017

Thanks for the quick fix!

Sign in to add a comment