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/paint/BoxPainter.h" | 8 #include "core/paint/BoxPainter.h" |
9 #include "core/paint/DrawingRecorder.h" | |
9 #include "core/paint/LineBoxListPainter.h" | 10 #include "core/paint/LineBoxListPainter.h" |
10 #include "core/paint/ObjectPainter.h" | 11 #include "core/paint/ObjectPainter.h" |
11 #include "core/rendering/GraphicsContextAnnotator.h" | 12 #include "core/rendering/GraphicsContextAnnotator.h" |
12 #include "core/rendering/PaintInfo.h" | 13 #include "core/rendering/PaintInfo.h" |
13 #include "core/rendering/RenderInline.h" | 14 #include "core/rendering/RenderInline.h" |
14 #include "core/rendering/RenderTheme.h" | 15 #include "core/rendering/RenderTheme.h" |
15 #include "core/rendering/RootInlineBox.h" | 16 #include "core/rendering/RootInlineBox.h" |
16 #include "platform/geometry/LayoutPoint.h" | 17 #include "platform/geometry/LayoutPoint.h" |
17 | 18 |
18 namespace blink { | 19 namespace blink { |
19 | 20 |
20 void InlinePainter::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset) | 21 void InlinePainter::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset) |
21 { | 22 { |
22 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, &m_renderInline); | 23 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, &m_renderInline); |
23 LineBoxListPainter(*m_renderInline.lineBoxes()).paint(&m_renderInline, paint Info, paintOffset); | 24 LineBoxListPainter(*m_renderInline.lineBoxes()).paint(&m_renderInline, paint Info, paintOffset); |
24 } | 25 } |
25 | 26 |
26 void InlinePainter::paintOutline(PaintInfo& paintInfo, const LayoutPoint& paintO ffset) | 27 void InlinePainter::paintOutline(PaintInfo& paintInfo, const LayoutPoint& paintO ffset) |
27 { | 28 { |
28 RenderStyle* styleToUse = m_renderInline.style(); | 29 RenderStyle* styleToUse = m_renderInline.style(); |
29 if (!styleToUse->hasOutline()) | 30 if (!styleToUse->hasOutline()) |
30 return; | 31 return; |
31 | 32 |
33 LayoutRect bounds; | |
34 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { | |
35 bounds = m_renderInline.linesVisualOverflowBoundingBox(); | |
leviw_travelin_and_unemployed
2014/11/14 22:27:59
This is going to be really expensive to calculate
chrishtr
2014/11/14 22:31:43
It suffices to use a bound that includes the inlin
fs
2014/11/17 16:13:20
I've used Levi's suggestion for now. I'm not sure
| |
36 bounds.moveBy(paintOffset); | |
37 } | |
38 DrawingRecorder recorder(paintInfo.context, &m_renderInline, paintInfo.phase , bounds); | |
39 | |
32 if (styleToUse->outlineStyleIsAuto()) { | 40 if (styleToUse->outlineStyleIsAuto()) { |
33 if (RenderTheme::theme().shouldDrawDefaultFocusRing(&m_renderInline)) { | 41 if (RenderTheme::theme().shouldDrawDefaultFocusRing(&m_renderInline)) { |
34 // Only paint the focus ring by hand if the theme isn't able to draw the focus ring. | 42 // Only paint the focus ring by hand if the theme isn't able to draw the focus ring. |
35 ObjectPainter(m_renderInline).paintFocusRing(paintInfo, paintOffset, styleToUse); | 43 ObjectPainter(m_renderInline).paintFocusRing(paintInfo, paintOffset, styleToUse); |
36 } | 44 } |
37 return; | 45 return; |
38 } | 46 } |
39 | 47 |
40 if (styleToUse->outlineStyle() == BNONE) | 48 if (styleToUse->outlineStyle() == BNONE) |
41 return; | 49 return; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
177 pixelSnappedBox.maxX() + outlineWidth, | 185 pixelSnappedBox.maxX() + outlineWidth, |
178 pixelSnappedBox.maxY() + outlineWidth, | 186 pixelSnappedBox.maxY() + outlineWidth, |
179 BSBottom, outlineColor, outlineStyle, | 187 BSBottom, outlineColor, outlineStyle, |
180 outlineWidth, | 188 outlineWidth, |
181 outlineWidth, | 189 outlineWidth, |
182 antialias); | 190 antialias); |
183 } | 191 } |
184 } | 192 } |
185 | 193 |
186 } // namespace blink | 194 } // namespace blink |
OLD | NEW |