Skip to content

Commit

Permalink
[SVG] SVGLength{,List} migration to new SVG property impl.
Browse files Browse the repository at this point in the history
This CL replaces SVG{Animated,}Length{,List} classes with NewSVGProperty implementation.

For details, see design doc: https://docs.google.com/document/d/1bg7CUyUszqdwmENY3JX6_PoQD6uHRCNcRPJMlC4qlkw/edit?usp=sharing

BUG=308818

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

git-svn-id: svn://svn.chromium.org/blink/trunk@164832 bbb929c8-8fbe-4397-9dbb-9b2b20218538
  • Loading branch information
kouhei@chromium.org committed Jan 10, 2014
1 parent 8f80c85 commit f44e27c
Show file tree
Hide file tree
Showing 113 changed files with 2,153 additions and 1,635 deletions.
10 changes: 10 additions & 0 deletions third_party/WebKit/LayoutTests/TestExpectations
Original file line number Diff line number Diff line change
Expand Up @@ -911,3 +911,13 @@ crbug.com/332271 media/video-layer-crash.html [ NeedsRebaseline ]
crbug.com/332271 media/video-transformed.html [ NeedsRebaseline ]
crbug.com/332271 media/video-zoom-controls.html [ NeedsRebaseline ]
crbug.com/332271 media/video-zoom.html [ NeedsRebaseline ]

crbug.com/308818 [ Mac ] svg/custom/gradient-deep-referencing.svg [ NeedsRebaseline ]
crbug.com/308818 [ Mac ] svg/custom/invalid-lengthlist.svg [ NeedsRebaseline ]
crbug.com/308818 [ Mac Win ] http/tests/security/contentSecurityPolicy/img-blocked-no-gc-crash.html [ NeedsRebaseline ]
crbug.com/308818 [ Mac Win ] svg/dynamic-updates/SVGFEDropShadowElement-svgdom-shadow-opacity-prop.html [ NeedsRebaseline ]
crbug.com/308818 [ Mac Win ] svg/dynamic-updates/SVGFEDropShadowElement-svgdom-shadow-color-prop.html [ NeedsRebaseline ]
crbug.com/308818 [ Mac Win ] svg/dynamic-updates/SVGFEDropShadowElement-dom-shadow-color-attr.html [ NeedsRebaseline ]
crbug.com/308818 [ Mac Win ] svg/dynamic-updates/SVGFESpecularLightingElement-inherit-lighting-color-css-prop.html [ NeedsRebaseline ]
crbug.com/308818 [ Mac Win ] svg/dynamic-updates/SVGFEDropShadowElement-dom-shadow-opacity-attr.html [ NeedsRebaseline ]
crbug.com/308818 [ Mac Win ] svg/dynamic-updates/SVGFESpecularLightingElement-lighting-color-css-prop.html [ NeedsRebaseline ]
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ CONSOLE ERROR: Refused to evaluate a string as JavaScript because 'unsafe-eval'

CONSOLE ERROR: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".

CONSOLE ERROR: line 210: Uncaught EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".
CONSOLE ERROR: line 220: Uncaught EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'unsafe-inline'".

CONSOLE ERROR: Refused to load the image 'http://127.0.0.1:8000/security/resources/abe.png' because it violates the following Content Security Policy directive: "img-src 'none'".

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ layer at (0,0) size 800x600
RenderSVGResourceLinearGradient {linearGradient} [id="gradient1f"] [gradientUnits=userSpaceOnUse] [start=(0,100)] [end=(100,100)]
RenderSVGResourceLinearGradient {linearGradient} [id="gradient1e"] [gradientUnits=userSpaceOnUse] [start=(0,100)] [end=(100,0)]
RenderSVGResourceLinearGradient {linearGradient} [id="gradient1d"] [gradientUnits=userSpaceOnUse] [start=(0,100)] [end=(100,0)]
RenderSVGResourceRadialGradient {radialGradient} [id="gradient1c"] [gradientUnits=userSpaceOnUse] [center=(400,400)] [focal=(400,400)] [radius=400.00] [focalRadius=0.00]
RenderSVGResourceRadialGradient {radialGradient} [id="gradient1c"] [gradientUnits=userSpaceOnUse] [center=(400,300)] [focal=(400,300)] [radius=353.55] [focalRadius=0.00]
RenderSVGGradientStop {stop} [offset=0.00] [color=#FF0000]
RenderSVGGradientStop {stop} [offset=1.00] [color=#0000FF]
RenderSVGResourceLinearGradient {linearGradient} [id="gradient1b"] [gradientUnits=userSpaceOnUse] [start=(0,0)] [end=(100,0)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CONSOLE ERROR: line 13: Error: Invalid value for <text> attribute x="1.2.3"
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
Expand Down
10 changes: 10 additions & 0 deletions third_party/WebKit/LayoutTests/resources/js-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,20 @@ function isMinusZero(n)
return n === 0 && 1/n < 0;
}

function isNewSVGTearOffType(v)
{
return ['[object SVGLength]', '[object SVGLengthList]'].indexOf(""+v) != -1;
}

function isResultCorrect(actual, expected)
{
if (expected === 0)
return actual === expected && (1/actual) === (1/expected);
if (actual === expected)
return true;
// http://crbug.com/308818 : The new implementation of SVGListProperties do not necessary return the same wrapper object, so === operator would not work. We compare for their string representation instead.
if (isNewSVGTearOffType(expected) && typeof(expected) == typeof(actual) && actual.valueAsString == expected.valueAsString)
return true;
if (typeof(expected) == "number" && isNaN(expected))
return typeof(actual) == "number" && isNaN(actual);
if (expected && (Object.prototype.toString.call(expected) == Object.prototype.toString.call([])))
Expand All @@ -173,6 +181,8 @@ function isResultCorrect(actual, expected)

function stringify(v)
{
if (isNewSVGTearOffType(v))
return v.valueAsString;
if (v === 0 && 1/v < 0)
return "-0";
else return "" + v;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ svg.x.baseVal.value = 10
svg.x.animVal.value = 10
SUCCESS (1 of 2)
setting svg.x.animVal.value = 5
caught exception: An attempt was made to modify an object where modifications are not allowed.
caught exception: Failed to set the 'value' property on 'SVGLength': The attribute is read-only.
svg.x.baseVal.value = 10
svg.x.animVal.value = 10
SUCCESS (2 of 2)
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Test uncommon arguments for initialize()
PASS text1.x.baseVal.initialize(30) threw exception TypeError: Failed to execute 'initialize' on 'SVGLengthList': parameter 1 is not of type 'SVGLength'..
PASS text1.x.baseVal.initialize('aString') threw exception TypeError: Failed to execute 'initialize' on 'SVGLengthList': parameter 1 is not of type 'SVGLength'..
PASS text1.x.baseVal.initialize(text1) threw exception TypeError: Failed to execute 'initialize' on 'SVGLengthList': parameter 1 is not of type 'SVGLength'..
PASS text1.x.baseVal.initialize(null) threw exception TypeError: Failed to execute 'initialize' on 'SVGLengthList': The PassListItemType provided is invalid..
PASS text1.x.baseVal.initialize(null) threw exception TypeError: Failed to execute 'initialize' on 'SVGLengthList': Lists must be initialized with a valid item..

Test uncommon arguments for getItem()
PASS text1.x.baseVal.getItem(30) threw exception IndexSizeError: Index or size was negative, or greater than the allowed value..
Expand Down Expand Up @@ -55,7 +55,7 @@ PASS text1.getAttribute('x') is "500 1000 1500"
PASS text1.x.baseVal.insertItemBefore(30, 0) threw exception TypeError: Failed to execute 'insertItemBefore' on 'SVGLengthList': parameter 1 is not of type 'SVGLength'..
PASS text1.x.baseVal.insertItemBefore('aString', 0) threw exception TypeError: Failed to execute 'insertItemBefore' on 'SVGLengthList': parameter 1 is not of type 'SVGLength'..
PASS text1.x.baseVal.insertItemBefore(text1, 0) threw exception TypeError: Failed to execute 'insertItemBefore' on 'SVGLengthList': parameter 1 is not of type 'SVGLength'..
PASS text1.x.baseVal.insertItemBefore(null, 0) threw exception TypeError: Failed to execute 'insertItemBefore' on 'SVGLengthList': The PassListItemType provided is invalid..
PASS text1.x.baseVal.insertItemBefore(null, 0) threw exception TypeError: Failed to execute 'insertItemBefore' on 'SVGLengthList': An invalid item cannot be inserted to a list..

Set x='1 2 3 4' for text1
PASS text1.setAttribute('x', '1 2 3 4') is undefined.
Expand Down Expand Up @@ -85,7 +85,7 @@ PASS text1.x.baseVal.replaceItem(null) threw exception TypeError: Failed to exec
PASS text1.x.baseVal.replaceItem(30, 0) threw exception TypeError: Failed to execute 'replaceItem' on 'SVGLengthList': parameter 1 is not of type 'SVGLength'..
PASS text1.x.baseVal.replaceItem('aString', 0) threw exception TypeError: Failed to execute 'replaceItem' on 'SVGLengthList': parameter 1 is not of type 'SVGLength'..
PASS text1.x.baseVal.replaceItem(text1, 0) threw exception TypeError: Failed to execute 'replaceItem' on 'SVGLengthList': parameter 1 is not of type 'SVGLength'..
PASS text1.x.baseVal.replaceItem(null, 0) threw exception TypeError: Failed to execute 'replaceItem' on 'SVGLengthList': The PassListItemType provided is invalid..
PASS text1.x.baseVal.replaceItem(null, 0) threw exception TypeError: Failed to execute 'replaceItem' on 'SVGLengthList': An invalid item cannot be replaced with an existing list item..
PASS text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(0), 0) is text1.x.baseVal.getItem(0)
PASS text1.x.baseVal.numberOfItems is 4
PASS text1.x.baseVal.getItem(0).value is 1
Expand Down Expand Up @@ -137,10 +137,10 @@ Test uncommon arguments for appendItem()
PASS text1.x.baseVal.appendItem(30) threw exception TypeError: Failed to execute 'appendItem' on 'SVGLengthList': parameter 1 is not of type 'SVGLength'..
PASS text1.x.baseVal.appendItem('aString') threw exception TypeError: Failed to execute 'appendItem' on 'SVGLengthList': parameter 1 is not of type 'SVGLength'..
PASS text1.x.baseVal.appendItem(text1) threw exception TypeError: Failed to execute 'appendItem' on 'SVGLengthList': parameter 1 is not of type 'SVGLength'..
PASS text1.x.baseVal.appendItem(null) threw exception TypeError: Failed to execute 'appendItem' on 'SVGLengthList': The PassListItemType provided is invalid..
PASS text1.x.baseVal.appendItem(null) threw exception TypeError: Failed to execute 'appendItem' on 'SVGLengthList': An invalid item cannot be appended to a list..

Testing animVal clear throws
PASS text1.x.animVal.clear() threw exception NoModificationAllowedError: An attempt was made to modify an object where modifications are not allowed..
PASS text1.x.animVal.clear() threw exception NoModificationAllowedError: Failed to execute 'clear' on 'SVGLengthList': The object is read-only..
PASS text1.x.baseVal.clear() is undefined.
PASS successfullyParsed is true

Expand Down
Loading

0 comments on commit f44e27c

Please sign in to comment.