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" |
11 #include "core/paint/PaintInfo.h" | 11 #include "core/paint/PaintInfo.h" |
12 #include "platform/graphics/paint/ClipRecorder.h" | 12 #include "platform/graphics/paint/ClipRecorder.h" |
13 #include "wtf/Optional.h" | 13 #include "wtf/Optional.h" |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
17 const int buttonShadowHeight = 2; | 17 const int buttonShadowHeight = 2; |
18 | 18 |
19 void FileUploadControlPainter::paintObject(const PaintInfo& paintInfo, const Lay
outPoint& paintOffset) | 19 void FileUploadControlPainter::paintObject(const PaintInfo& paintInfo, const Lay
outPoint& paintOffset) |
20 { | 20 { |
21 if (m_layoutFileUploadControl.style()->visibility() != VISIBLE) | 21 if (m_layoutFileUploadControl.style()->visibility() != EVisibility::Visible) |
22 return; | 22 return; |
23 | 23 |
24 // Push a clip. | 24 // Push a clip. |
25 Optional<ClipRecorder> clipRecorder; | 25 Optional<ClipRecorder> clipRecorder; |
26 if (paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhase
DescendantBlockBackgroundsOnly) { | 26 if (paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhase
DescendantBlockBackgroundsOnly) { |
27 IntRect clipRect = enclosingIntRect(LayoutRect( | 27 IntRect clipRect = enclosingIntRect(LayoutRect( |
28 LayoutPoint(paintOffset.x() + m_layoutFileUploadControl.borderLeft()
, paintOffset.y() + m_layoutFileUploadControl.borderTop()), | 28 LayoutPoint(paintOffset.x() + m_layoutFileUploadControl.borderLeft()
, paintOffset.y() + m_layoutFileUploadControl.borderTop()), |
29 m_layoutFileUploadControl.size() + LayoutSize(0, -m_layoutFileUpload
Control.borderWidth() + buttonShadowHeight))); | 29 m_layoutFileUploadControl.size() + LayoutSize(0, -m_layoutFileUpload
Control.borderWidth() + buttonShadowHeight))); |
30 if (clipRect.isEmpty()) | 30 if (clipRect.isEmpty()) |
31 return; | 31 return; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |