REGRESSION(r160806): line-height is not applied when only present in :link style.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 12 Jan 2014 18:55:33 +0000 (18:55 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 12 Jan 2014 18:55:33 +0000 (18:55 +0000)
<http://webkit.org/b/126839>
<rdar://problem/15799899>

Reviewed by Antti Koivisto.

Source/WebCore:

Test: fast/css/line-height-link-style.html

* css/StyleResolver.cpp:
(WebCore::StyleResolver::CascadedProperties::Property::apply):

    Use the CSSValue for SelectorChecker::MatchLink when applying
    style inside a link.

LayoutTests:

* fast/css/line-height-link-style-expected.txt: Added.
* fast/css/line-height-link-style.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@161814 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/css/line-height-link-style-expected.txt [new file with mode: 0644]
LayoutTests/fast/css/line-height-link-style.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/css/StyleResolver.cpp

index 9cad2fba1188e1e58486f83c534c83aef418d639..f4ecc98653112c7f320a71cd3cbc4a36e078f06e 100644 (file)
@@ -1,3 +1,14 @@
+2014-01-12  Andreas Kling  <akling@apple.com>
+
+        REGRESSION(r160806): line-height is not applied when only present in :link style.
+        <http://webkit.org/b/126839>
+        <rdar://problem/15799899>
+
+        Reviewed by Antti Koivisto.
+
+        * fast/css/line-height-link-style-expected.txt: Added.
+        * fast/css/line-height-link-style.html: Added.
+
 2014-01-11  Brent Fulgham  <bfulgham@apple.com>
 
         [WebGL] Correct uniform input validation for texture sampler uniforms
diff --git a/LayoutTests/fast/css/line-height-link-style-expected.txt b/LayoutTests/fast/css/line-height-link-style-expected.txt
new file mode 100644 (file)
index 0000000..6539344
--- /dev/null
@@ -0,0 +1,11 @@
+This test verifies that line-height gets applied from link-only style.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS regularComputedStyle.lineHeight is '100px'
+PASS linkComputedStyle.lineHeight is '200px'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/css/line-height-link-style.html b/LayoutTests/fast/css/line-height-link-style.html
new file mode 100644 (file)
index 0000000..dca48b7
--- /dev/null
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src="../../resources/js-test-pre.js"></script>
+<style>
+a { line-height: 100px }
+a:link { line-height: 200px }
+</style>
+</head>
+<body>
+<div id="gunk">
+    <a id="a_regular">regular anchor</a>
+    <a id="a_link" href="#">link anchor</a>
+</div>
+<script>
+
+description("This test verifies that line-height gets applied from link-only style.");
+
+var regularComputedStyle = window.getComputedStyle(document.getElementById("a_regular"));
+var linkComputedStyle = window.getComputedStyle(document.getElementById("a_link"));
+
+shouldBe("regularComputedStyle.lineHeight", "'100px'");
+shouldBe("linkComputedStyle.lineHeight", "'200px'");
+
+document.getElementById("gunk").remove();
+
+</script>
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
index ec143503d44233b5b65f97652a5ebb03f824cdce..53d45092d442bf0187947b51d5d2a88237a93d1e 100644 (file)
@@ -1,3 +1,19 @@
+2014-01-12  Andreas Kling  <akling@apple.com>
+
+        REGRESSION(r160806): line-height is not applied when only present in :link style.
+        <http://webkit.org/b/126839>
+        <rdar://problem/15799899>
+
+        Reviewed by Antti Koivisto.
+
+        Test: fast/css/line-height-link-style.html
+
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::CascadedProperties::Property::apply):
+
+            Use the CSSValue for SelectorChecker::MatchLink when applying
+            style inside a link.
+
 2014-01-12  David Kilzer  <ddkilzer@apple.com>
 
         [iOS] Fix link errors for iOS: Part 3
index 2f7b6072b832e4793eb97c1b400e43387bf98e26..064c63601a4565f8bb3f045553fd28041b2385ac 100644 (file)
@@ -4252,8 +4252,8 @@ void StyleResolver::CascadedProperties::Property::apply(StyleResolver& resolver)
 
     // FIXME: It would be nice if line-height were less of a special snowflake.
     if (id == CSSPropertyLineHeight) {
-        if (cssValue[0])
-            state.setLineHeightValue(cssValue[0]);
+        if (auto value = state.style()->insideLink() == NotInsideLink ? cssValue[0] : cssValue[SelectorChecker::MatchLink])
+            state.setLineHeightValue(value);
         return;
     }