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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutFileUploadControl.cpp

Issue 2286543002: Add Length::isPercent and use it in tables. (Closed)
Patch Set: rebase Created 4 years, 3 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 float minDefaultLabelWidth = defaultWidthNumChars * font.width(constructText Run(font, characterAsString, styleRef(), TextRun::AllowTrailingExpansion)); 91 float minDefaultLabelWidth = defaultWidthNumChars * font.width(constructText Run(font, characterAsString, styleRef(), TextRun::AllowTrailingExpansion));
92 92
93 const String label = toHTMLInputElement(node())->locale().queryString(WebLoc alizedString::FileButtonNoFileSelectedLabel); 93 const String label = toHTMLInputElement(node())->locale().queryString(WebLoc alizedString::FileButtonNoFileSelectedLabel);
94 float defaultLabelWidth = font.width(constructTextRun(font, label, styleRef( ), TextRun::AllowTrailingExpansion)); 94 float defaultLabelWidth = font.width(constructTextRun(font, label, styleRef( ), TextRun::AllowTrailingExpansion));
95 if (HTMLInputElement* button = uploadButton()) { 95 if (HTMLInputElement* button = uploadButton()) {
96 if (LayoutObject* buttonLayoutObject = button->layoutObject()) 96 if (LayoutObject* buttonLayoutObject = button->layoutObject())
97 defaultLabelWidth += buttonLayoutObject->maxPreferredLogicalWidth() + afterButtonSpacing; 97 defaultLabelWidth += buttonLayoutObject->maxPreferredLogicalWidth() + afterButtonSpacing;
98 } 98 }
99 maxLogicalWidth = LayoutUnit(ceilf(std::max(minDefaultLabelWidth, defaultLab elWidth))); 99 maxLogicalWidth = LayoutUnit(ceilf(std::max(minDefaultLabelWidth, defaultLab elWidth)));
100 100
101 if (!style()->width().hasPercent()) 101 if (!style()->width().isPercentOrCalc())
102 minLogicalWidth = maxLogicalWidth; 102 minLogicalWidth = maxLogicalWidth;
103 } 103 }
104 104
105 void LayoutFileUploadControl::computePreferredLogicalWidths() 105 void LayoutFileUploadControl::computePreferredLogicalWidths()
106 { 106 {
107 ASSERT(preferredLogicalWidthsDirty()); 107 ASSERT(preferredLogicalWidthsDirty());
108 108
109 m_minPreferredLogicalWidth = LayoutUnit(); 109 m_minPreferredLogicalWidth = LayoutUnit();
110 m_maxPreferredLogicalWidth = LayoutUnit(); 110 m_maxPreferredLogicalWidth = LayoutUnit();
111 const ComputedStyle& styleToUse = styleRef(); 111 const ComputedStyle& styleToUse = styleRef();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 } 154 }
155 155
156 String LayoutFileUploadControl::fileTextValue() const 156 String LayoutFileUploadControl::fileTextValue() const
157 { 157 {
158 HTMLInputElement* input = toHTMLInputElement(node()); 158 HTMLInputElement* input = toHTMLInputElement(node());
159 ASSERT(input->files()); 159 ASSERT(input->files());
160 return LayoutTheme::theme().fileListNameForWidth(input->locale(), input->fil es(), style()->font(), maxFilenameWidth()); 160 return LayoutTheme::theme().fileListNameForWidth(input->locale(), input->fil es(), style()->font(), maxFilenameWidth());
161 } 161 }
162 162
163 } // namespace blink 163 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698