| 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 "config.h" | 5 #include "config.h" |
| 6 #include "core/paint/SVGInlineTextBoxPainter.h" | 6 #include "core/paint/SVGInlineTextBoxPainter.h" |
| 7 | 7 |
| 8 #include "core/dom/DocumentMarkerController.h" | 8 #include "core/dom/DocumentMarkerController.h" |
| 9 #include "core/dom/RenderedDocumentMarker.h" | 9 #include "core/dom/RenderedDocumentMarker.h" |
| 10 #include "core/editing/Editor.h" | 10 #include "core/editing/Editor.h" |
| 11 #include "core/frame/LocalFrame.h" | 11 #include "core/frame/LocalFrame.h" |
| 12 #include "core/layout/LayoutTheme.h" | 12 #include "core/layout/LayoutTheme.h" |
| 13 #include "core/layout/api/SelectionState.h" |
| 13 #include "core/layout/line/InlineFlowBox.h" | 14 #include "core/layout/line/InlineFlowBox.h" |
| 14 #include "core/layout/svg/LayoutSVGInlineText.h" | 15 #include "core/layout/svg/LayoutSVGInlineText.h" |
| 15 #include "core/layout/svg/SVGLayoutSupport.h" | 16 #include "core/layout/svg/SVGLayoutSupport.h" |
| 16 #include "core/layout/svg/SVGResourcesCache.h" | 17 #include "core/layout/svg/SVGResourcesCache.h" |
| 17 #include "core/layout/svg/line/SVGInlineTextBox.h" | 18 #include "core/layout/svg/line/SVGInlineTextBox.h" |
| 18 #include "core/paint/InlineTextBoxPainter.h" | 19 #include "core/paint/InlineTextBoxPainter.h" |
| 19 #include "core/paint/LayoutObjectDrawingRecorder.h" | 20 #include "core/paint/LayoutObjectDrawingRecorder.h" |
| 20 #include "core/paint/PaintInfo.h" | 21 #include "core/paint/PaintInfo.h" |
| 21 #include "core/paint/SVGPaintContext.h" | 22 #include "core/paint/SVGPaintContext.h" |
| 22 #include "core/style/ShadowList.h" | 23 #include "core/style/ShadowList.h" |
| 23 #include "platform/graphics/GraphicsContextStateSaver.h" | 24 #include "platform/graphics/GraphicsContextStateSaver.h" |
| 24 | 25 |
| 25 namespace blink { | 26 namespace blink { |
| 26 | 27 |
| 27 static inline bool textShouldBePainted(LayoutSVGInlineText& textLayoutObject) | 28 static inline bool textShouldBePainted(LayoutSVGInlineText& textLayoutObject) |
| 28 { | 29 { |
| 29 // Font::pixelSize(), returns FontDescription::computedPixelSize(), which re
turns "int(x + 0.5)". | 30 // Font::pixelSize(), returns FontDescription::computedPixelSize(), which re
turns "int(x + 0.5)". |
| 30 // If the absolute font size on screen is below x=0.5, don't render anything
. | 31 // If the absolute font size on screen is below x=0.5, don't render anything
. |
| 31 return textLayoutObject.scaledFont().fontDescription().computedPixelSize(); | 32 return textLayoutObject.scaledFont().fontDescription().computedPixelSize(); |
| 32 } | 33 } |
| 33 | 34 |
| 34 bool SVGInlineTextBoxPainter::shouldPaintSelection(const PaintInfo& paintInfo) c
onst | 35 bool SVGInlineTextBoxPainter::shouldPaintSelection(const PaintInfo& paintInfo) c
onst |
| 35 { | 36 { |
| 36 return !paintInfo.isPrinting() && m_svgInlineTextBox.selectionState() != Lay
outObject::SelectionNone; | 37 return !paintInfo.isPrinting() && m_svgInlineTextBox.selectionState() != Sel
ectionNone; |
| 37 } | 38 } |
| 38 | 39 |
| 39 void SVGInlineTextBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoin
t& paintOffset) | 40 void SVGInlineTextBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoin
t& paintOffset) |
| 40 { | 41 { |
| 41 ASSERT(paintInfo.shouldPaintWithinRoot(&m_svgInlineTextBox.layoutObject())); | 42 ASSERT(paintInfo.shouldPaintWithinRoot(&m_svgInlineTextBox.layoutObject())); |
| 42 ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPh
aseSelection); | 43 ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPh
aseSelection); |
| 43 ASSERT(m_svgInlineTextBox.truncation() == cNoTruncation); | 44 ASSERT(m_svgInlineTextBox.truncation() == cNoTruncation); |
| 44 | 45 |
| 45 if (m_svgInlineTextBox.layoutObject().style()->visibility() != VISIBLE) | 46 if (m_svgInlineTextBox.layoutObject().style()->visibility() != VISIBLE) |
| 46 return; | 47 return; |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 if (!fragmentTransform.isIdentity()) | 442 if (!fragmentTransform.isIdentity()) |
| 442 context->concatCTM(fragmentTransform); | 443 context->concatCTM(fragmentTransform); |
| 443 context->setFillColor(color); | 444 context->setFillColor(color); |
| 444 context->fillRect(fragmentRect, color); | 445 context->fillRect(fragmentRect, color); |
| 445 } | 446 } |
| 446 } | 447 } |
| 447 } | 448 } |
| 448 } | 449 } |
| 449 | 450 |
| 450 } // namespace blink | 451 } // namespace blink |
| OLD | NEW |