- Revision
- 189060
- Author
- [email protected]
- Date
- 2015-08-27 15:12:12 -0700 (Thu, 27 Aug 2015)
Log Message
Page does not update when <link> media attribute changes to no longer apply to page
https://bugs.webkit.org/show_bug.cgi?id=148392
Reviewed by Antti Koivisto.
Source/WebCore:
Test: fast/css/link-media-attr.html
* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::parseAttribute):
When the media attribute changes, recalculate styles if the link is not disabled.
LayoutTests:
* fast/css/link-media-attr-expected.txt: Added.
* fast/css/link-media-attr.html: Added.
Add a test to verify that styles change after a link's media attribute changes.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (189059 => 189060)
--- trunk/LayoutTests/ChangeLog 2015-08-27 21:42:29 UTC (rev 189059)
+++ trunk/LayoutTests/ChangeLog 2015-08-27 22:12:12 UTC (rev 189060)
@@ -1,3 +1,14 @@
+2015-08-27 Joseph Pecoraro <[email protected]>
+
+ Page does not update when <link> media attribute changes to no longer apply to page
+ https://bugs.webkit.org/show_bug.cgi?id=148392
+
+ Reviewed by Antti Koivisto.
+
+ * fast/css/link-media-attr-expected.txt: Added.
+ * fast/css/link-media-attr.html: Added.
+ Add a test to verify that styles change after a link's media attribute changes.
+
2015-08-27 Chris Dumez <[email protected]>
Document window.NodeFilter properties
Added: trunk/LayoutTests/fast/css/link-media-attr-expected.txt (0 => 189060)
--- trunk/LayoutTests/fast/css/link-media-attr-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/link-media-attr-expected.txt 2015-08-27 22:12:12 UTC (rev 189060)
@@ -0,0 +1,24 @@
+Modifying the media attribute of a link element to apply / unapply to the page should recalc styles
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS link.media is "print"
+PASS link.disabled is false
+PASS getComputedStyle(target).color is "rgb(0, 0, 0)"
+link.media = "screen"
+PASS link.media is "screen"
+PASS link.disabled is false
+PASS getComputedStyle(target).color is "rgb(255, 0, 0)"
+link.media = "screen,screen"
+PASS link.media is "screen,screen"
+PASS link.disabled is false
+PASS getComputedStyle(target).color is "rgb(255, 0, 0)"
+link.media = "print"
+PASS link.media is "print"
+PASS link.disabled is false
+PASS getComputedStyle(target).color is "rgb(0, 0, 0)"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/css/link-media-attr.html (0 => 189060)
--- trunk/LayoutTests/fast/css/link-media-attr.html (rev 0)
+++ trunk/LayoutTests/fast/css/link-media-attr.html 2015-08-27 22:12:12 UTC (rev 189060)
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<link id="link" rel="stylesheet" href="" media="print">
+<script src=""
+</head>
+<body>
+<span id="target"></span>
+<script>
+description("Modifying the media attribute of a link element to apply / unapply to the page should recalc styles");
+
+window.jsTestIsAsync = true;
+
+link = document.getElementById("link");
+target = document.getElementById("target");
+
+window.addEventListener("load", function() {
+ shouldBeEqualToString("link.media", "print");
+ shouldBeFalse("link.disabled");
+ shouldBeEqualToString("getComputedStyle(target).color", "rgb(0, 0, 0)");
+
+ evalAndLog('link.media = "screen"');
+ shouldBeEqualToString("link.media", "screen");
+ shouldBeFalse("link.disabled");
+ shouldBeEqualToString("getComputedStyle(target).color", "rgb(255, 0, 0)");
+
+ evalAndLog('link.media = "screen,screen"');
+ shouldBeEqualToString("link.media", "screen,screen");
+ shouldBeFalse("link.disabled");
+ shouldBeEqualToString("getComputedStyle(target).color", "rgb(255, 0, 0)");
+
+ evalAndLog('link.media = "print"');
+ shouldBeEqualToString("link.media", "print");
+ shouldBeFalse("link.disabled");
+ shouldBeEqualToString("getComputedStyle(target).color", "rgb(0, 0, 0)");
+
+ finishJSTest();
+});
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (189059 => 189060)
--- trunk/Source/WebCore/ChangeLog 2015-08-27 21:42:29 UTC (rev 189059)
+++ trunk/Source/WebCore/ChangeLog 2015-08-27 22:12:12 UTC (rev 189060)
@@ -1,3 +1,16 @@
+2015-08-27 Joseph Pecoraro <[email protected]>
+
+ Page does not update when <link> media attribute changes to no longer apply to page
+ https://bugs.webkit.org/show_bug.cgi?id=148392
+
+ Reviewed by Antti Koivisto.
+
+ Test: fast/css/link-media-attr.html
+
+ * html/HTMLLinkElement.cpp:
+ (WebCore::HTMLLinkElement::parseAttribute):
+ When the media attribute changes, recalculate styles if the link is not disabled.
+
2015-08-27 Zalan Bujtas <[email protected]>
Simple line layout: Text jumps sometimes on naughty strings page
Modified: trunk/Source/WebCore/html/HTMLLinkElement.cpp (189059 => 189060)
--- trunk/Source/WebCore/html/HTMLLinkElement.cpp 2015-08-27 21:42:29 UTC (rev 189059)
+++ trunk/Source/WebCore/html/HTMLLinkElement.cpp 2015-08-27 22:12:12 UTC (rev 189060)
@@ -166,6 +166,8 @@
if (name == mediaAttr) {
m_media = value.string().lower();
process();
+ if (m_sheet && !isDisabled())
+ document().styleResolverChanged(DeferRecalcStyle);
return;
}
if (name == disabledAttr) {