Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: Source/core/css/CSSQuadValue.h

Issue 1304993002: Change Rect and Quad to be CSSValues (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@split_counter_out_attempt_3
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 // TODO rename to CSSQuadValue.
32 class CORE_EXPORT CSSQuadValue : public CSSValue {
33 public:
34 static PassRefPtrWillBeRawPtr<CSSQuadValue> createQuad(PassRefPtrWillBeRawPt r<CSSPrimitiveValue> top, PassRefPtrWillBeRawPtr<CSSPrimitiveValue> right, PassR efPtrWillBeRawPtr<CSSPrimitiveValue> bottom, PassRefPtrWillBeRawPtr<CSSPrimitive Value> left)
35 {
36 return adoptRefWillBeNoop(new CSSQuadValue(top, right, bottom, left, fal se));
37 }
38
39 static PassRefPtrWillBeRawPtr<CSSQuadValue> createRect(PassRefPtrWillBeRawPt r<CSSPrimitiveValue> top, PassRefPtrWillBeRawPtr<CSSPrimitiveValue> right, PassR efPtrWillBeRawPtr<CSSPrimitiveValue> bottom, PassRefPtrWillBeRawPtr<CSSPrimitive Value> left)
40 {
41 return adoptRefWillBeNoop(new CSSQuadValue(top, right, bottom, left, tru e));
42 }
43
44 CSSPrimitiveValue* top() const { return m_top.get(); }
45 CSSPrimitiveValue* right() const { return m_right.get(); }
46 CSSPrimitiveValue* bottom() const { return m_bottom.get(); }
47 CSSPrimitiveValue* left() const { return m_left.get(); }
48
49 bool isRect() { return m_serializeAsRect; }
50
51 String customCSSText() const
52 {
53 return generateCSSString(top()->cssText(), right()->cssText(), bottom()- >cssText(), left()->cssText(), m_serializeAsRect);
54 }
55
56 bool equals(const CSSQuadValue& other) const
57 {
58 return compareCSSValuePtr(m_top, other.m_top)
59 && compareCSSValuePtr(m_right, other.m_right)
60 && compareCSSValuePtr(m_left, other.m_left)
61 && compareCSSValuePtr(m_bottom, other.m_bottom);
62 }
63
64 DECLARE_TRACE_AFTER_DISPATCH();
65
66 protected:
67 CSSQuadValue(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> top, PassRefPtrWillBe RawPtr<CSSPrimitiveValue> right, PassRefPtrWillBeRawPtr<CSSPrimitiveValue> botto m, PassRefPtrWillBeRawPtr<CSSPrimitiveValue> left, bool serializeAsRect)
68 : CSSValue(QuadClass)
69 , m_serializeAsRect(serializeAsRect)
70 , m_top(top)
71 , m_right(right)
72 , m_bottom(bottom)
73 , m_left(left) { }
74
75 private:
76 bool m_serializeAsRect;
77
78 static String generateCSSString(const String& top, const String& right, cons t String& bottom, const String& left, bool serializeAsRect);
79
80 RefPtrWillBeMember<CSSPrimitiveValue> m_top;
81 RefPtrWillBeMember<CSSPrimitiveValue> m_right;
82 RefPtrWillBeMember<CSSPrimitiveValue> m_bottom;
83 RefPtrWillBeMember<CSSPrimitiveValue> m_left;
84 };
85
86 DEFINE_CSS_VALUE_TYPE_CASTS(CSSQuadValue, isQuadValue());
87
88 } // namespace blink
89
90 #endif // CSSQuadValue_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698