| OLD | NEW |
| 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 "core/layout/svg/LayoutSVGBlock.h" | 22 #include "core/layout/svg/LayoutSVGBlock.h" |
| 23 | 23 |
| 24 #include "core/layout/LayoutGeometryMap.h" | |
| 25 #include "core/layout/LayoutView.h" | 24 #include "core/layout/LayoutView.h" |
| 26 #include "core/layout/svg/LayoutSVGRoot.h" | 25 #include "core/layout/svg/LayoutSVGRoot.h" |
| 27 #include "core/layout/svg/SVGLayoutSupport.h" | 26 #include "core/layout/svg/SVGLayoutSupport.h" |
| 28 #include "core/layout/svg/SVGResourcesCache.h" | 27 #include "core/layout/svg/SVGResourcesCache.h" |
| 29 #include "core/style/ShadowList.h" | 28 #include "core/style/ShadowList.h" |
| 30 #include "core/svg/SVGElement.h" | 29 #include "core/svg/SVGElement.h" |
| 31 #include "platform/geometry/TransformState.h" | |
| 32 | 30 |
| 33 namespace blink { | 31 namespace blink { |
| 34 | 32 |
| 35 LayoutSVGBlock::LayoutSVGBlock(SVGElement* element) | 33 LayoutSVGBlock::LayoutSVGBlock(SVGElement* element) |
| 36 : LayoutBlockFlow(element) {} | 34 : LayoutBlockFlow(element) {} |
| 37 | 35 |
| 38 bool LayoutSVGBlock::allowsOverflowClip() const { | 36 bool LayoutSVGBlock::allowsOverflowClip() const { |
| 39 // LayoutSVGBlock, used by Layout(SVGText|ForeignObject), is not allowed to | 37 // LayoutSVGBlock, used by Layout(SVGText|ForeignObject), is not allowed to |
| 40 // have overflow clip. | 38 // have overflow clip. |
| 41 // LayoutBlock assumes a layer to be present when the overflow clip | 39 // LayoutBlock assumes a layer to be present when the overflow clip |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 : DescendantIsolationNeedsUpdate); | 90 : DescendantIsolationNeedsUpdate); |
| 93 } | 91 } |
| 94 | 92 |
| 95 LayoutBlock::styleDidChange(diff, oldStyle); | 93 LayoutBlock::styleDidChange(diff, oldStyle); |
| 96 SVGResourcesCache::clientStyleChanged(this, diff, styleRef()); | 94 SVGResourcesCache::clientStyleChanged(this, diff, styleRef()); |
| 97 } | 95 } |
| 98 | 96 |
| 99 void LayoutSVGBlock::mapLocalToAncestor(const LayoutBoxModelObject* ancestor, | 97 void LayoutSVGBlock::mapLocalToAncestor(const LayoutBoxModelObject* ancestor, |
| 100 TransformState& transformState, | 98 TransformState& transformState, |
| 101 MapCoordinatesFlags flags) const { | 99 MapCoordinatesFlags flags) const { |
| 102 // Convert from local HTML coordinates to local SVG coordinates. | |
| 103 transformState.move(locationOffset()); | |
| 104 // Apply other mappings on local SVG coordinates. | |
| 105 SVGLayoutSupport::mapLocalToAncestor(this, ancestor, transformState, flags); | 100 SVGLayoutSupport::mapLocalToAncestor(this, ancestor, transformState, flags); |
| 106 } | 101 } |
| 107 | 102 |
| 108 void LayoutSVGBlock::mapAncestorToLocal(const LayoutBoxModelObject* ancestor, | 103 void LayoutSVGBlock::mapAncestorToLocal(const LayoutBoxModelObject* ancestor, |
| 109 TransformState& transformState, | 104 TransformState& transformState, |
| 110 MapCoordinatesFlags flags) const { | 105 MapCoordinatesFlags flags) const { |
| 111 if (this == ancestor) | 106 if (this == ancestor) |
| 112 return; | 107 return; |
| 113 | |
| 114 // Map to local SVG coordinates. | |
| 115 SVGLayoutSupport::mapAncestorToLocal(*this, ancestor, transformState, flags); | 108 SVGLayoutSupport::mapAncestorToLocal(*this, ancestor, transformState, flags); |
| 116 // Convert from local SVG coordinates to local HTML coordinates. | |
| 117 transformState.move(-locationOffset()); | |
| 118 } | 109 } |
| 119 | 110 |
| 120 const LayoutObject* LayoutSVGBlock::pushMappingToContainer( | 111 const LayoutObject* LayoutSVGBlock::pushMappingToContainer( |
| 121 const LayoutBoxModelObject* ancestorToStopAt, | 112 const LayoutBoxModelObject* ancestorToStopAt, |
| 122 LayoutGeometryMap& geometryMap) const { | 113 LayoutGeometryMap& geometryMap) const { |
| 123 // Convert from local HTML coordinates to local SVG coordinates. | |
| 124 geometryMap.push(this, locationOffset()); | |
| 125 // Apply other mappings on local SVG coordinates. | |
| 126 return SVGLayoutSupport::pushMappingToContainer(this, ancestorToStopAt, | 114 return SVGLayoutSupport::pushMappingToContainer(this, ancestorToStopAt, |
| 127 geometryMap); | 115 geometryMap); |
| 128 } | 116 } |
| 129 | 117 |
| 130 LayoutRect LayoutSVGBlock::absoluteVisualRect() const { | 118 LayoutRect LayoutSVGBlock::absoluteVisualRect() const { |
| 131 return SVGLayoutSupport::visualRectInAncestorSpace(*this, *view()); | 119 return SVGLayoutSupport::visualRectInAncestorSpace(*this, *view()); |
| 132 } | 120 } |
| 133 | 121 |
| 134 bool LayoutSVGBlock::mapToVisualRectInAncestorSpace( | 122 bool LayoutSVGBlock::mapToVisualRectInAncestorSpace( |
| 135 const LayoutBoxModelObject* ancestor, | 123 const LayoutBoxModelObject* ancestor, |
| 136 LayoutRect& rect, | 124 LayoutRect& rect, |
| 137 VisualRectFlags) const { | 125 VisualRectFlags) const { |
| 138 // Convert from local HTML coordinates to local SVG coordinates. | |
| 139 rect.moveBy(location()); | |
| 140 // Apply other mappings on local SVG coordinates. | |
| 141 return SVGLayoutSupport::mapToVisualRectInAncestorSpace( | 126 return SVGLayoutSupport::mapToVisualRectInAncestorSpace( |
| 142 *this, ancestor, FloatRect(rect), rect); | 127 *this, ancestor, FloatRect(rect), rect); |
| 143 } | 128 } |
| 144 | 129 |
| 145 bool LayoutSVGBlock::nodeAtPoint(HitTestResult&, | 130 bool LayoutSVGBlock::nodeAtPoint(HitTestResult&, |
| 146 const HitTestLocation&, | 131 const HitTestLocation&, |
| 147 const LayoutPoint&, | 132 const LayoutPoint&, |
| 148 HitTestAction) { | 133 HitTestAction) { |
| 149 ASSERT_NOT_REACHED(); | 134 ASSERT_NOT_REACHED(); |
| 150 return false; | 135 return false; |
| 151 } | 136 } |
| 152 | 137 |
| 153 } // namespace blink | 138 } // namespace blink |
| OLD | NEW |