From 044c127e18ae87fa6b692ea5a483b1e039347f5a Mon Sep 17 00:00:00 2001 From: eseidel Date: Thu, 18 Oct 2007 07:30:13 +0000 Subject: [PATCH] 2007-10-18 Eric Seidel Reviewed by Maciej. Fix crashers in SVGViewSpec::parseViewSpec http://bugs.webkit.org/show_bug.cgi?id=15504 Test is blocked by bug 15503, landed as: * svg/dom/viewspec-parser.html-disabled * bindings/scripts/CodeGeneratorObjC.pm: support classes where all parents are interfaces * ksvg2/svg/SVGViewSpec.cpp: (WebCore::SVGViewSpec::parseViewSpec): * ksvg2/svg/SVGViewSpec.idl: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@26740 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- LayoutTests/ChangeLog | 12 ++ LayoutTests/fast/js/resources/js-test-post.js | 2 +- LayoutTests/fast/js/resources/js-test-pre.js | 8 +- LayoutTests/svg/dom/viewspec-parser.html-disabled | 178 ++++++++++++++++++++++ WebCore/ChangeLog | 15 ++ WebCore/bindings/scripts/CodeGeneratorObjC.pm | 5 +- WebCore/ksvg2/svg/SVGViewSpec.cpp | 37 +++-- WebCore/ksvg2/svg/SVGViewSpec.idl | 38 +++++ 8 files changed, 270 insertions(+), 25 deletions(-) create mode 100644 LayoutTests/svg/dom/viewspec-parser.html-disabled create mode 100644 WebCore/ksvg2/svg/SVGViewSpec.idl diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index 606e2e0..8a169c3 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,15 @@ +2007-10-18 Eric Seidel + + Reviewed by Maciej. + + Test case for http://bugs.webkit.org/show_bug.cgi?id=15504 + Landed -disabled as it's blocked by: + http://bugs.webkit.org/show_bug.cgi?id=15503 + + * fast/js/resources/js-test-post.js: add support for XHTML + * fast/js/resources/js-test-pre.js: add support for XHTML + * svg/dom/viewspec-parser.html-disabled: Added. + 2007-10-17 Rob Buis Reviewed by Darin, Adam, and Maciej. diff --git a/LayoutTests/fast/js/resources/js-test-post.js b/LayoutTests/fast/js/resources/js-test-post.js index 72ba76f..6d8a68f 100644 --- a/LayoutTests/fast/js/resources/js-test-post.js +++ b/LayoutTests/fast/js/resources/js-test-post.js @@ -1,2 +1,2 @@ shouldBeTrue("successfullyParsed"); -debug('
TEST COMPLETE'); \ No newline at end of file +debug('
TEST COMPLETE'); diff --git a/LayoutTests/fast/js/resources/js-test-pre.js b/LayoutTests/fast/js/resources/js-test-pre.js index 26d7d5a..d11d2bc 100644 --- a/LayoutTests/fast/js/resources/js-test-pre.js +++ b/LayoutTests/fast/js/resources/js-test-pre.js @@ -16,8 +16,8 @@ function description(msg) function debug(msg) { var span = document.createElement("span"); - span.innerHTML = msg + '
'; - document.getElementById("console").appendChild(span); + document.getElementById("console").appendChild(span); // insert it first so XHTML knows the namespace + span.innerHTML = msg + '
'; } function escapeHTML(text) @@ -27,12 +27,12 @@ function escapeHTML(text) function testPassed(msg) { - debug('PASS ' + escapeHTML(msg) + ''); + debug('PASS ' + escapeHTML(msg) + ''); } function testFailed(msg) { - debug('FAIL ' + escapeHTML(msg) + ''); + debug('FAIL ' + escapeHTML(msg) + ''); } function areArraysEqual(_a, _b) diff --git a/LayoutTests/svg/dom/viewspec-parser.html-disabled b/LayoutTests/svg/dom/viewspec-parser.html-disabled new file mode 100644 index 0000000..dac5cd7 --- /dev/null +++ b/LayoutTests/svg/dom/viewspec-parser.html-disabled @@ -0,0 +1,178 @@ + + + + + + + +

+
+ + diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog index 7ac63c4..342b11d 100644 --- a/WebCore/ChangeLog +++ b/WebCore/ChangeLog @@ -1,3 +1,18 @@ +2007-10-18 Eric Seidel + + Reviewed by Maciej. + + Fix crashers in SVGViewSpec::parseViewSpec + http://bugs.webkit.org/show_bug.cgi?id=15504 + + Test is blocked by bug 15503, landed as: + * svg/dom/viewspec-parser.html-disabled + + * bindings/scripts/CodeGeneratorObjC.pm: support classes where all parents are interfaces + * ksvg2/svg/SVGViewSpec.cpp: + (WebCore::SVGViewSpec::parseViewSpec): + * ksvg2/svg/SVGViewSpec.idl: Added. + 2007-10-17 Rob Buis Reviewed by Darin, Adam, and Maciej. diff --git a/WebCore/bindings/scripts/CodeGeneratorObjC.pm b/WebCore/bindings/scripts/CodeGeneratorObjC.pm index ee6f99f..2b9113d 100644 --- a/WebCore/bindings/scripts/CodeGeneratorObjC.pm +++ b/WebCore/bindings/scripts/CodeGeneratorObjC.pm @@ -204,7 +204,7 @@ sub finish } # Uppercase the first letter, while respecting WebKit style guidelines. -# E.g., xmlEncoding becomes XMLEncoding, but xmlllang becomes Xmllang. +# E.g., xmlEncoding becomes XMLEncoding, but xmllang becomes Xmllang. sub WK_ucfirst { my $param = shift; @@ -386,6 +386,9 @@ sub GetParentAndProtocols my $firstParent = $codeGenerator->StripModule(shift(@parents)); if (IsProtocolType($firstParent)) { push(@protocols, "DOM" . $firstParent); + if (!$isProtocol) { + $parent = "DOMObject"; + } } else { $parent = "DOM" . $firstParent; } diff --git a/WebCore/ksvg2/svg/SVGViewSpec.cpp b/WebCore/ksvg2/svg/SVGViewSpec.cpp index e3aeefa..4e469d3 100644 --- a/WebCore/ksvg2/svg/SVGViewSpec.cpp +++ b/WebCore/ksvg2/svg/SVGViewSpec.cpp @@ -99,30 +99,30 @@ bool SVGViewSpec::parseViewSpec(const String& viewSpec) if (!skipString(currViewSpec, end, svgViewSpec, sizeof(svgViewSpec) / sizeof(UChar))) return false; - if (*currViewSpec != '(' ) + if (currViewSpec >= end || *currViewSpec != '(' ) return false; currViewSpec++; - while (*currViewSpec != ')' && currViewSpec < end) { + while (currViewSpec < end && *currViewSpec != ')') { if (*currViewSpec == 'v') { if (skipString(currViewSpec, end, viewBoxSpec, sizeof(viewBoxSpec) / sizeof(UChar))) { - if (*currViewSpec != '(') + if (currViewSpec >= end || *currViewSpec != '(') return false; currViewSpec++; float x, y, w, h; if (!parseViewBox(currViewSpec, end, x, y, w, h, false)) return false; setViewBoxBaseValue(FloatRect(x, y, w, h)); - if (*currViewSpec != ')') + if (currViewSpec >= end || *currViewSpec != ')') return false; currViewSpec++; } else if (skipString(currViewSpec, end, viewTargetSpec, sizeof(viewTargetSpec) / sizeof(UChar))) { - if (*currViewSpec != '(') + if (currViewSpec >= end || *currViewSpec != '(') return false; const UChar* viewTargetStart = ++currViewSpec; - while (*currViewSpec != ')' && currViewSpec <= end) + while (currViewSpec < end && *currViewSpec != ')') currViewSpec++; - if (currViewSpec > end) + if (currViewSpec >= end) return false; setViewTargetString(String(viewTargetStart, currViewSpec - viewTargetStart)); currViewSpec++; @@ -131,44 +131,43 @@ bool SVGViewSpec::parseViewSpec(const String& viewSpec) } else if (*currViewSpec == 'z') { if (!skipString(currViewSpec, end, zoomAndPanSpec, sizeof(zoomAndPanSpec) / sizeof(UChar))) return false; - if (*currViewSpec != '(') + if (currViewSpec >= end || *currViewSpec != '(') return false; currViewSpec++; if (!parseZoomAndPan(currViewSpec, end)) return false; - if (*currViewSpec != ')') + if (currViewSpec >= end || *currViewSpec != ')') return false; currViewSpec++; } else if (*currViewSpec == 'p') { if (!skipString(currViewSpec, end, preserveAspectRatioSpec, sizeof(preserveAspectRatioSpec) / sizeof(UChar))) return false; - if (*currViewSpec != '(') + if (currViewSpec >= end || *currViewSpec != '(') return false; currViewSpec++; if (!preserveAspectRatioBaseValue()->parsePreserveAspectRatio(currViewSpec, end, false)) return false; - if (*currViewSpec != ')') + if (currViewSpec >= end || *currViewSpec != ')') return false; currViewSpec++; } else if (*currViewSpec == 't') { if (!skipString(currViewSpec, end, transformSpec, sizeof(transformSpec) / sizeof(UChar))) return false; - if (*currViewSpec != '(') + if (currViewSpec >= end || *currViewSpec != '(') return false; currViewSpec++; SVGTransformable::parseTransformAttribute(m_transform.get(), currViewSpec, end); - if (*currViewSpec != ')') + if (currViewSpec >= end || *currViewSpec != ')') return false; currViewSpec++; - } + } else + return false; - if (*currViewSpec == ';') + if (currViewSpec < end && *currViewSpec == ';') currViewSpec++; } - if (currViewSpec >= end) - return false; - - if (*currViewSpec != ')') + + if (currViewSpec >= end || *currViewSpec != ')') return false; return true; diff --git a/WebCore/ksvg2/svg/SVGViewSpec.idl b/WebCore/ksvg2/svg/SVGViewSpec.idl new file mode 100644 index 0000000..46d4c8e --- /dev/null +++ b/WebCore/ksvg2/svg/SVGViewSpec.idl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2007 Eric Seidel + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +module svg { + + interface [Conditional=SVG, ObjCCustomInternalImpl] SVGViewSpec : SVGZoomAndPan, SVGFitToViewBox + { + readonly attribute SVGTransformList transform; + readonly attribute SVGElement viewTarget; + readonly attribute DOMString viewBoxString; + readonly attribute DOMString preserveAspectRatioString; + readonly attribute DOMString transformString; + readonly attribute DOMString viewTargetString; + }; + +} -- 1.8.3.1