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

Side by Side Diff: Source/core/css/CSSQuadValue.cpp

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: 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 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "config.h"
6 #include "core/css/CSSQuadValue.h"
7
8 #include "wtf/text/StringBuilder.h"
9
10 namespace blink {
11
12 String CSSQuadValue::generateCSSString(const String& top, const String& right, c onst String& bottom, const String& left, bool serializeAsRect)
13 {
14 if (serializeAsRect)
15 return "rect(" + top + ' ' + right + ' ' + bottom + ' ' + left + ')';
16
17 StringBuilder result;
18 // reserve space for the four strings, plus three space separator characters .
19 result.reserveCapacity(top.length() + right.length() + bottom.length() + lef t.length() + 3);
20 result.append(top);
21 if (right != top || bottom != top || left != top) {
22 result.append(' ');
23 result.append(right);
24 if (bottom != top || right != left) {
25 result.append(' ');
26 result.append(bottom);
27 if (left != right) {
28 result.append(' ');
29 result.append(left);
30 }
31 }
32 }
33 return result.toString();
34 }
35
36 DEFINE_TRACE_AFTER_DISPATCH(CSSQuadValue)
37 {
38 visitor->trace(m_top);
39 visitor->trace(m_right);
40 visitor->trace(m_bottom);
41 visitor->trace(m_left);
42 CSSValue::traceAfterDispatch(visitor);
43 }
44
45 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698