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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 } | 76 } |
77 | 77 |
78 if (m_shapeLogicalWidth == logicalWidth && m_shapeLogicalHeight == logic
alHeight) | 78 if (m_shapeLogicalWidth == logicalWidth && m_shapeLogicalHeight == logic
alHeight) |
79 return; | 79 return; |
80 dirtyShapeSize(); | 80 dirtyShapeSize(); |
81 m_shapeLogicalWidth = logicalWidth; | 81 m_shapeLogicalWidth = logicalWidth; |
82 m_shapeLogicalHeight = logicalHeight; | 82 m_shapeLogicalHeight = logicalHeight; |
83 } | 83 } |
84 | 84 |
85 virtual bool computeSegmentsForLine(LayoutUnit lineTop, LayoutUnit lineHeigh
t); | 85 virtual bool computeSegmentsForLine(LayoutUnit lineTop, LayoutUnit lineHeigh
t); |
| 86 void clearSegments() { m_segments.clear(); } |
86 | 87 |
87 LayoutUnit shapeLogicalTop() const { return computedShapeLogicalBoundingBox(
).y() + logicalTopOffset(); } | 88 LayoutUnit shapeLogicalTop() const { return computedShapeLogicalBoundingBox(
).y() + logicalTopOffset(); } |
88 LayoutUnit shapeLogicalBottom() const { return computedShapeLogicalBoundingB
ox().maxY() + logicalTopOffset(); } | 89 LayoutUnit shapeLogicalBottom() const { return computedShapeLogicalBoundingB
ox().maxY() + logicalTopOffset(); } |
89 LayoutUnit shapeLogicalLeft() const { return computedShapeLogicalBoundingBox
().x() + logicalLeftOffset(); } | 90 LayoutUnit shapeLogicalLeft() const { return computedShapeLogicalBoundingBox
().x() + logicalLeftOffset(); } |
90 LayoutUnit shapeLogicalRight() const { return computedShapeLogicalBoundingBo
x().maxX() + logicalLeftOffset(); } | 91 LayoutUnit shapeLogicalRight() const { return computedShapeLogicalBoundingBo
x().maxX() + logicalLeftOffset(); } |
91 LayoutUnit shapeLogicalWidth() const { return computedShapeLogicalBoundingBo
x().width(); } | 92 LayoutUnit shapeLogicalWidth() const { return computedShapeLogicalBoundingBo
x().width(); } |
92 LayoutUnit shapeLogicalHeight() const { return computedShapeLogicalBoundingB
ox().height(); } | 93 LayoutUnit shapeLogicalHeight() const { return computedShapeLogicalBoundingB
ox().height(); } |
93 | 94 |
94 LayoutUnit logicalLineTop() const { return m_shapeLineTop + logicalTopOffset
(); } | 95 LayoutUnit logicalLineTop() const { return m_shapeLineTop + logicalTopOffset
(); } |
95 LayoutUnit logicalLineBottom() const { return m_shapeLineTop + m_lineHeight
+ logicalTopOffset(); } | 96 LayoutUnit logicalLineBottom() const { return m_shapeLineTop + m_lineHeight
+ logicalTopOffset(); } |
96 | 97 |
97 bool lineOverlapsShapeBounds() const { return logicalLineTop() < shapeLogica
lBottom() && logicalLineBottom() >= shapeLogicalTop(); } | 98 LayoutUnit shapeContainingBlockHeight() const { return (m_renderer->style()-
>boxSizing() == CONTENT_BOX) ? (m_shapeLogicalHeight + m_renderer->borderAndPadd
ingLogicalHeight()) : m_shapeLogicalHeight; } |
| 99 |
| 100 bool lineOverlapsShapeBounds() const { return logicalLineTop() < shapeLogica
lBottom() && shapeLogicalTop() <= logicalLineBottom(); } |
98 | 101 |
99 void dirtyShapeSize() { m_shape.clear(); } | 102 void dirtyShapeSize() { m_shape.clear(); } |
100 bool shapeSizeDirty() { return !m_shape.get(); } | 103 bool shapeSizeDirty() { return !m_shape.get(); } |
101 const RenderType* owner() const { return m_renderer; } | 104 const RenderType* owner() const { return m_renderer; } |
102 | 105 |
103 protected: | 106 protected: |
104 ShapeInfo(const RenderType* renderer): m_renderer(renderer) { } | 107 ShapeInfo(const RenderType* renderer): m_renderer(renderer) { } |
105 | 108 |
106 const Shape* computedShape() const; | 109 const Shape* computedShape() const; |
107 virtual LayoutRect computedShapeLogicalBoundingBox() const = 0; | 110 virtual LayoutRect computedShapeLogicalBoundingBox() const = 0; |
108 | 111 |
109 LayoutUnit logicalTopOffset() const; | 112 LayoutUnit logicalTopOffset() const { return m_renderer->style()->boxSizing(
) == CONTENT_BOX ? m_renderer->borderAndPaddingBefore() : LayoutUnit(); } |
110 LayoutUnit logicalLeftOffset() const { return m_renderer->style()->boxSizing
() == CONTENT_BOX ? m_renderer->borderStart() + m_renderer->paddingStart() : Lay
outUnit(); } | 113 LayoutUnit logicalLeftOffset() const { return (m_renderer->style()->boxSizin
g() == CONTENT_BOX && !m_renderer->isRenderRegion()) ? m_renderer->borderAndPadd
ingStart() : LayoutUnit(); } |
111 | 114 |
112 LayoutUnit m_shapeLineTop; | 115 LayoutUnit m_shapeLineTop; |
113 LayoutUnit m_lineHeight; | 116 LayoutUnit m_lineHeight; |
114 SegmentList m_segments; | 117 SegmentList m_segments; |
115 | 118 |
116 const RenderType* m_renderer; | 119 const RenderType* m_renderer; |
117 | 120 |
118 private: | 121 private: |
119 mutable OwnPtr<Shape> m_shape; | 122 mutable OwnPtr<Shape> m_shape; |
120 | 123 |
121 LayoutUnit m_shapeLogicalWidth; | 124 LayoutUnit m_shapeLogicalWidth; |
122 LayoutUnit m_shapeLogicalHeight; | 125 LayoutUnit m_shapeLogicalHeight; |
123 }; | 126 }; |
124 } | 127 } |
125 #endif | 128 #endif |
OLD | NEW |