Reviewed by Hyatt.
Test case for our CSS shorthand serialization.
* fast/dom/css-shortHands-expected.checksum: Added.
* fast/dom/css-shortHands-expected.png: Added.
* fast/dom/css-shortHands-expected.txt: Added.
* fast/dom/css-shortHands.html: Added.
WebCore:
Reviewed by Dave Hyatt.
Test: fast/dom/css-shortHands.html
First cut at leaving off implicit values in shorthand properties.
Need to account for multipl backgrounds and "border" later.
* khtml/css/css_valueimpl.cpp:
(DOM::CSSMutableStyleDeclarationImpl::get4Values):
(DOM::CSSMutableStyleDeclarationImpl::getShortHandValue):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@11576
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2005-12-13 Timothy Hatcher <timothy@apple.com>
+
+ Reviewed by Hyatt.
+
+ Test case for our CSS shorthand serialization.
+
+ * fast/dom/css-shortHands-expected.checksum: Added.
+ * fast/dom/css-shortHands-expected.png: Added.
+ * fast/dom/css-shortHands-expected.txt: Added.
+ * fast/dom/css-shortHands.html: Added.
+
2005-12-13 Anders Carlsson <andersca@mac.com>
Reviewed by Darin.
--- /dev/null
+6f74d902253de3da4002005d2e89078c
\ No newline at end of file
--- /dev/null
+layer at (0,0) size 800x600
+ RenderCanvas at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x579
+ RenderBlock {PRE} at (0,0) size 784x180
+ RenderText {TEXT} at (0,0) size 120x180
+ text run at (0,0) width 24: "1px"
+ text run at (0,15) width 56: "1px 2px"
+ text run at (0,30) width 88: "1px 2px 3px"
+ text run at (0,45) width 120: "1px 2px 3px 4px"
+ text run at (0,60) width 24: "1px"
+ text run at (0,75) width 56: "1px 2px"
+ text run at (0,90) width 88: "1px 2px 3px"
+ text run at (0,105) width 120: "1px 2px 3px 4px"
+ text run at (0,120) width 24: "red"
+ text run at (0,135) width 24: "red"
+ text run at (0,150) width 24: "red"
+ text run at (0,165) width 24: "red"
--- /dev/null
+<html>
+<head>
+<style>
+div { margin: 1px; }
+div { margin: 1px 2px; }
+div { margin: 1px 2px 3px; }
+div { margin: 1px 2px 3px 4px; }
+
+div { padding: 1px; }
+div { padding: 1px 2px; }
+div { padding: 1px 2px 3px; }
+div { padding: 1px 2px 3px 4px; }
+
+div { border-top: red; }
+div { border-bottom: red; }
+div { border-left: red; }
+div { border-right: red; }
+</style>
+</head>
+<body>
+<pre id="result"></pre>
+<script>
+var styleSheet = document.styleSheets.item(0);
+var s = "";
+for (var i = 0; i < styleSheet.cssRules.length; i++) {
+ var rule = styleSheet.cssRules[i];
+ var prop = null;
+ if (i < 4) prop = "margin";
+ else if (i >= 4 && i < 8) prop = "padding";
+ else if (i == 8) prop = "border-top";
+ else if (i == 9) prop = "border-bottom";
+ else if (i == 10) prop = "border-left";
+ else if (i == 11) prop = "border-right";
+ s += rule.style.getPropertyValue(prop) + "\n";
+}
+document.getElementById("result").innerText = s;
+</script>
+</body>
+</html>
+2005-12-13 Timothy Hatcher <timothy@apple.com>
+
+ Reviewed by Dave Hyatt.
+
+ Test: fast/dom/css-shortHands.html
+
+ First cut at leaving off implicit values in shorthand properties.
+ Need to account for multipl backgrounds and "border" later.
+
+ * khtml/css/css_valueimpl.cpp:
+ (DOM::CSSMutableStyleDeclarationImpl::get4Values):
+ (DOM::CSSMutableStyleDeclarationImpl::getShortHandValue):
+
2005-12-13 Anders Carlsson <andersca@mac.com>
* ChangeLog: Add titles to the recent bugzilla bugs.
DOMString CSSMutableStyleDeclarationImpl::get4Values( const int* properties ) const
{
DOMString res;
- for ( int i = 0 ; i < 4 ; ++i ) {
- CSSValueImpl* value = getPropertyCSSValue( properties[i] );
- if ( !value ) { // apparently all 4 properties must be specified.
- return DOMString();
+ for (int i = 0; i < 4; ++i) {
+ if (!isPropertyImplicit(properties[i])) {
+ CSSValueImpl* value = getPropertyCSSValue(properties[i]);
+ if (!value) // apparently all 4 properties must be specified.
+ return DOMString();
+ value->ref();
+ if (!res.isNull())
+ res += " ";
+ res += value->cssText();
+ value->deref();
}
- value->ref();
- if ( i > 0 )
- res += " ";
- res += value->cssText();
- value->deref();
}
return res;
}
DOMString CSSMutableStyleDeclarationImpl::getShortHandValue( const int* properties, int number ) const
{
DOMString res;
- for ( int i = 0 ; i < number ; ++i ) {
- CSSValueImpl* value = getPropertyCSSValue( properties[i] );
- if ( value ) { // TODO provide default value if !value
- value->ref();
- if ( !res.isNull() )
- res += " ";
- res += value->cssText();
- value->deref();
+ for (int i = 0; i < number; ++i) {
+ if (!isPropertyImplicit(properties[i])) {
+ CSSValueImpl* value = getPropertyCSSValue(properties[i]);
+ if (value) { // TODO provide default value if !value
+ value->ref();
+ if (!res.isNull())
+ res += " ";
+ res += value->cssText();
+ value->deref();
+ }
}
}
return res;