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

Issue 759420 link

Starred by 2 users

Issue metadata

Status: Duplicate
Merged: issue 756804
Owner:
Last visit > 30 days ago
Closed: Aug 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug



Sign in to add a comment

Removing media attribute doesn't trigger style recalculation

Project Member Reported by elkurin@google.com, Aug 28 2017

Issue description

Chrome Version: 60.0.3112.101 (Official Build) (64-bit)
OS: Linux

JS Code:
http://jsbin.com/zerazujeto/1/edit?html,output

Expected Result:
The media attribute is removed from the style rule, so this rule must be applied to all kinds of media.
The text "Should be Green" should be colored green.

Actual Result:
The text "Should be Green" is colored red.
The media attribute is not removed successfully.
 

Comment 1 by elkurin@google.com, Aug 28 2017

attribute.Remove in Element::RemoveAttributeInternal seems to be removing the attribute from the rule sets.
I checked that the media attribute exists before attribute.Remove and is removed after attribute.Remove.

Also I checked that the NeedsStyleRecalc flag is properly set, so this must be recalculated after the removal of the media attribute.

Comment 2 by kochi@chromium.org, Aug 28 2017

Summary: Removing media attribute doesn't trigger style recalculation (was: removeAttribute is not working properly)
Looks like this doesn't require Shadow DOM at all.
http://jsbin.com/sebokuwodu/edit?html,output

I also checked a case that adds media attribute, which seems working fine.

Comment 3 by r...@opera.com, Aug 28 2017

Owner: r...@opera.com
Status: Assigned (was: Untriaged)

Comment 4 by r...@opera.com, Aug 28 2017

Owner: shanmuga.m@chromium.org
shanmuga.m@: could you check if your change for 756804 also fixes this issue?

Comment 5 by r...@opera.com, Aug 28 2017

Owner: shanmug...@samsung.com
rune@ : Yes. The changes for 756804 also fixes this issue as well.

Comment 7 by r...@opera.com, Aug 28 2017

Mergedinto: 756804
Status: Duplicate (was: Assigned)
Project Member

Comment 8 by bugdroid1@chromium.org, Aug 29 2017

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

commit cbe78d23e79476b05503d6fe028b83addfc45d6e
Author: Shanmuga Pandi M <shanmuga.m@samsung.com>
Date: Tue Aug 29 12:48:36 2017

Changing <style> element's media attribute should reflect is CSS.

CSSStyleSheet is not created for style elements when the media type 
is not matching screen or print earlier.
With this change, it will create style sheet for all media types.

Bug:  756804 ,  759420 ,  757450 
Change-Id: I8c38f2daf6d70b749a0f8de394d646f755695d02
Reviewed-on: https://chromium-review.googlesource.com/631859
Reviewed-by: Rune Lillesveen <rune@opera.com>
Commit-Queue: Shanmuga Pandi <shanmuga.m@samsung.com>
Cr-Commit-Position: refs/heads/master@{#498083}
[add] https://crrev.com/cbe78d23e79476b05503d6fe028b83addfc45d6e/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-style-element/style_media_change.html
[add] https://crrev.com/cbe78d23e79476b05503d6fe028b83addfc45d6e/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-style-element/style_non_matching_media.html
[modify] https://crrev.com/cbe78d23e79476b05503d6fe028b83addfc45d6e/third_party/WebKit/Source/core/dom/StyleElement.cpp

Sign in to add a comment