| 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 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 // selection. | 514 // selection. |
| 515 bool paint_selected_text_only = paint_info.phase == kPaintPhaseSelection; | 515 bool paint_selected_text_only = paint_info.phase == kPaintPhaseSelection; |
| 516 if (start_position > 0 && !paint_selected_text_only) { | 516 if (start_position > 0 && !paint_selected_text_only) { |
| 517 PaintFlags flags; | 517 PaintFlags flags; |
| 518 if (SetupTextPaint(paint_info, style, resource_mode, flags)) | 518 if (SetupTextPaint(paint_info, style, resource_mode, flags)) |
| 519 PaintText(paint_info, text_run, fragment, 0, start_position, flags); | 519 PaintText(paint_info, text_run, fragment, 0, start_position, flags); |
| 520 } | 520 } |
| 521 | 521 |
| 522 // Draw text using selection style from the start to the end position of the | 522 // Draw text using selection style from the start to the end position of the |
| 523 // selection. | 523 // selection. |
| 524 if (style != selection_style) { | 524 { |
| 525 StyleDifference diff; | 525 SVGResourcesCache::TemporaryStyleScope scope(ParentInlineLayoutObject(), |
| 526 diff.SetNeedsPaintInvalidationObject(); | 526 style, selection_style); |
| 527 SVGResourcesCache::ClientStyleChanged(&ParentInlineLayoutObject(), diff, | |
| 528 selection_style); | |
| 529 } | |
| 530 | 527 |
| 531 PaintFlags flags; | 528 PaintFlags flags; |
| 532 if (SetupTextPaint(paint_info, selection_style, resource_mode, flags)) | 529 if (SetupTextPaint(paint_info, selection_style, resource_mode, flags)) { |
| 533 PaintText(paint_info, text_run, fragment, start_position, end_position, | 530 PaintText(paint_info, text_run, fragment, start_position, end_position, |
| 534 flags); | 531 flags); |
| 535 | 532 } |
| 536 if (style != selection_style) { | |
| 537 StyleDifference diff; | |
| 538 diff.SetNeedsPaintInvalidationObject(); | |
| 539 SVGResourcesCache::ClientStyleChanged(&ParentInlineLayoutObject(), diff, | |
| 540 style); | |
| 541 } | 533 } |
| 542 | 534 |
| 543 // Eventually draw text using regular style from the end position of the | 535 // Eventually draw text using regular style from the end position of the |
| 544 // selection to the end of the current chunk part. | 536 // selection to the end of the current chunk part. |
| 545 if (end_position < static_cast<int>(fragment.length) && | 537 if (end_position < static_cast<int>(fragment.length) && |
| 546 !paint_selected_text_only) { | 538 !paint_selected_text_only) { |
| 547 PaintFlags flags; | 539 PaintFlags flags; |
| 548 if (SetupTextPaint(paint_info, style, resource_mode, flags)) { | 540 if (SetupTextPaint(paint_info, style, resource_mode, flags)) { |
| 549 PaintText(paint_info, text_run, fragment, end_position, fragment.length, | 541 PaintText(paint_info, text_run, fragment, end_position, fragment.length, |
| 550 flags); | 542 flags); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 } | 654 } |
| 663 FloatRect fragment_rect = svg_inline_text_box_.SelectionRectForTextFragment( | 655 FloatRect fragment_rect = svg_inline_text_box_.SelectionRectForTextFragment( |
| 664 fragment, text_match_info.start_position, text_match_info.end_position, | 656 fragment, text_match_info.start_position, text_match_info.end_position, |
| 665 style); | 657 style); |
| 666 paint_info.context.SetFillColor(color); | 658 paint_info.context.SetFillColor(color); |
| 667 paint_info.context.FillRect(fragment_rect); | 659 paint_info.context.FillRect(fragment_rect); |
| 668 } | 660 } |
| 669 } | 661 } |
| 670 | 662 |
| 671 } // namespace blink | 663 } // namespace blink |
| OLD | NEW |