Movatterモバイル変換


[0]ホーム

URL:


Chapter 2: Conformance Criteria

2.1. Overview

Graphics defined with SVG have many different applications. As a result, not all software that uses SVG will have the same features. Conformance to the SVG specification is therefore not a binary matter; sofware may be conforming within a restricted feature set.

Furthermore, SVG is designed to be integrated into other types of documents; depending on the type of integration, only a limited feature-set may be appropriate. There are various ways that an SVG document fragment can be referenced by or included in other documents and thereby be processed by a user agent. SVG documents can also be viewed directly, as the primary document. Each different method by which an SVG document fragment can be used implies a certain set of requirements on how the SVG document fragment must be processed.

This chapter therefore defines a number ofprocessing modes that encompass the different combinations of features which may be enabled or disabled in the document. In addition, it specifies normative requirements for which processing mode must be used when SVG documents reference or embed other SVG documents. The same set of processing modes may be used by reference in other specifications to describe how SVG documents should be processed.

This document does not place normative requirements on other specifications that can reference or include SVG documents, such as HTML and various CSS specifications. The intention is for these other specifications to normatively point to the appropriate processing mode from this document.

This chapter also outlines specific conformance requirements fordifferent types of SVG content, anddifferent classes of software that use or create SVG.

2.2. Processing modes

This section defines a standard set ofprocessing modes for SVG documents. Each processing mode specifies whether certain high level SVG features are enabled.

2.2.1. Features

The features that can be enabled or disabled depending on the processing mode are as follows:

declarative animation

Declarative animation includes both the animation elements in SVG –animate,animateMotion,animateTransform andset – and CSS Transitions and Animations (see theAnimation appendix for details). When declarative animations are disabled in an SVG document, any animation elements or CSS Transitions or Animations must not be applied or run.

This is not the same as pausing the document's animated state at 0s document time; if an animation is defined to begin at 0s, it still will not be applied.

references to external resources

References toexternal resources are URLs references or network access requests made by markup, style properties, script or other Web platform features used in the document, except for:

When external references are disabled in an SVG document, any attempt to fetch a document through an external reference must instead be treated as if a network error occurred and no data was received.

When external references are enabled, user agents that support external file requests from the Internet must adhere to the restrictions on cross-origin resource fetching, as outlined inthe Linking chapter.

script execution

Script execution is the execution of any SVGscript elements, script found inevent attributes (such asonclick on SVG elements), or any other script defined by other Web platform features used in the document, such as any HTMLscript elements. When script execution is disabled in an SVG document, no script in the document must be run.

interaction

Interaction refers to the delivery of DOM Events or the invocation of any user agent specific UI behaviors such as text selection, focus changing, link traversal, or animation or transition triggering that is done in response to user input such as mouse or keyboard activity. When interaction is disabled in an SVG document, any user input events that would be targetted at the document or any elements within the document must have no effect.

2.2.2. Dynamic interactive mode

Thisprocessing mode imposes no restrictions on any feature of the SVG language.

Dynamic Interactive Features
script executionyes
external referencesyes
declarative animationyes
interactivityyes

2.2.3. Animated mode

Thisprocessing mode is intended for circumstances wherean SVG document is to be used as an animated image that is allowedto resolve external references, but which is not intended to be usedas an interactive document.

Animated Features
script executionno
external referencesyes
declarative animationyes
interactivityno

2.2.4. Secure animated mode

Thisprocessing mode is intended for circumstances where an SVG document is to be used as an animated image that is not allowed to resolve external references, and which is not intended to be used as an interactive document. This mode might be used where image support has traditionally been limited to raster images (such as JPEG, PNG and GIF).

Secure Animated Features
script executionno
external referencesno
declarative animationyes
interactivityno

2.2.5. Static mode

Thisprocessing mode is intended for circumstances wherean SVG document is to be used as a non-animated image that is allowedto resolve external references, but which is not intended to be usedas an interactive document.For example,an SVG viewer that processes graphics for inclusion in print documentswould likely use static mode.

Static Features
script executionno
external referencesyes
declarative animationno
interactivityno

2.2.6. Secure static mode

Thisprocessing mode is intended for circumstances where an SVG document is to be used as a non-animated image that is not allowed to resolve external references, and which is not intended to be used as an interactive document. This mode might be used where image support has traditionally been limited to non-animated raster images (such as JPEG and PNG.)

Secure Static Features
script executionno
external referencesno
declarative animationno
interactivityno

2.3. Processing modes for SVG sub-resource documents

When an SVG document is viewed directly, it is expected to be displayed using the most comprehensiveprocessing mode supported by the user agent. However, when an SVG is processed as a sub-resource or embedded document, the following restrictions must apply:

image references

An SVG embedded within animage element must be processed insecure animated mode if the embedding document supportsdeclarative animation, or insecure static mode otherwise.

The same processing modes are expected to be used for other cases where SVG is used in place of a raster image, such as an HTML‘img’ element or in any CSS property that takes an<image> data type. This is consistent withHTML's requirement that image sources must reference "a non-interactive, optionally animated, image resource that is neither paged nor scripted" [HTML]

iframe references

SVG documents referenced by the an HTMLiframe element in an SVG document must use the same processing mode as the embedding document, subject to any restrictions defined by thesandbox attribute on the embeddingiframe.

The same processing rules are intended to be used when an SVG document is loaded in an HTML‘embed’,‘iframe’ or‘object’ element[HTML]. An HTML document that is atop-level browsing context in an interactive web browser is equivalent to SVG'sdynamic interactive processing mode.

use element and otherhref references

When SVG documents are loaded throughuse element references orpaint server element cross-references they must be processed insecure static mode.

Note that animations do not run while processing the sub-resource document, for both performance reasons and because there is currently no context defined for resource documents to reference their timeline against. However, when elements from a sub-resource document are cloned into the current document because of ause element reference or paint-server cross-reference, the clonedelement instances may be animated in the current document's timeline, as described inAnimations in use-element shadow trees, and may trigger the loading of additional sub-resource files.

Graphical effects references

When SVG documents are loaded through any style property references that target specific elements in the document (as opposed to SVG as an image format), they must be processed insecure static mode.

Note that animations do not run in sub-resource documents, for both performance reasons and because there is currently no context defined for resource documents to reference their timeline against.

Some style properties may reference either specific elements or entire image files; the processing mode is more restrictive in the first case. For example, a reference to an SVGmask element will not be animated, but an entire SVG file used as an image mask can be.

SVG in fonts

When SVG files are processed as part of a font reference, they must use thesecure animated mode if animated glyphs are supported, orsecure static mode otherwise.

These restrictions are included in the OpenType specification for processing documents from the "SVG" table. OpenType also applies additional restrictions, in the form of auser agent style sheet that prevents rendering of text and foreign objects [OPENTYPE].

SVG document fragments that are included inline in a host document must use aprocessing mode that matches that of the host document. SVG document fragments included as children of an SVGforeignObject element must use theprocessing mode of the surrounding SVG document; non-SVG foreign content must be processed with equivalent restrictions.

For example, if an SVG document is being used insecure animated mode due to being referenced by an HTML‘img’ or SVGimage element, then any content within aforeignObject element must have scripts, interactivity, and external file references disabled, but should have declarative animation enabled.

2.3.1. Examples

Below are various methods of embedding SVG in an HTML page by reference, along with the expected processing mode and allowed features for each.

Each cell in the "Live Example" row should display a yellow smiley face. In each example below, clicking on the eyes tests link traversal, and clicking on the face tests declarative interactivity and script execution. The link should replace the image with a blue square (clicking it will revert it to the original image). The declarative interactivity uses theset element to change the face from shades of yellow to shades of green, and uses CSS pseudoclasses to add a stroke to the interactive elements. The script should fill in the smile. Time-based (as opposed to interactivity-based) declarative animation is supported if the left eye is winking (using theanimate element) and if the eyes are dark blue with regular flashes of light blue (using CSS keyframe animation).

The expected processing modes and features outlined here are subject to any future changes in the corresponding HTML or CSS specification.

Embedding methodobject without sandboxingiframe withsandbox=""imgCSS background
Expected processing modedynamic interactivedynamic interactive, with restrictionssecure animatedsecure animated
Declarative, time-based animation
(winking left eye, color-change in both eyes)
allowedallowedallowedallowed
Declarative, interactive animation and style changes
(face color changes when clicked, face/eyes outlined when hovered or focused)
allowedalloweddisableddisabled
Link navigation within the same browsing context, to the same domain
(image changes when clicking eyes)
allowedalloweddisableddisabled
Scripted interaction
(smile widens when clicking face)
alloweddisabled (because of sandboxing)disableddisabled
Live exampleThis browser does not support embedded SVG images.smiley face, as an image
 

2.4. Document Conformance Classes

SVG is defined in terms of a document object model (DOM), rather than a particular file format or document type. For SVG content, therefore, conformance with this specification is defined by whether the content is or can generate a conforming DOM. Additional conformance classes depend on whether the content is also valid and well-formed XML [xml].

2.4.1. Conforming SVG DOM Subtrees

A DOM node tree or subtree rooted at a given elementis aconforming SVG DOM subtreeif it forms aSVG document fragmentthat adheres to the specification described in this document(Scalable Vector Graphics (SVG) Specification).Specifically, it:

SVG document fragments can be included within parent XML documents usingthe XML namespace facilities described inNamespaces in XML [xml-names].Note, however, that since a conforming SVG DOM subtree must have ansvg element as its root, the use of an individual non-svgelement from the SVG namespace is disallowed. Thus, the SVG part of thefollowing document isnot conforming:

<?xml version="1.0" standalone="no"?><!DOCTYPE SomeParentXMLGrammar PUBLIC "-//SomeParent" "http://SomeParentXMLGrammar.dtd"><ParentXML>  <!-- Elements from ParentXML go here -->  <!-- The following isnot conforming -->  <z:rect xmlns:z="http://www.w3.org/2000/svg"          x="0" y="0" width="10" height="10" />  <!-- More elements from ParentXML go here --></ParentXML>

Instead, for the SVG part to become aconforming SVG DOM subtree,the file could be modified as follows:

<?xml version="1.0" standalone="no"?><!DOCTYPE SomeParentXMLGrammar PUBLIC "-//SomeParent" "http://SomeParentXMLGrammar.dtd"><ParentXML>  <!-- Elements from ParentXML go here -->  <!-- The following is conforming -->  <z:svg xmlns:z="http://www.w3.org/2000/svg"         width="100px" height="100px">    <z:rect x="0" y="0" width="10" height="10"/>  </z:svg>  <!-- More elements from ParentXML go here --></ParentXML>

The SVG language and these conformance criteria provide no designatedsize limits on any aspect of SVG content. There are no maximum values onthe number of elements, the amount of character data, or the number ofcharacters in attribute values.

2.4.2. Conforming SVG Markup Fragments

A document or part of a document is aconforming SVG markup fragment if it can be parsed without error (other than network errors) by the appropriate parser for the document MIME type to form aconforming SVG DOM subtree, and in addition if:

2.4.3. Conforming XML-Compatible SVG Markup Fragments

Aconforming SVG markup fragment is also aconforming XML-compatible SVG markup fragmentif it:

2.4.4. Conforming XML-Compatible SVG DOM Subtrees

A DOM node tree or subtree rooted at a given elementis anconforming XML-compatible SVG DOM subtreeif, once serialized to XML,it could form aconforming XML-compatible SVG markup fragment.

If the DOM subtree cannot be serialized to conforming XML without altering it,such as when anid value is not a valid XML name, or when aComment node's data contains the substring "--", then the subtree is nota conforming XML-compatible SVG DOM subtree.

2.4.5. Conforming SVG Stand-Alone Files

A document is aconforming SVG stand-alone file if:

2.4.6. Error processing

There are various scenarios where an SVG document fragmentis technicallyin error:

A dynamic document can go in and out of error over time. Forexample, document changes from theSVG DOMor fromanimation can causea document to becomein error and a further change cancause the document to become correct again.

User agents must use the following error processing rules whenever a documentis in error,unless other sections of this specification define more specific rules for handling the particular error type:

Because of situations where a block of scripting changesmight cause a given SVG document fragment to go into and out oferror, the user agent should only apply error processing at times when documentpresentation (e.g., rendering to the display device) isupdated.

2.5. Software Conformance Classes

For software, the requirements for conformance dependon the category of program:

SVG generators
Any software that creates or makes available SVG content, either as markup or as a DOM (as is the case with client-side JavaScript libraries).
SVG authoring tools
Any software that provides an interface for human content creators to manipulate graphics or code that will be used to generate SVG. SVG authoring tools are implicitly alsoSVG generators.
SVG servers
Any network or file server that makes available SVG content in response to requests from other software. SVG servers are implicitly alsoSVG generators.
SVG interpreters
Any software that parses or processes SVG documents or markup fragments. An SVG interpreter is anSVG user agent for the purpose of any sections of this specification that relate to the parsing or processing steps undertaken by the interpreter.
SVG viewers
Any software that creates a rendered graphical representation after parsing or processing an SVG document or SVG markup fragment. SVG viewers are implicitly alsoSVG interpreters. An SVG viewer is always anSVG user agent for the purpose of this specification.
SVG user agent
An SVG user agent is auser agent that is able to retrieve and render SVG content.
user agent

The general definition of a user agent is an application that retrieves and renders Web content, including text, graphics, sounds, video, images, and other content types. A user agent may require additional user agents that handle some types of content. For instance, a browser may run a separate program or plug-in to render sound or video. User agents include graphical desktop browsers, multimedia players, text browsers, voice browsers, and assistive technologies such as screen readers, screen magnifiers, speech synthesizers, onscreen keyboards, and voice input software.

In general terms, a "user agent" may or may not have the ability to retrieve and render SVG content; however, unless the context requires an alternative interpretation, all references to a "user agent" in this specification are assumed to be references to anSVG user agent that retrieves and renders SVG content.

Many programs will fall under multiple software classes.For example, a graphical editor that can import and display SVG files,allow the user to modify them,and then export the modified graphic to file,is an SVG interpreter,an SVG viewer,an SVG authoring tool,and an SVG generator.

2.5.1. Conforming SVG Generators

Aconforming SVG generator is aSVG generator that:

SVG generators are strongly encouraged touse a Unicode character encoding by default,and to follow the other guidelines of theCharacter Model for the World Wide Web[UNICODE][charmod].

SVG generators handling high-precision dataare encouraged to follow the guidelines in the sectionNotes on generating high-precision geometry.

2.5.2. Conforming SVG Authoring Tools

Anauthoring tool,as defined in theAuthoring Tool AccessibilityGuidelines 2.0,is aconforming SVG authoring toolif it is aconforming SVG generatorand it also conforms to all relevant Level A requirements from that document[atag20].Level AA and Level AAA requirements areencouraged but not required for conformance.

2.5.3. Conforming SVG Servers

Aconforming SVG server must meet all the requirements of aconforming SVG generator. In addition, conforming SVG servers using HTTP or other protocolsthat use Internet Media types must serve SVG stand-alone files with the mediatype"image/svg+xml".

Also, if the SVG file is compressed with gzip or deflate, conforming SVGServers must indicate this with the appropriate header, according to what theprotocol supports. Specifically, for content compressed by the serverimmediately prior to transfer, the server must use the "Transfer-Encoding: gzip"or "Transfer-Encoding: deflate" headers as appropriate, and for contentstored in a compressed format on the server (e.g. with the file extension "svgz"),the server must use the "Content-Encoding: gzip" or"Content-Encoding: deflate" headers as appropriate.

Compression of storedcontent (the "entity," in HTTPterms) is distinct from automatic compression of themessage body, asdefined in HTTP/1.1TE/Transfer Encoding([rfc2616], sections 14.39 and 14.41).

2.5.4. Conforming SVG Interpreters

AnSVG interpreter is a program which can parse and processSVG document fragments. Examples of SVG interpreters areserver-side transcoding tools or optimizers (e.g., a tool which converts SVGcontent into modified SVG content) or analysis tools (e.g., atool which extracts the text content from SVG content,or a validity checker).A transcoder from SVG into another graphicsrepresentation, such as an SVG-to-raster transcoder, representsa viewer, and thus viewer conformance criteria also apply.

Aconforming SVG interpreter must be able to parse and process allXML constructs defined inXML 1.0[xml] andNamespaces in XML[xml-names].

Aconforming SVG interpreter must parse anyconforming XML-compatible SVG markup fragmentin a manner that correctly respects the DOM structure(elements, attributes, text content, comments, etc.) of the content.The interpreter is not required to interpret the semantics of allfeatures correctly.

If the SVG interpreter supports non-XML syntaxes (such as HTML),it must correctly parse anyconforming SVG markup fragment in that syntax.

If the SVG interpreter runs scripts or fetches external resource filesas a consequence of processing the SVG content,it must follow the restrictions described foruser agents inProcessing modes for SVG sub-resource documentsand in theLinking chapter.

2.5.5. Conforming SVG Viewers

Action:Look at the performance class requirements and decide whether to remove points or move them into general requirements. (heycam)
Spec that calculation of CTMs should use double precision. (stakagi)
Resolution:Remove performance class requirements from SVG 2. (ConformingHighQualitySVGViewers )
Purpose:To modulate the tradeoff of a numerical precision in use cases of the technical drawing and mapping, and the performance of user agent.
Owner:heycam, stakagi

AnSVG viewer is a program which can parse and process anSVG document fragment and render the contents of the documentonto some sort of graphical output medium such as a display, printer, or engraver.Thus, anSVG viewer is also anSVG interpreter(in that it can parse and process SVG document fragments),but with the additional requirement of correct rendering.

Aconforming SVG viewermust be aconforming SVG interpreter, andmust be able to support rendering output in at least one of theprocessing modes defined in this chapter:

A conforming SVG viewer must meet all normative requirementsindicated in this specification foruser agents,for all features supported by its processing mode(s).

Specific criteria that must apply to allconforming SVG viewers:

Aconforming SVG viewer that supportsprocessing modes thatincludeinteraction must support the following additional features:

Aconforming SVG viewer that supportsprocessing modes thatincludescript execution must support the following additional features:

If the user agent includes an HTML or XHTML viewingcapability, or can apply CSS styling properties to XMLdocuments, then aconforming SVG viewer must supportresources of MIME type "image/svg+xml" wherever raster imageexternal resources can be used, such as in the HTML or XHTML‘img’ element and in CSSproperties that can refer to raster image resources (e.g.,‘background-image’).

2.5.5.1. Printing implementation notes

For user agents which support both zooming on displaydevices and printing, it is recommended that the defaultprinting option produce printed output that reflects thedisplay device's current view of the current SVG documentfragment (assuming there is no media-specific styling), takinginto account any zooming and panning done by the user, thecurrent state of animation, and any document changes due to DOMand scripting.

Thus, if the user zooms into a particular areaof a map on the display device and then requests a hardcopy,the hardcopy should show the same view of the map as appears onthe display device. If a user pauses an animation and prints,the hardcopy should show the same graphics as the currentlypaused picture on the display device. If scripting has added orremoved elements from the document, then the hardcopy shouldreflect the same changes that would be reflected on thedisplay.

When an SVG document is rendered on a static-only devicesuch as a printer which does not support SVG's animation andscripting and facilities, then the user agent shall ignore anyanimation and scripting elements in the document and render theremaining graphics elements according to the rules in thisspecification.

2.5.6. Conforming High-Quality SVG Viewer

In order for aconforming SVG viewer to be consideredaconforming high-quality SVG viewer, it mustsupport the following additional features:

Aconforming high-quality SVG viewer that supportsprocessing modes thatincludescript execution,declarative animation, orinteractionmust support the following additional features:

Aconforming high-quality SVG viewer that supportsprocessing modesthat includeinteraction must support the following additional features:


[8]ページ先頭

©2009-2025 Movatter.jp