| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "public/platform/WebFont.h" | 5 #include "public/platform/WebFont.h" |
| 6 | 6 |
| 7 #include "platform/fonts/Font.h" | 7 #include "platform/fonts/Font.h" |
| 8 #include "platform/fonts/FontCache.h" | 8 #include "platform/fonts/FontCache.h" |
| 9 #include "platform/fonts/FontDescription.h" | 9 #include "platform/fonts/FontDescription.h" |
| 10 #include "platform/graphics/GraphicsContext.h" | 10 #include "platform/graphics/GraphicsContext.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 100 |
| 101 ASSERT(!DrawingRecorder::useCachedDrawingIfPossible(context, *m_private, Dis
playItem::WebFont)); | 101 ASSERT(!DrawingRecorder::useCachedDrawingIfPossible(context, *m_private, Dis
playItem::WebFont)); |
| 102 { | 102 { |
| 103 DrawingRecorder drawingRecorder(context, *m_private, DisplayItem::WebFon
t, intRect); | 103 DrawingRecorder drawingRecorder(context, *m_private, DisplayItem::WebFon
t, intRect); |
| 104 context.save(); | 104 context.save(); |
| 105 context.setFillColor(color); | 105 context.setFillColor(color); |
| 106 context.clip(textClipRect); | 106 context.clip(textClipRect); |
| 107 context.drawText(m_private->getFont(), runInfo, leftBaseline); | 107 context.drawText(m_private->getFont(), runInfo, leftBaseline); |
| 108 context.restore(); | 108 context.restore(); |
| 109 } | 109 } |
| 110 | 110 RefPtr<const SkPicture> recording = pictureBuilder.endRecording(); |
| 111 pictureBuilder.endRecording()->playback(canvas); | 111 if (recording) |
| 112 recording->playback(canvas); |
| 112 } | 113 } |
| 113 | 114 |
| 114 int WebFont::calculateWidth(const WebTextRun& run) const | 115 int WebFont::calculateWidth(const WebTextRun& run) const |
| 115 { | 116 { |
| 116 return m_private->getFont().width(run, 0); | 117 return m_private->getFont().width(run, 0); |
| 117 } | 118 } |
| 118 | 119 |
| 119 int WebFont::offsetForPosition(const WebTextRun& run, float position) const | 120 int WebFont::offsetForPosition(const WebTextRun& run, float position) const |
| 120 { | 121 { |
| 121 return m_private->getFont().offsetForPosition(run, position, true); | 122 return m_private->getFont().offsetForPosition(run, position, true); |
| 122 } | 123 } |
| 123 | 124 |
| 124 WebFloatRect WebFont::selectionRectForText(const WebTextRun& run, const WebFloat
Point& leftBaseline, int height, int from, int to) const | 125 WebFloatRect WebFont::selectionRectForText(const WebTextRun& run, const WebFloat
Point& leftBaseline, int height, int from, int to) const |
| 125 { | 126 { |
| 126 return m_private->getFont().selectionRectForText(run, leftBaseline, height,
from, to); | 127 return m_private->getFont().selectionRectForText(run, leftBaseline, height,
from, to); |
| 127 } | 128 } |
| 128 | 129 |
| 129 } // namespace blink | 130 } // namespace blink |
| OLD | NEW |