hr color attribute not working.

The noshade attribute is a boolean attribute and when set on hr element
it shows a gray color. When there is color attribute the default gray
color should be replaced by the color mentioned by the color attribute.
Firefox and IE show the same behaviour but Blink is different. Making
the behaviour of Blink similiar to Firefox and IE's behaviour.

When the color attribute is present that value is applied and the
default gray color is ignored. Incase of no color attribute the default
gray color is applied.

I already landed this patch on Webkit. Just modified the layout test file.
http://trac.webkit.org/changeset/161334

R=esprehn@chromium.org,eseidel@chromium.org
BUG=175359

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

git-svn-id: svn://svn.chromium.org/blink/trunk@168571 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent ed6f4545
HTMLHeaderElement color and noshade attribute test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS window.getComputedStyle(document.getElementById('hrElement1'),null).getPropertyValue('border-color') is "rgb(255, 0, 0)"
PASS window.getComputedStyle(document.getElementById('hrElement1'),null).getPropertyValue('background-color') is "rgb(255, 0, 0)"
PASS window.getComputedStyle(document.getElementById('hrElement2'),null).getPropertyValue('border-color') is "rgb(0, 0, 255)"
PASS window.getComputedStyle(document.getElementById('hrElement2'),null).getPropertyValue('background-color') is "rgb(0, 0, 255)"
PASS window.getComputedStyle(document.getElementById('hrElement3'),null).getPropertyValue('border-color') is "rgb(0, 0, 0)"
PASS window.getComputedStyle(document.getElementById('hrElement3'),null).getPropertyValue('background-color') is "rgb(0, 0, 0)"
PASS window.getComputedStyle(document.getElementById('hrElement4'),null).getPropertyValue('border-color') is "rgb(128, 128, 128)"
PASS window.getComputedStyle(document.getElementById('hrElement4'),null).getPropertyValue('background-color') is "rgb(128, 128, 128)"
PASS window.getComputedStyle(document.getElementById('hrElement5'),null).getPropertyValue('border-color') is "rgb(255, 255, 0)"
PASS window.getComputedStyle(document.getElementById('hrElement5'),null).getPropertyValue('background-color') is "rgb(255, 255, 0)"
PASS window.getComputedStyle(document.getElementById('hrElement6'),null).getPropertyValue('border-color') is "rgb(0, 128, 0)"
PASS window.getComputedStyle(document.getElementById('hrElement6'),null).getPropertyValue('background-color') is "rgb(0, 128, 0)"
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test.js"></script>
</head>
<body>
<hr id="hrElement1" color="red" noshade>
<hr id="hrElement2" noshade color="blue">
<hr id="hrElement3" noshade color="^&*(">
<hr id="hrElement4" noshade>
<hr id="hrElement5">
<hr id="hrElement6">
<script src="script-tests/color-noshade-attribute.js"></script>
</body>
</html>
description("HTMLHeaderElement color and noshade attribute test");
shouldBeEqualToString("window.getComputedStyle(document.getElementById('hrElement1'),null).getPropertyValue('border-color')","rgb(255, 0, 0)");
shouldBeEqualToString("window.getComputedStyle(document.getElementById('hrElement1'),null).getPropertyValue('background-color')","rgb(255, 0, 0)");
shouldBeEqualToString("window.getComputedStyle(document.getElementById('hrElement2'),null).getPropertyValue('border-color')","rgb(0, 0, 255)");
shouldBeEqualToString("window.getComputedStyle(document.getElementById('hrElement2'),null).getPropertyValue('background-color')","rgb(0, 0, 255)");
shouldBeEqualToString("window.getComputedStyle(document.getElementById('hrElement3'),null).getPropertyValue('border-color')","rgb(0, 0, 0)");
shouldBeEqualToString("window.getComputedStyle(document.getElementById('hrElement3'),null).getPropertyValue('background-color')","rgb(0, 0, 0)");
shouldBeEqualToString("window.getComputedStyle(document.getElementById('hrElement4'),null).getPropertyValue('border-color')","rgb(128, 128, 128)");
shouldBeEqualToString("window.getComputedStyle(document.getElementById('hrElement4'),null).getPropertyValue('background-color')","rgb(128, 128, 128)");
document.getElementById('hrElement5').setAttribute('color','yellow');
document.getElementById('hrElement5').setAttribute('noshade', '');
shouldBeEqualToString("window.getComputedStyle(document.getElementById('hrElement5'),null).getPropertyValue('border-color')","rgb(255, 255, 0)");
shouldBeEqualToString("window.getComputedStyle(document.getElementById('hrElement5'),null).getPropertyValue('background-color')","rgb(255, 255, 0)");
document.getElementById('hrElement6').setAttribute('noshade', '');
document.getElementById('hrElement6').setAttribute('color','green');
shouldBeEqualToString("window.getComputedStyle(document.getElementById('hrElement6'),null).getPropertyValue('border-color')","rgb(0, 128, 0)");
shouldBeEqualToString("window.getComputedStyle(document.getElementById('hrElement6'),null).getPropertyValue('background-color')","rgb(0, 128, 0)");
......@@ -76,11 +76,13 @@ void HTMLHRElement::collectStyleForPresentationAttribute(const QualifiedName& na
addHTMLColorToStyle(style, CSSPropertyBorderColor, value);
addHTMLColorToStyle(style, CSSPropertyBackgroundColor, value);
} else if (name == noshadeAttr) {
addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderStyle, CSSValueSolid);
if (!hasAttribute(colorAttr)) {
addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderStyle, CSSValueSolid);
RefPtrWillBeRawPtr<CSSPrimitiveValue> darkGrayValue = cssValuePool().createColorValue(Color::darkGray);
style->setProperty(CSSPropertyBorderColor, darkGrayValue);
style->setProperty(CSSPropertyBackgroundColor, darkGrayValue);
RefPtrWillBeRawPtr<CSSPrimitiveValue> darkGrayValue = cssValuePool().createColorValue(Color::darkGray);
style->setProperty(CSSPropertyBorderColor, darkGrayValue);
style->setProperty(CSSPropertyBackgroundColor, darkGrayValue);
}
} else if (name == sizeAttr) {
StringImpl* si = value.impl();
int size = si->toInt();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment