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/editing/markers/RenderedDocumentMarker.h" | 10 #include "core/editing/markers/RenderedDocumentMarker.h" |
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
768 textDecorationThickness = std::max(1.f, styleToUse.computedFontSize() /
10.f); | 768 textDecorationThickness = std::max(1.f, styleToUse.computedFontSize() /
10.f); |
769 | 769 |
770 context.setStrokeThickness(textDecorationThickness); | 770 context.setStrokeThickness(textDecorationThickness); |
771 | 771 |
772 bool antialiasDecoration = shouldSetDecorationAntialias(overline.style, unde
rline.style, linethrough.style); | 772 bool antialiasDecoration = shouldSetDecorationAntialias(overline.style, unde
rline.style, linethrough.style); |
773 | 773 |
774 // Offset between lines - always non-zero, so lines never cross each other. | 774 // Offset between lines - always non-zero, so lines never cross each other. |
775 float doubleOffset = textDecorationThickness + 1.f; | 775 float doubleOffset = textDecorationThickness + 1.f; |
776 | 776 |
777 if (deco & TextDecorationUnderline) { | 777 if (deco & TextDecorationUnderline) { |
778 const int underlineOffset = computeUnderlineOffset(styleToUse.textUnderl
inePosition(), styleToUse.fontMetrics(), &m_inlineTextBox, textDecorationThickne
ss); | 778 const int underlineOffset = computeUnderlineOffset(styleToUse.getTextUnd
erlinePosition(), styleToUse.fontMetrics(), &m_inlineTextBox, textDecorationThic
kness); |
779 paintAppliedDecoration(context, FloatPoint(localOrigin) + FloatPoint(0,
underlineOffset), width.toFloat(), doubleOffset, 1, underline, textDecorationThi
ckness, antialiasDecoration, isPrinting); | 779 paintAppliedDecoration(context, FloatPoint(localOrigin) + FloatPoint(0,
underlineOffset), width.toFloat(), doubleOffset, 1, underline, textDecorationThi
ckness, antialiasDecoration, isPrinting); |
780 } | 780 } |
781 if (deco & TextDecorationOverline) { | 781 if (deco & TextDecorationOverline) { |
782 paintAppliedDecoration(context, FloatPoint(localOrigin), width.toFloat()
, -doubleOffset, 1, overline, textDecorationThickness, antialiasDecoration, isPr
inting); | 782 paintAppliedDecoration(context, FloatPoint(localOrigin), width.toFloat()
, -doubleOffset, 1, overline, textDecorationThickness, antialiasDecoration, isPr
inting); |
783 } | 783 } |
784 if (deco & TextDecorationLineThrough) { | 784 if (deco & TextDecorationLineThrough) { |
785 const float lineThroughOffset = 2 * baseline / 3; | 785 const float lineThroughOffset = 2 * baseline / 3; |
786 paintAppliedDecoration(context, FloatPoint(localOrigin) + FloatPoint(0,
lineThroughOffset), width.toFloat(), doubleOffset, 0, linethrough, textDecoratio
nThickness, antialiasDecoration, isPrinting); | 786 paintAppliedDecoration(context, FloatPoint(localOrigin) + FloatPoint(0,
lineThroughOffset), width.toFloat(), doubleOffset, 0, linethrough, textDecoratio
nThickness, antialiasDecoration, isPrinting); |
787 } | 787 } |
788 } | 788 } |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
871 | 871 |
872 Color color = LayoutTheme::theme().platformTextSearchHighlightColor(marker->
activeMatch()); | 872 Color color = LayoutTheme::theme().platformTextSearchHighlightColor(marker->
activeMatch()); |
873 GraphicsContext& context = paintInfo.context; | 873 GraphicsContext& context = paintInfo.context; |
874 GraphicsContextStateSaver stateSaver(context); | 874 GraphicsContextStateSaver stateSaver(context); |
875 context.clip(FloatRect(boxOrigin.x().toFloat(), (boxOrigin.y() - deltaY).toF
loat(), m_inlineTextBox.logicalWidth().toFloat(), selHeight)); | 875 context.clip(FloatRect(boxOrigin.x().toFloat(), (boxOrigin.y() - deltaY).toF
loat(), m_inlineTextBox.logicalWidth().toFloat(), selHeight)); |
876 context.drawHighlightForText(font, run, FloatPoint(boxOrigin.x().toFloat(),
(boxOrigin.y() - deltaY).toFloat()), selHeight, color, sPos, ePos); | 876 context.drawHighlightForText(font, run, FloatPoint(boxOrigin.x().toFloat(),
(boxOrigin.y() - deltaY).toFloat()), selHeight, color, sPos, ePos); |
877 } | 877 } |
878 | 878 |
879 | 879 |
880 } // namespace blink | 880 } // namespace blink |
OLD | NEW |