2001-12-12 10:59:31 +03:00
|
|
|
/* -*- 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/. */
|
2001-12-12 10:59:31 +03:00
|
|
|
|
|
|
|
@namespace url(http://www.w3.org/2000/svg);
|
2012-10-04 01:32:35 +04:00
|
|
|
@namespace xml url(http://www.w3.org/XML/1998/namespace);
|
2001-12-12 10:59:31 +03:00
|
|
|
|
2019-04-29 03:20:30 +03:00
|
|
|
style, script {
|
2004-04-13 03:28:39 +04:00
|
|
|
display: none;
|
|
|
|
}
|
2004-10-27 04:25:08 +04:00
|
|
|
|
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.
|
|
|
|
*/
|
2019-04-29 03:20:30 +03:00
|
|
|
symbol {
|
|
|
|
display: none !important;
|
|
|
|
}
|
|
|
|
|
2019-04-29 11:04:22 +03:00
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*/
|
2017-06-14 17:51:56 +03:00
|
|
|
symbol:-moz-use-shadow-tree-root {
|
|
|
|
display: inline !important;
|
|
|
|
}
|
|
|
|
|
2012-07-09 04:55:34 +04:00
|
|
|
svg:not(:root), symbol, image, marker, pattern, foreignObject {
|
2005-04-12 19:46:42 +04:00
|
|
|
overflow: hidden;
|
2004-11-23 16:51:57 +03:00
|
|
|
}
|
2006-02-28 14:27:29 +03:00
|
|
|
|
2012-09-06 08:58:46 +04:00
|
|
|
@media all and (-moz-is-glyph) {
|
|
|
|
:root {
|
2013-09-14 15:40:49 +04:00
|
|
|
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;
|
2012-09-06 08:58:46 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-28 14:27:29 +03:00
|
|
|
foreignObject {
|
2015-11-02 22:17:48 +03:00
|
|
|
-moz-appearance: none ! important;
|
2020-06-05 03:39:50 +03:00
|
|
|
-moz-default-appearance: none ! important;
|
2006-02-28 14:27:29 +03:00
|
|
|
margin: 0 ! important;
|
|
|
|
padding: 0 ! important;
|
2007-05-05 10:22:36 +04:00
|
|
|
border-width: 0 ! important;
|
2013-01-26 14:28:15 +04:00
|
|
|
white-space: normal;
|
2006-02-28 14:27:29 +03:00
|
|
|
}
|
2006-06-12 08:27:10 +04:00
|
|
|
|
2011-09-24 12:28:55 +04:00
|
|
|
@media all and (-moz-is-resource-document) {
|
|
|
|
foreignObject *|* {
|
2011-09-26 20:29:06 +04:00
|
|
|
-moz-appearance: none !important;
|
2020-06-05 03:39:50 +03:00
|
|
|
-moz-default-appearance: none !important;
|
2011-09-24 12:28:55 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-06-12 08:27:10 +04:00
|
|
|
*|*::-moz-svg-foreign-content {
|
|
|
|
display: block !important;
|
2012-02-22 03:01:41 +04:00
|
|
|
/* We need to be an absolute and fixed container */
|
2013-03-20 22:59:11 +04:00
|
|
|
transform: translate(0) !important;
|
2008-09-16 02:41:42 +04:00
|
|
|
text-indent: 0;
|
2006-06-12 08:27:10 +04:00
|
|
|
}
|
2012-05-17 08:05:09 +04:00
|
|
|
|
2015-05-25 00:40:37 +03:00
|
|
|
/* Set |transform-origin:0 0;| for all SVG elements except outer-<svg>,
|
2012-05-17 08:05:09 +04:00
|
|
|
noting that 'svg' as a child of 'foreignObject' counts as outer-<svg>.
|
|
|
|
*/
|
|
|
|
*:not(svg),
|
|
|
|
*:not(foreignObject) > svg {
|
2013-03-20 22:59:11 +04:00
|
|
|
transform-origin:0 0;
|
2012-05-17 08:05:09 +04:00
|
|
|
}
|
|
|
|
|
2012-08-10 11:09:55 +04:00
|
|
|
*|*::-moz-svg-text {
|
|
|
|
unicode-bidi: inherit;
|
2013-06-16 15:05:39 +04:00
|
|
|
vector-effect: inherit;
|
2012-08-10 11:09:55 +04:00
|
|
|
}
|
2012-10-04 01:32:35 +04:00
|
|
|
|
|
|
|
*[xml|space=preserve] {
|
2014-06-05 07:25:15 +04:00
|
|
|
white-space: -moz-pre-space;
|
2012-10-04 01:32:35 +04:00
|
|
|
}
|
2013-09-16 09:06:29 +04:00
|
|
|
|
|
|
|
*|*::-moz-svg-marker-anon-child {
|
|
|
|
clip-path: inherit;
|
|
|
|
filter: inherit;
|
|
|
|
mask: inherit;
|
|
|
|
opacity: inherit;
|
|
|
|
}
|
2014-05-24 23:29:11 +04:00
|
|
|
|
2016-05-24 07:23:22 +03:00
|
|
|
*:-moz-focusring {
|
|
|
|
/* Don't specify the outline-color, we should always use initial value. */
|
|
|
|
outline: 1px dotted;
|
|
|
|
}
|
2018-07-13 21:01:48 +03:00
|
|
|
|
|
|
|
/* 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;
|
|
|
|
}
|
|
|
|
|