| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 // that will fit within or around a shape. The line is defined by a pair of logi
cal Y coordinates and the | 65 // that will fit within or around a shape. The line is defined by a pair of logi
cal Y coordinates and the |
| 66 // computed segments are returned as pairs of logical X coordinates. The BasicSh
ape itself is defined in | 66 // computed segments are returned as pairs of logical X coordinates. The BasicSh
ape itself is defined in |
| 67 // physical coordinates. | 67 // physical coordinates. |
| 68 | 68 |
| 69 class Shape { | 69 class Shape { |
| 70 public: | 70 public: |
| 71 struct DisplayPaths { | 71 struct DisplayPaths { |
| 72 Path shape; | 72 Path shape; |
| 73 Path marginShape; | 73 Path marginShape; |
| 74 }; | 74 }; |
| 75 static PassOwnPtr<Shape> createShape(const BasicShape*, const LayoutSize& lo
gicalBoxSize, WritingMode, float margin); | 75 static PassOwnPtr<Shape> createShape(const BasicShape*, const LayoutSize& lo
gicalBoxSize, float margin); |
| 76 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, float margin); |
| 77 static PassOwnPtr<Shape> createEmptyRasterShape(WritingMode, float margin); | 77 static PassOwnPtr<Shape> createEmptyRasterShape(float margin); |
| 78 static PassOwnPtr<Shape> createLayoutBoxShape(const RoundedRect&, WritingMod
e, float margin); | 78 static PassOwnPtr<Shape> createLayoutBoxShape(const RoundedRect&, float marg
in); |
| 79 | 79 |
| 80 virtual ~Shape() { } | 80 virtual ~Shape() { } |
| 81 | 81 |
| 82 virtual LayoutRect shapeMarginLogicalBoundingBox() const = 0; | 82 virtual LayoutRect shapeMarginLogicalBoundingBox() const = 0; |
| 83 virtual bool isEmpty() const = 0; | 83 virtual bool isEmpty() const = 0; |
| 84 virtual LineSegment getExcludedInterval(LayoutUnit logicalTop, LayoutUnit lo
gicalHeight) const = 0; | 84 virtual LineSegment getExcludedInterval(LayoutUnit logicalTop, LayoutUnit lo
gicalHeight) const = 0; |
| 85 | 85 |
| 86 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()); } |
| 87 virtual void buildDisplayPaths(DisplayPaths&) const = 0; | 87 virtual void buildDisplayPaths(DisplayPaths&) const = 0; |
| 88 | 88 |
| 89 protected: | 89 protected: |
| 90 float shapeMargin() const { return m_margin; } | 90 float shapeMargin() const { return m_margin; } |
| 91 | 91 |
| 92 private: | 92 private: |
| 93 bool lineOverlapsBoundingBox(LayoutUnit lineTop, LayoutUnit lineHeight, cons
t LayoutRect& rect) const | 93 bool lineOverlapsBoundingBox(LayoutUnit lineTop, LayoutUnit lineHeight, cons
t LayoutRect& rect) const |
| 94 { | 94 { |
| 95 if (rect.isEmpty()) | 95 if (rect.isEmpty()) |
| 96 return false; | 96 return false; |
| 97 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()); |
| 98 } | 98 } |
| 99 | 99 |
| 100 WritingMode m_writingMode; | |
| 101 float m_margin; | 100 float m_margin; |
| 102 }; | 101 }; |
| 103 | 102 |
| 104 } // namespace blink | 103 } // namespace blink |
| 105 | 104 |
| 106 #endif // Shape_h | 105 #endif // Shape_h |
| OLD | NEW |