| 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 "core/paint/ListMarkerPainter.h" | 5 #include "core/paint/ListMarkerPainter.h" |
| 6 | 6 |
| 7 #include "core/layout/LayoutListItem.h" | 7 #include "core/layout/LayoutListItem.h" |
| 8 #include "core/layout/LayoutListMarker.h" | 8 #include "core/layout/LayoutListMarker.h" |
| 9 #include "core/layout/ListMarkerText.h" | 9 #include "core/layout/ListMarkerText.h" |
| 10 #include "core/layout/api/SelectionState.h" | 10 #include "core/layout/api/SelectionState.h" |
| 11 #include "core/paint/BoxPainter.h" | 11 #include "core/paint/BoxPainter.h" |
| 12 #include "core/paint/LayoutObjectDrawingRecorder.h" | 12 #include "core/paint/LayoutObjectDrawingRecorder.h" |
| 13 #include "core/paint/PaintInfo.h" | 13 #include "core/paint/PaintInfo.h" |
| 14 #include "core/paint/TextPainter.h" | 14 #include "core/paint/TextPainter.h" |
| 15 #include "platform/geometry/LayoutPoint.h" | 15 #include "platform/geometry/LayoutPoint.h" |
| 16 #include "platform/graphics/GraphicsContextStateSaver.h" | 16 #include "platform/graphics/GraphicsContextStateSaver.h" |
| 17 | 17 |
| 18 namespace blink { | 18 namespace blink { |
| 19 | 19 |
| 20 static inline void paintSymbol(GraphicsContext& context, | 20 static inline void paintSymbol(GraphicsContext& context, |
| 21 const Color& color, | 21 const Color& color, |
| 22 const IntRect& marker, | 22 const IntRect& marker, |
| 23 EListStyleType listStyle) { | 23 EListStyleType listStyle) { |
| 24 context.setStrokeColor(color); | 24 context.setStrokeColor(color); |
| 25 context.setStrokeStyle(SolidStroke); | 25 context.setStrokeStyle(SolidStroke); |
| 26 context.setStrokeThickness(1.0f); | 26 context.setStrokeThickness(1.0f); |
| 27 switch (listStyle) { | 27 switch (listStyle) { |
| 28 case EListStyleType::Disc: | 28 case EListStyleType::kDisc: |
| 29 context.fillEllipse(marker); | 29 context.fillEllipse(marker); |
| 30 break; | 30 break; |
| 31 case EListStyleType::Circle: | 31 case EListStyleType::kCircle: |
| 32 context.strokeEllipse(marker); | 32 context.strokeEllipse(marker); |
| 33 break; | 33 break; |
| 34 case EListStyleType::Square: | 34 case EListStyleType::kSquare: |
| 35 context.fillRect(marker); | 35 context.fillRect(marker); |
| 36 break; | 36 break; |
| 37 default: | 37 default: |
| 38 ASSERT_NOT_REACHED(); | 38 ASSERT_NOT_REACHED(); |
| 39 break; | 39 break; |
| 40 } | 40 } |
| 41 } | 41 } |
| 42 | 42 |
| 43 void ListMarkerPainter::paint(const PaintInfo& paintInfo, | 43 void ListMarkerPainter::paint(const PaintInfo& paintInfo, |
| 44 const LayoutPoint& paintOffset) { | 44 const LayoutPoint& paintOffset) { |
| 45 if (paintInfo.phase != PaintPhaseForeground) | 45 if (paintInfo.phase != PaintPhaseForeground) |
| 46 return; | 46 return; |
| 47 | 47 |
| 48 if (m_layoutListMarker.style()->visibility() != EVisibility::Visible) | 48 if (m_layoutListMarker.style()->visibility() != EVisibility::kVisible) |
| 49 return; | 49 return; |
| 50 | 50 |
| 51 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible( | 51 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible( |
| 52 paintInfo.context, m_layoutListMarker, paintInfo.phase)) | 52 paintInfo.context, m_layoutListMarker, paintInfo.phase)) |
| 53 return; | 53 return; |
| 54 | 54 |
| 55 LayoutPoint boxOrigin(paintOffset + m_layoutListMarker.location()); | 55 LayoutPoint boxOrigin(paintOffset + m_layoutListMarker.location()); |
| 56 LayoutRect overflowRect(m_layoutListMarker.visualOverflowRect()); | 56 LayoutRect overflowRect(m_layoutListMarker.visualOverflowRect()); |
| 57 overflowRect.moveBy(boxOrigin); | 57 overflowRect.moveBy(boxOrigin); |
| 58 | 58 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 context.drawText(font, suffixRunInfo, | 165 context.drawText(font, suffixRunInfo, |
| 166 textOrigin + IntSize(font.width(textRun), 0)); | 166 textOrigin + IntSize(font.width(textRun), 0)); |
| 167 } else { | 167 } else { |
| 168 context.drawText(font, suffixRunInfo, textOrigin); | 168 context.drawText(font, suffixRunInfo, textOrigin); |
| 169 context.drawText(font, textRunPaintInfo, | 169 context.drawText(font, textRunPaintInfo, |
| 170 textOrigin + IntSize(font.width(suffixRun), 0)); | 170 textOrigin + IntSize(font.width(suffixRun), 0)); |
| 171 } | 171 } |
| 172 } | 172 } |
| 173 | 173 |
| 174 } // namespace blink | 174 } // namespace blink |
| OLD | NEW |