Commit e7b09df5 authored by Fredrik Söderquist's avatar Fredrik Söderquist Committed by Commit Bot

SVGAnimatedAngle initial values

This CL implements correct initial values for all SVGAnimatedAngle properties
(which is only one: 'orient' on <marker>.)

Bug: 225807, 589856
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I61c50162a98a47d0da23f3a7d0830440b8c7aa25
Reviewed-on: https://chromium-review.googlesource.com/1207331Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#588942}
parent 9c9d3fe6
<!DOCTYPE html>
<title>Property value does not override the attribute value after invalid attribute is set</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
test(function() {
var marker = document.createElementNS("http://www.w3.org/2000/svg", "marker");
assert_equals(marker.orientType.baseVal, SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE, "initial");
// Set to 'auto' via property.
marker.orientType.baseVal = SVGMarkerElement.SVG_MARKER_ORIENT_AUTO;
// Set attribute to invalid value.
marker.setAttribute("orient", "aito");
assert_equals(marker.orientType.baseVal, SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE, "initial");
assert_equals(marker.orientAngle.baseVal.value, 0);
// Read the attribute.
assert_equals(marker.getAttribute("orient"), "aito", "attribute value unchanged");
}, document.title+', setting orientType.');
test(function() {
var marker = document.createElementNS("http://www.w3.org/2000/svg", "marker");
assert_equals(marker.orientType.baseVal, SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE, "initial");
marker.orientAngle.baseVal.value = 90;
// Set attribute to invalid value.
marker.setAttribute("orient", "aito");
assert_equals(marker.orientType.baseVal, SVGMarkerElement.SVG_MARKER_ORIENT_ANGLE, "initial");
assert_equals(marker.orientAngle.baseVal.value, 0);
// Read the attribute.
assert_equals(marker.getAttribute("orient"), "aito", "attribute value unchanged");
}, document.title+', setting orientAngle.');
</script>
<!DOCTYPE html>
<title>SVGAnimatedAngle, initial values</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="resources/initial-value-helper.js"></script>
<script>
assert_initial_values([
{ interface: 'SVGMarkerElement', attributes: [ 'orientAngle' ],
orientAngle: { initial: '0', valid: '90deg' } },
], { mapProperty: { orientAngle: 'orient' },
getValue: function(value) { return value.valueAsString } });
</script>
......@@ -95,6 +95,13 @@ class SVGAngle final : public SVGPropertyHelper<SVGAngle> {
void SetValue(float);
float Value() const;
// Technically speaking, we don't need any bits (it's always the
// same), but we want SetInitial to be called.
static constexpr int kInitialValueBits = 1;
void SetInitial(unsigned) {
NewValueSpecifiedUnits(kSvgAngletypeUnspecified, 0);
}
void SetValueInSpecifiedUnits(float value_in_specified_units) {
value_in_specified_units_ = value_in_specified_units;
}
......
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