summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/Source/core/css/CSSCounterValue.cpp
blob: 70861c5a6ac607f0151f6b5cbd21b0427da67d00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright 2015 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 file.

#include "core/css/CSSCounterValue.h"

#include "core/css/CSSMarkup.h"
#include "wtf/text/StringBuilder.h"

namespace blink {

String CSSCounterValue::customCSSText() const
{
    StringBuilder result;
    if (separator().isEmpty())
        result.appendLiteral("counter(");
    else
        result.appendLiteral("counters(");

    result.append(identifier());
    if (!separator().isEmpty()) {
        result.appendLiteral(", ");
        result.append(serializeString(separator()));
    }
    bool isDefaultListStyle = listStyle() == CSSValueDecimal;
    if (!isDefaultListStyle) {
        result.appendLiteral(", ");
        result.append(m_listStyle->cssText());
    }
    result.append(')');

    return result.toString();
}

DEFINE_TRACE_AFTER_DISPATCH(CSSCounterValue)
{
    visitor->trace(m_identifier);
    visitor->trace(m_listStyle);
    visitor->trace(m_separator);
    CSSValue::traceAfterDispatch(visitor);
}

} // namespace blink