| 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 10 matching lines...) Expand all Loading... |
| 21 namespace blink { | 21 namespace blink { |
| 22 | 22 |
| 23 void InlinePainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOf
fset) | 23 void InlinePainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOf
fset) |
| 24 { | 24 { |
| 25 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, &m_layoutInline); | 25 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, &m_layoutInline); |
| 26 LineBoxListPainter(*m_layoutInline.lineBoxes()).paint(&m_layoutInline, paint
Info, paintOffset); | 26 LineBoxListPainter(*m_layoutInline.lineBoxes()).paint(&m_layoutInline, paint
Info, paintOffset); |
| 27 } | 27 } |
| 28 | 28 |
| 29 void InlinePainter::paintOutline(const PaintInfo& paintInfo, const LayoutPoint&
paintOffset) | 29 void InlinePainter::paintOutline(const PaintInfo& paintInfo, const LayoutPoint&
paintOffset) |
| 30 { | 30 { |
| 31 const LayoutStyle& styleToUse = m_layoutInline.styleRef(); | 31 const ComputedStyle& styleToUse = m_layoutInline.styleRef(); |
| 32 if (!styleToUse.hasOutline()) | 32 if (!styleToUse.hasOutline()) |
| 33 return; | 33 return; |
| 34 | 34 |
| 35 if (styleToUse.outlineStyleIsAuto()) { | 35 if (styleToUse.outlineStyleIsAuto()) { |
| 36 if (LayoutTheme::theme().shouldDrawDefaultFocusRing(&m_layoutInline)) { | 36 if (LayoutTheme::theme().shouldDrawDefaultFocusRing(&m_layoutInline)) { |
| 37 Vector<LayoutRect> focusRingRects; | 37 Vector<LayoutRect> focusRingRects; |
| 38 m_layoutInline.addFocusRingRects(focusRingRects, paintOffset); | 38 m_layoutInline.addFocusRingRects(focusRingRects, paintOffset); |
| 39 LayoutRect focusRingBoundingRect; | 39 LayoutRect focusRingBoundingRect; |
| 40 for (const auto& rect : focusRingRects) | 40 for (const auto& rect : focusRingRects) |
| 41 focusRingBoundingRect.unite(rect); | 41 focusRingBoundingRect.unite(rect); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 for (unsigned i = 1; i < rects.size() - 1; i++) | 90 for (unsigned i = 1; i < rects.size() - 1; i++) |
| 91 paintOutlineForLine(graphicsContext, paintOffset, rects.at(i - 1), rects
.at(i), rects.at(i + 1), outlineColor); | 91 paintOutlineForLine(graphicsContext, paintOffset, rects.at(i - 1), rects
.at(i), rects.at(i + 1), outlineColor); |
| 92 | 92 |
| 93 if (useTransparencyLayer) | 93 if (useTransparencyLayer) |
| 94 graphicsContext->endLayer(); | 94 graphicsContext->endLayer(); |
| 95 } | 95 } |
| 96 | 96 |
| 97 void InlinePainter::paintOutlineForLine(GraphicsContext* graphicsContext, const
LayoutPoint& paintOffset, | 97 void InlinePainter::paintOutlineForLine(GraphicsContext* graphicsContext, const
LayoutPoint& paintOffset, |
| 98 const LayoutRect& lastline, const LayoutRect& thisline, const LayoutRect& ne
xtline, const Color outlineColor) | 98 const LayoutRect& lastline, const LayoutRect& thisline, const LayoutRect& ne
xtline, const Color outlineColor) |
| 99 { | 99 { |
| 100 const LayoutStyle& styleToUse = m_layoutInline.styleRef(); | 100 const ComputedStyle& styleToUse = m_layoutInline.styleRef(); |
| 101 int outlineWidth = styleToUse.outlineWidth(); | 101 int outlineWidth = styleToUse.outlineWidth(); |
| 102 EBorderStyle outlineStyle = styleToUse.outlineStyle(); | 102 EBorderStyle outlineStyle = styleToUse.outlineStyle(); |
| 103 | 103 |
| 104 bool antialias = BoxPainter::shouldAntialiasLines(graphicsContext); | 104 bool antialias = BoxPainter::shouldAntialiasLines(graphicsContext); |
| 105 | 105 |
| 106 int offset = m_layoutInline.style()->outlineOffset(); | 106 int offset = m_layoutInline.style()->outlineOffset(); |
| 107 | 107 |
| 108 LayoutRect box(LayoutPoint(paintOffset.x() + thisline.x() - offset, paintOff
set.y() + thisline.y() - offset), | 108 LayoutRect box(LayoutPoint(paintOffset.x() + thisline.x() - offset, paintOff
set.y() + thisline.y() - offset), |
| 109 LayoutSize(thisline.width() + offset, thisline.height() + offset)); | 109 LayoutSize(thisline.width() + offset, thisline.height() + offset)); |
| 110 | 110 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 pixelSnappedBox.maxX() + outlineWidth, | 208 pixelSnappedBox.maxX() + outlineWidth, |
| 209 pixelSnappedBox.maxY() + outlineWidth, | 209 pixelSnappedBox.maxY() + outlineWidth, |
| 210 BSBottom, outlineColor, outlineStyle, | 210 BSBottom, outlineColor, outlineStyle, |
| 211 outlineWidth, | 211 outlineWidth, |
| 212 outlineWidth, | 212 outlineWidth, |
| 213 antialias); | 213 antialias); |
| 214 } | 214 } |
| 215 } | 215 } |
| 216 | 216 |
| 217 } // namespace blink | 217 } // namespace blink |
| OLD | NEW |