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

Side by Side Diff: Source/core/rendering/shapes/Shape.h

Issue 815933006: Change all uses of the RoundedRect class to use FloatRoundedRect instead. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 12 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/rendering/shapes/BoxShapeTest.cpp ('k') | Source/core/rendering/shapes/Shape.cpp » ('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) 2012 Adobe Systems Incorporated. All rights reserved. 2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above 8 * 1. Redistributions of source code must retain the above
9 * copyright notice, this list of conditions and the following 9 * copyright notice, this list of conditions and the following
10 * disclaimer. 10 * disclaimer.
(...skipping 15 matching lines...) Expand all
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
27 * OF THE POSSIBILITY OF SUCH DAMAGE. 27 * OF THE POSSIBILITY OF SUCH DAMAGE.
28 */ 28 */
29 29
30 #ifndef Shape_h 30 #ifndef Shape_h
31 #define Shape_h 31 #define Shape_h
32 32
33 #include "core/rendering/style/BasicShapes.h" 33 #include "core/rendering/style/BasicShapes.h"
34 #include "core/rendering/style/StyleImage.h" 34 #include "core/rendering/style/StyleImage.h"
35 #include "platform/geometry/LayoutRect.h" 35 #include "platform/geometry/LayoutRect.h"
36 #include "platform/geometry/RoundedRect.h"
37 #include "platform/graphics/Path.h" 36 #include "platform/graphics/Path.h"
38 #include "platform/text/WritingMode.h" 37 #include "platform/text/WritingMode.h"
39 #include "wtf/PassOwnPtr.h" 38 #include "wtf/PassOwnPtr.h"
40 39
41 namespace blink { 40 namespace blink {
42 41
42 class FloatRoundedRect;
43
43 struct LineSegment { 44 struct LineSegment {
44 LineSegment() 45 LineSegment()
45 : logicalLeft(0) 46 : logicalLeft(0)
46 , logicalRight(0) 47 , logicalRight(0)
47 , isValid(false) 48 , isValid(false)
48 { 49 {
49 } 50 }
50 51
51 LineSegment(float logicalLeft, float logicalRight) 52 LineSegment(float logicalLeft, float logicalRight)
52 : logicalLeft(logicalLeft) 53 : logicalLeft(logicalLeft)
(...skipping 14 matching lines...) Expand all
67 68
68 class Shape { 69 class Shape {
69 public: 70 public:
70 struct DisplayPaths { 71 struct DisplayPaths {
71 Path shape; 72 Path shape;
72 Path marginShape; 73 Path marginShape;
73 }; 74 };
74 static PassOwnPtr<Shape> createShape(const BasicShape*, const LayoutSize& lo gicalBoxSize, WritingMode, float margin); 75 static PassOwnPtr<Shape> createShape(const BasicShape*, const LayoutSize& lo gicalBoxSize, WritingMode, float margin);
75 static PassOwnPtr<Shape> createRasterShape(Image*, float threshold, const La youtRect& imageRect, const LayoutRect& marginRect, WritingMode, float margin); 76 static PassOwnPtr<Shape> createRasterShape(Image*, float threshold, const La youtRect& imageRect, const LayoutRect& marginRect, WritingMode, float margin);
76 static PassOwnPtr<Shape> createEmptyRasterShape(WritingMode, float margin); 77 static PassOwnPtr<Shape> createEmptyRasterShape(WritingMode, float margin);
77 static PassOwnPtr<Shape> createLayoutBoxShape(const RoundedRect&, WritingMod e, float margin); 78 static PassOwnPtr<Shape> createLayoutBoxShape(const FloatRoundedRect&, Writi ngMode, float margin);
78 79
79 virtual ~Shape() { } 80 virtual ~Shape() { }
80 81
81 virtual LayoutRect shapeMarginLogicalBoundingBox() const = 0; 82 virtual LayoutRect shapeMarginLogicalBoundingBox() const = 0;
82 virtual bool isEmpty() const = 0; 83 virtual bool isEmpty() const = 0;
83 virtual LineSegment getExcludedInterval(LayoutUnit logicalTop, LayoutUnit lo gicalHeight) const = 0; 84 virtual LineSegment getExcludedInterval(LayoutUnit logicalTop, LayoutUnit lo gicalHeight) const = 0;
84 85
85 bool lineOverlapsShapeMarginBounds(LayoutUnit lineTop, LayoutUnit lineHeight ) const { return lineOverlapsBoundingBox(lineTop, lineHeight, shapeMarginLogical BoundingBox()); } 86 bool lineOverlapsShapeMarginBounds(LayoutUnit lineTop, LayoutUnit lineHeight ) const { return lineOverlapsBoundingBox(lineTop, lineHeight, shapeMarginLogical BoundingBox()); }
86 virtual void buildDisplayPaths(DisplayPaths&) const = 0; 87 virtual void buildDisplayPaths(DisplayPaths&) const = 0;
87 88
88 protected: 89 protected:
89 float shapeMargin() const { return m_margin; } 90 float shapeMargin() const { return m_margin; }
90 91
91 private: 92 private:
92 bool lineOverlapsBoundingBox(LayoutUnit lineTop, LayoutUnit lineHeight, cons t LayoutRect& rect) const 93 bool lineOverlapsBoundingBox(LayoutUnit lineTop, LayoutUnit lineHeight, cons t LayoutRect& rect) const
93 { 94 {
94 if (rect.isEmpty()) 95 if (rect.isEmpty())
95 return false; 96 return false;
96 return (lineTop < rect.maxY() && lineTop + lineHeight > rect.y()) || (!l ineHeight && lineTop == rect.y()); 97 return (lineTop < rect.maxY() && lineTop + lineHeight > rect.y()) || (!l ineHeight && lineTop == rect.y());
97 } 98 }
98 99
99 WritingMode m_writingMode; 100 WritingMode m_writingMode;
100 float m_margin; 101 float m_margin;
101 }; 102 };
102 103
103 } // namespace blink 104 } // namespace blink
104 105
105 #endif // Shape_h 106 #endif // Shape_h
OLDNEW
« no previous file with comments | « Source/core/rendering/shapes/BoxShapeTest.cpp ('k') | Source/core/rendering/shapes/Shape.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698