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

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: Review feedback 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 class CORE_EXPORT CSSQuadValue : public CSSValue {
32 public:
33 enum SerializationType {
34 SerializeAsRect,
35 SerializeAsQuad
36 };
37
38 static PassRefPtrWillBeRawPtr<CSSQuadValue> create(PassRefPtrWillBeRawPtr<CS SPrimitiveValue> top, PassRefPtrWillBeRawPtr<CSSPrimitiveValue> right, PassRefPt rWillBeRawPtr<CSSPrimitiveValue> bottom, PassRefPtrWillBeRawPtr<CSSPrimitiveValu e> left, SerializationType serializationType)
39 {
40 return adoptRefWillBeNoop(new CSSQuadValue(top, right, bottom, left, ser ializationType));
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 SerializationType serializationType() { return m_serializationType; }
49
50 String customCSSText() const;
51
52 bool equals(const CSSQuadValue& other) const
53 {
54 return compareCSSValuePtr(m_top, other.m_top)
55 && compareCSSValuePtr(m_right, other.m_right)
56 && compareCSSValuePtr(m_left, other.m_left)
57 && compareCSSValuePtr(m_bottom, other.m_bottom);
58 }
59
60 DECLARE_TRACE_AFTER_DISPATCH();
61
62 protected:
63 CSSQuadValue(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> top, PassRefPtrWillBe RawPtr<CSSPrimitiveValue> right, PassRefPtrWillBeRawPtr<CSSPrimitiveValue> botto m, PassRefPtrWillBeRawPtr<CSSPrimitiveValue> left, SerializationType serializati onType)
64 : CSSValue(QuadClass)
65 , m_serializationType(serializationType)
66 , m_top(top)
67 , m_right(right)
68 , m_bottom(bottom)
69 , m_left(left) { }
70
71 private:
72 SerializationType m_serializationType;
73 RefPtrWillBeMember<CSSPrimitiveValue> m_top;
74 RefPtrWillBeMember<CSSPrimitiveValue> m_right;
75 RefPtrWillBeMember<CSSPrimitiveValue> m_bottom;
76 RefPtrWillBeMember<CSSPrimitiveValue> m_left;
77 };
78
79 DEFINE_CSS_VALUE_TYPE_CASTS(CSSQuadValue, isQuadValue());
80
81 } // namespace blink
82
83 #endif // CSSQuadValue_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698