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/SVGInlineTextBoxPainter.h" | 5 #include "core/paint/SVGInlineTextBoxPainter.h" |
6 | 6 |
7 #include "core/editing/Editor.h" | 7 #include "core/editing/Editor.h" |
8 #include "core/editing/markers/DocumentMarkerController.h" | 8 #include "core/editing/markers/DocumentMarkerController.h" |
9 #include "core/frame/LocalFrame.h" | 9 #include "core/frame/LocalFrame.h" |
10 #include "core/layout/LayoutTheme.h" | 10 #include "core/layout/LayoutTheme.h" |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 | 585 |
586 fragment_info_list.push_back(SVGTextFragmentWithRange( | 586 fragment_info_list.push_back(SVGTextFragmentWithRange( |
587 fragment, fragment_start_position, fragment_end_position)); | 587 fragment, fragment_start_position, fragment_end_position)); |
588 } | 588 } |
589 return fragment_info_list; | 589 return fragment_info_list; |
590 } | 590 } |
591 | 591 |
592 void SVGInlineTextBoxPainter::PaintTextMatchMarkerForeground( | 592 void SVGInlineTextBoxPainter::PaintTextMatchMarkerForeground( |
593 const PaintInfo& paint_info, | 593 const PaintInfo& paint_info, |
594 const LayoutPoint& point, | 594 const LayoutPoint& point, |
595 const DocumentMarker& marker, | 595 const TextMatchMarker& marker, |
596 const ComputedStyle& style, | 596 const ComputedStyle& style, |
597 const Font& font) { | 597 const Font& font) { |
598 const Vector<SVGTextFragmentWithRange> text_match_info_list = | 598 const Vector<SVGTextFragmentWithRange> text_match_info_list = |
599 CollectTextMatches(marker); | 599 CollectTextMatches(marker); |
600 if (text_match_info_list.IsEmpty()) | 600 if (text_match_info_list.IsEmpty()) |
601 return; | 601 return; |
602 | 602 |
603 Color text_color = | 603 Color text_color = |
604 LayoutTheme::GetTheme().PlatformTextSearchColor(marker.IsActiveMatch()); | 604 LayoutTheme::GetTheme().PlatformTextSearchColor(marker.IsActiveMatch()); |
605 | 605 |
(...skipping 21 matching lines...) Expand all Loading... |
627 if (should_paint_stroke) { | 627 if (should_paint_stroke) { |
628 PaintText(paint_info, text_run, fragment, text_match_info.start_position, | 628 PaintText(paint_info, text_run, fragment, text_match_info.start_position, |
629 text_match_info.end_position, stroke_flags); | 629 text_match_info.end_position, stroke_flags); |
630 } | 630 } |
631 } | 631 } |
632 } | 632 } |
633 | 633 |
634 void SVGInlineTextBoxPainter::PaintTextMatchMarkerBackground( | 634 void SVGInlineTextBoxPainter::PaintTextMatchMarkerBackground( |
635 const PaintInfo& paint_info, | 635 const PaintInfo& paint_info, |
636 const LayoutPoint& point, | 636 const LayoutPoint& point, |
637 const DocumentMarker& marker, | 637 const TextMatchMarker& marker, |
638 const ComputedStyle& style, | 638 const ComputedStyle& style, |
639 const Font& font) { | 639 const Font& font) { |
640 const Vector<SVGTextFragmentWithRange> text_match_info_list = | 640 const Vector<SVGTextFragmentWithRange> text_match_info_list = |
641 CollectTextMatches(marker); | 641 CollectTextMatches(marker); |
642 if (text_match_info_list.IsEmpty()) | 642 if (text_match_info_list.IsEmpty()) |
643 return; | 643 return; |
644 | 644 |
645 Color color = LayoutTheme::GetTheme().PlatformTextSearchHighlightColor( | 645 Color color = LayoutTheme::GetTheme().PlatformTextSearchHighlightColor( |
646 marker.IsActiveMatch()); | 646 marker.IsActiveMatch()); |
647 for (const SVGTextFragmentWithRange& text_match_info : text_match_info_list) { | 647 for (const SVGTextFragmentWithRange& text_match_info : text_match_info_list) { |
648 const SVGTextFragment& fragment = text_match_info.fragment; | 648 const SVGTextFragment& fragment = text_match_info.fragment; |
649 | 649 |
650 GraphicsContextStateSaver state_saver(paint_info.context, false); | 650 GraphicsContextStateSaver state_saver(paint_info.context, false); |
651 if (fragment.IsTransformed()) { | 651 if (fragment.IsTransformed()) { |
652 state_saver.Save(); | 652 state_saver.Save(); |
653 paint_info.context.ConcatCTM(fragment.BuildFragmentTransform()); | 653 paint_info.context.ConcatCTM(fragment.BuildFragmentTransform()); |
654 } | 654 } |
655 FloatRect fragment_rect = svg_inline_text_box_.SelectionRectForTextFragment( | 655 FloatRect fragment_rect = svg_inline_text_box_.SelectionRectForTextFragment( |
656 fragment, text_match_info.start_position, text_match_info.end_position, | 656 fragment, text_match_info.start_position, text_match_info.end_position, |
657 style); | 657 style); |
658 paint_info.context.SetFillColor(color); | 658 paint_info.context.SetFillColor(color); |
659 paint_info.context.FillRect(fragment_rect); | 659 paint_info.context.FillRect(fragment_rect); |
660 } | 660 } |
661 } | 661 } |
662 | 662 |
663 } // namespace blink | 663 } // namespace blink |
OLD | NEW |