| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/paint/InlineFlowBoxPainter.h" | 5 #include "core/paint/InlineFlowBoxPainter.h" |
| 6 | 6 |
| 7 #include "core/layout/LayoutBlock.h" | 7 #include "core/layout/LayoutBlock.h" |
| 8 #include "core/layout/LayoutInline.h" | 8 #include "core/layout/LayoutInline.h" |
| 9 #include "core/layout/LayoutView.h" | 9 #include "core/layout/LayoutView.h" |
| 10 #include "core/layout/api/LineLayoutAPIShim.h" | 10 #include "core/layout/api/LineLayoutAPIShim.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 } | 122 } |
| 123 | 123 |
| 124 LayoutRect InlineFlowBoxPainter::paintRectForImageStrip(const LayoutPoint& paint
Offset, const LayoutSize& frameSize, TextDirection direction) const | 124 LayoutRect InlineFlowBoxPainter::paintRectForImageStrip(const LayoutPoint& paint
Offset, const LayoutSize& frameSize, TextDirection direction) const |
| 125 { | 125 { |
| 126 // We have a fill/border/mask image that spans multiple lines. | 126 // We have a fill/border/mask image that spans multiple lines. |
| 127 // We need to adjust the offset by the width of all previous lines. | 127 // We need to adjust the offset by the width of all previous lines. |
| 128 // Think of background painting on inlines as though you had one long line,
a single continuous | 128 // Think of background painting on inlines as though you had one long line,
a single continuous |
| 129 // strip. Even though that strip has been broken up across multiple lines, y
ou still paint it | 129 // strip. Even though that strip has been broken up across multiple lines, y
ou still paint it |
| 130 // as though you had one single line. This means each line has to pick up th
e background where | 130 // as though you had one single line. This means each line has to pick up th
e background where |
| 131 // the previous line left off. | 131 // the previous line left off. |
| 132 LayoutUnit logicalOffsetOnLine = 0; | 132 LayoutUnit logicalOffsetOnLine; |
| 133 LayoutUnit totalLogicalWidth; | 133 LayoutUnit totalLogicalWidth; |
| 134 if (direction == LTR) { | 134 if (direction == LTR) { |
| 135 for (const InlineFlowBox* curr = m_inlineFlowBox.prevLineBox(); curr; cu
rr = curr->prevLineBox()) | 135 for (const InlineFlowBox* curr = m_inlineFlowBox.prevLineBox(); curr; cu
rr = curr->prevLineBox()) |
| 136 logicalOffsetOnLine += curr->logicalWidth(); | 136 logicalOffsetOnLine += curr->logicalWidth(); |
| 137 totalLogicalWidth = logicalOffsetOnLine; | 137 totalLogicalWidth = logicalOffsetOnLine; |
| 138 for (const InlineFlowBox* curr = &m_inlineFlowBox; curr; curr = curr->ne
xtLineBox()) | 138 for (const InlineFlowBox* curr = &m_inlineFlowBox; curr; curr = curr->ne
xtLineBox()) |
| 139 totalLogicalWidth += curr->logicalWidth(); | 139 totalLogicalWidth += curr->logicalWidth(); |
| 140 } else { | 140 } else { |
| 141 for (const InlineFlowBox* curr = m_inlineFlowBox.nextLineBox(); curr; cu
rr = curr->nextLineBox()) | 141 for (const InlineFlowBox* curr = m_inlineFlowBox.nextLineBox(); curr; cu
rr = curr->nextLineBox()) |
| 142 logicalOffsetOnLine += curr->logicalWidth(); | 142 logicalOffsetOnLine += curr->logicalWidth(); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 rect.setHeight(logicalHeight); | 318 rect.setHeight(logicalHeight); |
| 319 } else { | 319 } else { |
| 320 rect.setX(logicalTop); | 320 rect.setX(logicalTop); |
| 321 rect.setWidth(logicalHeight); | 321 rect.setWidth(logicalHeight); |
| 322 } | 322 } |
| 323 } | 323 } |
| 324 return rect; | 324 return rect; |
| 325 } | 325 } |
| 326 | 326 |
| 327 } // namespace blink | 327 } // namespace blink |
| OLD | NEW |