| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 { | 94 { |
| 95 DrawingRecorder drawingRecorder(context, builder, DisplayItem::kWebFont, | 95 DrawingRecorder drawingRecorder(context, builder, DisplayItem::kWebFont, |
| 96 intRect); | 96 intRect); |
| 97 context.save(); | 97 context.save(); |
| 98 context.setFillColor(color); | 98 context.setFillColor(color); |
| 99 context.clip(textClipRect); | 99 context.clip(textClipRect); |
| 100 context.drawText(m_private->getFont(), runInfo, leftBaseline); | 100 context.drawText(m_private->getFont(), runInfo, leftBaseline); |
| 101 context.restore(); | 101 context.restore(); |
| 102 } | 102 } |
| 103 | 103 |
| 104 builder.endRecording()->playback(canvas); | 104 canvas->drawPicture(builder.endRecording()); |
| 105 } | 105 } |
| 106 | 106 |
| 107 int WebFont::calculateWidth(const WebTextRun& run) const { | 107 int WebFont::calculateWidth(const WebTextRun& run) const { |
| 108 return m_private->getFont().width(run, 0); | 108 return m_private->getFont().width(run, 0); |
| 109 } | 109 } |
| 110 | 110 |
| 111 int WebFont::offsetForPosition(const WebTextRun& run, float position) const { | 111 int WebFont::offsetForPosition(const WebTextRun& run, float position) const { |
| 112 return m_private->getFont().offsetForPosition(run, position, true); | 112 return m_private->getFont().offsetForPosition(run, position, true); |
| 113 } | 113 } |
| 114 | 114 |
| 115 WebFloatRect WebFont::selectionRectForText(const WebTextRun& run, | 115 WebFloatRect WebFont::selectionRectForText(const WebTextRun& run, |
| 116 const WebFloatPoint& leftBaseline, | 116 const WebFloatPoint& leftBaseline, |
| 117 int height, | 117 int height, |
| 118 int from, | 118 int from, |
| 119 int to) const { | 119 int to) const { |
| 120 return m_private->getFont().selectionRectForText(run, leftBaseline, height, | 120 return m_private->getFont().selectionRectForText(run, leftBaseline, height, |
| 121 from, to); | 121 from, to); |
| 122 } | 122 } |
| 123 | 123 |
| 124 } // namespace blink | 124 } // namespace blink |
| OLD | NEW |