| 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/editing/markers/RenderedDocumentMarker.h" | 9 #include "core/editing/markers/RenderedDocumentMarker.h" |
| 10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 static inline bool textShouldBePainted( | 30 static inline bool textShouldBePainted( |
| 31 const LayoutSVGInlineText& textLayoutObject) { | 31 const LayoutSVGInlineText& textLayoutObject) { |
| 32 // Font::pixelSize(), returns FontDescription::computedPixelSize(), which | 32 // Font::pixelSize(), returns FontDescription::computedPixelSize(), which |
| 33 // returns "int(x + 0.5)". If the absolute font size on screen is below | 33 // returns "int(x + 0.5)". If the absolute font size on screen is below |
| 34 // x=0.5, don't render anything. | 34 // x=0.5, don't render anything. |
| 35 return textLayoutObject.scaledFont().getFontDescription().computedPixelSize(); | 35 return textLayoutObject.scaledFont().getFontDescription().computedPixelSize(); |
| 36 } | 36 } |
| 37 | 37 |
| 38 bool SVGInlineTextBoxPainter::shouldPaintSelection( | 38 bool SVGInlineTextBoxPainter::shouldPaintSelection( |
| 39 const PaintInfo& paintInfo) const { | 39 const PaintInfo& paintInfo) const { |
| 40 return !paintInfo.isPrinting() && | 40 // Don't paint selections when printing. |
| 41 m_svgInlineTextBox.getSelectionState() != SelectionNone; | 41 if (paintInfo.isPrinting()) |
| 42 return false; |
| 43 // Don't paint selections when rendering a mask, clip-path (as a mask), |
| 44 // pattern or feImage (element reference.) |
| 45 if (paintInfo.isRenderingResourceSubtree()) |
| 46 return false; |
| 47 return m_svgInlineTextBox.getSelectionState() != SelectionNone; |
| 42 } | 48 } |
| 43 | 49 |
| 44 static bool hasShadow(const PaintInfo& paintInfo, const ComputedStyle& style) { | 50 static bool hasShadow(const PaintInfo& paintInfo, const ComputedStyle& style) { |
| 45 // Text shadows are disabled when printing. http://crbug.com/258321 | 51 // Text shadows are disabled when printing. http://crbug.com/258321 |
| 46 return style.textShadow() && !paintInfo.isPrinting(); | 52 return style.textShadow() && !paintInfo.isPrinting(); |
| 47 } | 53 } |
| 48 | 54 |
| 49 FloatRect SVGInlineTextBoxPainter::boundsForDrawingRecorder( | 55 FloatRect SVGInlineTextBoxPainter::boundsForDrawingRecorder( |
| 50 const PaintInfo& paintInfo, | 56 const PaintInfo& paintInfo, |
| 51 const ComputedStyle& style, | 57 const ComputedStyle& style, |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 } | 651 } |
| 646 FloatRect fragmentRect = m_svgInlineTextBox.selectionRectForTextFragment( | 652 FloatRect fragmentRect = m_svgInlineTextBox.selectionRectForTextFragment( |
| 647 fragment, textMatchInfo.startPosition, textMatchInfo.endPosition, | 653 fragment, textMatchInfo.startPosition, textMatchInfo.endPosition, |
| 648 style); | 654 style); |
| 649 paintInfo.context.setFillColor(color); | 655 paintInfo.context.setFillColor(color); |
| 650 paintInfo.context.fillRect(fragmentRect); | 656 paintInfo.context.fillRect(fragmentRect); |
| 651 } | 657 } |
| 652 } | 658 } |
| 653 | 659 |
| 654 } // namespace blink | 660 } // namespace blink |
| OLD | NEW |