| 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/InlineTextBoxPainter.h" | 5 #include "core/paint/InlineTextBoxPainter.h" |
| 6 | 6 |
| 7 #include "core/editing/CompositionUnderline.h" | 7 #include "core/editing/CompositionUnderline.h" |
| 8 #include "core/editing/Editor.h" | 8 #include "core/editing/Editor.h" |
| 9 #include "core/editing/markers/DocumentMarkerController.h" | 9 #include "core/editing/markers/DocumentMarkerController.h" |
| 10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
| (...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 957 // Place the underline at the very bottom of the text in small/medium fonts. | 957 // Place the underline at the very bottom of the text in small/medium fonts. |
| 958 underlineOffset = (m_inlineTextBox.logicalHeight() - lineThickness).toInt(); | 958 underlineOffset = (m_inlineTextBox.logicalHeight() - lineThickness).toInt(); |
| 959 } else { | 959 } else { |
| 960 // In larger fonts, though, place the underline up near the baseline to | 960 // In larger fonts, though, place the underline up near the baseline to |
| 961 // prevent a big gap. | 961 // prevent a big gap. |
| 962 underlineOffset = baseline + 2; | 962 underlineOffset = baseline + 2; |
| 963 } | 963 } |
| 964 context.drawLineForDocumentMarker( | 964 context.drawLineForDocumentMarker( |
| 965 FloatPoint((boxOrigin.x() + start).toFloat(), | 965 FloatPoint((boxOrigin.x() + start).toFloat(), |
| 966 (boxOrigin.y() + underlineOffset).toFloat()), | 966 (boxOrigin.y() + underlineOffset).toFloat()), |
| 967 width.toFloat(), lineStyleForMarkerType(marker.type())); | 967 width.toFloat(), lineStyleForMarkerType(marker.type()), |
| 968 style.effectiveZoom()); |
| 968 } | 969 } |
| 969 | 970 |
| 970 template <InlineTextBoxPainter::PaintOptions options> | 971 template <InlineTextBoxPainter::PaintOptions options> |
| 971 void InlineTextBoxPainter::paintSelection(GraphicsContext& context, | 972 void InlineTextBoxPainter::paintSelection(GraphicsContext& context, |
| 972 const LayoutRect& boxRect, | 973 const LayoutRect& boxRect, |
| 973 const ComputedStyle& style, | 974 const ComputedStyle& style, |
| 974 const Font& font, | 975 const Font& font, |
| 975 Color textColor, | 976 Color textColor, |
| 976 LayoutTextCombine* combinedText) { | 977 LayoutTextCombine* combinedText) { |
| 977 // See if we have a selection to paint at all. | 978 // See if we have a selection to paint at all. |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1328 | 1329 |
| 1329 LayoutRect boxRect(boxOrigin, LayoutSize(m_inlineTextBox.logicalWidth(), | 1330 LayoutRect boxRect(boxOrigin, LayoutSize(m_inlineTextBox.logicalWidth(), |
| 1330 m_inlineTextBox.logicalHeight())); | 1331 m_inlineTextBox.logicalHeight())); |
| 1331 context.clip(FloatRect(boxRect)); | 1332 context.clip(FloatRect(boxRect)); |
| 1332 context.drawHighlightForText(font, run, FloatPoint(boxOrigin), | 1333 context.drawHighlightForText(font, run, FloatPoint(boxOrigin), |
| 1333 boxRect.height().toInt(), color, | 1334 boxRect.height().toInt(), color, |
| 1334 paintOffsets.first, paintOffsets.second); | 1335 paintOffsets.first, paintOffsets.second); |
| 1335 } | 1336 } |
| 1336 | 1337 |
| 1337 } // namespace blink | 1338 } // namespace blink |
| OLD | NEW |