Changeset 139536 in webkit
- Timestamp:
- Jan 11, 2013, 6:29:31 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r139535 r139536 1 2013-01-11 Ojan Vafai <ojan@chromium.org> 2 3 Fixed width overrides intrinsic min-width/max-width for text inputs and listboxes 4 https://bugs.webkit.org/show_bug.cgi?id=106675 5 6 Reviewed by Emil A Eklund. 7 8 * fast/forms/file/intrinsic-min-width-overrides-width-expected.html: 9 * fast/forms/file/intrinsic-min-width-overrides-width.html: 10 * fast/forms/select/listbox-intrinsic-min-width-applies-with-fixed-width-expected.html: Added. 11 * fast/forms/select/listbox-intrinsic-min-width-applies-with-fixed-width.html: Added. 12 1 13 2013-01-10 Ojan Vafai <ojan@chromium.org> 2 14 -
trunk/LayoutTests/fast/forms/file/intrinsic-min-width-overrides-width-expected.html
r139329 r139536 7 7 </style> 8 8 9 <input> 10 <input> 11 12 <br> 13 9 14 <input type="file"> 10 15 <input type="file"> -
trunk/LayoutTests/fast/forms/file/intrinsic-min-width-overrides-width.html
r139329 r139536 20 20 </style> 21 21 22 <input class="min"> 23 <input class="max"> 24 25 <br> 26 22 27 <input class="min" type="file"> 23 28 <input class="max" type="file"> -
trunk/Source/WebCore/ChangeLog
r139535 r139536 1 2013-01-11 Ojan Vafai <ojan@chromium.org> 2 3 Fixed width overrides intrinsic min-width/max-width for text inputs and listboxes 4 https://bugs.webkit.org/show_bug.cgi?id=106675 5 6 Reviewed by Emil A Eklund. 7 8 Implement computeIntrinsicLogicalWidths so that RenderBox::computeLogicalWidthInRegionUsing 9 can get the correct intrinsic sizes instead of the preferred sizes. 10 11 Test: fast/forms/select/listbox-intrinsic-min-width-applies-with-fixed-width.html 12 13 * rendering/RenderListBox.cpp: 14 (WebCore::RenderListBox::computeIntrinsicLogicalWidths): 15 (WebCore): 16 (WebCore::RenderListBox::computePreferredLogicalWidths): 17 * rendering/RenderListBox.h: 18 (RenderListBox): 19 * rendering/RenderTextControl.cpp: 20 (WebCore::RenderTextControl::computeIntrinsicLogicalWidths): 21 (WebCore): 22 (WebCore::RenderTextControl::computePreferredLogicalWidths): 23 * rendering/RenderTextControl.h: 24 (RenderTextControl): 25 1 26 2013-01-10 Ojan Vafai <ojan@chromium.org> 2 27 -
trunk/Source/WebCore/rendering/RenderListBox.cpp
r139503 r139536 204 204 } 205 205 206 void RenderListBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const 207 { 208 maxLogicalWidth = m_optionsWidth + 2 * optionsSpacingHorizontal; 209 if (m_vBar) 210 maxLogicalWidth += m_vBar->width(); 211 if (!style()->width().isPercent()) 212 minLogicalWidth = maxLogicalWidth; 213 } 214 206 215 void RenderListBox::computePreferredLogicalWidths() 207 216 { … … 213 222 if (style()->width().isFixed() && style()->width().value() > 0) 214 223 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = adjustContentBoxLogicalWidthForBoxSizing(style()->width().value()); 215 else { 216 m_maxPreferredLogicalWidth = m_optionsWidth + 2 * optionsSpacingHorizontal; 217 if (m_vBar) 218 m_maxPreferredLogicalWidth += m_vBar->width(); 219 220 if (!style()->width().isPercent()) 221 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth; 222 } 224 else 225 computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferredLogicalWidth); 223 226 224 227 if (style()->minWidth().isFixed() && style()->minWidth().value() > 0) { -
trunk/Source/WebCore/rendering/RenderListBox.h
r139503 r139536 76 76 virtual bool logicalScroll(ScrollLogicalDirection, ScrollGranularity, float multiplier = 1, Node** stopNode = 0); 77 77 78 virtual void computePreferredLogicalWidths(); 78 virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const OVERRIDE; 79 virtual void computePreferredLogicalWidths() OVERRIDE; 79 80 virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; 80 81 virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&) const OVERRIDE; -
trunk/Source/WebCore/rendering/RenderTextControl.cpp
r139216 r139536 255 255 } 256 256 257 void RenderTextControl::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const 258 { 259 // Use average character width. Matches IE. 260 AtomicString family = style()->font().family().family(); 261 maxLogicalWidth = preferredContentWidth(const_cast<RenderTextControl*>(this)->getAvgCharWidth(family)); 262 if (RenderBox* innerTextRenderBox = innerTextElement()->renderBox()) 263 maxLogicalWidth += innerTextRenderBox->paddingLeft() + innerTextRenderBox->paddingRight(); 264 if (!style()->width().isPercent()) 265 minLogicalWidth = maxLogicalWidth; 266 } 267 257 268 void RenderTextControl::computePreferredLogicalWidths() 258 269 { … … 264 275 if (style()->width().isFixed() && style()->width().value() >= 0) 265 276 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = adjustContentBoxLogicalWidthForBoxSizing(style()->width().value()); 266 else { 267 // Use average character width. Matches IE. 268 AtomicString family = style()->font().family().family(); 269 m_maxPreferredLogicalWidth = preferredContentWidth(getAvgCharWidth(family)); 270 if (RenderBox* innerTextRenderBox = innerTextElement()->renderBox()) 271 m_maxPreferredLogicalWidth += innerTextRenderBox->paddingLeft() + innerTextRenderBox->paddingRight(); 272 273 if (!style()->width().isPercent()) 274 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth; 275 } 277 else 278 computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferredLogicalWidth); 276 279 277 280 if (style()->minWidth().isFixed() && style()->minWidth().value() > 0) { -
trunk/Source/WebCore/rendering/RenderTextControl.h
r131322 r139536 69 69 virtual const char* renderName() const { return "RenderTextControl"; } 70 70 virtual bool isTextControl() const { return true; } 71 virtual void computePreferredLogicalWidths(); 71 virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const OVERRIDE; 72 virtual void computePreferredLogicalWidths() OVERRIDE; 72 73 virtual void removeLeftoverAnonymousBlock(RenderBlock*) { } 73 74 virtual bool avoidsFloats() const { return true; }
Note:
See TracChangeset
for help on using the changeset viewer.