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

Side by Side Diff: third_party/WebKit/Source/core/css/CSSContentDistributionValue.cpp

Issue 2750843002: [css-align] Adapt content-alignment properties to the new baseline syntax (Closed)
Patch Set: Don't use raw pointers attributes on a GC managed class. Created 3 years, 9 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
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/css/CSSContentDistributionValue.h" 5 #include "core/css/CSSContentDistributionValue.h"
6 6
7 #include "core/css/CSSValueList.h" 7 #include "core/css/CSSValueList.h"
8 #include "wtf/text/StringBuilder.h" 8 #include "wtf/text/StringBuilder.h"
9 9
10 namespace blink { 10 namespace blink {
11 11
12 CSSContentDistributionValue::CSSContentDistributionValue( 12 CSSContentDistributionValue::CSSContentDistributionValue(
13 CSSValueID distribution, 13 CSSValueID distribution,
14 CSSValueID position, 14 CSSValueID position,
15 CSSValueID overflow) 15 CSSValueID overflow)
16 : CSSValue(CSSContentDistributionClass), 16 : CSSValue(CSSContentDistributionClass),
17 m_distribution(distribution), 17 m_distribution(distribution),
18 m_position(position), 18 m_position(position),
19 m_overflow(overflow) {} 19 m_overflow(overflow) {}
20 20
21 CSSContentDistributionValue::~CSSContentDistributionValue() {} 21 CSSContentDistributionValue::~CSSContentDistributionValue() {}
22 22
23 String CSSContentDistributionValue::customCSSText() const { 23 String CSSContentDistributionValue::customCSSText() const {
24 CSSValueList* list = CSSValueList::createSpaceSeparated(); 24 CSSValueList* list = CSSValueList::createSpaceSeparated();
25 25
26 if (m_distribution != CSSValueInvalid) 26 if (m_distribution != CSSValueInvalid)
27 list->append(*distribution()); 27 list->append(*distribution());
28 if (m_position != CSSValueInvalid) 28 if (m_position != CSSValueInvalid) {
29 list->append(*position()); 29 if (m_position == CSSValueFirstBaseline ||
30 m_position == CSSValueLastBaseline) {
31 CSSValueID preference =
32 m_position == CSSValueFirstBaseline ? CSSValueFirst : CSSValueLast;
33 list->append(*CSSIdentifierValue::create(preference));
34 list->append(*CSSIdentifierValue::create(CSSValueBaseline));
35 } else {
36 list->append(*position());
37 }
38 }
30 if (m_overflow != CSSValueInvalid) 39 if (m_overflow != CSSValueInvalid)
31 list->append(*overflow()); 40 list->append(*overflow());
32 41
33 return list->customCSSText(); 42 return list->customCSSText();
34 } 43 }
35 44
36 bool CSSContentDistributionValue::equals( 45 bool CSSContentDistributionValue::equals(
37 const CSSContentDistributionValue& other) const { 46 const CSSContentDistributionValue& other) const {
38 return m_distribution == other.m_distribution && 47 return m_distribution == other.m_distribution &&
39 m_position == other.m_position && m_overflow == other.m_overflow; 48 m_position == other.m_position && m_overflow == other.m_overflow;
40 } 49 }
41 50
42 } // namespace blink 51 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698