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/InlinePainter.h" | 6 #include "core/paint/InlinePainter.h" |
7 | 7 |
8 #include "core/layout/LayoutBlock.h" | 8 #include "core/layout/LayoutBlock.h" |
9 #include "core/layout/LayoutInline.h" | 9 #include "core/layout/LayoutInline.h" |
10 #include "core/layout/LayoutTheme.h" | 10 #include "core/layout/LayoutTheme.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 // FIXME: When Skia supports annotation rect covering (https://code.google.c
om/p/skia/issues/detail?id=3872), | 24 // FIXME: When Skia supports annotation rect covering (https://code.google.c
om/p/skia/issues/detail?id=3872), |
25 // this rect may be covered by foreground and descendant drawings. Then we m
ay need a dedicated paint phase. | 25 // this rect may be covered by foreground and descendant drawings. Then we m
ay need a dedicated paint phase. |
26 if (paintInfo.phase == PaintPhaseForeground && paintInfo.isPrinting()) | 26 if (paintInfo.phase == PaintPhaseForeground && paintInfo.isPrinting()) |
27 ObjectPainter(m_layoutInline).addPDFURLRectIfNeeded(paintInfo, paintOffs
et); | 27 ObjectPainter(m_layoutInline).addPDFURLRectIfNeeded(paintInfo, paintOffs
et); |
28 | 28 |
29 LineBoxListPainter(*m_layoutInline.lineBoxes()).paint(&m_layoutInline, paint
Info, paintOffset); | 29 LineBoxListPainter(*m_layoutInline.lineBoxes()).paint(&m_layoutInline, paint
Info, paintOffset); |
30 } | 30 } |
31 | 31 |
32 LayoutRect InlinePainter::outlinePaintRect(const Vector<LayoutRect>& outlineRect
s, const LayoutPoint& paintOffset) const | 32 LayoutRect InlinePainter::outlinePaintRect(const Vector<LayoutRect>& outlineRect
s, const LayoutPoint& paintOffset) const |
33 { | 33 { |
34 int outlineOutset = m_layoutInline.styleRef().outlineOutset(); | 34 int outlineOutset = m_layoutInline.styleRef().outlineOutsetExtent(); |
35 LayoutRect outlineRect; | 35 LayoutRect outlineRect; |
36 for (const LayoutRect& rect : outlineRects) { | 36 for (const LayoutRect& rect : outlineRects) { |
37 LayoutRect inflatedRect(rect); | 37 LayoutRect inflatedRect(rect); |
38 // Inflate the individual rects instead of the union, to avoid losing | 38 // Inflate the individual rects instead of the union, to avoid losing |
39 // rects which have degenerate width/height (== isEmpty() true.) | 39 // rects which have degenerate width/height (== isEmpty() true.) |
40 inflatedRect.inflate(outlineOutset); | 40 inflatedRect.inflate(outlineOutset); |
41 outlineRect.unite(inflatedRect); | 41 outlineRect.unite(inflatedRect); |
42 } | 42 } |
43 outlineRect.moveBy(paintOffset); | 43 outlineRect.moveBy(paintOffset); |
44 return outlineRect; | 44 return outlineRect; |
45 } | 45 } |
46 | 46 |
47 void InlinePainter::paintOutline(const PaintInfo& paintInfo, const LayoutPoint&
paintOffset) | 47 void InlinePainter::paintOutline(const PaintInfo& paintInfo, const LayoutPoint&
paintOffset) |
48 { | 48 { |
49 const ComputedStyle& styleToUse = m_layoutInline.styleRef(); | 49 const ComputedStyle& styleToUse = m_layoutInline.styleRef(); |
50 if (!styleToUse.hasOutline()) | 50 if (!styleToUse.hasOutline()) |
51 return; | 51 return; |
52 | 52 |
53 if (styleToUse.outlineStyleIsAuto()) { | 53 if (styleToUse.outlineStyleIsAuto()) { |
54 if (!LayoutTheme::theme().shouldDrawDefaultFocusRing(&m_layoutInline)) | 54 if (!LayoutTheme::theme().shouldDrawDefaultFocusRing(&m_layoutInline)) |
55 return; | 55 return; |
56 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*paintInfo.c
ontext, m_layoutInline, paintInfo.phase)) | 56 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*paintInfo.c
ontext, m_layoutInline, paintInfo.phase)) |
57 return; | 57 return; |
58 | 58 |
59 Vector<LayoutRect> focusRingRects; | 59 Vector<LayoutRect> focusRingRects; |
60 m_layoutInline.addFocusRingRects(focusRingRects, paintOffset); | 60 m_layoutInline.addOutlineRects(focusRingRects, paintOffset); |
61 | 61 |
62 LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutInline,
paintInfo.phase, outlinePaintRect(focusRingRects, LayoutPoint())); | 62 LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutInline,
paintInfo.phase, outlinePaintRect(focusRingRects, LayoutPoint())); |
63 // Only paint the focus ring by hand if the theme isn't able to draw the
focus ring. | 63 // Only paint the focus ring by hand if the theme isn't able to draw the
focus ring. |
64 ObjectPainter(m_layoutInline).paintFocusRing(paintInfo, styleToUse, focu
sRingRects); | 64 ObjectPainter(m_layoutInline).paintFocusRing(paintInfo, styleToUse, focu
sRingRects); |
65 return; | 65 return; |
66 } | 66 } |
67 | 67 |
68 if (styleToUse.outlineStyle() == BNONE) | 68 if (styleToUse.outlineStyle() == BNONE) |
69 return; | 69 return; |
70 | 70 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 pixelSnappedBox.maxX() + outlineWidth, | 216 pixelSnappedBox.maxX() + outlineWidth, |
217 pixelSnappedBox.maxY() + outlineWidth, | 217 pixelSnappedBox.maxY() + outlineWidth, |
218 BSBottom, outlineColor, outlineStyle, | 218 BSBottom, outlineColor, outlineStyle, |
219 outlineWidth, | 219 outlineWidth, |
220 outlineWidth, | 220 outlineWidth, |
221 false); | 221 false); |
222 } | 222 } |
223 } | 223 } |
224 | 224 |
225 } // namespace blink | 225 } // namespace blink |
OLD | NEW |