Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
CSSStyleDeclaration.getPropertyPriority() fails for CSS shorthand pro…
…perties with 'important' priority https://bugs.webkit.org/show_bug.cgi?id=49058 Reviewed by Andreas Kling. Source/WebCore: CSSMutableStyleDeclaration::getPropertyPriority was not handling shorthands properly. Shorthands are not part of the property list of the style so we need to query the longhands which are the one added in the list. Only if the longhands have equal priority the shorthand priority is known. I also renamed getPropertyPriority (not the CSSOM exposed method) to something more consistent with WebKit naming guidelines. Test: fast/css/shorthand-priority.html * css/CSSMutableStyleDeclaration.cpp: (WebCore::CSSMutableStyleDeclaration::propertyIsImportant): (WebCore::CSSMutableStyleDeclaration::addParsedProperty): (WebCore::CSSMutableStyleDeclaration::getPropertyPriority): * css/CSSMutableStyleDeclaration.h: (CSSMutableStyleDeclaration): * editing/EditingStyle.cpp: (WebCore::EditingStyle::extractAndRemoveTextDirection): (WebCore::EditingStyle::collapseTextDecorationProperties): (WebCore::EditingStyle::conflictsWithInlineStyleOfElement): (WebCore::setTextDecorationProperty): * editing/RemoveCSSPropertyCommand.cpp: (WebCore::RemoveCSSPropertyCommand::doApply): Source/WebKit/qt: Update the code as getPropertyPriority has been renamed to propertyIsImportant. * Api/qwebelement.cpp: (QWebElement::styleProperty): LayoutTests: * fast/css/shorthand-priority-expected.txt: Added. * fast/css/shorthand-priority.html: Added. Canonical link: https://commits.webkit.org/94440@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@106490 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Alexis Menard
committed
Feb 1, 2012
1 parent
98f98ad
commit 7a3a15b0635d426625be394186c19c5ea0102e3b
Showing
10 changed files
with
130 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,15 @@ | ||
Tests that querying the priority for a shorthand works. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS e.style.getPropertyValue('border-bottom-style') is 'solid' | ||
PASS e.style.getPropertyPriority('border-bottom-style') is 'important' | ||
PASS e.style.getPropertyValue('border') is '20px solid green' | ||
PASS e.style.getPropertyPriority('border') is '' | ||
PASS e.style.getPropertyValue('border') is '20px solid green' | ||
PASS e.style.getPropertyPriority('border') is 'important' | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,38 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<script src="../js/resources/js-test-pre.js"></script> | ||
</head> | ||
<body> | ||
<script> | ||
|
||
description("Tests that querying the priority for a shorthand works."); | ||
|
||
var testContainer = document.createElement("div"); | ||
document.body.appendChild(testContainer); | ||
|
||
testContainer.innerHTML = '<div id="test">hello</div>'; | ||
|
||
e = document.getElementById('test'); | ||
|
||
// Sanity check. | ||
e.style.setProperty("border-bottom-style", "solid", "!important"); | ||
shouldBe("e.style.getPropertyValue('border-bottom-style')", "'solid'"); | ||
shouldBe("e.style.getPropertyPriority('border-bottom-style')", "'important'"); | ||
|
||
e.style.borderBottomStyle = ""; | ||
e.style.border = "20px solid green"; | ||
shouldBe("e.style.getPropertyValue('border')", "'20px solid green'"); | ||
shouldBe("e.style.getPropertyPriority('border')", "''"); | ||
|
||
e.style.border = ""; | ||
e.style.setProperty("border", "20px solid green", "!important"); | ||
shouldBe("e.style.getPropertyValue('border')", "'20px solid green'"); | ||
shouldBe("e.style.getPropertyPriority('border')", "'important'"); | ||
|
||
document.body.removeChild(testContainer); | ||
</script> | ||
<script src="../js/resources/js-test-post.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters