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

Side by Side Diff: Source/core/rendering/RenderFileUploadControl.cpp

Issue 238973008: Minor refactoring to avoid redundant calls to RenderObject::style() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 8 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
OLDNEW
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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 if (!style()->width().isPercent()) 166 if (!style()->width().isPercent())
167 minLogicalWidth = maxLogicalWidth; 167 minLogicalWidth = maxLogicalWidth;
168 } 168 }
169 169
170 void RenderFileUploadControl::computePreferredLogicalWidths() 170 void RenderFileUploadControl::computePreferredLogicalWidths()
171 { 171 {
172 ASSERT(preferredLogicalWidthsDirty()); 172 ASSERT(preferredLogicalWidthsDirty());
173 173
174 m_minPreferredLogicalWidth = 0; 174 m_minPreferredLogicalWidth = 0;
175 m_maxPreferredLogicalWidth = 0; 175 m_maxPreferredLogicalWidth = 0;
176 RenderStyle* styleToUse = style();
176 177
177 if (style()->width().isFixed() && style()->width().value() > 0) 178 if (styleToUse->width().isFixed() && styleToUse->width().value() > 0)
178 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = adjustContentB oxLogicalWidthForBoxSizing(style()->width().value()); 179 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = adjustContentB oxLogicalWidthForBoxSizing(styleToUse->width().value());
179 else 180 else
180 computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferred LogicalWidth); 181 computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferred LogicalWidth);
181 182
182 if (style()->minWidth().isFixed() && style()->minWidth().value() > 0) { 183 if (styleToUse->minWidth().isFixed() && styleToUse->minWidth().value() > 0) {
183 m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, adjustConte ntBoxLogicalWidthForBoxSizing(style()->minWidth().value())); 184 m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, adjustConte ntBoxLogicalWidthForBoxSizing(styleToUse->minWidth().value()));
184 m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, adjustConte ntBoxLogicalWidthForBoxSizing(style()->minWidth().value())); 185 m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, adjustConte ntBoxLogicalWidthForBoxSizing(styleToUse->minWidth().value()));
185 } 186 }
186 187
187 if (style()->maxWidth().isFixed()) { 188 if (styleToUse->maxWidth().isFixed()) {
188 m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, adjustConte ntBoxLogicalWidthForBoxSizing(style()->maxWidth().value())); 189 m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, adjustConte ntBoxLogicalWidthForBoxSizing(styleToUse->maxWidth().value()));
189 m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, adjustConte ntBoxLogicalWidthForBoxSizing(style()->maxWidth().value())); 190 m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, adjustConte ntBoxLogicalWidthForBoxSizing(styleToUse->maxWidth().value()));
190 } 191 }
191 192
192 int toAdd = borderAndPaddingWidth(); 193 int toAdd = borderAndPaddingWidth();
193 m_minPreferredLogicalWidth += toAdd; 194 m_minPreferredLogicalWidth += toAdd;
194 m_maxPreferredLogicalWidth += toAdd; 195 m_maxPreferredLogicalWidth += toAdd;
195 196
196 clearPreferredLogicalWidthsDirty(); 197 clearPreferredLogicalWidthsDirty();
197 } 198 }
198 199
199 PositionWithAffinity RenderFileUploadControl::positionForPoint(const LayoutPoint &) 200 PositionWithAffinity RenderFileUploadControl::positionForPoint(const LayoutPoint &)
(...skipping 18 matching lines...) Expand all
218 } 219 }
219 220
220 String RenderFileUploadControl::fileTextValue() const 221 String RenderFileUploadControl::fileTextValue() const
221 { 222 {
222 HTMLInputElement* input = toHTMLInputElement(node()); 223 HTMLInputElement* input = toHTMLInputElement(node());
223 ASSERT(input->files()); 224 ASSERT(input->files());
224 return RenderTheme::theme().fileListNameForWidth(input->locale(), input->fil es(), style()->font(), maxFilenameWidth()); 225 return RenderTheme::theme().fileListNameForWidth(input->locale(), input->fil es(), style()->font(), maxFilenameWidth());
225 } 226 }
226 227
227 } // namespace WebCore 228 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698