Commit 252463ab authored by rob.buis@samsung.com's avatar rob.buis@samsung.com

Use ConstructFromLiteral instead of implicit conversion

Since we are supposed to end up with an AtomicString, don't rely on implicit conversion, but provide it as static local variable while using ConstructFromLiteral to avoid using strlen.

Review URL: https://codereview.chromium.org/567653002

git-svn-id: svn://svn.chromium.org/blink/trunk@181840 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent ecde3750
...@@ -148,14 +148,15 @@ Document* SVGUseElement::externalDocument() const ...@@ -148,14 +148,15 @@ Document* SVGUseElement::externalDocument() const
void transferUseWidthAndHeightIfNeeded(const SVGUseElement& use, SVGElement* shadowElement, const SVGElement& originalElement) void transferUseWidthAndHeightIfNeeded(const SVGUseElement& use, SVGElement* shadowElement, const SVGElement& originalElement)
{ {
DEFINE_STATIC_LOCAL(const AtomicString, hundredPercentString, ("100%", AtomicString::ConstructFromLiteral));
ASSERT(shadowElement); ASSERT(shadowElement);
if (isSVGSymbolElement(*shadowElement)) { if (isSVGSymbolElement(*shadowElement)) {
// Spec (<use> on <symbol>): This generated 'svg' will always have explicit values for attributes width and height. // Spec (<use> on <symbol>): This generated 'svg' will always have explicit values for attributes width and height.
// If attributes width and/or height are provided on the 'use' element, then these attributes // If attributes width and/or height are provided on the 'use' element, then these attributes
// will be transferred to the generated 'svg'. If attributes width and/or height are not specified, // will be transferred to the generated 'svg'. If attributes width and/or height are not specified,
// the generated 'svg' element will use values of 100% for these attributes. // the generated 'svg' element will use values of 100% for these attributes.
shadowElement->setAttribute(SVGNames::widthAttr, use.width()->isSpecified() ? AtomicString(use.width()->currentValue()->valueAsString()) : "100%"); shadowElement->setAttribute(SVGNames::widthAttr, use.width()->isSpecified() ? AtomicString(use.width()->currentValue()->valueAsString()) : hundredPercentString);
shadowElement->setAttribute(SVGNames::heightAttr, use.height()->isSpecified() ? AtomicString(use.height()->currentValue()->valueAsString()) : "100%"); shadowElement->setAttribute(SVGNames::heightAttr, use.height()->isSpecified() ? AtomicString(use.height()->currentValue()->valueAsString()) : hundredPercentString);
} else if (isSVGSVGElement(*shadowElement)) { } else if (isSVGSVGElement(*shadowElement)) {
// Spec (<use> on <svg>): If attributes width and/or height are provided on the 'use' element, then these // Spec (<use> on <svg>): If attributes width and/or height are provided on the 'use' element, then these
// values will override the corresponding attributes on the 'svg' in the generated tree. // values will override the corresponding attributes on the 'svg' in the generated tree.
......
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