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/FileUploadControlPainter.h" | 6 #include "core/paint/FileUploadControlPainter.h" |
7 | 7 |
8 #include "core/layout/LayoutButton.h" | 8 #include "core/layout/LayoutButton.h" |
9 #include "core/layout/LayoutFileUploadControl.h" | 9 #include "core/layout/LayoutFileUploadControl.h" |
10 #include "core/layout/TextRunConstructor.h" | 10 #include "core/layout/TextRunConstructor.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
60 if (LayoutButton* buttonLayoutObject = toLayoutButton(button->layoutObje ct())) | 60 if (LayoutButton* buttonLayoutObject = toLayoutButton(button->layoutObje ct())) |
61 textY = paintOffset.y() + m_layoutFileUploadControl.borderTop() + m_ layoutFileUploadControl.paddingTop() + buttonLayoutObject->baselinePosition(Alph abeticBaseline, true, HorizontalLine, PositionOnContainingLine); | 61 textY = paintOffset.y() + m_layoutFileUploadControl.borderTop() + m_ layoutFileUploadControl.paddingTop() + buttonLayoutObject->baselinePosition(Alph abeticBaseline, true, HorizontalLine, PositionOnContainingLine); |
62 else | 62 else |
63 textY = m_layoutFileUploadControl.baselinePosition(AlphabeticBaselin e, true, HorizontalLine, PositionOnContainingLine); | 63 textY = m_layoutFileUploadControl.baselinePosition(AlphabeticBaselin e, true, HorizontalLine, PositionOnContainingLine); |
64 TextRunPaintInfo textRunPaintInfo(textRun); | 64 TextRunPaintInfo textRunPaintInfo(textRun); |
65 // FIXME: Shouldn't these offsets be rounded? crbug.com/350474 | 65 // FIXME: Shouldn't these offsets be rounded? crbug.com/350474 |
66 textRunPaintInfo.bounds = FloatRect(textX.toFloat(), textY.toFloat() - m _layoutFileUploadControl.style()->fontMetrics().ascent(), | 66 textRunPaintInfo.bounds = FloatRect(textX.toFloat(), textY.toFloat() - m _layoutFileUploadControl.style()->fontMetrics().ascent(), |
67 textWidth, m_layoutFileUploadControl.style()->fontMetrics().height() ); | 67 textWidth, m_layoutFileUploadControl.style()->fontMetrics().height() ); |
68 | 68 |
69 // Draw the filename. | 69 // Draw the filename. |
70 LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutFileUpl oadControl, paintInfo.phase, textRunPaintInfo.bounds); | 70 LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutFileUpl oadControl, paintInfo.phase, LayoutRect(enclosingIntRect(textRunPaintInfo.bounds ))); |
jbroman
2015/08/26 21:45:08
ditto (no need for LayoutRect conversion)
chrishtr
2015/08/26 22:32:21
Done.
| |
71 paintInfo.context->setFillColor(m_layoutFileUploadControl.resolveColor(C SSPropertyColor)); | 71 paintInfo.context->setFillColor(m_layoutFileUploadControl.resolveColor(C SSPropertyColor)); |
72 paintInfo.context->drawBidiText(font, textRunPaintInfo, FloatPoint(round ToInt(textX), roundToInt(textY))); | 72 paintInfo.context->drawBidiText(font, textRunPaintInfo, FloatPoint(round ToInt(textX), roundToInt(textY))); |
73 } | 73 } |
74 | 74 |
75 // Paint the children. | 75 // Paint the children. |
76 m_layoutFileUploadControl.LayoutBlockFlow::paintObject(paintInfo, paintOffse t); | 76 m_layoutFileUploadControl.LayoutBlockFlow::paintObject(paintInfo, paintOffse t); |
77 } | 77 } |
78 | 78 |
79 } // namespace blink | 79 } // namespace blink |
OLD | NEW |