summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/svg/svg_text_content_element.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/blink/renderer/core/svg/svg_text_content_element.cc')
-rw-r--r--chromium/third_party/blink/renderer/core/svg/svg_text_content_element.cc46
1 files changed, 22 insertions, 24 deletions
diff --git a/chromium/third_party/blink/renderer/core/svg/svg_text_content_element.cc b/chromium/third_party/blink/renderer/core/svg/svg_text_content_element.cc
index 99abac1b520..307267cab67 100644
--- a/chromium/third_party/blink/renderer/core/svg/svg_text_content_element.cc
+++ b/chromium/third_party/blink/renderer/core/svg/svg_text_content_element.cc
@@ -20,13 +20,14 @@
#include "third_party/blink/renderer/core/svg/svg_text_content_element.h"
-#include "third_party/blink/renderer/core/css_property_names.h"
+#include "third_party/blink/renderer/core/css/css_property_names.h"
#include "third_party/blink/renderer/core/css_value_keywords.h"
#include "third_party/blink/renderer/core/editing/frame_selection.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/use_counter.h"
#include "third_party/blink/renderer/core/layout/api/line_layout_item.h"
#include "third_party/blink/renderer/core/layout/svg/svg_text_query.h"
+#include "third_party/blink/renderer/core/svg/svg_enumeration_map.h"
#include "third_party/blink/renderer/core/svg/svg_point_tear_off.h"
#include "third_party/blink/renderer/core/svg/svg_rect_tear_off.h"
#include "third_party/blink/renderer/core/svg_names.h"
@@ -37,14 +38,12 @@
namespace blink {
template <>
-const SVGEnumerationStringEntries&
-GetStaticStringEntries<SVGLengthAdjustType>() {
- DEFINE_STATIC_LOCAL(SVGEnumerationStringEntries, entries, ());
- if (entries.IsEmpty()) {
- entries.push_back(std::make_pair(kSVGLengthAdjustSpacing, "spacing"));
- entries.push_back(
- std::make_pair(kSVGLengthAdjustSpacingAndGlyphs, "spacingAndGlyphs"));
- }
+const SVGEnumerationMap& GetEnumerationMap<SVGLengthAdjustType>() {
+ static const SVGEnumerationMap::Entry enum_items[] = {
+ {kSVGLengthAdjustSpacing, "spacing"},
+ {kSVGLengthAdjustSpacingAndGlyphs, "spacingAndGlyphs"},
+ };
+ static const SVGEnumerationMap entries(enum_items);
return entries;
}
@@ -54,9 +53,15 @@ GetStaticStringEntries<SVGLengthAdjustType>() {
class SVGAnimatedTextLength final : public SVGAnimatedLength {
public:
static SVGAnimatedTextLength* Create(SVGTextContentElement* context_element) {
- return new SVGAnimatedTextLength(context_element);
+ return MakeGarbageCollected<SVGAnimatedTextLength>(context_element);
}
+ SVGAnimatedTextLength(SVGTextContentElement* context_element)
+ : SVGAnimatedLength(context_element,
+ svg_names::kTextLengthAttr,
+ SVGLengthMode::kWidth,
+ SVGLength::Initial::kUnitlessZero) {}
+
SVGLengthTearOff* baseVal() override {
SVGTextContentElement* text_content_element =
ToSVGTextContentElement(ContextElement());
@@ -67,13 +72,6 @@ class SVGAnimatedTextLength final : public SVGAnimatedLength {
return SVGAnimatedLength::baseVal();
}
-
- private:
- SVGAnimatedTextLength(SVGTextContentElement* context_element)
- : SVGAnimatedLength(context_element,
- SVGNames::textLengthAttr,
- SVGLengthMode::kWidth,
- SVGLength::Initial::kUnitlessZero) {}
};
SVGTextContentElement::SVGTextContentElement(const QualifiedName& tag_name,
@@ -83,7 +81,7 @@ SVGTextContentElement::SVGTextContentElement(const QualifiedName& tag_name,
text_length_is_specified_by_user_(false),
length_adjust_(SVGAnimatedEnumeration<SVGLengthAdjustType>::Create(
this,
- SVGNames::lengthAdjustAttr,
+ svg_names::kLengthAdjustAttr,
kSVGLengthAdjustSpacing)) {
AddToPropertyMap(text_length_);
AddToPropertyMap(length_adjust_);
@@ -224,7 +222,7 @@ void SVGTextContentElement::selectSubString(unsigned charnum,
bool SVGTextContentElement::IsPresentationAttribute(
const QualifiedName& name) const {
- if (name.Matches(XMLNames::spaceAttr))
+ if (name.Matches(xml_names::kSpaceAttr))
return true;
return SVGGraphicsElement::IsPresentationAttribute(name);
}
@@ -233,7 +231,7 @@ void SVGTextContentElement::CollectStyleForPresentationAttribute(
const QualifiedName& name,
const AtomicString& value,
MutableCSSPropertyValueSet* style) {
- if (name.Matches(XMLNames::spaceAttr)) {
+ if (name.Matches(xml_names::kSpaceAttr)) {
DEFINE_STATIC_LOCAL(const AtomicString, preserve_string, ("preserve"));
if (value == preserve_string) {
@@ -254,12 +252,12 @@ void SVGTextContentElement::CollectStyleForPresentationAttribute(
void SVGTextContentElement::SvgAttributeChanged(
const QualifiedName& attr_name) {
- if (attr_name == SVGNames::textLengthAttr)
+ if (attr_name == svg_names::kTextLengthAttr)
text_length_is_specified_by_user_ = true;
- if (attr_name == SVGNames::textLengthAttr ||
- attr_name == SVGNames::lengthAdjustAttr ||
- attr_name == XMLNames::spaceAttr) {
+ if (attr_name == svg_names::kTextLengthAttr ||
+ attr_name == svg_names::kLengthAdjustAttr ||
+ attr_name == xml_names::kSpaceAttr) {
SVGElement::InvalidationGuard invalidation_guard(this);
if (LayoutObject* layout_object = GetLayoutObject())