| 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/LayoutTheme.h" | 8 #include "core/layout/LayoutTheme.h" |
| 9 #include "core/paint/BoxPainter.h" | 9 #include "core/paint/BoxPainter.h" |
| 10 #include "core/paint/GraphicsContextAnnotator.h" | 10 #include "core/paint/GraphicsContextAnnotator.h" |
| 11 #include "core/paint/LineBoxListPainter.h" | 11 #include "core/paint/LineBoxListPainter.h" |
| 12 #include "core/paint/ObjectPainter.h" | 12 #include "core/paint/ObjectPainter.h" |
| 13 #include "core/paint/RenderDrawingRecorder.h" | 13 #include "core/paint/RenderDrawingRecorder.h" |
| 14 #include "core/rendering/PaintInfo.h" | 14 #include "core/rendering/PaintInfo.h" |
| 15 #include "core/rendering/RenderBlock.h" | 15 #include "core/rendering/RenderBlock.h" |
| 16 #include "core/rendering/RenderInline.h" | 16 #include "core/rendering/RenderInline.h" |
| 17 #include "core/rendering/RootInlineBox.h" | 17 #include "core/rendering/RootInlineBox.h" |
| 18 #include "platform/geometry/LayoutPoint.h" | 18 #include "platform/geometry/LayoutPoint.h" |
| 19 | 19 |
| 20 namespace blink { | 20 namespace blink { |
| 21 | 21 |
| 22 void InlinePainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOf
fset) | 22 void InlinePainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOf
fset) |
| 23 { | 23 { |
| 24 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, &m_renderInline); | 24 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, &m_renderInline); |
| 25 LineBoxListPainter(*m_renderInline.lineBoxes()).paint(&m_renderInline, paint
Info, paintOffset); | 25 LineBoxListPainter(*m_renderInline.lineBoxes()).paint(&m_renderInline, paint
Info, paintOffset); |
| 26 } | 26 } |
| 27 | 27 |
| 28 void InlinePainter::paintOutline(const PaintInfo& paintInfo, const LayoutPoint&
paintOffset) | 28 void InlinePainter::paintOutline(const PaintInfo& paintInfo, const LayoutPoint&
paintOffset) |
| 29 { | 29 { |
| 30 RenderStyle* styleToUse = m_renderInline.style(); | 30 const RenderStyle* styleToUse = m_renderInline.style(); |
| 31 if (!styleToUse->hasOutline()) | 31 if (!styleToUse->hasOutline()) |
| 32 return; | 32 return; |
| 33 | 33 |
| 34 LayoutRect bounds; | 34 LayoutRect bounds; |
| 35 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { | 35 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { |
| 36 // FIXME: Use tighter bounds. | 36 // FIXME: Use tighter bounds. |
| 37 RenderBlock* cb = m_renderInline.containingBlock(); | 37 RenderBlock* cb = m_renderInline.containingBlock(); |
| 38 bounds = cb->visualOverflowRect(); | 38 bounds = cb->visualOverflowRect(); |
| 39 bounds.moveBy(paintOffset); | 39 bounds.moveBy(paintOffset); |
| 40 } | 40 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 for (unsigned i = 1; i < rects.size() - 1; i++) | 76 for (unsigned i = 1; i < rects.size() - 1; i++) |
| 77 paintOutlineForLine(graphicsContext, paintOffset, rects.at(i - 1), rects
.at(i), rects.at(i + 1), outlineColor); | 77 paintOutlineForLine(graphicsContext, paintOffset, rects.at(i - 1), rects
.at(i), rects.at(i + 1), outlineColor); |
| 78 | 78 |
| 79 if (useTransparencyLayer) | 79 if (useTransparencyLayer) |
| 80 graphicsContext->endLayer(); | 80 graphicsContext->endLayer(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void InlinePainter::paintOutlineForLine(GraphicsContext* graphicsContext, const
LayoutPoint& paintOffset, | 83 void InlinePainter::paintOutlineForLine(GraphicsContext* graphicsContext, const
LayoutPoint& paintOffset, |
| 84 const LayoutRect& lastline, const LayoutRect& thisline, const LayoutRect& ne
xtline, const Color outlineColor) | 84 const LayoutRect& lastline, const LayoutRect& thisline, const LayoutRect& ne
xtline, const Color outlineColor) |
| 85 { | 85 { |
| 86 RenderStyle* styleToUse = m_renderInline.style(); | 86 const RenderStyle* styleToUse = m_renderInline.style(); |
| 87 int outlineWidth = styleToUse->outlineWidth(); | 87 int outlineWidth = styleToUse->outlineWidth(); |
| 88 EBorderStyle outlineStyle = styleToUse->outlineStyle(); | 88 EBorderStyle outlineStyle = styleToUse->outlineStyle(); |
| 89 | 89 |
| 90 bool antialias = BoxPainter::shouldAntialiasLines(graphicsContext); | 90 bool antialias = BoxPainter::shouldAntialiasLines(graphicsContext); |
| 91 | 91 |
| 92 int offset = m_renderInline.style()->outlineOffset(); | 92 int offset = m_renderInline.style()->outlineOffset(); |
| 93 | 93 |
| 94 LayoutRect box(LayoutPoint(paintOffset.x() + thisline.x() - offset, paintOff
set.y() + thisline.y() - offset), | 94 LayoutRect box(LayoutPoint(paintOffset.x() + thisline.x() - offset, paintOff
set.y() + thisline.y() - offset), |
| 95 LayoutSize(thisline.width() + offset, thisline.height() + offset)); | 95 LayoutSize(thisline.width() + offset, thisline.height() + offset)); |
| 96 | 96 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 pixelSnappedBox.maxX() + outlineWidth, | 190 pixelSnappedBox.maxX() + outlineWidth, |
| 191 pixelSnappedBox.maxY() + outlineWidth, | 191 pixelSnappedBox.maxY() + outlineWidth, |
| 192 BSBottom, outlineColor, outlineStyle, | 192 BSBottom, outlineColor, outlineStyle, |
| 193 outlineWidth, | 193 outlineWidth, |
| 194 outlineWidth, | 194 outlineWidth, |
| 195 antialias); | 195 antialias); |
| 196 } | 196 } |
| 197 } | 197 } |
| 198 | 198 |
| 199 } // namespace blink | 199 } // namespace blink |
| OLD | NEW |