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/FileUploadControlPainter.h" | 5 #include "core/paint/FileUploadControlPainter.h" |
6 | 6 |
7 #include "core/layout/LayoutButton.h" | 7 #include "core/layout/LayoutButton.h" |
8 #include "core/layout/LayoutFileUploadControl.h" | 8 #include "core/layout/LayoutFileUploadControl.h" |
9 #include "core/layout/TextRunConstructor.h" | 9 #include "core/layout/TextRunConstructor.h" |
10 #include "core/paint/LayoutObjectDrawingRecorder.h" | 10 #include "core/paint/LayoutObjectDrawingRecorder.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 LayoutUnit textY; | 56 LayoutUnit textY; |
57 // We want to match the button's baseline | 57 // We want to match the button's baseline |
58 // FIXME: Make this work with transforms. | 58 // FIXME: Make this work with transforms. |
59 if (LayoutButton* buttonLayoutObject = toLayoutButton(button->layoutObje
ct())) | 59 if (LayoutButton* buttonLayoutObject = toLayoutButton(button->layoutObje
ct())) |
60 textY = paintOffset.y() + m_layoutFileUploadControl.borderTop() + m_
layoutFileUploadControl.paddingTop() + buttonLayoutObject->baselinePosition(Alph
abeticBaseline, true, HorizontalLine, PositionOnContainingLine); | 60 textY = paintOffset.y() + m_layoutFileUploadControl.borderTop() + m_
layoutFileUploadControl.paddingTop() + buttonLayoutObject->baselinePosition(Alph
abeticBaseline, true, HorizontalLine, PositionOnContainingLine); |
61 else | 61 else |
62 textY = LayoutUnit(m_layoutFileUploadControl.baselinePosition(Alphab
eticBaseline, true, HorizontalLine, PositionOnContainingLine)); | 62 textY = LayoutUnit(m_layoutFileUploadControl.baselinePosition(Alphab
eticBaseline, true, HorizontalLine, PositionOnContainingLine)); |
63 TextRunPaintInfo textRunPaintInfo(textRun); | 63 TextRunPaintInfo textRunPaintInfo(textRun); |
64 // FIXME: Shouldn't these offsets be rounded? crbug.com/350474 | 64 // FIXME: Shouldn't these offsets be rounded? crbug.com/350474 |
65 textRunPaintInfo.bounds = FloatRect(textX.toFloat(), textY.toFloat() - m
_layoutFileUploadControl.style()->fontMetrics().ascent(), | 65 textRunPaintInfo.bounds = FloatRect(textX.toFloat(), textY.toFloat() - m
_layoutFileUploadControl.style()->getFontMetrics().ascent(), |
66 textWidth, m_layoutFileUploadControl.style()->fontMetrics().height()
); | 66 textWidth, m_layoutFileUploadControl.style()->getFontMetrics().heigh
t()); |
67 | 67 |
68 // Draw the filename. | 68 // Draw the filename. |
69 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutFileUplo
adControl, paintInfo.phase, textRunPaintInfo.bounds); | 69 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutFileUplo
adControl, paintInfo.phase, textRunPaintInfo.bounds); |
70 paintInfo.context.setFillColor(m_layoutFileUploadControl.resolveColor(CS
SPropertyColor)); | 70 paintInfo.context.setFillColor(m_layoutFileUploadControl.resolveColor(CS
SPropertyColor)); |
71 paintInfo.context.drawBidiText(font, textRunPaintInfo, FloatPoint(roundT
oInt(textX), roundToInt(textY))); | 71 paintInfo.context.drawBidiText(font, textRunPaintInfo, FloatPoint(roundT
oInt(textX), roundToInt(textY))); |
72 } | 72 } |
73 | 73 |
74 // Paint the children. | 74 // Paint the children. |
75 m_layoutFileUploadControl.LayoutBlockFlow::paintObject(paintInfo, paintOffse
t); | 75 m_layoutFileUploadControl.LayoutBlockFlow::paintObject(paintInfo, paintOffse
t); |
76 } | 76 } |
77 | 77 |
78 } // namespace blink | 78 } // namespace blink |
OLD | NEW |