gecko-dev/layout/svg/svg.css

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

113 строки
2.9 KiB
CSS
Исходник Обычный вид История

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
2012-05-21 15:12:37 +04:00
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
@namespace url(http://www.w3.org/2000/svg);
@namespace xml url(http://www.w3.org/XML/1998/namespace);
style, script {
display: none;
}
Bug 1579181 - Don't keep <use> shadow trees which we know we'll never render. r=longsonr This partially addresses the regression, but not fully. With this patch we don't maintain shadow trees for nodes that we know won't get rendered. This works fast in WebKit / Blink because of a bug in their implementation which doesn't synchronize style attributes, introduced in [1]. You can see this clearly if you click on the bug's test-case and inspect the <use> shadow trees (there's no style="stroke:orange" whatsoever). They can kinda get away with it because they don't properly implement SVG 2. In particular, in Blink / WebKit, the style of the element in the <use> shadow tree is the style of the referenced element, which means that even if the style attribute isn't properly synced it's ~ok since it doesn't end up mattering for styling. Easiest test-case for the behavior difference is: ``` <!doctype html> <style> rect:hover { fill: green; } </style> <svg width=300 height=300> <g id="canvas"> <rect fill=red width=100 height=100></rect> </g> <g> <use x=200 href="#canvas"></use> </g> </svg> ``` Where Firefox will properly update each square independently when hovered, but Blink / WebKit won't. This used to work faster because in this particular test-case we have 3 hidden <use> elements whose href is the #canvas, which is basically everything. Before moving to shadow trees we'd do it using anonymous content, and since we never got a frame we'd never clone the subtree in the first case. This case was faster before bug 1450250, but this approach makes other cases slow that were fixed by that bug, like bug 1485402. So I'll try to optimize shadow tree syncing instead, I guess, but there's no good reason not to land this in the meantime IMHO. [1]: https://chromium.googlesource.com/chromium/src/+/f4b022e64bbe0c74f07ee9209aa4033bddece145%5E%21/third_party/WebKit/WebCore/svg/SVGElement.cpp Differential Revision: https://phabricator.services.mozilla.com/D45953 --HG-- extra : moz-landing-system : lando
2019-09-15 19:09:28 +03:00
/*
* This is only to be overridden by the rule right below.
*
* NOTE(emilio): NodeCouldBeRendered in SVGUseElement.cpp relies on this.
*/
symbol {
display: none !important;
}
/*
* From https://svgwg.org/svg2-draft/struct.html#SymbolNotes:
*
* > The generated instance of a 'symbol' that is the direct referenced element
* > of a 'use' element must always have a computed value of inline for the
* > display property. In other words, it must be rendered whenever the host
* > 'use' element is rendered.
*
* NOTE(emilio): other browsers instead just replace the `<symbol>` element by
* an `<svg>` element while cloning, but they don't implement the SVG2
* selector-matching rules that would make that observable via selectors.
*/
symbol:-moz-use-shadow-tree-root {
display: inline !important;
}
svg:not(:root), symbol, image, marker, pattern, foreignObject {
overflow: hidden;
}
@media all and (-moz-is-glyph) {
:root {
fill: context-fill;
fill-opacity: context-fill-opacity;
stroke: context-stroke;
stroke-opacity: context-stroke-opacity;
stroke-width: context-value;
stroke-dasharray: context-value;
stroke-dashoffset: context-value;
}
}
foreignObject {
-moz-appearance: none ! important;
-moz-default-appearance: none ! important;
margin: 0 ! important;
padding: 0 ! important;
border-width: 0 ! important;
white-space: normal;
}
@media all and (-moz-is-resource-document) {
foreignObject *|* {
-moz-appearance: none !important;
-moz-default-appearance: none !important;
}
}
*|*::-moz-svg-foreign-content {
display: block !important;
/* We need to be an absolute and fixed container */
transform: translate(0) !important;
text-indent: 0;
}
/* Set |transform-origin:0 0;| for all SVG elements except outer-<svg>,
noting that 'svg' as a child of 'foreignObject' counts as outer-<svg>.
*/
*:not(svg),
*:not(foreignObject) > svg {
transform-origin:0 0;
}
*|*::-moz-svg-text {
unicode-bidi: inherit;
vector-effect: inherit;
}
*[xml|space=preserve] {
white-space: -moz-pre-space;
}
*|*::-moz-svg-marker-anon-child {
clip-path: inherit;
filter: inherit;
mask: inherit;
opacity: inherit;
}
*:-moz-focusring {
/* Don't specify the outline-color, we should always use initial value. */
outline: 1px dotted;
}
/* Make SVG shapes unselectable to avoid triggering AccessibleCaret on tap.
<mesh> will be supported in bug 1238882. */
circle, ellipse, line, mesh, path, polygon, polyline, rect {
-moz-user-select: none;
}