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

Side by Side Diff: Source/core/rendering/RenderButton.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /** 1 /**
2 * Copyright (C) 2005 Apple Computer, Inc. 2 * Copyright (C) 2005 Apple Computer, Inc.
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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // when the content overflows, treat it the same as align-items: flex-start. 102 // when the content overflows, treat it the same as align-items: flex-start.
103 innerStyle->setMarginTop(Length()); 103 innerStyle->setMarginTop(Length());
104 innerStyle->setMarginBottom(Length()); 104 innerStyle->setMarginBottom(Length());
105 innerStyle->setFlexDirection(style()->flexDirection()); 105 innerStyle->setFlexDirection(style()->flexDirection());
106 } 106 }
107 107
108 void RenderButton::updateFromElement() 108 void RenderButton::updateFromElement()
109 { 109 {
110 // If we're an input element, we may need to change our button text. 110 // If we're an input element, we may need to change our button text.
111 if (node()->hasTagName(inputTag)) { 111 if (node()->hasTagName(inputTag)) {
112 HTMLInputElement* input = static_cast<HTMLInputElement*>(node()); 112 HTMLInputElement* input = toHTMLInputElement(node());
113 String value = input->valueWithDefault(); 113 String value = input->valueWithDefault();
114 setText(value); 114 setText(value);
115 } 115 }
116 } 116 }
117 117
118 void RenderButton::setText(const String& str) 118 void RenderButton::setText(const String& str)
119 { 119 {
120 if (str.isEmpty()) { 120 if (str.isEmpty()) {
121 if (m_buttonText) { 121 if (m_buttonText) {
122 m_buttonText->destroy(); 122 m_buttonText->destroy();
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 // baseline for the empty case manually here. 164 // baseline for the empty case manually here.
165 if (direction == HorizontalLine) 165 if (direction == HorizontalLine)
166 return marginTop() + borderTop() + paddingTop() + contentHeight(); 166 return marginTop() + borderTop() + paddingTop() + contentHeight();
167 167
168 return marginRight() + borderRight() + paddingRight() + contentWidth(); 168 return marginRight() + borderRight() + paddingRight() + contentWidth();
169 } 169 }
170 return RenderFlexibleBox::baselinePosition(baseline, firstLine, direction, l inePositionMode); 170 return RenderFlexibleBox::baselinePosition(baseline, firstLine, direction, l inePositionMode);
171 } 171 }
172 172
173 } // namespace WebCore 173 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/HitTestResult.cpp ('k') | Source/core/rendering/RenderFileUploadControl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698