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

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: Review feedback 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::customCSSText() const
13 {
14 String top = m_top->cssText();
15 String right = m_right->cssText();
16 String bottom = m_bottom->cssText();
17 String left = m_left->cssText();
18
19 if (m_serializationType == SerializationType::SerializeAsRect)
20 return "rect(" + top + ' ' + right + ' ' + bottom + ' ' + left + ')';
21
22 StringBuilder result;
23 // reserve space for the four strings, plus three space separator characters .
24 result.reserveCapacity(top.length() + right.length() + bottom.length() + lef t.length() + 3);
25 result.append(top);
26 if (right != top || bottom != top || left != top) {
27 result.append(' ');
28 result.append(right);
29 if (bottom != top || right != left) {
30 result.append(' ');
31 result.append(bottom);
32 if (left != right) {
33 result.append(' ');
34 result.append(left);
35 }
36 }
37 }
38 return result.toString();
39 }
40
41 DEFINE_TRACE_AFTER_DISPATCH(CSSQuadValue)
42 {
43 visitor->trace(m_top);
44 visitor->trace(m_right);
45 visitor->trace(m_bottom);
46 visitor->trace(m_left);
47 CSSValue::traceAfterDispatch(visitor);
48 }
49
50 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698