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

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

Issue 1318543010: Change first() and second() in CSSPairValue to return const references (Closed) Base URL: svn://svn.chromium.org/blink/trunk
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 | Annotate | Revision Log
« no previous file with comments | « Source/core/css/CSSGradientValue.cpp ('k') | Source/core/css/parser/CSSPropertyParser.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 Apple Computer, Inc. 3 * Copyright (C) 2004, 2005, 2006 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,
(...skipping 29 matching lines...) Expand all
40 IdenticalValuesPolicy identicalValuesPolicy) 40 IdenticalValuesPolicy identicalValuesPolicy)
41 { 41 {
42 return adoptRefWillBeNoop(new CSSValuePair(first, second, identicalValue sPolicy)); 42 return adoptRefWillBeNoop(new CSSValuePair(first, second, identicalValue sPolicy));
43 } 43 }
44 44
45 static PassRefPtrWillBeRawPtr<CSSValuePair> create(const LengthSize& lengthS ize, const ComputedStyle& style) 45 static PassRefPtrWillBeRawPtr<CSSValuePair> create(const LengthSize& lengthS ize, const ComputedStyle& style)
46 { 46 {
47 return adoptRefWillBeNoop(new CSSValuePair(CSSPrimitiveValue::create(len gthSize.width(), style.effectiveZoom()), CSSPrimitiveValue::create(lengthSize.he ight(), style.effectiveZoom()), KeepIdenticalValues)); 47 return adoptRefWillBeNoop(new CSSValuePair(CSSPrimitiveValue::create(len gthSize.width(), style.effectiveZoom()), CSSPrimitiveValue::create(lengthSize.he ight(), style.effectiveZoom()), KeepIdenticalValues));
48 } 48 }
49 49
50 CSSValue* first() const { return m_first.get(); } 50 CSSValue& first() { return *m_first; }
51 CSSValue* second() const { return m_second.get(); } 51 CSSValue& second() { return *m_second; }
alancutter (OOO until 2018) 2015/08/31 05:49:21 Can these be trivially removed? If they can be rem
sashab 2015/09/01 04:54:41 It's not *super* easy to remove them... Lots of pl
52 const CSSValue& first() const { return *m_first; }
53 const CSSValue& second() const { return *m_second; }
alancutter (OOO until 2018) 2015/08/31 05:49:21 Now that these are references we should assert the
sashab 2015/09/01 04:54:41 Thanks, done.
52 54
53 String customCSSText() const 55 String customCSSText() const
54 { 56 {
55 String first = m_first->cssText(); 57 String first = m_first->cssText();
56 String second = m_second->cssText(); 58 String second = m_second->cssText();
57 if (m_identicalValuesPolicy == DropIdenticalValues && first == second) 59 if (m_identicalValuesPolicy == DropIdenticalValues && first == second)
58 return first; 60 return first;
59 return first + ' ' + second; 61 return first + ' ' + second;
60 } 62 }
61 63
(...skipping 16 matching lines...) Expand all
78 RefPtrWillBeMember<CSSValue> m_first; 80 RefPtrWillBeMember<CSSValue> m_first;
79 RefPtrWillBeMember<CSSValue> m_second; 81 RefPtrWillBeMember<CSSValue> m_second;
80 IdenticalValuesPolicy m_identicalValuesPolicy; 82 IdenticalValuesPolicy m_identicalValuesPolicy;
81 }; 83 };
82 84
83 DEFINE_CSS_VALUE_TYPE_CASTS(CSSValuePair, isValuePair()); 85 DEFINE_CSS_VALUE_TYPE_CASTS(CSSValuePair, isValuePair());
84 86
85 } // namespace 87 } // namespace
86 88
87 #endif // CSSValuePair_h 89 #endif // CSSValuePair_h
OLDNEW
« no previous file with comments | « Source/core/css/CSSGradientValue.cpp ('k') | Source/core/css/parser/CSSPropertyParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698