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

Unified Diff: Source/core/css/CSSContentDistributionValue.cpp

Issue 636993002: [CSS Grid Layout] Upgrade justify-content parsing to CSS3 Box Alignment spec. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Using a custom CSSValue to simplify parsing and style building. Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/css/CSSContentDistributionValue.cpp
diff --git a/Source/core/css/CSSContentDistributionValue.cpp b/Source/core/css/CSSContentDistributionValue.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..0feea22b2d2d83ee7a0264b0bfcf36b5a997a84f
--- /dev/null
+++ b/Source/core/css/CSSContentDistributionValue.cpp
@@ -0,0 +1,47 @@
+// Copyright (c) 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE fil
Julien - ping for review 2014/10/28 17:23:05 LICENSE fil again
jfernandez 2014/10/29 11:03:04 Done.
+
+#include "config.h"
+#include "core/css/CSSContentDistributionValue.h"
+
+#include "wtf/text/StringBuilder.h"
+
+namespace blink {
+
+CSSContentDistributionValue::CSSContentDistributionValue(CSSValueID distribution, CSSValueID position, CSSValueID overflow)
+ : CSSValue(CSSContentDistributionClass)
+ , m_distribution(distribution)
+ , m_position(position)
+ , m_overflow(overflow)
+{
+}
+
+CSSContentDistributionValue::~CSSContentDistributionValue()
+{
+}
+
+String CSSContentDistributionValue::customCSSText() const
+{
+ StringBuilder result;
+ if (m_distribution != CSSValueInvalid)
+ result.append(distribution()->customCSSText());
+ if (m_position != CSSValueInvalid) {
+ if (m_distribution != CSSValueInvalid)
+ result.appendLiteral(" ");
Julien - ping for review 2014/10/28 17:23:05 We could simplify this if you just used a space-se
jfernandez 2014/10/29 11:03:04 Acknowledged.
+ result.append(position()->customCSSText());
Julien - ping for review 2014/10/28 17:23:05 This creates a temporary object but valueName is s
jfernandez 2014/10/29 11:03:04 Done.
+ }
+ if (m_overflow != CSSValueInvalid) {
+ if (m_distribution != CSSValueInvalid || m_position != CSSValueInvalid)
+ result.appendLiteral(" ");
+ result.append(overflow()->customCSSText());
+ }
+ return result.toString();
+}
+
+bool CSSContentDistributionValue::equals(const CSSContentDistributionValue& other) const
+{
+ return m_distribution == other.m_distribution && m_position == other.m_position && m_overflow == other.m_overflow;
+}
+
+}

Powered by Google App Engine
This is Rietveld 408576698