2007-12-03 Nikolas Zimmermann <zimmermann@kde.org>
+ Reviewed by David.
+
+ Add new testcase verifying that CSS selectors don't affect the non-exposed SVG shadow tree.
+
+ * platform/mac/svg/custom/use-css-no-effect-on-shadow-tree-expected.checksum: Added.
+ * platform/mac/svg/custom/use-css-no-effect-on-shadow-tree-expected.png: Added.
+ * platform/mac/svg/custom/use-css-no-effect-on-shadow-tree-expected.txt: Added.
+ * svg/custom/use-css-no-effect-on-shadow-tree.svg: Added.
+
+2007-12-03 Nikolas Zimmermann <zimmermann@kde.org>
+
Rubber stamped by Mark.
Commit missing layout test results from my last commit (fix for bug 15403)
--- /dev/null
+bc0f6d15f6cc84da243f2e6c41b44ccb
\ No newline at end of file
--- /dev/null
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 453x113
+ RenderSVGRoot {svg} at (-0.06,-0.56) size 453.13x114.13
+ RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+ RenderPath {path} at (300,49.50) size 600.50x201 [stroke={[type=SOLID] [color=#FF0000] [opacity=0.50] [miter limit=10.00] [line join=BEVEL] [dash array={300.00, 100.00}]}] [fill={[type=SOLID] [color=#000000]}] [data="M300.00,50.00L900.00,50.00L900.00,250.00L300.00,250.00"]
+ RenderPath {rect} at (-0.06,-0.56) size 453.13x114.13 [stroke={[type=SOLID] [color=#0000FF] [stroke width=3.00]}] [data="M0.00,0.00L1200.00,0.00L1200.00,300.00L0.00,300.00"]
+ RenderSVGContainer {g} at (105.97,11.30) size 241.07x90.40
+ RenderSVGContainer {use} at (105.97,11.30) size 241.07x90.40
+ RenderSVGContainer {g} at (105.97,11.30) size 241.07x90.40
+ RenderPath {path} at (105.97,11.30) size 241.07x90.40 [stroke={[type=SOLID] [color=#FF0000] [opacity=0.50] [stroke width=40.00] [line cap=ROUND] [line join=BEVEL] [dash offset=50.00] [dash array={300.00, 100.00}]}] [fill={[type=SOLID] [color=#0000FF] [opacity=0.50]}] [data="M300.00,50.00L900.00,50.00L900.00,250.00L300.00,250.00"]
--- /dev/null
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg width="12cm" height="3cm" viewBox="0 0 1200 300" version="1.1"
+ xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <desc>Example Use04 - 'use' with CSS styling</desc>
+ <defs style=" /* rule 9 */ stroke-miterlimit: 10" >
+ <path id="MyPath" d="M300 50 L900 50 L900 250 L300 250"
+ class="MyPathClass"
+ style=" /* rule 10 */ stroke-dasharray:300,100" />
+ </defs>
+ <style type="text/css">
+ <![CDATA[
+ /* rule 1 */ #MyUse { fill: blue }
+ /* rule 2 */ #MyPath { stroke: red }
+ /* rule 3 */ use { fill-opacity: .5 }
+ /* rule 4 */ path { stroke-opacity: .5 }
+ /* rule 5 */ .MyUseClass { stroke-linecap: round }
+ /* rule 6 */ .MyPathClass { stroke-linejoin: bevel }
+ /* rule 7 */ use > path { shape-rendering: optimizeQuality }
+ /* rule 8 */ g > path { visibility: hidden }
+ ]]>
+ </style>
+
+ <rect x="0" y="0" width="1200" height="300"
+ style="fill:none; stroke:blue; stroke-width:3"/>
+ <g style=" /* rule 11 */ stroke-width:40">
+ <use id="MyUse" xlink:href="#MyPath"
+ class="MyUseClass"
+ style="/* rule 12 */ stroke-dashoffset:50" />
+ </g>
+</svg>
+2007-12-03 Nikolas Zimmermann <zimmermann@kde.org>
+
+ Reviewed by David.
+
+ Fixes: http://bugs.webkit.org/show_bug.cgi?id=15645
+ Don't allow selectors to interfere with the SVG shadow tree (<use> internal non-exposed tree).
+
+ * css/CSSStyleSelector.cpp:
+ (WebCore::CSSStyleSelector::checkSelector):
+
2007-12-03 Dan Bernstein <mitz@apple.com>
Reviewed by Adam Roben.
// Check the selector
SelectorMatch match = checkSelector(sel, element, true, false);
- if (match != SelectorMatches) return false;
+ if (match != SelectorMatches)
+ return false;
if (pseudoStyle != RenderStyle::NOPSEUDO && pseudoStyle != dynamicPseudo)
return false;
// * SelectorMatches - the selector matches the element e
// * SelectorFailsLocally - the selector fails for the element e
// * SelectorFailsCompletely - the selector fails for e and any sibling or ancestor of e
-CSSStyleSelector::SelectorMatch CSSStyleSelector::checkSelector(CSSSelector* sel, Element *e, bool isAncestor, bool isSubSelector)
+CSSStyleSelector::SelectorMatch CSSStyleSelector::checkSelector(CSSSelector* sel, Element* e, bool isAncestor, bool isSubSelector)
{
+#if ENABLE(SVG)
+ // Spec: CSS2 selectors cannot be applied to the (conceptually) cloned DOM tree
+ // because its contents are not part of the formal document structure.
+ if (e->isSVGElement() && e->isShadowNode())
+ return SelectorFailsCompletely;
+#endif
+
// first selector has to match
if (!checkOneSelector(sel, e, isAncestor, isSubSelector))
return SelectorFailsLocally;
// Prepare next sel
sel = sel->m_tagHistory;
- if (!sel) return SelectorMatches;
+ if (!sel)
+ return SelectorMatches;
if (relation != CSSSelector::SubSelector)
// Bail-out if this selector is irrelevant for the pseudoStyle