OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org> | 2 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org> |
3 * Copyright (C) 2006 Apple Computer, Inc. | 3 * Copyright (C) 2006 Apple Computer, Inc. |
4 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> | 4 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> |
5 * Copyright (C) 2007, 2008, 2009 Rob Buis <buis@kde.org> | 5 * Copyright (C) 2007, 2008, 2009 Rob Buis <buis@kde.org> |
6 * Copyright (C) 2009 Google, Inc. | 6 * Copyright (C) 2009 Google, Inc. |
7 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> | 7 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
8 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> | 8 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "core/layout/svg/SVGResources.h" | 35 #include "core/layout/svg/SVGResources.h" |
36 #include "core/layout/svg/SVGResourcesCache.h" | 36 #include "core/layout/svg/SVGResourcesCache.h" |
37 #include "core/paint/SVGImagePainter.h" | 37 #include "core/paint/SVGImagePainter.h" |
38 #include "core/svg/SVGImageElement.h" | 38 #include "core/svg/SVGImageElement.h" |
39 #include "platform/LengthFunctions.h" | 39 #include "platform/LengthFunctions.h" |
40 #include "third_party/skia/include/core/SkPicture.h" | 40 #include "third_party/skia/include/core/SkPicture.h" |
41 | 41 |
42 namespace blink { | 42 namespace blink { |
43 | 43 |
44 LayoutSVGImage::LayoutSVGImage(SVGImageElement* impl) | 44 LayoutSVGImage::LayoutSVGImage(SVGImageElement* impl) |
45 : RenderSVGModelObject(impl) | 45 : LayoutSVGModelObject(impl) |
46 , m_needsBoundariesUpdate(true) | 46 , m_needsBoundariesUpdate(true) |
47 , m_needsTransformUpdate(true) | 47 , m_needsTransformUpdate(true) |
48 , m_imageResource(LayoutImageResource::create()) | 48 , m_imageResource(LayoutImageResource::create()) |
49 { | 49 { |
50 m_imageResource->initialize(this); | 50 m_imageResource->initialize(this); |
51 } | 51 } |
52 | 52 |
53 LayoutSVGImage::~LayoutSVGImage() | 53 LayoutSVGImage::~LayoutSVGImage() |
54 { | 54 { |
55 } | 55 } |
56 | 56 |
57 void LayoutSVGImage::destroy() | 57 void LayoutSVGImage::destroy() |
58 { | 58 { |
59 ImageQualityController::remove(this); | 59 ImageQualityController::remove(this); |
60 m_imageResource->shutdown(); | 60 m_imageResource->shutdown(); |
61 RenderSVGModelObject::destroy(); | 61 LayoutSVGModelObject::destroy(); |
62 } | 62 } |
63 | 63 |
64 FloatSize LayoutSVGImage::computeImageViewportSize(ImageResource& cachedImage) c
onst | 64 FloatSize LayoutSVGImage::computeImageViewportSize(ImageResource& cachedImage) c
onst |
65 { | 65 { |
66 if (toSVGImageElement(element())->preserveAspectRatio()->currentValue()->ali
gn() != SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_NONE) | 66 if (toSVGImageElement(element())->preserveAspectRatio()->currentValue()->ali
gn() != SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_NONE) |
67 return m_objectBoundingBox.size(); | 67 return m_objectBoundingBox.size(); |
68 | 68 |
69 // Images with preserveAspectRatio=none should force non-uniform | 69 // Images with preserveAspectRatio=none should force non-uniform |
70 // scaling. This can be achieved by setting the image's container size to | 70 // scaling. This can be achieved by setting the image's container size to |
71 // its viewport size (i.e. if a viewBox is available - use that - else use i
ntrinsic size.) | 71 // its viewport size (i.e. if a viewBox is available - use that - else use i
ntrinsic size.) |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 130 |
131 m_needsBoundariesUpdate = false; | 131 m_needsBoundariesUpdate = false; |
132 } | 132 } |
133 | 133 |
134 // Invalidate all resources of this client if our layout changed. | 134 // Invalidate all resources of this client if our layout changed. |
135 if (everHadLayout() && selfNeedsLayout()) | 135 if (everHadLayout() && selfNeedsLayout()) |
136 SVGResourcesCache::clientLayoutChanged(this); | 136 SVGResourcesCache::clientLayoutChanged(this); |
137 | 137 |
138 // If our bounds changed, notify the parents. | 138 // If our bounds changed, notify the parents. |
139 if (transformOrBoundariesUpdate) | 139 if (transformOrBoundariesUpdate) |
140 RenderSVGModelObject::setNeedsBoundariesUpdate(); | 140 LayoutSVGModelObject::setNeedsBoundariesUpdate(); |
141 | 141 |
142 clearNeedsLayout(); | 142 clearNeedsLayout(); |
143 } | 143 } |
144 | 144 |
145 void LayoutSVGImage::paint(const PaintInfo& paintInfo, const LayoutPoint&) | 145 void LayoutSVGImage::paint(const PaintInfo& paintInfo, const LayoutPoint&) |
146 { | 146 { |
147 SVGImagePainter(*this).paint(paintInfo); | 147 SVGImagePainter(*this).paint(paintInfo); |
148 } | 148 } |
149 | 149 |
150 bool LayoutSVGImage::nodeAtFloatPoint(const HitTestRequest& request, HitTestResu
lt& result, const FloatPoint& pointInParent, HitTestAction hitTestAction) | 150 bool LayoutSVGImage::nodeAtFloatPoint(const HitTestRequest& request, HitTestResu
lt& result, const FloatPoint& pointInParent, HitTestAction hitTestAction) |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 | 193 |
194 void LayoutSVGImage::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPo
int&) const | 194 void LayoutSVGImage::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPo
int&) const |
195 { | 195 { |
196 // this is called from paint() after the localTransform has already been app
lied | 196 // this is called from paint() after the localTransform has already been app
lied |
197 LayoutRect contentRect = LayoutRect(paintInvalidationRectInLocalCoordinates(
)); | 197 LayoutRect contentRect = LayoutRect(paintInvalidationRectInLocalCoordinates(
)); |
198 if (!contentRect.isEmpty()) | 198 if (!contentRect.isEmpty()) |
199 rects.append(contentRect); | 199 rects.append(contentRect); |
200 } | 200 } |
201 | 201 |
202 } // namespace blink | 202 } // namespace blink |
OLD | NEW |