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 "config.h" | 5 #include "config.h" |
6 #include "core/paint/ObjectPainter.h" | 6 #include "core/paint/ObjectPainter.h" |
7 | 7 |
| 8 #include "core/layout/LayoutBlock.h" |
8 #include "core/layout/LayoutInline.h" | 9 #include "core/layout/LayoutInline.h" |
9 #include "core/layout/LayoutObject.h" | 10 #include "core/layout/LayoutObject.h" |
10 #include "core/layout/LayoutTheme.h" | 11 #include "core/layout/LayoutTheme.h" |
11 #include "core/paint/BoxBorderPainter.h" | 12 #include "core/paint/BoxBorderPainter.h" |
12 #include "core/paint/LayoutObjectDrawingRecorder.h" | 13 #include "core/paint/LayoutObjectDrawingRecorder.h" |
13 #include "core/paint/PaintInfo.h" | 14 #include "core/paint/PaintInfo.h" |
14 #include "core/style/BorderEdge.h" | 15 #include "core/style/BorderEdge.h" |
15 #include "core/style/ComputedStyle.h" | 16 #include "core/style/ComputedStyle.h" |
16 #include "platform/geometry/LayoutPoint.h" | 17 #include "platform/geometry/LayoutPoint.h" |
17 | 18 |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 return; | 200 return; |
200 | 201 |
201 Vector<LayoutRect> outlineRects; | 202 Vector<LayoutRect> outlineRects; |
202 m_layoutObject.addOutlineRects(outlineRects, paintOffset, m_layoutObject.out
lineRectsShouldIncludeBlockVisualOverflow()); | 203 m_layoutObject.addOutlineRects(outlineRects, paintOffset, m_layoutObject.out
lineRectsShouldIncludeBlockVisualOverflow()); |
203 if (outlineRects.isEmpty()) | 204 if (outlineRects.isEmpty()) |
204 return; | 205 return; |
205 | 206 |
206 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*paintInfo.conte
xt, m_layoutObject, paintInfo.phase, paintOffset)) | 207 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*paintInfo.conte
xt, m_layoutObject, paintInfo.phase, paintOffset)) |
207 return; | 208 return; |
208 | 209 |
| 210 // The result rects are in coordinates of m_layoutObject's border box. |
| 211 // Block flipping is not applied yet if !m_layoutObject.isBox(). |
| 212 if (!m_layoutObject.isBox() && m_layoutObject.styleRef().isFlippedBlocksWrit
ingMode()) { |
| 213 LayoutBlock* container = m_layoutObject.containingBlock(); |
| 214 if (container) |
| 215 m_layoutObject.localToContainerRects(outlineRects, container, -paint
Offset, paintOffset); |
| 216 } |
| 217 |
209 Vector<IntRect> pixelSnappedOutlineRects; | 218 Vector<IntRect> pixelSnappedOutlineRects; |
210 for (auto& r : outlineRects) | 219 for (auto& r : outlineRects) |
211 pixelSnappedOutlineRects.append(pixelSnappedIntRect(r)); | 220 pixelSnappedOutlineRects.append(pixelSnappedIntRect(r)); |
212 | 221 |
213 IntRect unitedOutlineRect = unionRectEvenIfEmpty(pixelSnappedOutlineRects); | 222 IntRect unitedOutlineRect = unionRectEvenIfEmpty(pixelSnappedOutlineRects); |
214 IntRect bounds = unitedOutlineRect; | 223 IntRect bounds = unitedOutlineRect; |
215 bounds.inflate(m_layoutObject.styleRef().outlineOutsetExtent()); | 224 bounds.inflate(m_layoutObject.styleRef().outlineOutsetExtent()); |
216 LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutObject, pai
ntInfo.phase, bounds, paintOffset); | 225 LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutObject, pai
ntInfo.phase, bounds, paintOffset); |
217 | 226 |
218 Color color = m_layoutObject.resolveColor(styleToUse, CSSPropertyOutlineColo
r); | 227 Color color = m_layoutObject.resolveColor(styleToUse, CSSPropertyOutlineColo
r); |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 quad[1] = FloatPoint(x1, y2 - std::max(adjacentWidth2, 0)); | 526 quad[1] = FloatPoint(x1, y2 - std::max(adjacentWidth2, 0)); |
518 quad[2] = FloatPoint(x2, y2 - std::max(-adjacentWidth2, 0)); | 527 quad[2] = FloatPoint(x2, y2 - std::max(-adjacentWidth2, 0)); |
519 quad[3] = FloatPoint(x2, y1 + std::max(-adjacentWidth1, 0)); | 528 quad[3] = FloatPoint(x2, y1 + std::max(-adjacentWidth1, 0)); |
520 break; | 529 break; |
521 } | 530 } |
522 | 531 |
523 graphicsContext->fillPolygon(4, quad, color, antialias); | 532 graphicsContext->fillPolygon(4, quad, color, antialias); |
524 } | 533 } |
525 | 534 |
526 } // namespace blink | 535 } // namespace blink |
OLD | NEW |