OLD | NEW |
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 25 matching lines...) Expand all Loading... |
36 #include "platform/geometry/LayoutRect.h" | 36 #include "platform/geometry/LayoutRect.h" |
37 #include "platform/graphics/Path.h" | 37 #include "platform/graphics/Path.h" |
38 #include "platform/text/WritingMode.h" | 38 #include "platform/text/WritingMode.h" |
39 #include "wtf/PassOwnPtr.h" | 39 #include "wtf/PassOwnPtr.h" |
40 | 40 |
41 namespace blink { | 41 namespace blink { |
42 | 42 |
43 class FloatRoundedRect; | 43 class FloatRoundedRect; |
44 | 44 |
45 struct LineSegment { | 45 struct LineSegment { |
| 46 STACK_ALLOCATED(); |
46 LineSegment() | 47 LineSegment() |
47 : logicalLeft(0) | 48 : logicalLeft(0) |
48 , logicalRight(0) | 49 , logicalRight(0) |
49 , isValid(false) | 50 , isValid(false) |
50 { | 51 { |
51 } | 52 } |
52 | 53 |
53 LineSegment(float logicalLeft, float logicalRight) | 54 LineSegment(float logicalLeft, float logicalRight) |
54 : logicalLeft(logicalLeft) | 55 : logicalLeft(logicalLeft) |
55 , logicalRight(logicalRight) | 56 , logicalRight(logicalRight) |
56 , isValid(true) | 57 , isValid(true) |
57 { | 58 { |
58 } | 59 } |
59 | 60 |
60 float logicalLeft; | 61 float logicalLeft; |
61 float logicalRight; | 62 float logicalRight; |
62 bool isValid; | 63 bool isValid; |
63 }; | 64 }; |
64 | 65 |
65 // A representation of a BasicShape that enables layout code to determine how to
break a line up into segments | 66 // A representation of a BasicShape that enables layout code to determine how to
break a line up into segments |
66 // that will fit within or around a shape. The line is defined by a pair of logi
cal Y coordinates and the | 67 // that will fit within or around a shape. The line is defined by a pair of logi
cal Y coordinates and the |
67 // computed segments are returned as pairs of logical X coordinates. The BasicSh
ape itself is defined in | 68 // computed segments are returned as pairs of logical X coordinates. The BasicSh
ape itself is defined in |
68 // physical coordinates. | 69 // physical coordinates. |
69 | 70 |
70 class CORE_EXPORT Shape { | 71 class CORE_EXPORT Shape { |
| 72 WTF_MAKE_FAST_ALLOCATED(Shape); |
71 public: | 73 public: |
72 struct DisplayPaths { | 74 struct DisplayPaths { |
| 75 STACK_ALLOCATED(); |
73 Path shape; | 76 Path shape; |
74 Path marginShape; | 77 Path marginShape; |
75 }; | 78 }; |
76 static PassOwnPtr<Shape> createShape(const BasicShape*, const LayoutSize& lo
gicalBoxSize, WritingMode, float margin); | 79 static PassOwnPtr<Shape> createShape(const BasicShape*, const LayoutSize& lo
gicalBoxSize, WritingMode, float margin); |
77 static PassOwnPtr<Shape> createRasterShape(Image*, float threshold, const La
youtRect& imageRect, const LayoutRect& marginRect, WritingMode, float margin); | 80 static PassOwnPtr<Shape> createRasterShape(Image*, float threshold, const La
youtRect& imageRect, const LayoutRect& marginRect, WritingMode, float margin); |
78 static PassOwnPtr<Shape> createEmptyRasterShape(WritingMode, float margin); | 81 static PassOwnPtr<Shape> createEmptyRasterShape(WritingMode, float margin); |
79 static PassOwnPtr<Shape> createLayoutBoxShape(const FloatRoundedRect&, Writi
ngMode, float margin); | 82 static PassOwnPtr<Shape> createLayoutBoxShape(const FloatRoundedRect&, Writi
ngMode, float margin); |
80 | 83 |
81 virtual ~Shape() { } | 84 virtual ~Shape() { } |
82 | 85 |
(...skipping 15 matching lines...) Expand all Loading... |
98 return (lineTop < rect.maxY() && lineTop + lineHeight > rect.y()) || (!l
ineHeight && lineTop == rect.y()); | 101 return (lineTop < rect.maxY() && lineTop + lineHeight > rect.y()) || (!l
ineHeight && lineTop == rect.y()); |
99 } | 102 } |
100 | 103 |
101 WritingMode m_writingMode; | 104 WritingMode m_writingMode; |
102 float m_margin; | 105 float m_margin; |
103 }; | 106 }; |
104 | 107 |
105 } // namespace blink | 108 } // namespace blink |
106 | 109 |
107 #endif // Shape_h | 110 #endif // Shape_h |
OLD | NEW |