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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 for (size_t i = 0; i < m_segments.size(); i++) { | 67 for (size_t i = 0; i < m_segments.size(); i++) { |
68 m_segments[i].logicalLeft -= lineOffset.width(); | 68 m_segments[i].logicalLeft -= lineOffset.width(); |
69 m_segments[i].logicalRight -= lineOffset.width(); | 69 m_segments[i].logicalRight -= lineOffset.width(); |
70 } | 70 } |
71 return result; | 71 return result; |
72 } | 72 } |
73 | 73 |
74 bool ShapeInsideInfo::updateSegmentsForLine(LayoutUnit lineTop, LayoutUnit lineH
eight) | 74 bool ShapeInsideInfo::updateSegmentsForLine(LayoutUnit lineTop, LayoutUnit lineH
eight) |
75 { | 75 { |
76 ASSERT(lineHeight >= 0); | 76 ASSERT(lineHeight >= 0); |
77 m_shapeLineTop = lineTop - logicalTopOffset(); | 77 m_referenceBoxLineTop = lineTop - logicalTopOffset(); |
78 m_lineHeight = lineHeight; | 78 m_lineHeight = lineHeight; |
79 m_segments.clear(); | 79 m_segments.clear(); |
80 m_segmentRanges.clear(); | 80 m_segmentRanges.clear(); |
81 | 81 |
82 if (lineOverlapsShapeBounds()) | 82 if (lineOverlapsShapeBounds()) |
83 m_segments = computeSegmentsForLine(lineTop, lineHeight); | 83 m_segments = computeSegmentsForLine(lineTop, lineHeight); |
84 | 84 |
85 return m_segments.size(); | 85 return m_segments.size(); |
86 } | 86 } |
87 | 87 |
88 bool ShapeInsideInfo::adjustLogicalLineTop(float minSegmentWidth) | 88 bool ShapeInsideInfo::adjustLogicalLineTop(float minSegmentWidth) |
89 { | 89 { |
90 const Shape* shape = computedShape(); | 90 const Shape* shape = computedShape(); |
91 if (!shape || m_lineHeight <= 0 || logicalLineTop() > shapeLogicalBottom()) | 91 if (!shape || m_lineHeight <= 0 || logicalLineTop() > shapeLogicalBottom()) |
92 return false; | 92 return false; |
93 | 93 |
94 LayoutUnit newLineTop; | 94 LayoutUnit newLineTop; |
95 if (shape->firstIncludedIntervalLogicalTop(m_shapeLineTop, FloatSize(minSegm
entWidth, m_lineHeight), newLineTop)) { | 95 if (shape->firstIncludedIntervalLogicalTop(m_referenceBoxLineTop, FloatSize(
minSegmentWidth, m_lineHeight), newLineTop)) { |
96 if (newLineTop > m_shapeLineTop) { | 96 if (newLineTop > m_referenceBoxLineTop) { |
97 m_shapeLineTop = newLineTop; | 97 m_referenceBoxLineTop = newLineTop; |
98 return true; | 98 return true; |
99 } | 99 } |
100 } | 100 } |
101 | 101 |
102 return false; | 102 return false; |
103 } | 103 } |
104 | 104 |
105 ShapeValue* ShapeInsideInfo::shapeValue() const | 105 ShapeValue* ShapeInsideInfo::shapeValue() const |
106 { | 106 { |
107 return m_renderer->style()->resolvedShapeInside(); | 107 return m_renderer->style()->resolvedShapeInside(); |
108 } | 108 } |
109 | 109 |
110 LayoutUnit ShapeInsideInfo::computeFirstFitPositionForFloat(const FloatSize& flo
atSize) const | 110 LayoutUnit ShapeInsideInfo::computeFirstFitPositionForFloat(const FloatSize& flo
atSize) const |
111 { | 111 { |
112 if (!computedShape() || !floatSize.width() || shapeLogicalBottom() < logical
LineTop()) | 112 if (!computedShape() || !floatSize.width() || shapeLogicalBottom() < logical
LineTop()) |
113 return 0; | 113 return 0; |
114 | 114 |
115 LayoutUnit firstFitPosition = 0; | 115 LayoutUnit firstFitPosition = 0; |
116 if (computedShape()->firstIncludedIntervalLogicalTop(m_shapeLineTop, floatSi
ze, firstFitPosition) && (m_shapeLineTop <= firstFitPosition)) | 116 if (computedShape()->firstIncludedIntervalLogicalTop(m_referenceBoxLineTop,
floatSize, firstFitPosition) && (m_referenceBoxLineTop <= firstFitPosition)) |
117 return firstFitPosition; | 117 return firstFitPosition; |
118 | 118 |
119 return 0; | 119 return 0; |
120 } | 120 } |
121 | 121 |
122 } | 122 } |
OLD | NEW |