Add invalid bounding box concept to SVG containers
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Mar 2012 14:36:59 +0000 (14:36 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Mar 2012 14:36:59 +0000 (14:36 +0000)
commite6c0ba039465c9d59b204448a16126dcd318ce58
tree7b41f703e0ebfe83ea612f91f31ea516cf8a8eee
parent814d61aaab6f56cb74af6ba2f89d8471efff78b7
Add invalid bounding box concept to SVG containers
https://bugs.webkit.org/show_bug.cgi?id=81104

Patch by Philip Rogers <pdr@google.com> on 2012-03-26
Reviewed by Nikolas Zimmermann.

Source/WebCore:

An empty <g> element needs to use an invalid bounding box because
an empty bounding box isn't the default state. This change
introduces the concept of an invalid object bounding box for
both RenderSVGContainer and RenderSVGRoot. Code that
does not explicitly check that the bounding box is valid
should be unaffected by this change. We use this new invalid
flag in computeContainerBoundingBoxes so that we do not
include invalid bounding boxes.

This change also contains a small fix in
RenderSVGContainer::toRenderSVGContainer which depended on
RenderSVGViewportContainer not inheriting from RenderSVGContainer,
which it now does.

Test: svg/custom/getBBox-empty-container.html

* rendering/svg/RenderSVGContainer.cpp:
(WebCore::RenderSVGContainer::RenderSVGContainer):
(WebCore::RenderSVGContainer::updateCachedBoundaries):
* rendering/svg/RenderSVGContainer.h:
(WebCore::RenderSVGContainer::isObjectBoundingBoxValid):
(RenderSVGContainer):
(WebCore::toRenderSVGContainer):
* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::RenderSVGRoot):
(WebCore::RenderSVGRoot::updateCachedBoundaries):
* rendering/svg/RenderSVGRoot.h:
(RenderSVGRoot):
* rendering/svg/SVGRenderSupport.cpp:
(WebCore):
(WebCore::updateObjectBoundingBox):
(WebCore::SVGRenderSupport::computeContainerBoundingBoxes):
* rendering/svg/SVGRenderSupport.h:
(SVGRenderSupport):

LayoutTests:

* svg/custom/getBBox-empty-container-expected.txt: Added.
* svg/custom/getBBox-empty-container.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@112091 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/svg/custom/getBBox-empty-container-expected.txt [new file with mode: 0644]
LayoutTests/svg/custom/getBBox-empty-container.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/svg/RenderSVGContainer.cpp
Source/WebCore/rendering/svg/RenderSVGContainer.h
Source/WebCore/rendering/svg/RenderSVGRoot.cpp
Source/WebCore/rendering/svg/RenderSVGRoot.h
Source/WebCore/rendering/svg/SVGRenderSupport.cpp
Source/WebCore/rendering/svg/SVGRenderSupport.h