Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(614)

Side by Side Diff: Source/core/layout/svg/LayoutSVGBlock.cpp

Issue 933953003: Move the remaining rendering/svg/RenderSVG* files to layout. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/layout/svg/LayoutSVGBlock.h ('k') | Source/core/layout/svg/LayoutSVGContainer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Apple Computer, Inc. 2 * Copyright (C) 2006 Apple Computer, Inc.
3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 4 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
11 * This library is distributed in the hope that it will be useful, 11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details. 14 * Library General Public License for more details.
15 * 15 *
16 * You should have received a copy of the GNU Library General Public License 16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to 17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA. 19 * Boston, MA 02110-1301, USA.
20 */ 20 */
21 21
22 #include "config.h" 22 #include "config.h"
23 #include "core/rendering/svg/RenderSVGBlock.h" 23 #include "core/layout/svg/LayoutSVGBlock.h"
24 24
25 #include "core/layout/style/ShadowList.h" 25 #include "core/layout/style/ShadowList.h"
26 #include "core/layout/svg/LayoutSVGRoot.h"
26 #include "core/layout/svg/SVGLayoutSupport.h" 27 #include "core/layout/svg/SVGLayoutSupport.h"
27 #include "core/layout/svg/SVGResourcesCache.h" 28 #include "core/layout/svg/SVGResourcesCache.h"
28 #include "core/rendering/RenderView.h" 29 #include "core/rendering/RenderView.h"
29 #include "core/rendering/svg/RenderSVGRoot.h"
30 #include "core/svg/SVGElement.h" 30 #include "core/svg/SVGElement.h"
31 31
32 namespace blink { 32 namespace blink {
33 33
34 RenderSVGBlock::RenderSVGBlock(SVGElement* element) 34 LayoutSVGBlock::LayoutSVGBlock(SVGElement* element)
35 : RenderBlockFlow(element) 35 : RenderBlockFlow(element)
36 { 36 {
37 } 37 }
38 38
39 LayoutRect RenderSVGBlock::visualOverflowRect() const 39 LayoutRect LayoutSVGBlock::visualOverflowRect() const
40 { 40 {
41 LayoutRect borderRect = borderBoxRect(); 41 LayoutRect borderRect = borderBoxRect();
42 42
43 if (const ShadowList* textShadow = style()->textShadow()) 43 if (const ShadowList* textShadow = style()->textShadow())
44 textShadow->adjustRectForShadow(borderRect); 44 textShadow->adjustRectForShadow(borderRect);
45 45
46 return borderRect; 46 return borderRect;
47 } 47 }
48 48
49 void RenderSVGBlock::updateFromStyle() 49 void LayoutSVGBlock::updateFromStyle()
50 { 50 {
51 RenderBlock::updateFromStyle(); 51 RenderBlock::updateFromStyle();
52 52
53 // RenderSVGlock, used by Render(SVGText|ForeignObject), is not allowed to c all setHasOverflowClip(true). 53 // LayoutSVGlock, used by Render(SVGText|ForeignObject), is not allowed to c all setHasOverflowClip(true).
54 // RenderBlock assumes a layer to be present when the overflow clip function ality is requested. Both 54 // RenderBlock assumes a layer to be present when the overflow clip function ality is requested. Both
55 // Render(SVGText|ForeignObject) return 'NoLayer' on 'layerTypeRequired'. Fi ne for LayoutSVGText. 55 // Render(SVGText|ForeignObject) return 'NoLayer' on 'layerTypeRequired'. Fi ne for LayoutSVGText.
56 // 56 //
57 // If we want to support overflow rules for <foreignObject> we can choose be tween two solutions: 57 // If we want to support overflow rules for <foreignObject> we can choose be tween two solutions:
58 // a) make LayoutSVGForeignObject require layers and SVG layer aware 58 // a) make LayoutSVGForeignObject require layers and SVG layer aware
59 // b) reactor overflow logic out of Layer (as suggested by dhyatt), which is a large task 59 // b) reactor overflow logic out of Layer (as suggested by dhyatt), which is a large task
60 // 60 //
61 // Until this is resolved, disable overflow support. Opera/FF don't support it as well at the moment (Feb 2010). 61 // Until this is resolved, disable overflow support. Opera/FF don't support it as well at the moment (Feb 2010).
62 // 62 //
63 // Note: This does NOT affect overflow handling on outer/inner <svg> element s - this is handled 63 // Note: This does NOT affect overflow handling on outer/inner <svg> element s - this is handled
64 // manually by RenderSVGRoot - which owns the documents enclosing root layer and thus works fine. 64 // manually by LayoutSVGRoot - which owns the documents enclosing root layer and thus works fine.
65 setHasOverflowClip(false); 65 setHasOverflowClip(false);
66 } 66 }
67 67
68 void RenderSVGBlock::absoluteRects(Vector<IntRect>&, const LayoutPoint&) const 68 void LayoutSVGBlock::absoluteRects(Vector<IntRect>&, const LayoutPoint&) const
69 { 69 {
70 // This code path should never be taken for SVG, as we're assuming useTransf orms=true everywhere, absoluteQuads should be used. 70 // This code path should never be taken for SVG, as we're assuming useTransf orms=true everywhere, absoluteQuads should be used.
71 ASSERT_NOT_REACHED(); 71 ASSERT_NOT_REACHED();
72 } 72 }
73 73
74 void RenderSVGBlock::willBeDestroyed() 74 void LayoutSVGBlock::willBeDestroyed()
75 { 75 {
76 SVGResourcesCache::clientDestroyed(this); 76 SVGResourcesCache::clientDestroyed(this);
77 RenderBlockFlow::willBeDestroyed(); 77 RenderBlockFlow::willBeDestroyed();
78 } 78 }
79 79
80 void RenderSVGBlock::styleDidChange(StyleDifference diff, const LayoutStyle* old Style) 80 void LayoutSVGBlock::styleDidChange(StyleDifference diff, const LayoutStyle* old Style)
81 { 81 {
82 if (diff.needsFullLayout()) 82 if (diff.needsFullLayout())
83 setNeedsBoundariesUpdate(); 83 setNeedsBoundariesUpdate();
84 84
85 if (isBlendingAllowed()) { 85 if (isBlendingAllowed()) {
86 bool hasBlendModeChanged = (oldStyle && oldStyle->hasBlendMode()) == !st yle()->hasBlendMode(); 86 bool hasBlendModeChanged = (oldStyle && oldStyle->hasBlendMode()) == !st yle()->hasBlendMode();
87 if (parent() && hasBlendModeChanged) 87 if (parent() && hasBlendModeChanged)
88 parent()->descendantIsolationRequirementsChanged(style()->hasBlendMo de() ? DescendantIsolationRequired : DescendantIsolationNeedsUpdate); 88 parent()->descendantIsolationRequirementsChanged(style()->hasBlendMo de() ? DescendantIsolationRequired : DescendantIsolationNeedsUpdate);
89 } 89 }
90 90
91 RenderBlock::styleDidChange(diff, oldStyle); 91 RenderBlock::styleDidChange(diff, oldStyle);
92 SVGResourcesCache::clientStyleChanged(this, diff, styleRef()); 92 SVGResourcesCache::clientStyleChanged(this, diff, styleRef());
93 } 93 }
94 94
95 void RenderSVGBlock::mapLocalToContainer(const LayoutLayerModelObject* paintInva lidationContainer, TransformState& transformState, MapCoordinatesFlags, bool* wa sFixed, const PaintInvalidationState* paintInvalidationState) const 95 void LayoutSVGBlock::mapLocalToContainer(const LayoutLayerModelObject* paintInva lidationContainer, TransformState& transformState, MapCoordinatesFlags, bool* wa sFixed, const PaintInvalidationState* paintInvalidationState) const
96 { 96 {
97 SVGLayoutSupport::mapLocalToContainer(this, paintInvalidationContainer, tran sformState, wasFixed, paintInvalidationState); 97 SVGLayoutSupport::mapLocalToContainer(this, paintInvalidationContainer, tran sformState, wasFixed, paintInvalidationState);
98 } 98 }
99 99
100 const LayoutObject* RenderSVGBlock::pushMappingToContainer(const LayoutLayerMode lObject* ancestorToStopAt, LayoutGeometryMap& geometryMap) const 100 const LayoutObject* LayoutSVGBlock::pushMappingToContainer(const LayoutLayerMode lObject* ancestorToStopAt, LayoutGeometryMap& geometryMap) const
101 { 101 {
102 return SVGLayoutSupport::pushMappingToContainer(this, ancestorToStopAt, geom etryMap); 102 return SVGLayoutSupport::pushMappingToContainer(this, ancestorToStopAt, geom etryMap);
103 } 103 }
104 104
105 LayoutRect RenderSVGBlock::clippedOverflowRectForPaintInvalidation(const LayoutL ayerModelObject* paintInvalidationContainer, const PaintInvalidationState* paint InvalidationState) const 105 LayoutRect LayoutSVGBlock::clippedOverflowRectForPaintInvalidation(const LayoutL ayerModelObject* paintInvalidationContainer, const PaintInvalidationState* paint InvalidationState) const
106 { 106 {
107 return SVGLayoutSupport::clippedOverflowRectForPaintInvalidation(this, paint InvalidationContainer, paintInvalidationState); 107 return SVGLayoutSupport::clippedOverflowRectForPaintInvalidation(this, paint InvalidationContainer, paintInvalidationState);
108 } 108 }
109 109
110 void RenderSVGBlock::mapRectToPaintInvalidationBacking(const LayoutLayerModelObj ect* paintInvalidationContainer, LayoutRect& rect, const PaintInvalidationState* paintInvalidationState) const 110 void LayoutSVGBlock::mapRectToPaintInvalidationBacking(const LayoutLayerModelObj ect* paintInvalidationContainer, LayoutRect& rect, const PaintInvalidationState* paintInvalidationState) const
111 { 111 {
112 FloatRect paintInvalidationRect = rect; 112 FloatRect paintInvalidationRect = rect;
113 paintInvalidationRect.inflate(style()->outlineWidth()); 113 paintInvalidationRect.inflate(style()->outlineWidth());
114 const RenderSVGRoot& svgRoot = SVGLayoutSupport::mapRectToSVGRootForPaintInv alidation(this, paintInvalidationRect, rect); 114 const LayoutSVGRoot& svgRoot = SVGLayoutSupport::mapRectToSVGRootForPaintInv alidation(this, paintInvalidationRect, rect);
115 svgRoot.mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, paintInvalidationState); 115 svgRoot.mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, paintInvalidationState);
116 } 116 }
117 117
118 bool RenderSVGBlock::nodeAtPoint(const HitTestRequest&, HitTestResult&, const Hi tTestLocation&, const LayoutPoint&, HitTestAction) 118 bool LayoutSVGBlock::nodeAtPoint(const HitTestRequest&, HitTestResult&, const Hi tTestLocation&, const LayoutPoint&, HitTestAction)
119 { 119 {
120 ASSERT_NOT_REACHED(); 120 ASSERT_NOT_REACHED();
121 return false; 121 return false;
122 } 122 }
123 123
124 void RenderSVGBlock::invalidateTreeIfNeeded(const PaintInvalidationState& paintI nvalidationState) 124 void LayoutSVGBlock::invalidateTreeIfNeeded(const PaintInvalidationState& paintI nvalidationState)
125 { 125 {
126 if (!shouldCheckForPaintInvalidation(paintInvalidationState)) 126 if (!shouldCheckForPaintInvalidation(paintInvalidationState))
127 return; 127 return;
128 128
129 if (paintInvalidationState.cachedOffsetsEnabled()) { 129 if (paintInvalidationState.cachedOffsetsEnabled()) {
130 m_cachedPaintInvalidationTransform = paintInvalidationState.svgTransform (); 130 m_cachedPaintInvalidationTransform = paintInvalidationState.svgTransform ();
131 } else { 131 } else {
132 m_cachedPaintInvalidationTransform.makeIdentity(); 132 m_cachedPaintInvalidationTransform.makeIdentity();
133 LayoutObject* next = parent(); 133 LayoutObject* next = parent();
134 while (!next->isSVGRoot()) { 134 while (!next->isSVGRoot()) {
135 m_cachedPaintInvalidationTransform = next->localToParentTransform() * m_cachedPaintInvalidationTransform; 135 m_cachedPaintInvalidationTransform = next->localToParentTransform() * m_cachedPaintInvalidationTransform;
136 next = next->parent(); 136 next = next->parent();
137 ASSERT(next); 137 ASSERT(next);
138 } 138 }
139 m_cachedPaintInvalidationTransform = toRenderSVGRoot(next)->localToBorde rBoxTransform() * m_cachedPaintInvalidationTransform; 139 m_cachedPaintInvalidationTransform = toLayoutSVGRoot(next)->localToBorde rBoxTransform() * m_cachedPaintInvalidationTransform;
140 } 140 }
141 141
142 ForceHorriblySlowRectMapping slowRectMapping(&paintInvalidationState); 142 ForceHorriblySlowRectMapping slowRectMapping(&paintInvalidationState);
143 RenderBlockFlow::invalidateTreeIfNeeded(paintInvalidationState); 143 RenderBlockFlow::invalidateTreeIfNeeded(paintInvalidationState);
144 } 144 }
145 145
146 void RenderSVGBlock::updatePaintInfoRect(IntRect& rect) 146 void LayoutSVGBlock::updatePaintInfoRect(IntRect& rect)
147 { 147 {
148 if (rect != LayoutRect::infiniteIntRect()) { 148 if (rect != LayoutRect::infiniteIntRect()) {
149 AffineTransform transformToRoot = m_cachedPaintInvalidationTransform * l ocalTransform(); 149 AffineTransform transformToRoot = m_cachedPaintInvalidationTransform * l ocalTransform();
150 rect = enclosingIntRect(transformToRoot.inverse().mapRect(FloatRect(rect ))); 150 rect = enclosingIntRect(transformToRoot.inverse().mapRect(FloatRect(rect )));
151 } 151 }
152 } 152 }
153 153
154 } 154 }
OLDNEW
« no previous file with comments | « Source/core/layout/svg/LayoutSVGBlock.h ('k') | Source/core/layout/svg/LayoutSVGContainer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698