Commit acc1e48e authored by Peter Kasting's avatar Peter Kasting Committed by Commit Bot

Remove using directives ("using namespace x") from blink/renderer/core/xml/.

Bug: 82078
Change-Id: Idb949d0a3d0d70077aa9a0e88558d504507a1e3a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1866431
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#708332}
parent 0b9037d9
......@@ -82,8 +82,6 @@
namespace blink {
using namespace html_names;
// FIXME: HTMLConstructionSite has a limit of 512, should these match?
static const unsigned kMaxXMLTreeDepth = 5000;
......@@ -455,8 +453,8 @@ bool XMLDocumentParser::ParseDocumentFragment(
// http://www.whatwg.org/specs/web-apps/current-work/multipage/the-xhtml-syntax.html#xml-fragment-parsing-algorithm
// For now we have a hack for script/style innerHTML support:
if (context_element &&
(context_element->HasLocalName(kScriptTag.LocalName()) ||
context_element->HasLocalName(kStyleTag.LocalName()))) {
(context_element->HasLocalName(html_names::kScriptTag.LocalName()) ||
context_element->HasLocalName(html_names::kStyleTag.LocalName()))) {
fragment->ParserAppendChild(fragment->GetDocument().createTextNode(chunk));
return true;
}
......@@ -981,7 +979,7 @@ void XMLDocumentParser::StartElementNs(const AtomicString& local_name,
prefix_to_namespace_map_, exception_state);
AtomicString is;
for (const auto& attr : prefixed_attributes) {
if (attr.GetName() == kIsAttr) {
if (attr.GetName() == html_names::kIsAttr) {
is = attr.Value();
break;
}
......
......@@ -38,8 +38,6 @@
namespace blink {
using namespace html_names;
const int kMaxErrors = 25;
XMLErrors::XMLErrors(Document* document)
......@@ -99,30 +97,31 @@ static inline Element* CreateXHTMLParserErrorHeader(
const String& error_messages) {
const CreateElementFlags flags = CreateElementFlags::ByParser();
Element* report_element = doc->CreateRawElement(
QualifiedName(g_null_atom, "parsererror", xhtmlNamespaceURI), flags);
QualifiedName(g_null_atom, "parsererror", html_names::xhtmlNamespaceURI),
flags);
Vector<Attribute> report_attributes;
report_attributes.push_back(Attribute(
kStyleAttr,
html_names::kStyleAttr,
"display: block; white-space: pre; border: 2px solid #c77; padding: 0 "
"1em 0 1em; margin: 1em; background-color: #fdd; color: black"));
report_element->ParserSetAttributes(report_attributes);
Element* h3 = doc->CreateRawElement(kH3Tag, flags);
Element* h3 = doc->CreateRawElement(html_names::kH3Tag, flags);
report_element->ParserAppendChild(h3);
h3->ParserAppendChild(
doc->createTextNode("This page contains the following errors:"));
Element* fixed = doc->CreateRawElement(kDivTag, flags);
Element* fixed = doc->CreateRawElement(html_names::kDivTag, flags);
Vector<Attribute> fixed_attributes;
fixed_attributes.push_back(
Attribute(kStyleAttr, "font-family:monospace;font-size:12px"));
fixed_attributes.push_back(Attribute(html_names::kStyleAttr,
"font-family:monospace;font-size:12px"));
fixed->ParserSetAttributes(fixed_attributes);
report_element->ParserAppendChild(fixed);
fixed->ParserAppendChild(doc->createTextNode(error_messages));
h3 = doc->CreateRawElement(kH3Tag, flags);
h3 = doc->CreateRawElement(html_names::kH3Tag, flags);
report_element->ParserAppendChild(h3);
h3->ParserAppendChild(doc->createTextNode(
"Below is a rendering of the page up to the first error."));
......@@ -139,22 +138,24 @@ void XMLErrors::InsertErrorMessageBlock() {
const CreateElementFlags flags = CreateElementFlags::ByParser();
Element* document_element = document_->documentElement();
if (!document_element) {
Element* root_element = document_->CreateRawElement(kHTMLTag, flags);
Element* body = document_->CreateRawElement(kBodyTag, flags);
Element* root_element =
document_->CreateRawElement(html_names::kHTMLTag, flags);
Element* body = document_->CreateRawElement(html_names::kBodyTag, flags);
root_element->ParserAppendChild(body);
document_->ParserAppendChild(root_element);
document_element = body;
} else if (document_element->namespaceURI() == svg_names::kNamespaceURI) {
Element* root_element = document_->CreateRawElement(kHTMLTag, flags);
Element* head = document_->CreateRawElement(kHeadTag, flags);
Element* style = document_->CreateRawElement(kStyleTag, flags);
Element* root_element =
document_->CreateRawElement(html_names::kHTMLTag, flags);
Element* head = document_->CreateRawElement(html_names::kHeadTag, flags);
Element* style = document_->CreateRawElement(html_names::kStyleTag, flags);
head->ParserAppendChild(style);
style->ParserAppendChild(
document_->createTextNode("html, body { height: 100% } parsererror + "
"svg { width: 100%; height: 100% }"));
style->FinishParsingChildren();
root_element->ParserAppendChild(head);
Element* body = document_->CreateRawElement(kBodyTag, flags);
Element* body = document_->CreateRawElement(html_names::kBodyTag, flags);
root_element->ParserAppendChild(body);
document_->ParserRemoveChild(*document_element);
......@@ -171,8 +172,9 @@ void XMLErrors::InsertErrorMessageBlock() {
if (DocumentXSLT::HasTransformSourceDocument(*document_)) {
Vector<Attribute> attributes;
attributes.push_back(Attribute(kStyleAttr, "white-space: normal"));
Element* paragraph = document_->CreateRawElement(kPTag, flags);
attributes.push_back(
Attribute(html_names::kStyleAttr, "white-space: normal"));
Element* paragraph = document_->CreateRawElement(html_names::kPTag, flags);
paragraph->ParserSetAttributes(attributes);
paragraph->ParserAppendChild(document_->createTextNode(
"This document was created as the result of an XSL transformation. The "
......
......@@ -36,8 +36,6 @@
namespace blink {
using namespace xpath;
XPathExpression* XPathEvaluator::createExpression(
const String& expression,
XPathNSResolver* resolver,
......@@ -56,7 +54,7 @@ XPathResult* XPathEvaluator::evaluate(const String& expression,
uint16_t type,
const ScriptValue&,
ExceptionState& exception_state) {
if (!IsValidContextNode(context_node)) {
if (!xpath::IsValidContextNode(context_node)) {
exception_state.ThrowDOMException(
DOMExceptionCode::kNotSupportedError,
"The node provided is '" + context_node->nodeName() +
......
......@@ -36,8 +36,6 @@
namespace blink {
using namespace xpath;
XPathExpression::XPathExpression() = default;
XPathExpression* XPathExpression::CreateExpression(
......@@ -45,7 +43,7 @@ XPathExpression* XPathExpression::CreateExpression(
XPathNSResolver* resolver,
ExceptionState& exception_state) {
auto* expr = MakeGarbageCollected<XPathExpression>();
Parser parser;
xpath::Parser parser;
expr->top_expression_ =
parser.ParseStatement(expression, resolver, exception_state);
......@@ -64,7 +62,7 @@ XPathResult* XPathExpression::evaluate(Node* context_node,
uint16_t type,
const ScriptValue&,
ExceptionState& exception_state) {
if (!IsValidContextNode(context_node)) {
if (!xpath::IsValidContextNode(context_node)) {
exception_state.ThrowDOMException(
DOMExceptionCode::kNotSupportedError,
"The node provided is '" + context_node->nodeName() +
......@@ -72,7 +70,7 @@ XPathResult* XPathExpression::evaluate(Node* context_node,
return nullptr;
}
EvaluationContext evaluation_context(*context_node);
xpath::EvaluationContext evaluation_context(*context_node);
auto* result = MakeGarbageCollected<XPathResult>(
evaluation_context, top_expression_->Evaluate(evaluation_context));
......
......@@ -37,8 +37,7 @@
#include "third_party/blink/renderer/platform/wtf/text/string_hash.h"
namespace blink {
using namespace xpath;
namespace xpath {
Parser* Parser::current_parser_ = nullptr;
......@@ -520,4 +519,5 @@ void Parser::DeleteString(String* s) {
strings_.erase(s);
}
} // namespace xpath
} // namespace blink
......@@ -33,24 +33,23 @@
namespace blink {
using namespace xpath;
XPathResult::XPathResult(EvaluationContext& context, const Value& value)
XPathResult::XPathResult(xpath::EvaluationContext& context,
const xpath::Value& value)
: value_(value), node_set_position_(0), dom_tree_version_(0) {
switch (value_.GetType()) {
case Value::kBooleanValue:
case xpath::Value::kBooleanValue:
result_type_ = kBooleanType;
return;
case Value::kNumberValue:
case xpath::Value::kNumberValue:
result_type_ = kNumberType;
return;
case Value::kStringValue:
case xpath::Value::kStringValue:
result_type_ = kStringType;
return;
case Value::kNodeSetValue:
case xpath::Value::kNodeSetValue:
result_type_ = kUnorderedNodeIteratorType;
node_set_position_ = 0;
node_set_ = NodeSet::Create(value_.ToNodeSet(&context));
node_set_ = xpath::NodeSet::Create(value_.ToNodeSet(&context));
document_ = &context.node->GetDocument();
dom_tree_version_ = document_->DomTreeVersion();
return;
......@@ -152,7 +151,7 @@ Node* XPathResult::singleNodeValue(ExceptionState& exception_state) const {
return nullptr;
}
const NodeSet& nodes = value_.ToNodeSet(nullptr);
const xpath::NodeSet& nodes = value_.ToNodeSet(nullptr);
if (resultType() == kFirstOrderedNodeType)
return nodes.FirstNode();
return nodes.AnyNode();
......@@ -209,7 +208,7 @@ Node* XPathResult::snapshotItem(unsigned index,
return nullptr;
}
const NodeSet& nodes = value_.ToNodeSet(nullptr);
const xpath::NodeSet& nodes = value_.ToNodeSet(nullptr);
if (index >= nodes.size())
return nullptr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment