LayoutTests/ChangeLog

 12011-12-20 Tim Horton <timothy_horton@apple.com>
 2
 3 Runtime changes to requiredExtensions don't update the enclosing <switch>
 4 https://bugs.webkit.org/show_bug.cgi?id=74749
 5 <rdar://problem/10582174>
 6
 7 Reviewed by NOBODY (OOPS!).
 8
 9 Add a test ensuring that a few different invalidations of the requiredExtensions string
 10 work as expected, both within <switch> elements and otherwise.
 11
 12 * platform/mac/svg/custom/requiredExtensions-runtime-changes-expected.png: Added.
 13 * platform/mac/svg/custom/requiredExtensions-runtime-changes-expected.txt: Added.
 14 * svg/custom/requiredExtensions-runtime-changes.svg: Added.
 15
1162011-12-16 Ryosuke Niwa <rniwa@webkit.org>
217
318 invalidateNodeListsCacheAfterAttributeChanged has too many callers

LayoutTests/platform/mac/svg/custom/requiredExtensions-runtime-changes-expected.png

Exception raised during decoding git binary patch:
Error: git binary content does not match index 0000000000000000000000000000000000000000
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:1023:in `extract_contents_from_git_binary_literal_chunk'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:1042:in `extract_contents_from_remote'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:717:in `initialize'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:850:in `new'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:850:in `block in parse'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:850:in `collect'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:850:in `parse'
/var/www/bugs.webkit.org/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:25:in `prettify'
/var/www/html/PrettyPatch/prettify.rb:30:in `<main>'

LayoutTests/platform/mac/svg/custom/requiredExtensions-runtime-changes-expected.txt

 1layer at (0,0) size 800x600
 2 RenderView at (0,0) size 800x600
 3layer at (0,0) size 600x600
 4 RenderSVGRoot {svg} at (0,0) size 350x350
 5 RenderSVGContainer {switch} at (0,0) size 50x50
 6 RenderSVGPath {path} at (0,0) size 50x50 [fill={[type=SOLID] [color=#008000]}] [data="M 0 0 L 50 0 L 50 50 L 0 50 Z"]
 7 RenderSVGContainer {switch} at (0,150) size 50x50 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,150.00)}]
 8 RenderSVGPath {path} at (0,150) size 50x50 [fill={[type=SOLID] [color=#008000]}] [data="M 0 0 L 50 0 L 50 50 L 0 50 Z"]
 9 RenderSVGContainer {switch} at (0,300) size 50x50 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,300.00)}]
 10 RenderSVGPath {path} at (0,300) size 50x50 [fill={[type=SOLID] [color=#008000]}] [data="M 0 0 L 50 0 L 50 50 L 0 50 Z"]
 11 RenderSVGContainer {g} at (300,0) size 50x50 [transform={m=((1.00,0.00)(0.00,1.00)) t=(300.00,0.00)}]
 12 RenderSVGPath {path} at (300,0) size 50x50 [fill={[type=SOLID] [color=#008000]}] [data="M 0 0 L 50 0 L 50 50 L 0 50 Z"]
 13 RenderSVGContainer {g} at (300,150) size 50x50 [transform={m=((1.00,0.00)(0.00,1.00)) t=(300.00,150.00)}]
 14 RenderSVGPath {path} at (300,150) size 50x50 [fill={[type=SOLID] [color=#008000]}] [data="M 0 0 L 50 0 L 50 50 L 0 50 Z"]
 15 RenderSVGContainer {g} at (300,300) size 50x50 [transform={m=((1.00,0.00)(0.00,1.00)) t=(300.00,300.00)}]
 16 RenderSVGContainer {g} at (300,300) size 50x50
 17 RenderSVGPath {path} at (300,300) size 50x50 [fill={[type=SOLID] [color=#008000]}] [data="M 0 0 L 50 0 L 50 50 L 0 50 Z"]

LayoutTests/svg/custom/requiredExtensions-runtime-changes.svg

 1<svg xmlns="http://www.w3.org/2000/svg" width="600" height="600">
 2 <title>This test passes if there are six green squares below.</title>
 3 <switch>
 4 <path class="removeRequiredExtensions" fill="green" d="M0,0 L50,0 L50,50 L0,50 Z" requiredExtensions="http://www.example.com/1234"/>
 5 <path fill="red" d="M0,0 L200,0 L200,20 L0,20 Z" />
 6 </switch>
 7
 8 <switch transform="translate(0,150)">
 9 <path class="removeRequiredExtensions" fill="green" d="M0,0 L50,0 L50,50 L0,50 Z" requiredExtensions="http://www.example.com/4567"/>
 10 </switch>
 11
 12 <switch transform="translate(0,300)">
 13 <path class="addRequiredExtensions" fill="red" d="M0,0 L200,0 L200,20 L0,20 Z" />
 14 <path fill="green" d="M0,0 L50,0 L50,50 L0,50 Z" />
 15 </switch>
 16
 17 <g transform="translate(300, 0)">
 18 <path class="removeRequiredExtensions" fill="green" d="M0,0 L50,0 L50,50 L0,50 Z" requiredExtensions="http://www.example.com/4567" />
 19 </g>
 20
 21 <g transform="translate(300, 150)">
 22 <path class="addRequiredExtensions" fill="red" d="M0,0 L200,0 L200,20 L0,20 Z" />
 23 <path fill="green" d="M0,0 L50,0 L50,50 L0,50 Z" />
 24 </g>
 25
 26 <g transform="translate(300, 300)">
 27 <g>
 28 <path class="addRequiredExtensions" fill="red" d="M0,0 L200,0 L200,20 L0,20 Z" />
 29 <path fill="green" d="M0,0 L50,0 L50,50 L0,50 Z" />
 30 </g>
 31 </g>
 32 <script type="text/javascript">
 33 <![CDATA[
 34 window.addEventListener('load', function(event) {
 35 var removeElements = document.getElementsByClassName("removeRequiredExtensions");
 36 var addElements = document.getElementsByClassName("addRequiredExtensions");
 37
 38 for (var i = 0; i < removeElements.length; i++) {
 39 removeElements[i].removeAttribute("requiredExtensions");
 40 }
 41
 42 for (var i = 0; i < addElements.length; i++) {
 43 addElements[i].setAttribute("requiredExtensions", "http://www.example.com/890");
 44 }
 45 });
 46 ]]>
 47 </script>
 48</svg>

Source/WebCore/ChangeLog

 12011-12-20 Tim Horton <timothy_horton@apple.com>
 2
 3 Runtime changes to requiredExtensions don't update the enclosing <switch>
 4 https://bugs.webkit.org/show_bug.cgi?id=74749
 5 <rdar://problem/10582174>
 6
 7 Reviewed by NOBODY (OOPS!).
 8
 9 When testing emptiness of requiredExtensions, test the merged string instead of the
 10 SVGStringList, because SVGStringList::reset() adds a single empty string to the list.
 11
 12 Invalid elements inside <switch> are prevented from creating renderers,
 13 but are still attached; SVGTests assumes that invalid elements will always be detached.
 14 Handle the <switch> case when changing SVGTest attributes on children.
 15
 16 Test: svg/custom/requiredExtensions-runtime-changes.svg
 17
 18 * svg/SVGSwitchElement.cpp:
 19 (WebCore::SVGSwitchElement::childShouldCreateRenderer):
 20 * svg/SVGTests.cpp:
 21 (WebCore::SVGTests::isValid):
 22 (WebCore::SVGTests::handleAttributeChange):
 23
1242011-12-16 Ryosuke Niwa <rniwa@webkit.org>
225
326 invalidateNodeListsCacheAfterAttributeChanged has too many callers

Source/WebCore/svg/SVGSwitchElement.cpp

@@PassRefPtr<SVGSwitchElement> SVGSwitchElement::create(const QualifiedName& tagNa
5151
5252bool SVGSwitchElement::childShouldCreateRenderer(Node* child) const
5353{
54  // FIXME: This function does not do what the comment below implies it does.
55  // It will create a renderer for any valid SVG element children, not just the first one.
5654 for (Node* node = firstChild(); node; node = node->nextSibling()) {
5755 if (!node->isSVGElement())
5856 continue;

Source/WebCore/svg/SVGTests.cpp

@@bool SVGTests::isValid() const
114114 return false;
115115 }
116116
117  if (!m_requiredExtensions.value.isEmpty())
 117 if (!m_requiredExtensions.value.valueAsString().isEmpty())
118118 return false;
119119
120120 return true;

@@bool SVGTests::handleAttributeChange(const SVGElement* targetElement, const Qual
154154 SVGElement* svgElement = const_cast<SVGElement*>(targetElement);
155155 ASSERT(svgElement);
156156 bool valid = svgElement->isValid();
157  if (valid && !svgElement->attached())
158  svgElement->attach();
 157 if (valid && (!svgElement->renderer() || !svgElement->attached()))
 158 svgElement->reattach();
159159 if (!valid && svgElement->attached())
160160 svgElement->detach();
 161
 162 // We need to invalidate any <switch> elements which are our immediate
 163 // parent. <switch> uses the shouldCreateRenderer mechanism instead of
 164 // attached state to enforce its choice, and reattaching the node will
 165 // cause this to be reevaluated.
 166 Node * parentNode = svgElement->parentNodeForRenderingAndStyle();
 167 if (parentNode->hasTagName(SVGNames::switchTag))
 168 parentNode->reattach();
 169
161170 return true;
162171}
163172