| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz> | 2 * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz> |
| 3 * Copyright (C) 2006 Apple Inc. All rights reserved. | 3 * Copyright (C) 2006 Apple Inc. All rights reserved. |
| 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 * |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "core/rendering/svg/RenderSVGInline.h" | 24 #include "core/rendering/svg/RenderSVGInline.h" |
| 25 | 25 |
| 26 #include "core/layout/svg/line/SVGInlineFlowBox.h" | 26 #include "core/layout/svg/line/SVGInlineFlowBox.h" |
| 27 #include "core/rendering/svg/RenderSVGText.h" | 27 #include "core/rendering/svg/RenderSVGText.h" |
| 28 #include "core/rendering/svg/SVGRenderSupport.h" | 28 #include "core/rendering/svg/SVGRenderSupport.h" |
| 29 #include "core/rendering/svg/SVGResourcesCache.h" | 29 #include "core/rendering/svg/SVGResourcesCache.h" |
| 30 #include "core/svg/SVGAElement.h" | 30 #include "core/svg/SVGAElement.h" |
| 31 | 31 |
| 32 namespace blink { | 32 namespace blink { |
| 33 | 33 |
| 34 bool RenderSVGInline::isChildAllowed(RenderObject* child, const RenderStyle& sty
le) const | 34 bool RenderSVGInline::isChildAllowed(LayoutObject* child, const RenderStyle& sty
le) const |
| 35 { | 35 { |
| 36 if (child->isText()) | 36 if (child->isText()) |
| 37 return SVGRenderSupport::isRenderableTextNode(child); | 37 return SVGRenderSupport::isRenderableTextNode(child); |
| 38 | 38 |
| 39 if (isSVGAElement(*node())) { | 39 if (isSVGAElement(*node())) { |
| 40 // Disallow direct descendant 'a'. | 40 // Disallow direct descendant 'a'. |
| 41 if (isSVGAElement(*child->node())) | 41 if (isSVGAElement(*child->node())) |
| 42 return false; | 42 return false; |
| 43 } | 43 } |
| 44 | 44 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 56 | 56 |
| 57 InlineFlowBox* RenderSVGInline::createInlineFlowBox() | 57 InlineFlowBox* RenderSVGInline::createInlineFlowBox() |
| 58 { | 58 { |
| 59 InlineFlowBox* box = new SVGInlineFlowBox(*this); | 59 InlineFlowBox* box = new SVGInlineFlowBox(*this); |
| 60 box->setHasVirtualLogicalHeight(); | 60 box->setHasVirtualLogicalHeight(); |
| 61 return box; | 61 return box; |
| 62 } | 62 } |
| 63 | 63 |
| 64 FloatRect RenderSVGInline::objectBoundingBox() const | 64 FloatRect RenderSVGInline::objectBoundingBox() const |
| 65 { | 65 { |
| 66 if (const RenderObject* object = RenderSVGText::locateRenderSVGTextAncestor(
this)) | 66 if (const LayoutObject* object = RenderSVGText::locateRenderSVGTextAncestor(
this)) |
| 67 return object->objectBoundingBox(); | 67 return object->objectBoundingBox(); |
| 68 | 68 |
| 69 return FloatRect(); | 69 return FloatRect(); |
| 70 } | 70 } |
| 71 | 71 |
| 72 FloatRect RenderSVGInline::strokeBoundingBox() const | 72 FloatRect RenderSVGInline::strokeBoundingBox() const |
| 73 { | 73 { |
| 74 if (const RenderObject* object = RenderSVGText::locateRenderSVGTextAncestor(
this)) | 74 if (const LayoutObject* object = RenderSVGText::locateRenderSVGTextAncestor(
this)) |
| 75 return object->strokeBoundingBox(); | 75 return object->strokeBoundingBox(); |
| 76 | 76 |
| 77 return FloatRect(); | 77 return FloatRect(); |
| 78 } | 78 } |
| 79 | 79 |
| 80 FloatRect RenderSVGInline::paintInvalidationRectInLocalCoordinates() const | 80 FloatRect RenderSVGInline::paintInvalidationRectInLocalCoordinates() const |
| 81 { | 81 { |
| 82 if (const RenderObject* object = RenderSVGText::locateRenderSVGTextAncestor(
this)) | 82 if (const LayoutObject* object = RenderSVGText::locateRenderSVGTextAncestor(
this)) |
| 83 return object->paintInvalidationRectInLocalCoordinates(); | 83 return object->paintInvalidationRectInLocalCoordinates(); |
| 84 | 84 |
| 85 return FloatRect(); | 85 return FloatRect(); |
| 86 } | 86 } |
| 87 | 87 |
| 88 LayoutRect RenderSVGInline::clippedOverflowRectForPaintInvalidation(const Layout
LayerModelObject* paintInvalidationContainer, const PaintInvalidationState* pain
tInvalidationState) const | 88 LayoutRect RenderSVGInline::clippedOverflowRectForPaintInvalidation(const Layout
LayerModelObject* paintInvalidationContainer, const PaintInvalidationState* pain
tInvalidationState) const |
| 89 { | 89 { |
| 90 return SVGRenderSupport::clippedOverflowRectForPaintInvalidation(this, paint
InvalidationContainer, paintInvalidationState); | 90 return SVGRenderSupport::clippedOverflowRectForPaintInvalidation(this, paint
InvalidationContainer, paintInvalidationState); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void RenderSVGInline::mapLocalToContainer(const LayoutLayerModelObject* paintInv
alidationContainer, TransformState& transformState, MapCoordinatesFlags, bool* w
asFixed, const PaintInvalidationState* paintInvalidationState) const | 93 void RenderSVGInline::mapLocalToContainer(const LayoutLayerModelObject* paintInv
alidationContainer, TransformState& transformState, MapCoordinatesFlags, bool* w
asFixed, const PaintInvalidationState* paintInvalidationState) const |
| 94 { | 94 { |
| 95 SVGRenderSupport::mapLocalToContainer(this, paintInvalidationContainer, tran
sformState, wasFixed, paintInvalidationState); | 95 SVGRenderSupport::mapLocalToContainer(this, paintInvalidationContainer, tran
sformState, wasFixed, paintInvalidationState); |
| 96 } | 96 } |
| 97 | 97 |
| 98 const RenderObject* RenderSVGInline::pushMappingToContainer(const LayoutLayerMod
elObject* ancestorToStopAt, RenderGeometryMap& geometryMap) const | 98 const LayoutObject* RenderSVGInline::pushMappingToContainer(const LayoutLayerMod
elObject* ancestorToStopAt, RenderGeometryMap& geometryMap) const |
| 99 { | 99 { |
| 100 return SVGRenderSupport::pushMappingToContainer(this, ancestorToStopAt, geom
etryMap); | 100 return SVGRenderSupport::pushMappingToContainer(this, ancestorToStopAt, geom
etryMap); |
| 101 } | 101 } |
| 102 | 102 |
| 103 void RenderSVGInline::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) co
nst | 103 void RenderSVGInline::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) co
nst |
| 104 { | 104 { |
| 105 const RenderObject* object = RenderSVGText::locateRenderSVGTextAncestor(this
); | 105 const LayoutObject* object = RenderSVGText::locateRenderSVGTextAncestor(this
); |
| 106 if (!object) | 106 if (!object) |
| 107 return; | 107 return; |
| 108 | 108 |
| 109 FloatRect textBoundingBox = object->strokeBoundingBox(); | 109 FloatRect textBoundingBox = object->strokeBoundingBox(); |
| 110 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox()) | 110 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox()) |
| 111 quads.append(localToAbsoluteQuad(FloatRect(textBoundingBox.x() + box->x(
), textBoundingBox.y() + box->y(), box->logicalWidth(), box->logicalHeight()), f
alse, wasFixed)); | 111 quads.append(localToAbsoluteQuad(FloatRect(textBoundingBox.x() + box->x(
), textBoundingBox.y() + box->y(), box->logicalWidth(), box->logicalHeight()), f
alse, wasFixed)); |
| 112 } | 112 } |
| 113 | 113 |
| 114 void RenderSVGInline::willBeDestroyed() | 114 void RenderSVGInline::willBeDestroyed() |
| 115 { | 115 { |
| 116 SVGResourcesCache::clientDestroyed(this); | 116 SVGResourcesCache::clientDestroyed(this); |
| 117 RenderInline::willBeDestroyed(); | 117 RenderInline::willBeDestroyed(); |
| 118 } | 118 } |
| 119 | 119 |
| 120 void RenderSVGInline::styleDidChange(StyleDifference diff, const RenderStyle* ol
dStyle) | 120 void RenderSVGInline::styleDidChange(StyleDifference diff, const RenderStyle* ol
dStyle) |
| 121 { | 121 { |
| 122 if (diff.needsFullLayout()) | 122 if (diff.needsFullLayout()) |
| 123 setNeedsBoundariesUpdate(); | 123 setNeedsBoundariesUpdate(); |
| 124 | 124 |
| 125 RenderInline::styleDidChange(diff, oldStyle); | 125 RenderInline::styleDidChange(diff, oldStyle); |
| 126 SVGResourcesCache::clientStyleChanged(this, diff, style()); | 126 SVGResourcesCache::clientStyleChanged(this, diff, style()); |
| 127 } | 127 } |
| 128 | 128 |
| 129 void RenderSVGInline::addChild(RenderObject* child, RenderObject* beforeChild) | 129 void RenderSVGInline::addChild(LayoutObject* child, LayoutObject* beforeChild) |
| 130 { | 130 { |
| 131 RenderInline::addChild(child, beforeChild); | 131 RenderInline::addChild(child, beforeChild); |
| 132 SVGResourcesCache::clientWasAddedToTree(child, child->style()); | 132 SVGResourcesCache::clientWasAddedToTree(child, child->style()); |
| 133 | 133 |
| 134 if (RenderSVGText* textRenderer = RenderSVGText::locateRenderSVGTextAncestor
(this)) | 134 if (RenderSVGText* textRenderer = RenderSVGText::locateRenderSVGTextAncestor
(this)) |
| 135 textRenderer->subtreeChildWasAdded(child); | 135 textRenderer->subtreeChildWasAdded(child); |
| 136 } | 136 } |
| 137 | 137 |
| 138 void RenderSVGInline::removeChild(RenderObject* child) | 138 void RenderSVGInline::removeChild(LayoutObject* child) |
| 139 { | 139 { |
| 140 SVGResourcesCache::clientWillBeRemovedFromTree(child); | 140 SVGResourcesCache::clientWillBeRemovedFromTree(child); |
| 141 | 141 |
| 142 RenderSVGText* textRenderer = RenderSVGText::locateRenderSVGTextAncestor(thi
s); | 142 RenderSVGText* textRenderer = RenderSVGText::locateRenderSVGTextAncestor(thi
s); |
| 143 if (!textRenderer) { | 143 if (!textRenderer) { |
| 144 RenderInline::removeChild(child); | 144 RenderInline::removeChild(child); |
| 145 return; | 145 return; |
| 146 } | 146 } |
| 147 Vector<SVGTextLayoutAttributes*, 2> affectedAttributes; | 147 Vector<SVGTextLayoutAttributes*, 2> affectedAttributes; |
| 148 textRenderer->subtreeChildWillBeRemoved(child, affectedAttributes); | 148 textRenderer->subtreeChildWillBeRemoved(child, affectedAttributes); |
| 149 RenderInline::removeChild(child); | 149 RenderInline::removeChild(child); |
| 150 textRenderer->subtreeChildWasRemoved(affectedAttributes); | 150 textRenderer->subtreeChildWasRemoved(affectedAttributes); |
| 151 } | 151 } |
| 152 | 152 |
| 153 } | 153 } |
| OLD | NEW |