Commit 732f8dbd authored by Peter Kasting's avatar Peter Kasting Committed by Commit Bot

Remove using directives ("using namespace x") in core/editing/serializers/.

Bug: 82078
Change-Id: I9b6f6c5fcd9b8a7235033f7d4e48dc70f3274591
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1870416
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
Reviewed-by: default avatarXiaocheng Hu <xiaochengh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#708572}
parent 38dfe964
...@@ -47,8 +47,6 @@ ...@@ -47,8 +47,6 @@
namespace blink { namespace blink {
using namespace html_names;
struct EntityDescription { struct EntityDescription {
UChar entity; UChar entity;
const std::string& reference; const std::string& reference;
...@@ -388,11 +386,15 @@ EntityMask MarkupFormatter::EntityMaskForText(const Text& text) const { ...@@ -388,11 +386,15 @@ EntityMask MarkupFormatter::EntityMaskForText(const Text& text) const {
parent_name = &(text.parentElement())->TagQName(); parent_name = &(text.parentElement())->TagQName();
if (parent_name && if (parent_name &&
(*parent_name == kScriptTag || *parent_name == kStyleTag || (*parent_name == html_names::kScriptTag ||
*parent_name == kXmpTag || *parent_name == kIFrameTag || *parent_name == html_names::kStyleTag ||
*parent_name == kPlaintextTag || *parent_name == kNoembedTag || *parent_name == html_names::kXmpTag ||
*parent_name == kNoframesTag || *parent_name == html_names::kIFrameTag ||
(*parent_name == kNoscriptTag && text.GetDocument().GetFrame() && *parent_name == html_names::kPlaintextTag ||
*parent_name == html_names::kNoembedTag ||
*parent_name == html_names::kNoframesTag ||
(*parent_name == html_names::kNoscriptTag &&
text.GetDocument().GetFrame() &&
text.GetDocument().CanExecuteScripts(kNotAboutToExecuteScript)))) text.GetDocument().CanExecuteScripts(kNotAboutToExecuteScript))))
return kEntityMaskInCDATA; return kEntityMaskInCDATA;
return kEntityMaskInHTMLPCDATA; return kEntityMaskInHTMLPCDATA;
......
...@@ -72,8 +72,6 @@ ...@@ -72,8 +72,6 @@
namespace blink { namespace blink {
using namespace html_names;
class AttributeChange { class AttributeChange {
DISALLOW_NEW(); DISALLOW_NEW();
...@@ -131,7 +129,7 @@ static HTMLElement* AncestorToRetainStructureAndAppearanceForBlock( ...@@ -131,7 +129,7 @@ static HTMLElement* AncestorToRetainStructureAndAppearanceForBlock(
if (!common_ancestor_block) if (!common_ancestor_block)
return nullptr; return nullptr;
if (common_ancestor_block->HasTagName(kTbodyTag) || if (common_ancestor_block->HasTagName(html_names::kTbodyTag) ||
IsHTMLTableRowElement(*common_ancestor_block)) IsHTMLTableRowElement(*common_ancestor_block))
return Traversal<HTMLTableElement>::FirstAncestor(*common_ancestor_block); return Traversal<HTMLTableElement>::FirstAncestor(*common_ancestor_block);
...@@ -251,7 +249,7 @@ static HTMLElement* HighestAncestorToWrapMarkup( ...@@ -251,7 +249,7 @@ static HTMLElement* HighestAncestorToWrapMarkup(
Position::FirstPositionInNode(special_common_ancestor Position::FirstPositionInNode(special_common_ancestor
? *special_common_ancestor ? *special_common_ancestor
: *common_ancestor), : *common_ancestor),
kATag))) html_names::kATag)))
special_common_ancestor = enclosing_anchor; special_common_ancestor = enclosing_anchor;
return special_common_ancestor; return special_common_ancestor;
...@@ -562,7 +560,7 @@ DocumentFragment* CreateFragmentFromText(const EphemeralRange& context, ...@@ -562,7 +560,7 @@ DocumentFragment* CreateFragmentFromText(const EphemeralRange& context,
fragment->AppendChild(document.createTextNode(string)); fragment->AppendChild(document.createTextNode(string));
if (string.EndsWith('\n')) { if (string.EndsWith('\n')) {
auto* element = MakeGarbageCollected<HTMLBRElement>(document); auto* element = MakeGarbageCollected<HTMLBRElement>(document);
element->setAttribute(kClassAttr, AppleInterchangeNewline); element->setAttribute(html_names::kClassAttr, AppleInterchangeNewline);
fragment->AppendChild(element); fragment->AppendChild(element);
} }
return fragment; return fragment;
...@@ -592,7 +590,7 @@ DocumentFragment* CreateFragmentFromText(const EphemeralRange& context, ...@@ -592,7 +590,7 @@ DocumentFragment* CreateFragmentFromText(const EphemeralRange& context,
if (s.IsEmpty() && i + 1 == num_lines) { if (s.IsEmpty() && i + 1 == num_lines) {
// For last line, use the "magic BR" rather than a P. // For last line, use the "magic BR" rather than a P.
element = MakeGarbageCollected<HTMLBRElement>(document); element = MakeGarbageCollected<HTMLBRElement>(document);
element->setAttribute(kClassAttr, AppleInterchangeNewline); element->setAttribute(html_names::kClassAttr, AppleInterchangeNewline);
} else { } else {
if (use_clones_of_enclosing_block) if (use_clones_of_enclosing_block)
element = &block->CloneWithoutChildren(); element = &block->CloneWithoutChildren();
......
...@@ -49,8 +49,6 @@ wtf_size_t TotalLength(const Vector<String>& strings) { ...@@ -49,8 +49,6 @@ wtf_size_t TotalLength(const Vector<String>& strings) {
} // namespace } // namespace
using namespace html_names;
StyledMarkupAccumulator::StyledMarkupAccumulator( StyledMarkupAccumulator::StyledMarkupAccumulator(
AbsoluteURLs should_resolve_urls, AbsoluteURLs should_resolve_urls,
const TextOffset& start, const TextOffset& start,
...@@ -119,7 +117,7 @@ void StyledMarkupAccumulator::AppendTextWithInlineStyle( ...@@ -119,7 +117,7 @@ void StyledMarkupAccumulator::AppendTextWithInlineStyle(
AppendText(text); AppendText(text);
} else { } else {
const bool use_rendered_text = !EnclosingElementWithTag( const bool use_rendered_text = !EnclosingElementWithTag(
Position::FirstPositionInNode(text), kSelectTag); Position::FirstPositionInNode(text), html_names::kSelectTag);
String content = String content =
use_rendered_text ? RenderedText(text) : StringValueForRange(text); use_rendered_text ? RenderedText(text) : StringValueForRange(text);
StringBuilder buffer; StringBuilder buffer;
...@@ -146,7 +144,7 @@ void StyledMarkupAccumulator::AppendElementWithInlineStyle( ...@@ -146,7 +144,7 @@ void StyledMarkupAccumulator::AppendElementWithInlineStyle(
AttributeCollection attributes = element.Attributes(); AttributeCollection attributes = element.Attributes();
for (const auto& attribute : attributes) { for (const auto& attribute : attributes) {
// We'll handle the style attribute separately, below. // We'll handle the style attribute separately, below.
if (attribute.GetName() == kStyleAttr) if (attribute.GetName() == html_names::kStyleAttr)
continue; continue;
AppendAttribute(out, element, attribute); AppendAttribute(out, element, attribute);
} }
......
...@@ -79,8 +79,6 @@ bool HandleSelectionBoundary<EditingInFlatTreeStrategy>(const Node& node) { ...@@ -79,8 +79,6 @@ bool HandleSelectionBoundary<EditingInFlatTreeStrategy>(const Node& node) {
} // namespace } // namespace
using namespace html_names;
template <typename Strategy> template <typename Strategy>
class StyledMarkupTraverser { class StyledMarkupTraverser {
STACK_ALLOCATED(); STACK_ALLOCATED();
...@@ -233,7 +231,7 @@ String StyledMarkupSerializer<Strategy>::CreateMarkup() { ...@@ -233,7 +231,7 @@ String StyledMarkupSerializer<Strategy>::CreateMarkup() {
*start_.ComputeContainerNode(), *end_.ComputeContainerNode()); *start_.ComputeContainerNode(), *end_.ComputeContainerNode());
DCHECK(common_ancestor); DCHECK(common_ancestor);
auto* body = To<HTMLBodyElement>(EnclosingElementWithTag( auto* body = To<HTMLBodyElement>(EnclosingElementWithTag(
Position::FirstPositionInNode(*common_ancestor), kBodyTag)); Position::FirstPositionInNode(*common_ancestor), html_names::kBodyTag));
HTMLBodyElement* fully_selected_root = nullptr; HTMLBodyElement* fully_selected_root = nullptr;
// FIXME: Do this for all fully selected blocks, not just the body. // FIXME: Do this for all fully selected blocks, not just the body.
if (body && AreSameRanges(body, start_, end_)) if (body && AreSameRanges(body, start_, end_))
...@@ -255,10 +253,12 @@ String StyledMarkupSerializer<Strategy>::CreateMarkup() { ...@@ -255,10 +253,12 @@ String StyledMarkupSerializer<Strategy>::CreateMarkup() {
!fully_selected_root_style->Style() || !fully_selected_root_style->Style() ||
!fully_selected_root_style->Style()->GetPropertyCSSValue( !fully_selected_root_style->Style()->GetPropertyCSSValue(
CSSPropertyID::kBackgroundImage)) && CSSPropertyID::kBackgroundImage)) &&
fully_selected_root->hasAttribute(kBackgroundAttr)) { fully_selected_root->hasAttribute(html_names::kBackgroundAttr)) {
fully_selected_root_style->Style()->SetProperty( fully_selected_root_style->Style()->SetProperty(
CSSPropertyID::kBackgroundImage, CSSPropertyID::kBackgroundImage,
"url('" + fully_selected_root->getAttribute(kBackgroundAttr) + "url('" +
fully_selected_root->getAttribute(
html_names::kBackgroundAttr) +
"')", "')",
/* important */ false, /* important */ false,
fully_selected_root->GetDocument().GetSecureContextMode()); fully_selected_root->GetDocument().GetSecureContextMode());
...@@ -370,7 +370,7 @@ Node* StyledMarkupTraverser<Strategy>::Traverse(Node* start_node, ...@@ -370,7 +370,7 @@ Node* StyledMarkupTraverser<Strategy>::Traverse(Node* start_node,
if (n->GetLayoutObject() || if (n->GetLayoutObject() ||
(element && element->HasDisplayContentsStyle()) || (element && element->HasDisplayContentsStyle()) ||
EnclosingElementWithTag(FirstPositionInOrBeforeNode(*n), EnclosingElementWithTag(FirstPositionInOrBeforeNode(*n),
kSelectTag)) { html_names::kSelectTag)) {
// Add the node to the markup if we're not skipping the descendants // Add the node to the markup if we're not skipping the descendants
AppendStartMarkup(*n); AppendStartMarkup(*n);
......
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