OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/EmbeddedObjectPainter.h" | 5 #include "core/paint/EmbeddedObjectPainter.h" |
6 | 6 |
7 #include "core/frame/Settings.h" | 7 #include "core/frame/Settings.h" |
8 #include "core/layout/LayoutEmbeddedObject.h" | 8 #include "core/layout/LayoutEmbeddedObject.h" |
9 #include "core/layout/LayoutTheme.h" | 9 #include "core/layout/LayoutTheme.h" |
10 #include "core/paint/LayoutObjectDrawingRecorder.h" | 10 #include "core/paint/LayoutObjectDrawingRecorder.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 65 |
66 LayoutRect backgroundRect( | 66 LayoutRect backgroundRect( |
67 0, 0, | 67 0, 0, |
68 textGeometry.width() + 2 * replacementTextRoundedRectLeftRightTextMargin, | 68 textGeometry.width() + 2 * replacementTextRoundedRectLeftRightTextMargin, |
69 replacementTextRoundedRectHeight); | 69 replacementTextRoundedRectHeight); |
70 backgroundRect.move(contentRect.center() - backgroundRect.center()); | 70 backgroundRect.move(contentRect.center() - backgroundRect.center()); |
71 backgroundRect = LayoutRect(pixelSnappedIntRect(backgroundRect)); | 71 backgroundRect = LayoutRect(pixelSnappedIntRect(backgroundRect)); |
72 Path roundedBackgroundRect; | 72 Path roundedBackgroundRect; |
73 FloatRect floatBackgroundRect(backgroundRect); | 73 FloatRect floatBackgroundRect(backgroundRect); |
74 roundedBackgroundRect.addRoundedRect( | 74 roundedBackgroundRect.addRoundedRect( |
75 floatBackgroundRect, FloatSize(replacementTextRoundedRectRadius, | 75 floatBackgroundRect, |
76 replacementTextRoundedRectRadius)); | 76 FloatSize(replacementTextRoundedRectRadius, |
| 77 replacementTextRoundedRectRadius)); |
77 context.setFillColor( | 78 context.setFillColor( |
78 scaleAlpha(Color::white, replacementTextRoundedRectOpacity)); | 79 scaleAlpha(Color::white, replacementTextRoundedRectOpacity)); |
79 context.fillPath(roundedBackgroundRect); | 80 context.fillPath(roundedBackgroundRect); |
80 | 81 |
81 FloatRect textRect(FloatPoint(), textGeometry); | 82 FloatRect textRect(FloatPoint(), textGeometry); |
82 textRect.move(FloatPoint(contentRect.center()) - textRect.center()); | 83 textRect.move(FloatPoint(contentRect.center()) - textRect.center()); |
83 TextRunPaintInfo runInfo(textRun); | 84 TextRunPaintInfo runInfo(textRun); |
84 runInfo.bounds = floatBackgroundRect; | 85 runInfo.bounds = floatBackgroundRect; |
85 context.setFillColor(scaleAlpha(Color::black, replacementTextTextOpacity)); | 86 context.setFillColor(scaleAlpha(Color::black, replacementTextTextOpacity)); |
86 context.drawBidiText( | 87 context.drawBidiText( |
87 font, runInfo, | 88 font, runInfo, |
88 textRect.location() + FloatSize(0, fontData->getFontMetrics().ascent())); | 89 textRect.location() + FloatSize(0, fontData->getFontMetrics().ascent())); |
89 } | 90 } |
90 | 91 |
91 } // namespace blink | 92 } // namespace blink |
OLD | NEW |