Commit 8cb52319 authored by philipj@opera.com's avatar philipj@opera.com

Count internal use of DOMImplementation::hasFeature() returning false

This is the only internal usage of DOMImplementation::hasFeature(), and
the only way that svg:requiredFeatures is observable, other than the
it->isEmpty() case.

If usage is low, DOMImplementation.hasFeature() and this internal usage
can be changed together, see
https://groups.google.com/a/chromium.org/d/msg/blink-dev/r2aARnIHG4k/_dN33g65mYgJ

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

git-svn-id: svn://svn.chromium.org/blink/trunk@185133 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent f57d3446
......@@ -558,6 +558,7 @@ public:
InputTypeSubmit = 591,
InputTypeSubmitWithValue = 592,
SetReferrerPolicy = 593,
DOMImplementationHasFeatureReturnFalseInternal = 594,
// Add new features immediately above this line. Don't change assigned
// numbers of any item, and don't reuse removed slots.
......
......@@ -167,7 +167,7 @@ protected:
void setCalcMode(CalcMode calcMode) { m_calcMode = calcMode; }
private:
virtual bool isValid() const override final { return SVGTests::isValid(); }
virtual bool isValid() const override final { return SVGTests::isValid(document()); }
virtual void animationAttributeChanged() override;
void setAttributeType(const AtomicString&);
......
......@@ -52,7 +52,7 @@ public:
private:
explicit SVGCursorElement(Document&);
virtual bool isValid() const override { return SVGTests::isValid(); }
virtual bool isValid() const override { return SVGTests::isValid(document()); }
bool isSupportedAttribute(const QualifiedName&);
virtual void parseAttribute(const QualifiedName&, const AtomicString&) override;
......
......@@ -62,7 +62,7 @@ public:
virtual void toClipPath(Path&);
virtual RenderObject* createRenderer(RenderStyle*) override;
virtual bool isValid() const override final { return SVGTests::isValid(); }
virtual bool isValid() const override final { return SVGTests::isValid(document()); }
SVGAnimatedTransformList* transform() { return m_transform.get(); }
const SVGAnimatedTransformList* transform() const { return m_transform.get(); }
......
......@@ -46,7 +46,7 @@ public:
private:
explicit SVGMaskElement(Document&);
virtual bool isValid() const override { return SVGTests::isValid(); }
virtual bool isValid() const override { return SVGTests::isValid(document()); }
virtual bool needsPendingResourceHandling() const override { return false; }
bool isSupportedAttribute(const QualifiedName&);
......
......@@ -62,7 +62,7 @@ public:
private:
explicit SVGPatternElement(Document&);
virtual bool isValid() const override { return SVGTests::isValid(); }
virtual bool isValid() const override { return SVGTests::isValid(document()); }
virtual bool needsPendingResourceHandling() const override { return false; }
bool isSupportedAttribute(const QualifiedName&);
......
......@@ -24,8 +24,9 @@
#include "core/SVGNames.h"
#include "core/dom/DOMImplementation.h"
#include "platform/Language.h"
#include "core/frame/UseCounter.h"
#include "core/svg/SVGElement.h"
#include "platform/Language.h"
namespace blink {
......@@ -47,15 +48,19 @@ bool SVGTests::hasExtension(const String&)
return false;
}
bool SVGTests::isValid() const
bool SVGTests::isValid(Document& document) const
{
if (m_requiredFeatures->isSpecified()) {
const Vector<String>& requiredFeatures = m_requiredFeatures->value()->values();
Vector<String>::const_iterator it = requiredFeatures.begin();
Vector<String>::const_iterator itEnd = requiredFeatures.end();
for (; it != itEnd; ++it) {
if (it->isEmpty() || !DOMImplementation::hasFeature(*it, String()))
if (it->isEmpty())
return false;
if (!DOMImplementation::hasFeature(*it, String())) {
UseCounter::count(document, UseCounter::DOMImplementationHasFeatureReturnFalseInternal);
return false;
}
}
}
......
......@@ -26,6 +26,7 @@
namespace blink {
class Document;
class QualifiedName;
class SVGElement;
......@@ -37,7 +38,7 @@ public:
SVGStringListTearOff* systemLanguage() { return m_systemLanguage->tearOff(); }
bool hasExtension(const String&);
bool isValid() const;
bool isValid(Document&) const;
bool parseAttribute(const QualifiedName&, const AtomicString&);
bool isKnownAttribute(const QualifiedName&);
......
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