1 // Copyright 2015 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.
6 #include "core/css/CSSNamespaceRule.h"
8 #include "core/css/CSSMarkup.h"
9 #include "core/css/StyleRuleNamespace.h"
10 #include "wtf/text/StringBuilder.h"
14 CSSNamespaceRule::CSSNamespaceRule(StyleRuleNamespace
* namespaceRule
, CSSStyleSheet
* parent
)
16 , m_namespaceRule(namespaceRule
)
20 CSSNamespaceRule::~CSSNamespaceRule()
24 String
CSSNamespaceRule::cssText() const
27 result
.appendLiteral("@namespace ");
28 serializeIdentifier(prefix(), result
);
29 if (!prefix().isEmpty())
30 result
.appendLiteral(" ");
31 result
.appendLiteral("url(");
32 result
.append(serializeString(namespaceURI()));
33 result
.appendLiteral(");");
34 return result
.toString();
37 AtomicString
CSSNamespaceRule::namespaceURI() const
39 return m_namespaceRule
->uri();
42 AtomicString
CSSNamespaceRule::prefix() const
44 return m_namespaceRule
->prefix();
47 DEFINE_TRACE(CSSNamespaceRule
)
49 visitor
->trace(m_namespaceRule
);
50 CSSRule::trace(visitor
);