Multiple selectors setting relative font-weight names to an element result in a cumulative result

According to http://dev.w3.org/csswg/css-fonts/#font-weight-prop, the computed
weight of 'lighter' and 'bolder' are based on the inherited 'font-weight', so set
that inherited weight before calculating 'lighter' and 'bolder'.

BUG=322032

Review URL: https://codereview.chromium.org/137813004

git-svn-id: svn://svn.chromium.org/blink/trunk@166795 bbb929c8-8fbe-4397-9dbb-9b2b20218538
diff --git a/third_party/WebKit/LayoutTests/css3/font-weight-multiple-selectors.html b/third_party/WebKit/LayoutTests/css3/font-weight-multiple-selectors.html
new file mode 100644
index 0000000..67aeeaf
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/css3/font-weight-multiple-selectors.html
@@ -0,0 +1,44 @@
+<html>
+<head>
+<style>
+#outer > div { font-weight: bolder; }
+#outer > div#bolder { font-weight: bolder; }
+#outer > div#lighter { font-weight: lighter; }
+</style>
+<script src="../resources/js-test.js"></script>
+</head>
+<body>
+<div id="outer">
+    <div id="bolder"></div>
+    <div id="lighter"></div>
+</div>
+<div id="console"></div>
+<script>
+description('Test that font-weight: bolder and font-weight: lighter are not cumulative when multiple selectors apply.');
+
+table = [
+["100"   , "100"   , "normal", "100"],
+["200"   , "200"   , "normal", "100"],
+["300"   , "300"   , "normal", "100"],
+["400"   , "normal", "bold"  , "100"],
+["normal", "normal", "bold"  , "100"],
+["500"   , "500"   , "bold"  , "100"],
+["600"   , "600"   , "900"   , "normal"],
+["700"   , "bold"  , "900"   , "normal"],
+["bold"  , "bold"  , "900"   , "normal"],
+["800"   , "800"   , "900"   , "bold"],
+["900"   , "900"   , "900"   , "bold"],
+];
+
+var outer = document.getElementById("outer");
+var bolder = document.getElementById("bolder");
+var lighter = document.getElementById("lighter");
+for(var i=0; i<table.length; i++) {
+    outer.style.fontWeight = table[i][0];
+    shouldBeEqualToString('getComputedStyle(outer).fontWeight', table[i][1]);
+    shouldBeEqualToString('getComputedStyle(bolder).fontWeight', table[i][2]);
+    shouldBeEqualToString('getComputedStyle(lighter).fontWeight', table[i][3]);
+}
+</script>
+</body>
+</html>