Diff
Modified: trunk/LayoutTests/ChangeLog (139535 => 139536)
--- trunk/LayoutTests/ChangeLog 2013-01-12 02:21:28 UTC (rev 139535)
+++ trunk/LayoutTests/ChangeLog 2013-01-12 02:29:31 UTC (rev 139536)
@@ -1,3 +1,15 @@
+2013-01-11 Ojan Vafai <o...@chromium.org>
+
+ Fixed width overrides intrinsic min-width/max-width for text inputs and listboxes
+ https://bugs.webkit.org/show_bug.cgi?id=106675
+
+ Reviewed by Emil A Eklund.
+
+ * fast/forms/file/intrinsic-min-width-overrides-width-expected.html:
+ * fast/forms/file/intrinsic-min-width-overrides-width.html:
+ * fast/forms/select/listbox-intrinsic-min-width-applies-with-fixed-width-expected.html: Added.
+ * fast/forms/select/listbox-intrinsic-min-width-applies-with-fixed-width.html: Added.
+
2013-01-10 Ojan Vafai <o...@chromium.org>
Setting width overrides intrinsic min-width/max-width on flexboxes and their subclasses
Modified: trunk/LayoutTests/fast/forms/file/intrinsic-min-width-overrides-width-expected.html (139535 => 139536)
--- trunk/LayoutTests/fast/forms/file/intrinsic-min-width-overrides-width-expected.html 2013-01-12 02:21:28 UTC (rev 139535)
+++ trunk/LayoutTests/fast/forms/file/intrinsic-min-width-overrides-width-expected.html 2013-01-12 02:29:31 UTC (rev 139536)
@@ -6,5 +6,10 @@
}
</style>
+<input>
+<input>
+
+<br>
+
<input type="file">
<input type="file">
Modified: trunk/LayoutTests/fast/forms/file/intrinsic-min-width-overrides-width.html (139535 => 139536)
--- trunk/LayoutTests/fast/forms/file/intrinsic-min-width-overrides-width.html 2013-01-12 02:21:28 UTC (rev 139535)
+++ trunk/LayoutTests/fast/forms/file/intrinsic-min-width-overrides-width.html 2013-01-12 02:29:31 UTC (rev 139536)
@@ -19,5 +19,10 @@
}
</style>
+<input class="min">
+<input class="max">
+
+<br>
+
<input class="min" type="file">
<input class="max" type="file">
Added: trunk/LayoutTests/fast/forms/select/listbox-intrinsic-min-width-applies-with-fixed-width-expected.html (0 => 139536)
--- trunk/LayoutTests/fast/forms/select/listbox-intrinsic-min-width-applies-with-fixed-width-expected.html (rev 0)
+++ trunk/LayoutTests/fast/forms/select/listbox-intrinsic-min-width-applies-with-fixed-width-expected.html 2013-01-12 02:29:31 UTC (rev 139536)
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<style>
+select {
+ outline: 2px solid;
+ margin: 0;
+}
+</style>
+<body>
+<p>Check that min-width intrinsic size still applies if a fixed width is set.</p>
+
+<select multiple></select>
+
+<select multiple></select>
+
+<select multiple></select>
+
+<div style="width: 30px">
+ <select multiple></select>
+</div>
+
+<div style="width: 10px">
+ <select multiple></select>
+</div>
+
+</body>
Added: trunk/LayoutTests/fast/forms/select/listbox-intrinsic-min-width-applies-with-fixed-width.html (0 => 139536)
--- trunk/LayoutTests/fast/forms/select/listbox-intrinsic-min-width-applies-with-fixed-width.html (rev 0)
+++ trunk/LayoutTests/fast/forms/select/listbox-intrinsic-min-width-applies-with-fixed-width.html 2013-01-12 02:29:31 UTC (rev 139536)
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<style>
+.min-content {
+ width: 1px;
+ min-width: -webkit-min-content;
+ min-width: -moz-min-content;
+ min-width: -ie-min-content;
+ min-width: -o-min-content;
+ min-width: min-content;
+}
+.max-content {
+ width: 1px;
+ min-width: -webkit-max-content;
+ min-width: -moz-max-content;
+ min-width: -ie-max-content;
+ min-width: -o-max-content;
+ min-width: max-content;
+}
+.fit-content {
+ width: 1px;
+ min-width: -webkit-fit-content;
+ min-width: -moz-fit-content;
+ min-width: -ie-fit-content;
+ min-width: -o-fit-content;
+ min-width: fit-content;
+}
+select {
+ outline: 2px solid;
+ margin: 0;
+}
+</style>
+<body>
+<p>Check that min-width intrinsic size still applies if a fixed width is set.</p>
+
+<select multiple class="min-content"></select>
+
+<select multiple class="max-content"></select>
+
+<select multiple class="fit-content"></select>
+
+<div style="width: 30px">
+ <select multiple class="fit-content"></select>
+</div>
+
+<div style="width: 10px">
+ <select multiple class="fit-content"></select>
+</div>
+
+</body>
Modified: trunk/Source/WebCore/ChangeLog (139535 => 139536)
--- trunk/Source/WebCore/ChangeLog 2013-01-12 02:21:28 UTC (rev 139535)
+++ trunk/Source/WebCore/ChangeLog 2013-01-12 02:29:31 UTC (rev 139536)
@@ -1,3 +1,28 @@
+2013-01-11 Ojan Vafai <o...@chromium.org>
+
+ Fixed width overrides intrinsic min-width/max-width for text inputs and listboxes
+ https://bugs.webkit.org/show_bug.cgi?id=106675
+
+ Reviewed by Emil A Eklund.
+
+ Implement computeIntrinsicLogicalWidths so that RenderBox::computeLogicalWidthInRegionUsing
+ can get the correct intrinsic sizes instead of the preferred sizes.
+
+ Test: fast/forms/select/listbox-intrinsic-min-width-applies-with-fixed-width.html
+
+ * rendering/RenderListBox.cpp:
+ (WebCore::RenderListBox::computeIntrinsicLogicalWidths):
+ (WebCore):
+ (WebCore::RenderListBox::computePreferredLogicalWidths):
+ * rendering/RenderListBox.h:
+ (RenderListBox):
+ * rendering/RenderTextControl.cpp:
+ (WebCore::RenderTextControl::computeIntrinsicLogicalWidths):
+ (WebCore):
+ (WebCore::RenderTextControl::computePreferredLogicalWidths):
+ * rendering/RenderTextControl.h:
+ (RenderTextControl):
+
2013-01-10 Ojan Vafai <o...@chromium.org>
Setting width overrides intrinsic min-width/max-width on flexboxes and their subclasses
Modified: trunk/Source/WebCore/rendering/RenderListBox.cpp (139535 => 139536)
--- trunk/Source/WebCore/rendering/RenderListBox.cpp 2013-01-12 02:21:28 UTC (rev 139535)
+++ trunk/Source/WebCore/rendering/RenderListBox.cpp 2013-01-12 02:29:31 UTC (rev 139536)
@@ -203,6 +203,15 @@
scrollToRevealElementAtListIndex(firstIndex);
}
+void RenderListBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const
+{
+ maxLogicalWidth = m_optionsWidth + 2 * optionsSpacingHorizontal;
+ if (m_vBar)
+ maxLogicalWidth += m_vBar->width();
+ if (!style()->width().isPercent())
+ minLogicalWidth = maxLogicalWidth;
+}
+
void RenderListBox::computePreferredLogicalWidths()
{
ASSERT(!m_optionsChanged);
@@ -212,15 +221,9 @@
if (style()->width().isFixed() && style()->width().value() > 0)
m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = adjustContentBoxLogicalWidthForBoxSizing(style()->width().value());
- else {
- m_maxPreferredLogicalWidth = m_optionsWidth + 2 * optionsSpacingHorizontal;
- if (m_vBar)
- m_maxPreferredLogicalWidth += m_vBar->width();
+ else
+ computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferredLogicalWidth);
- if (!style()->width().isPercent())
- m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth;
- }
-
if (style()->minWidth().isFixed() && style()->minWidth().value() > 0) {
m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(style()->minWidth().value()));
m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(style()->minWidth().value()));
Modified: trunk/Source/WebCore/rendering/RenderListBox.h (139535 => 139536)
--- trunk/Source/WebCore/rendering/RenderListBox.h 2013-01-12 02:21:28 UTC (rev 139535)
+++ trunk/Source/WebCore/rendering/RenderListBox.h 2013-01-12 02:29:31 UTC (rev 139536)
@@ -75,7 +75,8 @@
virtual bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1, Node** stopNode = 0);
virtual bool logicalScroll(ScrollLogicalDirection, ScrollGranularity, float multiplier = 1, Node** stopNode = 0);
- virtual void computePreferredLogicalWidths();
+ virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const OVERRIDE;
+ virtual void computePreferredLogicalWidths() OVERRIDE;
virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&) const OVERRIDE;
Modified: trunk/Source/WebCore/rendering/RenderTextControl.cpp (139535 => 139536)
--- trunk/Source/WebCore/rendering/RenderTextControl.cpp 2013-01-12 02:21:28 UTC (rev 139535)
+++ trunk/Source/WebCore/rendering/RenderTextControl.cpp 2013-01-12 02:29:31 UTC (rev 139536)
@@ -254,6 +254,17 @@
return roundf(style()->font().size() * x / unitsPerEm);
}
+void RenderTextControl::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const
+{
+ // Use average character width. Matches IE.
+ AtomicString family = style()->font().family().family();
+ maxLogicalWidth = preferredContentWidth(const_cast<RenderTextControl*>(this)->getAvgCharWidth(family));
+ if (RenderBox* innerTextRenderBox = innerTextElement()->renderBox())
+ maxLogicalWidth += innerTextRenderBox->paddingLeft() + innerTextRenderBox->paddingRight();
+ if (!style()->width().isPercent())
+ minLogicalWidth = maxLogicalWidth;
+}
+
void RenderTextControl::computePreferredLogicalWidths()
{
ASSERT(preferredLogicalWidthsDirty());
@@ -263,17 +274,9 @@
if (style()->width().isFixed() && style()->width().value() >= 0)
m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = adjustContentBoxLogicalWidthForBoxSizing(style()->width().value());
- else {
- // Use average character width. Matches IE.
- AtomicString family = style()->font().family().family();
- m_maxPreferredLogicalWidth = preferredContentWidth(getAvgCharWidth(family));
- if (RenderBox* innerTextRenderBox = innerTextElement()->renderBox())
- m_maxPreferredLogicalWidth += innerTextRenderBox->paddingLeft() + innerTextRenderBox->paddingRight();
+ else
+ computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferredLogicalWidth);
- if (!style()->width().isPercent())
- m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth;
- }
-
if (style()->minWidth().isFixed() && style()->minWidth().value() > 0) {
m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(style()->minWidth().value()));
m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(style()->minWidth().value()));
Modified: trunk/Source/WebCore/rendering/RenderTextControl.h (139535 => 139536)
--- trunk/Source/WebCore/rendering/RenderTextControl.h 2013-01-12 02:21:28 UTC (rev 139535)
+++ trunk/Source/WebCore/rendering/RenderTextControl.h 2013-01-12 02:29:31 UTC (rev 139536)
@@ -68,7 +68,8 @@
private:
virtual const char* renderName() const { return "RenderTextControl"; }
virtual bool isTextControl() const { return true; }
- virtual void computePreferredLogicalWidths();
+ virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const OVERRIDE;
+ virtual void computePreferredLogicalWidths() OVERRIDE;
virtual void removeLeftoverAnonymousBlock(RenderBlock*) { }
virtual bool avoidsFloats() const { return true; }
virtual bool canHaveGeneratedChildren() const OVERRIDE { return false; }