RenderSVGRoot should inherit from RenderReplaced
authorzimmermann@webkit.org <zimmermann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Jan 2012 08:45:17 +0000 (08:45 +0000)
committerzimmermann@webkit.org <zimmermann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Jan 2012 08:45:17 +0000 (08:45 +0000)
commit4b4fa28680660224b3501749f76884964d75e9d7
tree1d708fa912909f889938bec63db2e709510f0cbb
parent1e5665918aa05a194667f9d1cf60ab5a60c2651d
RenderSVGRoot should inherit from RenderReplaced
https://bugs.webkit.org/show_bug.cgi?id=76446

Reviewed by Zoltan Herczeg.

Source/WebCore:

Let RenderSVGRoot inherit from RenderReplaced, instead of faking RenderReplaced, by inherting from RenderBox
and calling setReplaced(true) in the constructor. The outermost <svg> element is a replaced element in the
sense of CSS, and thus this is just a logical move. It fixes some issues where the <svg> root appeared
as selection leaf, covered by existing tests.

It allows us to simplify the painting, as outlines, etc. are painted by RenderReplaced now.
While I was it, speed up the local to border box computations by caching the result.

* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::paint):
* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::RenderSVGRoot):
(WebCore::RenderSVGRoot::layout):
(WebCore::RenderSVGRoot::paintReplaced):
(WebCore::RenderSVGRoot::willBeDestroyed):
(WebCore::RenderSVGRoot::styleWillChange):
(WebCore::RenderSVGRoot::styleDidChange):
(WebCore::RenderSVGRoot::updateFromElement):
(WebCore::RenderSVGRoot::buildLocalToBorderBoxTransform):
(WebCore::RenderSVGRoot::localToParentTransform):
(WebCore::RenderSVGRoot::computeFloatRectForRepaint):
(WebCore::RenderSVGRoot::mapLocalToContainer):
(WebCore::RenderSVGRoot::nodeAtPoint):
* rendering/svg/RenderSVGRoot.h:
(WebCore::RenderSVGRoot::canHaveChildren):
(WebCore::RenderSVGRoot::canBeSelectionLeaf):
* svg/SVGSVGElement.cpp:
(WebCore::SVGSVGElement::setupInitialView):

LayoutTests:

Update test results after making RenderSVGRoot inherit from RenderReplaced.

* platform/chromium/test_expectations.txt:
* platform/mac/svg/custom/linking-a-03-b-all-expected.png: Text layout changed, we didn't relayout the tree when entering a new view before.
* platform/mac/svg/custom/linking-a-03-b-all-expected.txt: Ditto.
* platform/mac/svg/custom/linking-a-03-b-viewBox-expected.png: Ditto.
* platform/mac/svg/custom/linking-a-03-b-viewBox-expected.txt: Ditto.
* platform/mac/svg/custom/linking-a-03-b-viewBox-transform-expected.png: Ditto.
* platform/mac/svg/custom/linking-a-03-b-viewBox-transform-expected.txt: Ditto.
* platform/mac/svg/custom/mouse-move-on-svg-container-expected.png: Moving the circle, triggered a selection before, where it shouldn't. It's gone now.
* platform/mac/svg/custom/mouse-move-on-svg-container-expected.txt: Ditto.
* platform/mac/svg/custom/mouse-move-on-svg-container-standalone-expected.png: Ditto.
* platform/mac/svg/custom/mouse-move-on-svg-container-standalone-expected.txt: Ditto.
* platform/mac/svg/custom/mouse-move-on-svg-root-expected.png: Ditto.
* platform/mac/svg/custom/mouse-move-on-svg-root-expected.txt: Ditto.
* platform/mac/svg/custom/mouse-move-on-svg-root-standalone-expected.png: Ditto.
* platform/mac/svg/custom/mouse-move-on-svg-root-standalone-expected.txt: Ditto.
* platform/mac/svg/custom/pointer-events-image-css-transform-expected.png: Caret position which is reported changed, due the selection leaf changes.
* platform/mac/svg/custom/pointer-events-image-css-transform-expected.txt: Ditto.
* platform/mac/svg/custom/pointer-events-image-expected.png: Ditto.
* platform/mac/svg/custom/pointer-events-image-expected.txt: Ditto.
* platform/mac/svg/custom/pointer-events-text-css-transform-expected.png: Ditto.
* platform/mac/svg/custom/pointer-events-text-css-transform-expected.txt: Ditto.
* platform/mac/svg/custom/pointer-events-text-expected.png: Ditto.
* platform/mac/svg/custom/pointer-events-text-expected.txt: Ditto.
* platform/mac/svg/foreignObject/text-tref-02-b-expected.png: This now reports a valid size for the RenderSVGRoot in the <fO> subtree.
* svg/foreignObject/text-tref-02-b-expected.txt: Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@105247 268f45cc-cd09-0410-ab3c-d52691b4dbfc
31 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/chromium/test_expectations.txt
LayoutTests/platform/mac/svg/custom/linking-a-03-b-all-expected.png
LayoutTests/platform/mac/svg/custom/linking-a-03-b-all-expected.txt
LayoutTests/platform/mac/svg/custom/linking-a-03-b-viewBox-expected.png
LayoutTests/platform/mac/svg/custom/linking-a-03-b-viewBox-expected.txt
LayoutTests/platform/mac/svg/custom/linking-a-03-b-viewBox-transform-expected.png
LayoutTests/platform/mac/svg/custom/linking-a-03-b-viewBox-transform-expected.txt
LayoutTests/platform/mac/svg/custom/mouse-move-on-svg-container-expected.png
LayoutTests/platform/mac/svg/custom/mouse-move-on-svg-container-expected.txt
LayoutTests/platform/mac/svg/custom/mouse-move-on-svg-container-standalone-expected.png
LayoutTests/platform/mac/svg/custom/mouse-move-on-svg-container-standalone-expected.txt
LayoutTests/platform/mac/svg/custom/mouse-move-on-svg-root-expected.png
LayoutTests/platform/mac/svg/custom/mouse-move-on-svg-root-expected.txt
LayoutTests/platform/mac/svg/custom/mouse-move-on-svg-root-standalone-expected.png
LayoutTests/platform/mac/svg/custom/mouse-move-on-svg-root-standalone-expected.txt
LayoutTests/platform/mac/svg/custom/pointer-events-image-css-transform-expected.png
LayoutTests/platform/mac/svg/custom/pointer-events-image-css-transform-expected.txt
LayoutTests/platform/mac/svg/custom/pointer-events-image-expected.png
LayoutTests/platform/mac/svg/custom/pointer-events-image-expected.txt
LayoutTests/platform/mac/svg/custom/pointer-events-text-css-transform-expected.png
LayoutTests/platform/mac/svg/custom/pointer-events-text-css-transform-expected.txt
LayoutTests/platform/mac/svg/custom/pointer-events-text-expected.png
LayoutTests/platform/mac/svg/custom/pointer-events-text-expected.txt
LayoutTests/platform/mac/svg/foreignObject/text-tref-02-b-expected.png
LayoutTests/svg/foreignObject/text-tref-02-b-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderReplaced.cpp
Source/WebCore/rendering/svg/RenderSVGRoot.cpp
Source/WebCore/rendering/svg/RenderSVGRoot.h
Source/WebCore/svg/SVGSVGElement.cpp