OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org) | |
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | |
4 * | |
5 * This library is free software; you can redistribute it and/or | |
6 * modify it under the terms of the GNU Library General Public | |
7 * License as published by the Free Software Foundation; either | |
8 * version 2 of the License, or (at your option) any later version. | |
9 * | |
10 * This library is distributed in the hope that it will be useful, | |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 * Library General Public License for more details. | |
14 * | |
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 | |
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | |
18 * Boston, MA 02110-1301, USA. | |
19 */ | |
20 | |
21 #ifndef CSSQuadValue_h | |
22 #define CSSQuadValue_h | |
23 | |
24 #include "core/CoreExport.h" | |
25 #include "core/css/CSSPrimitiveValue.h" | |
26 #include "core/css/CSSValue.h" | |
27 #include "wtf/RefPtr.h" | |
28 | |
29 namespace blink { | |
30 | |
31 class CORE_EXPORT CSSQuadValue : public CSSValue { | |
32 public: | |
33 static PassRefPtrWillBeRawPtr<CSSQuadValue> createQuad(PassRefPtrWillBeRawPt r<CSSPrimitiveValue> top, PassRefPtrWillBeRawPtr<CSSPrimitiveValue> right, PassR efPtrWillBeRawPtr<CSSPrimitiveValue> bottom, PassRefPtrWillBeRawPtr<CSSPrimitive Value> left) | |
Timothy Loh
2015/08/24 03:18:04
I'd rather an enum for the serialization strategy
sashab
2015/08/24 05:43:58
Done.
| |
34 { | |
35 return adoptRefWillBeNoop(new CSSQuadValue(top, right, bottom, left, fal se)); | |
36 } | |
37 | |
38 static PassRefPtrWillBeRawPtr<CSSQuadValue> createRect(PassRefPtrWillBeRawPt r<CSSPrimitiveValue> top, PassRefPtrWillBeRawPtr<CSSPrimitiveValue> right, PassR efPtrWillBeRawPtr<CSSPrimitiveValue> bottom, PassRefPtrWillBeRawPtr<CSSPrimitive Value> left) | |
39 { | |
40 return adoptRefWillBeNoop(new CSSQuadValue(top, right, bottom, left, tru e)); | |
41 } | |
42 | |
43 CSSPrimitiveValue* top() const { return m_top.get(); } | |
44 CSSPrimitiveValue* right() const { return m_right.get(); } | |
45 CSSPrimitiveValue* bottom() const { return m_bottom.get(); } | |
46 CSSPrimitiveValue* left() const { return m_left.get(); } | |
47 | |
48 bool isRect() { return m_serializeAsRect; } | |
49 | |
50 String customCSSText() const | |
51 { | |
52 return generateCSSString(top()->cssText(), right()->cssText(), bottom()- >cssText(), left()->cssText(), m_serializeAsRect); | |
53 } | |
54 | |
55 bool equals(const CSSQuadValue& other) const | |
56 { | |
57 return compareCSSValuePtr(m_top, other.m_top) | |
58 && compareCSSValuePtr(m_right, other.m_right) | |
59 && compareCSSValuePtr(m_left, other.m_left) | |
60 && compareCSSValuePtr(m_bottom, other.m_bottom); | |
61 } | |
62 | |
63 DECLARE_TRACE_AFTER_DISPATCH(); | |
64 | |
65 protected: | |
66 CSSQuadValue(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> top, PassRefPtrWillBe RawPtr<CSSPrimitiveValue> right, PassRefPtrWillBeRawPtr<CSSPrimitiveValue> botto m, PassRefPtrWillBeRawPtr<CSSPrimitiveValue> left, bool serializeAsRect) | |
67 : CSSValue(QuadClass) | |
68 , m_serializeAsRect(serializeAsRect) | |
69 , m_top(top) | |
70 , m_right(right) | |
71 , m_bottom(bottom) | |
72 , m_left(left) { } | |
73 | |
74 private: | |
75 bool m_serializeAsRect; | |
76 | |
77 static String generateCSSString(const String& top, const String& right, cons t String& bottom, const String& left, bool serializeAsRect); | |
78 | |
79 RefPtrWillBeMember<CSSPrimitiveValue> m_top; | |
80 RefPtrWillBeMember<CSSPrimitiveValue> m_right; | |
81 RefPtrWillBeMember<CSSPrimitiveValue> m_bottom; | |
82 RefPtrWillBeMember<CSSPrimitiveValue> m_left; | |
83 }; | |
84 | |
85 DEFINE_CSS_VALUE_TYPE_CASTS(CSSQuadValue, isQuadValue()); | |
86 | |
87 } // namespace blink | |
88 | |
89 #endif // CSSQuadValue_h | |
OLD | NEW |