Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1132)

Unified Diff: Source/core/rendering/RenderFileUploadControl.cpp

Issue 16081007: Introduce toHTMLInputElement(Node*), and use it. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/rendering/RenderButton.cpp ('k') | Source/core/rendering/RenderImage.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderFileUploadControl.cpp
diff --git a/Source/core/rendering/RenderFileUploadControl.cpp b/Source/core/rendering/RenderFileUploadControl.cpp
index e25a9cf2acedbdd3e85f9851c9b030e010269141..5e449ba07964270453186e5bf0076607a27351d8 100644
--- a/Source/core/rendering/RenderFileUploadControl.cpp
+++ b/Source/core/rendering/RenderFileUploadControl.cpp
@@ -66,7 +66,7 @@ bool RenderFileUploadControl::canBeReplacedWithInlineRunIn() const
void RenderFileUploadControl::updateFromElement()
{
- HTMLInputElement* input = static_cast<HTMLInputElement*>(node());
+ HTMLInputElement* input = toHTMLInputElement(node());
ASSERT(input->isFileUpload());
if (HTMLInputElement* button = uploadButton()) {
@@ -92,7 +92,7 @@ static int nodeWidth(Node* node)
int RenderFileUploadControl::maxFilenameWidth() const
{
- HTMLInputElement* input = static_cast<HTMLInputElement*>(node());
+ HTMLInputElement* input = toHTMLInputElement(node());
return max(0, contentBoxRect().pixelSnappedWidth() - nodeWidth(uploadButton()) - afterButtonSpacing
- (input->icon() ? iconWidth + iconFilenameSpacing : 0));
}
@@ -125,7 +125,7 @@ void RenderFileUploadControl::paintObject(PaintInfo& paintInfo, const LayoutPoin
if (!button)
return;
- HTMLInputElement* input = static_cast<HTMLInputElement*>(node());
+ HTMLInputElement* input = toHTMLInputElement(node());
LayoutUnit buttonWidth = nodeWidth(button);
LayoutUnit buttonAndIconWidth = buttonWidth + afterButtonSpacing
+ (input->icon() ? iconWidth + iconFilenameSpacing : 0);
@@ -230,12 +230,12 @@ VisiblePosition RenderFileUploadControl::positionForPoint(const LayoutPoint&)
HTMLInputElement* RenderFileUploadControl::uploadButton() const
{
- HTMLInputElement* input = static_cast<HTMLInputElement*>(node());
+ HTMLInputElement* input = toHTMLInputElement(node());
ASSERT(input->shadow());
Node* buttonNode = input->shadow()->oldestShadowRoot()->firstChild();
- return buttonNode && buttonNode->isHTMLElement() && buttonNode->hasTagName(inputTag) ? static_cast<HTMLInputElement*>(buttonNode) : 0;
+ return buttonNode && buttonNode->isHTMLElement() && buttonNode->hasTagName(inputTag) ? toHTMLInputElement(buttonNode) : 0;
}
String RenderFileUploadControl::buttonValue()
@@ -248,7 +248,7 @@ String RenderFileUploadControl::buttonValue()
String RenderFileUploadControl::fileTextValue() const
{
- HTMLInputElement* input = static_cast<HTMLInputElement*>(node());
+ HTMLInputElement* input = toHTMLInputElement(node());
ASSERT(input->files());
return theme()->fileListNameForWidth(input->files(), style()->font(), maxFilenameWidth(), input->multiple());
}
« no previous file with comments | « Source/core/rendering/RenderButton.cpp ('k') | Source/core/rendering/RenderImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698