| 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/CompositionMarker.h" | 9 #include "core/editing/markers/CompositionMarker.h" |
| 10 #include "core/editing/markers/DocumentMarkerController.h" | 10 #include "core/editing/markers/DocumentMarkerController.h" |
| (...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 } | 698 } |
| 699 | 699 |
| 700 namespace { | 700 namespace { |
| 701 | 701 |
| 702 #if !OS(MACOSX) | 702 #if !OS(MACOSX) |
| 703 | 703 |
| 704 static const float kMarkerWidth = 4; | 704 static const float kMarkerWidth = 4; |
| 705 static const float kMarkerHeight = 2; | 705 static const float kMarkerHeight = 2; |
| 706 | 706 |
| 707 sk_sp<PaintRecord> RecordMarker(DocumentMarker::MarkerType marker_type) { | 707 sk_sp<PaintRecord> RecordMarker(DocumentMarker::MarkerType marker_type) { |
| 708 SkColor color = (marker_type == DocumentMarker::kGrammar) | 708 SkColor color = |
| 709 ? SkColorSetRGB(0xC0, 0xC0, 0xC0) | 709 (marker_type == DocumentMarker::kGrammar) |
| 710 : SK_ColorRED; | 710 ? LayoutTheme::GetTheme().PlatformGrammarMarkerUnderlineColor().Rgb() |
| 711 : LayoutTheme::GetTheme() |
| 712 .PlatformSpellingMarkerUnderlineColor() |
| 713 .Rgb(); |
| 711 | 714 |
| 712 // Record the path equivalent to this legacy pattern: | 715 // Record the path equivalent to this legacy pattern: |
| 713 // X o o X o o X | 716 // X o o X o o X |
| 714 // o X o o X o | 717 // o X o o X o |
| 715 | 718 |
| 716 // Adjust the phase such that f' == 0 is "pixel"-centered | 719 // Adjust the phase such that f' == 0 is "pixel"-centered |
| 717 // (for optimal rasterization at native rez). | 720 // (for optimal rasterization at native rez). |
| 718 SkPath path; | 721 SkPath path; |
| 719 path.moveTo(kMarkerWidth * -3 / 8, kMarkerHeight * 3 / 4); | 722 path.moveTo(kMarkerWidth * -3 / 8, kMarkerHeight * 3 / 4); |
| 720 path.cubicTo(kMarkerWidth * -1 / 8, kMarkerHeight * 3 / 4, | 723 path.cubicTo(kMarkerWidth * -1 / 8, kMarkerHeight * 3 / 4, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 739 | 742 |
| 740 return recorder.finishRecordingAsPicture(); | 743 return recorder.finishRecordingAsPicture(); |
| 741 } | 744 } |
| 742 | 745 |
| 743 #else // OS(MACOSX) | 746 #else // OS(MACOSX) |
| 744 | 747 |
| 745 static const float kMarkerWidth = 4; | 748 static const float kMarkerWidth = 4; |
| 746 static const float kMarkerHeight = 3; | 749 static const float kMarkerHeight = 3; |
| 747 | 750 |
| 748 sk_sp<PaintRecord> RecordMarker(DocumentMarker::MarkerType marker_type) { | 751 sk_sp<PaintRecord> RecordMarker(DocumentMarker::MarkerType marker_type) { |
| 749 SkColor color = (marker_type == DocumentMarker::kGrammar) | 752 SkColor color = |
| 750 ? SkColorSetRGB(0x6B, 0x6B, 0x6B) | 753 (marker_type == DocumentMarker::kGrammar) |
| 751 : SkColorSetRGB(0xFB, 0x2D, 0x1D); | 754 ? LayoutTheme::GetTheme().PlatformGrammarMarkerUnderlineColor().Rgb() |
| 755 : LayoutTheme::GetTheme() |
| 756 .PlatformSpellingMarkerUnderlineColor() |
| 757 .Rgb(); |
| 752 | 758 |
| 753 // Match the artwork used by the Mac. | 759 // Match the artwork used by the Mac. |
| 754 static const float kR = 1.5f; | 760 static const float kR = 1.5f; |
| 755 | 761 |
| 756 // top->bottom translucent gradient. | 762 // top->bottom translucent gradient. |
| 757 const SkColor colors[2] = { | 763 const SkColor colors[2] = { |
| 758 SkColorSetARGB(0x48, | 764 SkColorSetARGB(0x48, |
| 759 SkColorGetR(color), | 765 SkColorGetR(color), |
| 760 SkColorGetG(color), | 766 SkColorGetG(color), |
| 761 SkColorGetB(color)), | 767 SkColorGetB(color)), |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1176 | 1182 |
| 1177 LayoutRect box_rect(box_origin, LayoutSize(inline_text_box_.LogicalWidth(), | 1183 LayoutRect box_rect(box_origin, LayoutSize(inline_text_box_.LogicalWidth(), |
| 1178 inline_text_box_.LogicalHeight())); | 1184 inline_text_box_.LogicalHeight())); |
| 1179 context.Clip(FloatRect(box_rect)); | 1185 context.Clip(FloatRect(box_rect)); |
| 1180 context.DrawHighlightForText(font, run, FloatPoint(box_origin), | 1186 context.DrawHighlightForText(font, run, FloatPoint(box_origin), |
| 1181 box_rect.Height().ToInt(), color, | 1187 box_rect.Height().ToInt(), color, |
| 1182 paint_offsets.first, paint_offsets.second); | 1188 paint_offsets.first, paint_offsets.second); |
| 1183 } | 1189 } |
| 1184 | 1190 |
| 1185 } // namespace blink | 1191 } // namespace blink |
| OLD | NEW |