Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2002)

Unified Diff: Source/core/svg/SVGGraphicsElement.cpp

Issue 43223002: SVGTests should not leave detached elements in the tree (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add TestExpectations Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/svg/SVGGraphicsElement.cpp
diff --git a/Source/core/svg/SVGGraphicsElement.cpp b/Source/core/svg/SVGGraphicsElement.cpp
index 9da02b36d0c5be6abf56906c9b2bd9bb4be5a591..fd28c05813e07c3011c03ca88f28671718a5cfc7 100644
--- a/Source/core/svg/SVGGraphicsElement.cpp
+++ b/Source/core/svg/SVGGraphicsElement.cpp
@@ -27,6 +27,7 @@
#include "core/rendering/svg/RenderSVGResource.h"
#include "core/rendering/svg/SVGPathData.h"
#include "core/svg/SVGElementInstance.h"
+#include "core/svg/SVGElementRareData.h"
#include "platform/transforms/AffineTransform.h"
namespace WebCore {
@@ -120,6 +121,13 @@ void SVGGraphicsElement::parseAttribute(const QualifiedName& name, const AtomicS
ASSERT_NOT_REACHED();
}
+bool SVGGraphicsElement::cachedValidity() const
pdr. 2013/10/25 06:13:12 Ditto for this name.
+{
+ if (!hasSVGRareData())
+ return true;
+ return svgRareData()->isValid();
+}
+
void SVGGraphicsElement::svgAttributeChanged(const QualifiedName& attrName)
{
if (!isSupportedAttribute(attrName)) {
@@ -129,8 +137,16 @@ void SVGGraphicsElement::svgAttributeChanged(const QualifiedName& attrName)
SVGElementInstance::InvalidationGuard invalidationGuard(this);
- if (SVGTests::handleAttributeChange(this, attrName))
+ if (SVGTests::isKnownAttribute(attrName)) {
+ // FIXME: Need to cast because both SVGTests and SVGElement have isValid()
+ // and SVG code uses multiple inheritance way too much.
+ bool validity = static_cast<SVGElement*>(this)->isValid();
pdr. 2013/10/25 06:13:12 Please use toSVGElement here instead of the static
+ if (cachedValidity() != validity) {
+ lazyReattachIfAttached();
+ ensureSVGRareData()->setIsValid(validity);
+ }
return;
+ }
RenderObject* object = renderer();
if (!object)

Powered by Google App Engine
This is Rietveld 408576698