| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2012 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 HTMLInputElement* input = toHTMLInputElement(node()); | 90 HTMLInputElement* input = toHTMLInputElement(node()); |
| 91 return max(0, contentBoxRect().pixelSnappedWidth() - nodeWidth(uploadButton(
)) - afterButtonSpacing); | 91 return max(0, contentBoxRect().pixelSnappedWidth() - nodeWidth(uploadButton(
)) - afterButtonSpacing); |
| 92 } | 92 } |
| 93 | 93 |
| 94 void RenderFileUploadControl::paintObject(PaintInfo& paintInfo, const LayoutPoin
t& paintOffset) | 94 void RenderFileUploadControl::paintObject(PaintInfo& paintInfo, const LayoutPoin
t& paintOffset) |
| 95 { | 95 { |
| 96 if (style()->visibility() != VISIBLE) | 96 if (style()->visibility() != VISIBLE) |
| 97 return; | 97 return; |
| 98 | 98 |
| 99 // Push a clip. | 99 // Push a clip. |
| 100 GraphicsContextStateSaver stateSaver(*paintInfo.context, false); | 100 GraphicsContextStateSaver stateSaver(*(paintInfo.getContext()), false); |
| 101 if (paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhase
ChildBlockBackgrounds) { | 101 if (paintInfo.getPhase() == PaintPhaseForeground || paintInfo.getPhase() ==
PaintPhaseChildBlockBackgrounds) { |
| 102 IntRect clipRect = enclosingIntRect(LayoutRect(paintOffset.x() + borderL
eft(), paintOffset.y() + borderTop(), | 102 IntRect clipRect = enclosingIntRect(LayoutRect(paintOffset.x() + borderL
eft(), paintOffset.y() + borderTop(), |
| 103 width() - borderLeft() - borderRight(), height() - bord
erBottom() - borderTop() + buttonShadowHeight)); | 103 width() - borderLeft() - borderRight(), height() - bord
erBottom() - borderTop() + buttonShadowHeight)); |
| 104 if (clipRect.isEmpty()) | 104 if (clipRect.isEmpty()) |
| 105 return; | 105 return; |
| 106 stateSaver.save(); | 106 stateSaver.save(); |
| 107 paintInfo.context->clip(clipRect); | 107 paintInfo.getContext()->clip(clipRect); |
| 108 } | 108 } |
| 109 | 109 |
| 110 if (paintInfo.phase == PaintPhaseForeground) { | 110 if (paintInfo.getPhase() == PaintPhaseForeground) { |
| 111 const String& displayedFilename = fileTextValue(); | 111 const String& displayedFilename = fileTextValue(); |
| 112 const Font& font = style()->font(); | 112 const Font& font = style()->font(); |
| 113 TextRun textRun = constructTextRun(this, font, displayedFilename, style(
), TextRun::AllowTrailingExpansion, RespectDirection | RespectDirectionOverride)
; | 113 TextRun textRun = constructTextRun(this, font, displayedFilename, style(
), TextRun::AllowTrailingExpansion, RespectDirection | RespectDirectionOverride)
; |
| 114 textRun.disableRoundingHacks(); | 114 textRun.disableRoundingHacks(); |
| 115 | 115 |
| 116 // Determine where the filename should be placed | 116 // Determine where the filename should be placed |
| 117 LayoutUnit contentLeft = paintOffset.x() + borderLeft() + paddingLeft(); | 117 LayoutUnit contentLeft = paintOffset.x() + borderLeft() + paddingLeft(); |
| 118 HTMLInputElement* button = uploadButton(); | 118 HTMLInputElement* button = uploadButton(); |
| 119 if (!button) | 119 if (!button) |
| 120 return; | 120 return; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 135 if (RenderButton* buttonRenderer = toRenderButton(button->renderer())) | 135 if (RenderButton* buttonRenderer = toRenderButton(button->renderer())) |
| 136 textY = paintOffset.y() + borderTop() + paddingTop() + buttonRendere
r->baselinePosition(AlphabeticBaseline, true, HorizontalLine, PositionOnContaini
ngLine); | 136 textY = paintOffset.y() + borderTop() + paddingTop() + buttonRendere
r->baselinePosition(AlphabeticBaseline, true, HorizontalLine, PositionOnContaini
ngLine); |
| 137 else | 137 else |
| 138 textY = baselinePosition(AlphabeticBaseline, true, HorizontalLine, P
ositionOnContainingLine); | 138 textY = baselinePosition(AlphabeticBaseline, true, HorizontalLine, P
ositionOnContainingLine); |
| 139 TextRunPaintInfo textRunPaintInfo(textRun); | 139 TextRunPaintInfo textRunPaintInfo(textRun); |
| 140 textRunPaintInfo.bounds = FloatRect(textX, | 140 textRunPaintInfo.bounds = FloatRect(textX, |
| 141 textY - style()->fontMetrics().ascen
t(), | 141 textY - style()->fontMetrics().ascen
t(), |
| 142 textWidth, | 142 textWidth, |
| 143 style()->fontMetrics().height()); | 143 style()->fontMetrics().height()); |
| 144 | 144 |
| 145 paintInfo.context->setFillColor(resolveColor(CSSPropertyColor)); | 145 paintInfo.getContext()->setFillColor(resolveColor(CSSPropertyColor)); |
| 146 | 146 |
| 147 // Draw the filename | 147 // Draw the filename |
| 148 paintInfo.context->drawBidiText(font, textRunPaintInfo, IntPoint(roundTo
Int(textX), roundToInt(textY))); | 148 paintInfo.getContext()->drawBidiText(font, textRunPaintInfo, IntPoint(ro
undToInt(textX), roundToInt(textY))); |
| 149 } | 149 } |
| 150 | 150 |
| 151 // Paint the children. | 151 // Paint the children. |
| 152 RenderBlock::paintObject(paintInfo, paintOffset); | 152 RenderBlock::paintObject(paintInfo, paintOffset); |
| 153 } | 153 } |
| 154 | 154 |
| 155 void RenderFileUploadControl::computeIntrinsicLogicalWidths(LayoutUnit& minLogic
alWidth, LayoutUnit& maxLogicalWidth) const | 155 void RenderFileUploadControl::computeIntrinsicLogicalWidths(LayoutUnit& minLogic
alWidth, LayoutUnit& maxLogicalWidth) const |
| 156 { | 156 { |
| 157 // Figure out how big the filename space needs to be for a given number of c
haracters | 157 // Figure out how big the filename space needs to be for a given number of c
haracters |
| 158 // (using "0" as the nominal character). | 158 // (using "0" as the nominal character). |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 } | 227 } |
| 228 | 228 |
| 229 String RenderFileUploadControl::fileTextValue() const | 229 String RenderFileUploadControl::fileTextValue() const |
| 230 { | 230 { |
| 231 HTMLInputElement* input = toHTMLInputElement(node()); | 231 HTMLInputElement* input = toHTMLInputElement(node()); |
| 232 ASSERT(input->files()); | 232 ASSERT(input->files()); |
| 233 return theme()->fileListNameForWidth(input->files(), style()->font(), maxFil
enameWidth(), input->multiple()); | 233 return theme()->fileListNameForWidth(input->files(), style()->font(), maxFil
enameWidth(), input->multiple()); |
| 234 } | 234 } |
| 235 | 235 |
| 236 } // namespace WebCore | 236 } // namespace WebCore |
| OLD | NEW |