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

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

Issue 1317523002: Changed Pair to be a CSSValue (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@add_const_to_primvalue
Patch Set: Rebase Created 5 years, 3 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
« no previous file with comments | « Source/core/css/CSSValue.cpp ('k') | Source/core/css/CSSValuePair.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
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 CSSValuePair_h
22 #define CSSValuePair_h
23
24 #include "core/CoreExport.h"
25 #include "core/css/CSSPrimitiveValue.h"
26 #include "core/css/CSSValue.h"
27 #include "core/style/ComputedStyle.h"
28 #include "platform/Length.h"
29 #include "wtf/PassRefPtr.h"
30 #include "wtf/RefCounted.h"
31 #include "wtf/text/StringBuilder.h"
32
33 namespace blink {
34
35 class CORE_EXPORT CSSValuePair : public CSSValue {
36 public:
37 enum IdenticalValuesPolicy { DropIdenticalValues, KeepIdenticalValues };
38
39 static PassRefPtrWillBeRawPtr<CSSValuePair> create(PassRefPtrWillBeRawPtr<CS SValue> first, PassRefPtrWillBeRawPtr<CSSValue> second,
40 IdenticalValuesPolicy identicalValuesPolicy)
41 {
42 return adoptRefWillBeNoop(new CSSValuePair(first, second, identicalValue sPolicy));
43 }
44
45 static PassRefPtrWillBeRawPtr<CSSValuePair> create(const LengthSize& lengthS ize, const ComputedStyle& style)
46 {
47 return adoptRefWillBeNoop(new CSSValuePair(CSSPrimitiveValue::create(len gthSize.width(), style.effectiveZoom()), CSSPrimitiveValue::create(lengthSize.he ight(), style.effectiveZoom()), KeepIdenticalValues));
48 }
49
50 CSSValue* first() const { return m_first.get(); }
51 CSSValue* second() const { return m_second.get(); }
52
53 String customCSSText() const
54 {
55 String first = m_first->cssText();
56 String second = m_second->cssText();
57 if (m_identicalValuesPolicy == DropIdenticalValues && first == second)
58 return first;
59 return first + ' ' + second;
60 }
61
62 bool equals(const CSSValuePair& other) const
63 {
64 ASSERT(m_identicalValuesPolicy == other.m_identicalValuesPolicy);
65 return compareCSSValuePtr(m_first, other.m_first)
66 && compareCSSValuePtr(m_second, other.m_second);
67 }
68
69 DECLARE_TRACE_AFTER_DISPATCH();
70
71 private:
72 CSSValuePair(PassRefPtrWillBeRawPtr<CSSValue> first, PassRefPtrWillBeRawPtr< CSSValue> second, IdenticalValuesPolicy identicalValuesPolicy)
73 : CSSValue(ValuePairClass)
74 , m_first(first)
75 , m_second(second)
76 , m_identicalValuesPolicy(identicalValuesPolicy) { }
77
78 RefPtrWillBeMember<CSSValue> m_first;
79 RefPtrWillBeMember<CSSValue> m_second;
80 IdenticalValuesPolicy m_identicalValuesPolicy;
81 };
82
83 DEFINE_CSS_VALUE_TYPE_CASTS(CSSValuePair, isValuePair());
84
85 } // namespace
86
87 #endif // CSSValuePair_h
OLDNEW
« no previous file with comments | « Source/core/css/CSSValue.cpp ('k') | Source/core/css/CSSValuePair.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698