Changeset 180643 in webkit
- Timestamp:
- Feb 25, 2015 3:05:20 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r180638 r180643 1 2015-02-25 Said Abou-Hallawa <sabouhallawa@apple.com> 2 3 Horizontal and vertical lines are clipped completely if clip-path is included in the tag but the referenced element is defined later. 4 https://bugs.webkit.org/show_bug.cgi?id=141776. 5 6 Reviewed by Dean Jackson. 7 8 New test cases for SVG lines which are clipped to a <clipPath>. The <clipPath> 9 is referenced before it is defined. 10 11 * svg/clip-path/clip-path-line-use-before-defined-expected.svg: Added. 12 * svg/clip-path/clip-path-line-use-before-defined.svg: Added. 13 1 14 2015-02-25 Myles C. Maxfield <mmaxfield@apple.com> 2 15 -
trunk/Source/WebCore/ChangeLog
r180641 r180643 1 2015-02-25 Said Abou-Hallawa <sabouhallawa@apple.com> 2 3 Horizontal and vertical lines are clipped completely if clip-path is included in the tag but the referenced element is defined later. 4 https://bugs.webkit.org/show_bug.cgi?id=141776. 5 6 Reviewed by Dean Jackson. 7 8 Tests: svg/clip-path/clip-path-line-use-before-defined-expected.svg 9 svg/clip-path/clip-path-line-use-before-defined.svg 10 11 * rendering/svg/RenderSVGResourceClipper.cpp: 12 (WebCore::RenderSVGResourceClipper::applyClippingToContext): Ensure the renderer 13 is added to m_clipper if it does not exist. The same renderer might have been 14 added to m_clipper in resourceBoundingBox(). 15 16 (WebCore::RenderSVGResourceClipper::addRendererToClipper): Add the renderer to 17 m_clipper if it does not exist. Return the associated ClipperData. 18 19 (WebCore::RenderSVGResourceClipper::resourceBoundingBox): If the clipper is 20 referenced before it is defined, add the renderer to m_clipper. While doing the 21 layout() for the clipper, we can check if m_clipper has values or not. If it does 22 have, we are going to mark the clipper for client invalidation which is done by 23 the SVG root. 24 25 * rendering/svg/RenderSVGResourceClipper.h: 26 * rendering/svg/RenderSVGResourceContainer.h: 27 (WebCore::RenderSVGResourceContainer::selfNeedsClientInvalidation): Define a 28 new function selfNeedsClientInvalidation() which controls marking the clipper 29 for client invalidation. In RenderSVGResourceClipper, override it so it checks 30 m_clipper to force clients validation even if it the first time we do layout 31 for this clipper. 32 33 * rendering/svg/RenderSVGResourceContainer.cpp: 34 (WebCore::RenderSVGResourceContainer::layout): Call the virtual function 35 selfNeedsClientInvalidation() to check whether we need to mark the clipper for 36 client invalidation. 37 38 * svg/SVGElement.cpp: Delete unneeded header file. 39 1 40 2015-02-25 peavo@outlook.com <peavo@outlook.com> 2 41 -
trunk/Source/WebCore/rendering/svg/RenderSVGResourceClipper.cpp
r177259 r180643 131 131 const FloatRect& repaintRect, GraphicsContext* context) 132 132 { 133 bool missingClipperData = !m_clipper.contains(&renderer); 134 if (missingClipperData) 135 m_clipper.set(&renderer, std::make_unique<ClipperData>()); 136 137 bool shouldCreateClipData = false; 133 ClipperData* clipperData = addRendererToClipper(renderer); 134 ASSERT(clipperData); 135 bool shouldCreateClipData = !clipperData->clipMaskImage; 136 138 137 AffineTransform animatedLocalTransform = clipPathElement().animatedLocalTransform(); 139 ClipperData* clipperData = m_clipper.get(&renderer); 140 if (!clipperData->clipMaskImage) { 141 if (pathOnlyClipping(context, animatedLocalTransform, objectBoundingBox)) 142 return true; 143 shouldCreateClipData = true; 144 } 138 139 if (shouldCreateClipData && pathOnlyClipping(context, animatedLocalTransform, objectBoundingBox)) 140 return true; 145 141 146 142 AffineTransform absoluteTransform; … … 178 174 return false; 179 175 180 SVGRenderingContext::clipToImageBuffer(context, absoluteTransform, repaintRect, clipperData->clipMaskImage, missingClipperData);176 SVGRenderingContext::clipToImageBuffer(context, absoluteTransform, repaintRect, clipperData->clipMaskImage, shouldCreateClipData); 181 177 return true; 182 178 } … … 262 258 } 263 259 260 ClipperData* RenderSVGResourceClipper::addRendererToClipper(const RenderObject& object) 261 { 262 if (!m_clipper.contains(&object)) 263 m_clipper.set(&object, std::make_unique<ClipperData>()); 264 return m_clipper.get(&object); 265 } 266 264 267 bool RenderSVGResourceClipper::hitTestClipContent(const FloatRect& objectBoundingBox, const FloatPoint& nodeAtPoint) 265 268 { … … 295 298 { 296 299 // Resource was not layouted yet. Give back the boundingBox of the object. 297 if (selfNeedsLayout()) 300 if (selfNeedsLayout()) { 301 addRendererToClipper(object); 298 302 return object.objectBoundingBox(); 303 } 299 304 300 305 if (m_clipBoundaries.isEmpty()) -
trunk/Source/WebCore/rendering/svg/RenderSVGResourceClipper.h
r177259 r180643 61 61 SVGUnitTypes::SVGUnitType clipPathUnits() const { return clipPathElement().clipPathUnits(); } 62 62 63 protected: 64 virtual bool selfNeedsClientInvalidation() const override { return (everHadLayout() || m_clipper.size()) && selfNeedsLayout(); } 65 63 66 private: 64 67 void element() const = delete; … … 69 72 bool drawContentIntoMaskImage(ClipperData*, const FloatRect& objectBoundingBox); 70 73 void calculateClipContentRepaintRect(); 74 ClipperData* addRendererToClipper(const RenderObject&); 71 75 72 76 FloatRect m_clipBoundaries; 73 HashMap< RenderObject*, std::unique_ptr<ClipperData>> m_clipper;77 HashMap<const RenderObject*, std::unique_ptr<ClipperData>> m_clipper; 74 78 }; 75 79 -
trunk/Source/WebCore/rendering/svg/RenderSVGResourceContainer.cpp
r177259 r180643 53 53 StackStats::LayoutCheckPoint layoutCheckPoint; 54 54 // Invalidate all resources if our layout changed. 55 if ( everHadLayout() && selfNeedsLayout())55 if (selfNeedsClientInvalidation()) 56 56 RenderSVGRoot::addResourceForClientInvalidation(this); 57 57 -
trunk/Source/WebCore/rendering/svg/RenderSVGResourceContainer.h
r177259 r180643 56 56 57 57 // Used from the invalidateClient/invalidateClients methods from classes, inheriting from us. 58 virtual bool selfNeedsClientInvalidation() const { return everHadLayout() && selfNeedsLayout(); } 59 58 60 void markAllClientsForInvalidation(InvalidationMode); 59 61 void markAllClientLayersForInvalidation(); -
trunk/Source/WebCore/svg/SVGElement.cpp
r179980 r180643 40 40 #include "RenderObject.h" 41 41 #include "RenderSVGResource.h" 42 #include "RenderSVGResourceClipper.h"43 42 #include "RenderSVGResourceFilter.h" 44 43 #include "RenderSVGResourceMasker.h"
Note: See TracChangeset
for help on using the changeset viewer.