Title: [90304] trunk/Source/WebCore
- Revision
- 90304
- Author
- [email protected]
- Date
- 2011-07-01 17:43:45 -0700 (Fri, 01 Jul 2011)
Log Message
2011-07-01 Tim Horton <[email protected]>
Reviewed by Darin Adler.
Errors encountered within SVG documents should be reported to the console
https://bugs.webkit.org/show_bug.cgi?id=62599
Add SVGElement::reportAttributeParsingError, which will
write a Web Inspector console message if passed an SVGParsingError
and the attribute which was being applied, only in the case where
there is actually an error.
Include the SVG document's URI when writing to the Web Inspector
console, so that the UI displays both the filename and the line number.
* svg/SVGDocumentExtensions.cpp:
(WebCore::reportMessage):
* svg/SVGElement.cpp:
(WebCore::SVGElement::reportAttributeParsingError):
* svg/SVGElement.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (90303 => 90304)
--- trunk/Source/WebCore/ChangeLog 2011-07-02 00:26:38 UTC (rev 90303)
+++ trunk/Source/WebCore/ChangeLog 2011-07-02 00:43:45 UTC (rev 90304)
@@ -1,3 +1,24 @@
+2011-07-01 Tim Horton <[email protected]>
+
+ Reviewed by Darin Adler.
+
+ Errors encountered within SVG documents should be reported to the console
+ https://bugs.webkit.org/show_bug.cgi?id=62599
+
+ Add SVGElement::reportAttributeParsingError, which will
+ write a Web Inspector console message if passed an SVGParsingError
+ and the attribute which was being applied, only in the case where
+ there is actually an error.
+
+ Include the SVG document's URI when writing to the Web Inspector
+ console, so that the UI displays both the filename and the line number.
+
+ * svg/SVGDocumentExtensions.cpp:
+ (WebCore::reportMessage):
+ * svg/SVGElement.cpp:
+ (WebCore::SVGElement::reportAttributeParsingError):
+ * svg/SVGElement.h:
+
2011-07-01 Scott Byer <[email protected]>
Reviewed by Adam Barth.
Modified: trunk/Source/WebCore/svg/SVGDocumentExtensions.cpp (90303 => 90304)
--- trunk/Source/WebCore/svg/SVGDocumentExtensions.cpp 2011-07-02 00:26:38 UTC (rev 90303)
+++ trunk/Source/WebCore/svg/SVGDocumentExtensions.cpp 2011-07-02 00:43:45 UTC (rev 90304)
@@ -198,7 +198,7 @@
static void reportMessage(Document* document, MessageLevel level, const String& message)
{
if (Frame* frame = document->frame())
- frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, level, message, parserLineNumber(document), String());
+ frame->domWindow()->console()->addMessage(JSMessageSource, LogMessageType, level, message, parserLineNumber(document), document->documentURI());
}
void SVGDocumentExtensions::reportWarning(const String& message)
Modified: trunk/Source/WebCore/svg/SVGElement.cpp (90303 => 90304)
--- trunk/Source/WebCore/svg/SVGElement.cpp 2011-07-02 00:26:38 UTC (rev 90303)
+++ trunk/Source/WebCore/svg/SVGElement.cpp 2011-07-02 00:43:45 UTC (rev 90304)
@@ -103,6 +103,28 @@
return data;
}
+void SVGElement::reportAttributeParsingError(SVGParsingError error, Attribute* attribute)
+{
+ if (error == NoError)
+ return;
+
+ String errorString = "<" + tagName() + "> attribute " + attribute->name().toString() + "=\"" + attribute->value() + "\"";
+ SVGDocumentExtensions* extensions = document()->accessSVGExtensions();
+
+ if (error == NegativeValueForbiddenError) {
+ extensions->reportError("Invalid negative value for " + errorString);
+ return;
+ }
+
+ if (error == ParsingAttributeFailedError) {
+ extensions->reportError("Invalid value for " + errorString);
+ return;
+ }
+
+ ASSERT_NOT_REACHED();
+}
+
+
bool SVGElement::isSupported(StringImpl* feature, StringImpl* version) const
{
return DOMImplementation::hasFeature(feature, version);
Modified: trunk/Source/WebCore/svg/SVGElement.h (90303 => 90304)
--- trunk/Source/WebCore/svg/SVGElement.h 2011-07-02 00:26:38 UTC (rev 90303)
+++ trunk/Source/WebCore/svg/SVGElement.h 2011-07-02 00:43:45 UTC (rev 90304)
@@ -49,6 +49,12 @@
AnimatedUnknown
};
+enum SVGParsingError {
+ NoError,
+ ParsingAttributeFailedError,
+ NegativeValueForbiddenError
+};
+
typedef HashMap<QualifiedName, AnimatedAttributeType> AttributeToPropertyTypeMap;
class CSSCursorImageValue;
@@ -123,6 +129,8 @@
SVGElementRareData* rareSVGData() const;
SVGElementRareData* ensureRareSVGData();
+ void reportAttributeParsingError(SVGParsingError, Attribute*);
+
private:
friend class SVGElementInstance;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes