| OLD | NEW |
| 1 /** | 1 /** |
| 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) | 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2004, 2005, 2006, 2009 Apple Computer, Inc. | 3 * Copyright (C) 2004, 2005, 2006, 2009 Apple Computer, Inc. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 * Library General Public License for more details. | 13 * Library General Public License for more details. |
| 14 * | 14 * |
| 15 * You should have received a copy of the GNU Library General Public License | 15 * You should have received a copy of the GNU Library General Public License |
| 16 * along with this library; see the file COPYING.LIB. If not, write to | 16 * along with this library; see the file COPYING.LIB. If not, write to |
| 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 18 * Boston, MA 02110-1301, USA. | 18 * Boston, MA 02110-1301, USA. |
| 19 */ | 19 */ |
| 20 #include "core/css/CSSShadowValue.h" | 20 #include "core/css/CSSShadowValue.h" |
| 21 | 21 |
| 22 #include "core/css/CSSPrimitiveValue.h" | 22 #include "core/css/CSSPrimitiveValue.h" |
| 23 #include "core/css/serializer/CSSDeserializeStream.h" |
| 24 #include "core/css/serializer/CSSSerializeStream.h" |
| 23 #include "wtf/text/StringBuilder.h" | 25 #include "wtf/text/StringBuilder.h" |
| 24 #include "wtf/text/WTFString.h" | 26 #include "wtf/text/WTFString.h" |
| 25 | 27 |
| 26 namespace blink { | 28 namespace blink { |
| 27 | 29 |
| 28 // Used for text-shadow and box-shadow | 30 // Used for text-shadow and box-shadow |
| 29 CSSShadowValue::CSSShadowValue(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> x, | 31 CSSShadowValue::CSSShadowValue(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> x, |
| 30 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> y, | 32 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> y, |
| 31 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> blur, | 33 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> blur, |
| 32 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> spread, | 34 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> spread, |
| 33 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> style, | 35 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> style, |
| 34 PassRefPtrWillBeRawPtr<CSSValue> color) | 36 PassRefPtrWillBeRawPtr<CSSValue> color) |
| 35 : CSSValue(ShadowClass) | 37 : CSSValue(ShadowClass) |
| 36 , x(x) | 38 , x(x) |
| 37 , y(y) | 39 , y(y) |
| 38 , blur(blur) | 40 , blur(blur) |
| 39 , spread(spread) | 41 , spread(spread) |
| 40 , style(style) | 42 , style(style) |
| 41 , color(color) | 43 , color(color) |
| 42 { | 44 { |
| 43 } | 45 } |
| 44 | 46 |
| 47 PassRefPtrWillBeRawPtr<CSSShadowValue> CSSShadowValue::deserializeAfterDispatch(
CSSDeserializeStream* stream) |
| 48 { |
| 49 RefPtrWillBeRawPtr<CSSValue> x = CSSValue::deserialize(stream); |
| 50 RefPtrWillBeRawPtr<CSSValue> y = CSSValue::deserialize(stream); |
| 51 RefPtrWillBeRawPtr<CSSValue> blur = CSSValue::deserialize(stream); |
| 52 RefPtrWillBeRawPtr<CSSValue> spread = CSSValue::deserialize(stream); |
| 53 RefPtrWillBeRawPtr<CSSValue> style = CSSValue::deserialize(stream); |
| 54 RefPtrWillBeRawPtr<CSSValue> color = CSSValue::deserialize(stream); |
| 55 |
| 56 return create( |
| 57 toCSSPrimitiveValue(x.get()), |
| 58 toCSSPrimitiveValue(y.get()), |
| 59 toCSSPrimitiveValue(blur.get()), |
| 60 toCSSPrimitiveValue(spread.get()), |
| 61 toCSSPrimitiveValue(style.get()), |
| 62 color.release()); |
| 63 } |
| 64 |
| 45 String CSSShadowValue::customCSSText() const | 65 String CSSShadowValue::customCSSText() const |
| 46 { | 66 { |
| 47 StringBuilder text; | 67 StringBuilder text; |
| 48 | 68 |
| 49 if (color) | 69 if (color) |
| 50 text.append(color->cssText()); | 70 text.append(color->cssText()); |
| 51 if (x) { | 71 if (x) { |
| 52 if (!text.isEmpty()) | 72 if (!text.isEmpty()) |
| 53 text.append(' '); | 73 text.append(' '); |
| 54 text.append(x->cssText()); | 74 text.append(x->cssText()); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 80 bool CSSShadowValue::equals(const CSSShadowValue& other) const | 100 bool CSSShadowValue::equals(const CSSShadowValue& other) const |
| 81 { | 101 { |
| 82 return compareCSSValuePtr(color, other.color) | 102 return compareCSSValuePtr(color, other.color) |
| 83 && compareCSSValuePtr(x, other.x) | 103 && compareCSSValuePtr(x, other.x) |
| 84 && compareCSSValuePtr(y, other.y) | 104 && compareCSSValuePtr(y, other.y) |
| 85 && compareCSSValuePtr(blur, other.blur) | 105 && compareCSSValuePtr(blur, other.blur) |
| 86 && compareCSSValuePtr(spread, other.spread) | 106 && compareCSSValuePtr(spread, other.spread) |
| 87 && compareCSSValuePtr(style, other.style); | 107 && compareCSSValuePtr(style, other.style); |
| 88 } | 108 } |
| 89 | 109 |
| 110 void CSSShadowValue::serializeAfterDispatch(CSSSerializeStream* stream) const |
| 111 { |
| 112 x->serialize(stream); |
| 113 y->serialize(stream); |
| 114 blur->serialize(stream); |
| 115 spread->serialize(stream); |
| 116 style->serialize(stream); |
| 117 color->serialize(stream); |
| 118 } |
| 119 |
| 90 DEFINE_TRACE_AFTER_DISPATCH(CSSShadowValue) | 120 DEFINE_TRACE_AFTER_DISPATCH(CSSShadowValue) |
| 91 { | 121 { |
| 92 visitor->trace(x); | 122 visitor->trace(x); |
| 93 visitor->trace(y); | 123 visitor->trace(y); |
| 94 visitor->trace(blur); | 124 visitor->trace(blur); |
| 95 visitor->trace(spread); | 125 visitor->trace(spread); |
| 96 visitor->trace(style); | 126 visitor->trace(style); |
| 97 visitor->trace(color); | 127 visitor->trace(color); |
| 98 CSSValue::traceAfterDispatch(visitor); | 128 CSSValue::traceAfterDispatch(visitor); |
| 99 } | 129 } |
| 100 | 130 |
| 101 } | 131 } |
| OLD | NEW |