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

Side by Side Diff: Source/core/rendering/exclusions/ExclusionShape.h

Issue 14892005: [CSS Exclusions] ExclusionShape bounding box methods should return LayoutRects (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: [CSS Exclusions] ExclusionShape bounding box methods should return LayoutRects Created 7 years, 7 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
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 12 matching lines...) Expand all
23 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
25 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
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 ExclusionShape_h 30 #ifndef ExclusionShape_h
31 #define ExclusionShape_h 31 #define ExclusionShape_h
32 32
33 #include "core/platform/graphics/FloatRect.h" 33 #include "core/platform/graphics/LayoutRect.h"
34 #include "core/platform/text/WritingMode.h" 34 #include "core/platform/text/WritingMode.h"
35 #include "core/rendering/style/BasicShapes.h" 35 #include "core/rendering/style/BasicShapes.h"
36 #include <wtf/PassOwnPtr.h> 36 #include <wtf/PassOwnPtr.h>
37 #include <wtf/Vector.h> 37 #include <wtf/Vector.h>
38 38
39 namespace WebCore { 39 namespace WebCore {
40 40
41 struct LineSegment { 41 struct LineSegment {
42 LineSegment(float logicalLeft, float logicalRight) 42 LineSegment(float logicalLeft, float logicalRight)
43 : logicalLeft(logicalLeft) 43 : logicalLeft(logicalLeft)
44 , logicalRight(logicalRight) 44 , logicalRight(logicalRight)
45 { 45 {
46 } 46 }
47 47
48 float logicalLeft; 48 LayoutUnit logicalLeft;
eae 2013/05/06 15:59:29 The line-box tree still uses floats (and the LineS
49 float logicalRight; 49 LayoutUnit logicalRight;
50 }; 50 };
51 51
52 typedef Vector<LineSegment> SegmentList; 52 typedef Vector<LineSegment> SegmentList;
53 53
54 54
55 // A representation of a BasicShape that enables layout code to determine how to break a line up into segments 55 // A representation of a BasicShape that enables layout code to determine how to break a line up into segments
56 // that will fit within or around a shape. The line is defined by a pair of logi cal Y coordinates and the 56 // that will fit within or around a shape. The line is defined by a pair of logi cal Y coordinates and the
57 // computed segments are returned as pairs of logical X coordinates. The BasicSh ape itself is defined in 57 // computed segments are returned as pairs of logical X coordinates. The BasicSh ape itself is defined in
58 // physical coordinates. 58 // physical coordinates.
59 59
60 class ExclusionShape { 60 class ExclusionShape {
61 public: 61 public:
62 static PassOwnPtr<ExclusionShape> createExclusionShape(const BasicShape*, fl oat logicalBoxWidth, float logicalBoxHeight, WritingMode, Length margin, Length padding); 62 static PassOwnPtr<ExclusionShape> createExclusionShape(const BasicShape*, co nst LayoutSize& logicalBoxSize, WritingMode, Length margin, Length padding);
63 63
64 virtual ~ExclusionShape() { } 64 virtual ~ExclusionShape() { }
65 65
66 virtual LayoutRect shapeMarginLogicalBoundingBox() const = 0;
67 virtual LayoutRect shapePaddingLogicalBoundingBox() const = 0;
68 virtual bool isEmpty() const = 0;
69 virtual void getIncludedIntervals(LayoutUnit logicalTop, LayoutUnit logicalH eight, SegmentList&) const = 0;
70 virtual void getExcludedIntervals(LayoutUnit logicalTop, LayoutUnit logicalH eight, SegmentList&) const = 0;
71 virtual bool firstIncludedIntervalLogicalTop(LayoutUnit minLogicalIntervalTo p, const LayoutSize& minLogicalIntervalSize, LayoutUnit& result) const = 0;
72
73 protected:
66 float shapeMargin() const { return m_margin; } 74 float shapeMargin() const { return m_margin; }
67 float shapePadding() const { return m_padding; } 75 float shapePadding() const { return m_padding; }
68 virtual FloatRect shapeMarginLogicalBoundingBox() const = 0;
69 virtual FloatRect shapePaddingLogicalBoundingBox() const = 0;
70 virtual bool isEmpty() const = 0;
71 virtual void getIncludedIntervals(float logicalTop, float logicalHeight, Seg mentList&) const = 0;
72 virtual void getExcludedIntervals(float logicalTop, float logicalHeight, Seg mentList&) const = 0;
73 virtual bool firstIncludedIntervalLogicalTop(float minLogicalIntervalTop, co nst FloatSize& minLogicalIntervalSize, float& result) const = 0;
74 76
75 private: 77 private:
76 WritingMode m_writingMode; 78 WritingMode m_writingMode;
77 float m_logicalBoxWidth;
78 float m_logicalBoxHeight;
79 float m_margin; 79 float m_margin;
80 float m_padding; 80 float m_padding;
81 }; 81 };
82 82
83 } // namespace WebCore 83 } // namespace WebCore
84 84
85 #endif // ExclusionShape_h 85 #endif // ExclusionShape_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698