Diff
Modified: trunk/LayoutTests/ChangeLog (154825 => 154826)
--- trunk/LayoutTests/ChangeLog 2013-08-29 18:28:03 UTC (rev 154825)
+++ trunk/LayoutTests/ChangeLog 2013-08-29 18:38:44 UTC (rev 154826)
@@ -1,3 +1,16 @@
+2013-08-29 Robert Hogan <[email protected]>
+
+ Positioned Replaced Elements That Aren't RenderReplaced get Incorrect Width
+ https://bugs.webkit.org/show_bug.cgi?id=93735
+
+ Reviewed by David Hyatt.
+
+ * fast/replaced/intrinsic-button-and-input-height-expected.txt: Added.
+ * fast/replaced/intrinsic-button-and-input-height.html: Added.
+ * fast/replaced/width-and-height-of-positioned-replaced-elements.html: Added.
+ * platform/qt/fast/replaced/width-and-height-of-positioned-replaced-elements-expected.png: Added.
+ * platform/qt/fast/replaced/width-and-height-of-positioned-replaced-elements-expected.txt: Added.
+
2013-08-29 Joseph Pecoraro <[email protected]>
Web Inspector: Consolidate inspector-protocol Debugger tests
Added: trunk/LayoutTests/fast/replaced/intrinsic-button-and-input-height-expected.txt (0 => 154826)
--- trunk/LayoutTests/fast/replaced/intrinsic-button-and-input-height-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/replaced/intrinsic-button-and-input-height-expected.txt 2013-08-29 18:38:44 UTC (rev 154826)
@@ -0,0 +1,6 @@
+webkit.org/b/93735 : Ensure positioned, replaced buttons and input elements get the correct intrinsic height when none is specified.
+
+Text
+PASS
+
+PASS
Added: trunk/LayoutTests/fast/replaced/intrinsic-button-and-input-height.html (0 => 154826)
--- trunk/LayoutTests/fast/replaced/intrinsic-button-and-input-height.html (rev 0)
+++ trunk/LayoutTests/fast/replaced/intrinsic-button-and-input-height.html 2013-08-29 18:38:44 UTC (rev 154826)
@@ -0,0 +1,35 @@
+<!doctype html>
+<head>
+ <style>
+
+ button, input {
+ position: absolute;
+ text-align: center;
+ padding: 7px 0 8px;
+ top: 8px
+ width: 70px ;
+ border: 0px;
+ font: 10px/1 Ahem;
+ }
+ input {
+ top: 80px;
+ }
+
+ </style>
+
+ <script src=""
+</head>
+<body>
+ <p>webkit.org/b/93735 : Ensure positioned, replaced buttons and input elements get the correct intrinsic height when none is specified.</p>
+ <div>
+ <button data-expected-height=25>
+ <span class="login">Text</span>
+ </button>
+ <input type="text" value="text" data-expected-height=25>
+ </div>
+ <script>
+ checkLayout('button');
+ checkLayout('input');
+ </script>
+</body>
+</html>
Added: trunk/LayoutTests/fast/replaced/width-and-height-of-positioned-replaced-elements.html (0 => 154826)
--- trunk/LayoutTests/fast/replaced/width-and-height-of-positioned-replaced-elements.html (rev 0)
+++ trunk/LayoutTests/fast/replaced/width-and-height-of-positioned-replaced-elements.html 2013-08-29 18:38:44 UTC (rev 154826)
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+input, select, textarea {
+ left: 5px;
+ right: 5px;
+ position: absolute;
+}
+</style>
+</head>
+<body>
+ <!-- webkit.org/b/93735: Use the replaced height and width computation for positioned form controls -->
+ <input id="input" style="top: 30px">
+ <input type="button" id="button" value="text" style="top: 80px">
+ <select id="select" style="top: 130px"><option>test</select>
+ <textarea id="textarea" style="top: 180px"></textarea>
+</body>
+</html>
Added: trunk/LayoutTests/platform/qt/fast/replaced/width-and-height-of-positioned-replaced-elements-expected.png
(Binary files differ)
Property changes on: trunk/LayoutTests/platform/qt/fast/replaced/width-and-height-of-positioned-replaced-elements-expected.png
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/platform/qt/fast/replaced/width-and-height-of-positioned-replaced-elements-expected.txt (0 => 154826)
--- trunk/LayoutTests/platform/qt/fast/replaced/width-and-height-of-positioned-replaced-elements-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/qt/fast/replaced/width-and-height-of-positioned-replaced-elements-expected.txt 2013-08-29 18:38:44 UTC (rev 154826)
@@ -0,0 +1,22 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x8
+ RenderBlock {HTML} at (0,0) size 800x8
+ RenderBody {BODY} at (8,8) size 784x0
+layer at (7,32) size 192x23
+ RenderTextControl {INPUT} at (7,32) size 192x23
+layer at (9,34) size 188x19
+ RenderBlock {DIV} at (2,2) size 188x19
+layer at (7,82) size 34x31
+ RenderButton {INPUT} at (7,82) size 34x31 [bgcolor=#C0C0C0]
+ RenderBlock (anonymous) at (6,6) size 22x19
+ RenderText at (0,0) size 22x19
+ text run at (0,0) width 22: "text"
+layer at (7,132) size 49x24
+ RenderMenuList {SELECT} at (7,132) size 49x24 [bgcolor=#FFFFFF]
+ RenderBlock (anonymous) at (4,2) size 21x20
+ RenderText at (0,0) size 21x19
+ text run at (0,0) width 21: "test"
+layer at (7,182) size 199x42
+ RenderTextControl {TEXTAREA} at (7,182) size 199x42
+ RenderBlock {DIV} at (2,2) size 195x19
Modified: trunk/Source/WebCore/ChangeLog (154825 => 154826)
--- trunk/Source/WebCore/ChangeLog 2013-08-29 18:28:03 UTC (rev 154825)
+++ trunk/Source/WebCore/ChangeLog 2013-08-29 18:38:44 UTC (rev 154826)
@@ -1,3 +1,50 @@
+2013-08-29 Robert Hogan <[email protected]>
+
+ Positioned Replaced Elements That Aren't RenderReplaced get Incorrect Width
+ https://bugs.webkit.org/show_bug.cgi?id=93735
+
+ Reviewed by David Hyatt.
+
+ Replaced elements that aren't RenderReplaced aren't |isReplaced| and don't have an
+ intrinsic height or width. This causes them to go down the wrong height and width computation
+ path in RenderBox when they are absolute positioned.
+
+ The notion of |isReplaced| is entwined with the notion of being |isInline| so it isn't really
+ possible to make them isReplaced without re-wiring a lot of code. So instead use an ad-hoc definition
+ of isReplacedElement in RenderBox to bring all replaced elements into the height and width calculation.
+ To make sure we get the right height and width in there, give non-RenderReplaced replaced renderers
+ the helpers for returning their approximation of intrinsic height and width.
+
+ The initial attempt at landing this patch had to be rolled out because it used LayoutUnit() for default
+ intrinsic height of some replaced elements and this made the layout of the elements unstable in some sites.
+ The fix for this issue is captured in intrinsic-button-and-input-height.html.
+
+ Tests: fast/replaced/intrinsic-button-and-input-height.html
+ fast/replaced/width-and-height-of-positioned-replaced-elements.html
+
+ * rendering/RenderBox.cpp:
+ (WebCore::isReplacedElement):
+ (WebCore::RenderBox::computePositionedLogicalWidth):
+ (WebCore::RenderBox::computePositionedLogicalHeight):
+ * rendering/RenderBox.h:
+ (WebCore::RenderBox::intrinsicSize):
+ * rendering/RenderButton.h:
+ * rendering/RenderFileUploadControl.cpp:
+ (WebCore::RenderFileUploadControl::computePreferredLogicalWidths):
+ * rendering/RenderListBox.cpp:
+ (WebCore::RenderListBox::RenderListBox):
+ (WebCore::RenderListBox::computePreferredLogicalWidths):
+ (WebCore::RenderListBox::computeLogicalHeight):
+ * rendering/RenderListBox.h:
+ * rendering/RenderMenuList.h:
+ * rendering/RenderReplaced.h:
+ * rendering/RenderSlider.cpp:
+ (WebCore::RenderSlider::computePreferredLogicalWidths):
+ * rendering/RenderTextControl.cpp:
+ (WebCore::RenderTextControl::RenderTextControl):
+ (WebCore::RenderTextControl::computeLogicalHeight):
+ * rendering/RenderTextControl.h:
+
2013-08-29 Brent Fulgham <[email protected]>
[Windows] Unreviewed gardening. Add missing *.css files from project.
Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (154825 => 154826)
--- trunk/Source/WebCore/rendering/RenderBox.cpp 2013-08-29 18:28:03 UTC (rev 154825)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp 2013-08-29 18:38:44 UTC (rev 154826)
@@ -3095,9 +3095,15 @@
}
}
+static bool isReplacedElement(const RenderBox* child)
+{
+ // FIXME: Bug 117267, we should make form control elements isReplaced too so that we can just check for that.
+ return child->isReplaced() || (child->node() && child->node()->isElementNode() && toElement(child->node())->isFormControlElement() && !child->isFieldset());
+}
+
void RenderBox::computePositionedLogicalWidth(LogicalExtentComputedValues& computedValues, RenderRegion* region) const
{
- if (isReplaced()) {
+ if (isReplacedElement(this)) {
// FIXME: Positioned replaced elements inside a flow thread are not working properly
// with variable width regions (see https://bugs.webkit.org/show_bug.cgi?id=69896 ).
computePositionedLogicalWidthReplaced(computedValues);
@@ -3438,7 +3444,7 @@
void RenderBox::computePositionedLogicalHeight(LogicalExtentComputedValues& computedValues) const
{
- if (isReplaced()) {
+ if (isReplacedElement(this)) {
computePositionedLogicalHeightReplaced(computedValues);
return;
}
Modified: trunk/Source/WebCore/rendering/RenderBox.h (154825 => 154826)
--- trunk/Source/WebCore/rendering/RenderBox.h 2013-08-29 18:28:03 UTC (rev 154825)
+++ trunk/Source/WebCore/rendering/RenderBox.h 2013-08-29 18:38:44 UTC (rev 154826)
@@ -408,7 +408,6 @@
return document().inQuirksMode() && style()->logicalHeight().isAuto() && !isFloatingOrOutOfFlowPositioned() && (isRoot() || isBody()) && !document().shouldDisplaySeamlesslyWithParent() && !isInline();
}
- virtual LayoutSize intrinsicSize() const { return LayoutSize(); }
LayoutUnit intrinsicLogicalWidth() const { return style()->isHorizontalWritingMode() ? intrinsicSize().width() : intrinsicSize().height(); }
LayoutUnit intrinsicLogicalHeight() const { return style()->isHorizontalWritingMode() ? intrinsicSize().height() : intrinsicSize().width(); }
@@ -657,6 +656,7 @@
LayoutUnit viewLogicalHeightForPercentages() const;
+ virtual LayoutSize intrinsicSize() const { return LayoutSize(); }
void computePositionedLogicalHeight(LogicalExtentComputedValues&) const;
void computePositionedLogicalWidthUsing(Length logicalWidth, const RenderBoxModelObject* containerBlock, TextDirection containerDirection,
LayoutUnit containerLogicalWidth, LayoutUnit bordersPlusPadding,
Modified: trunk/Source/WebCore/rendering/RenderButton.h (154825 => 154826)
--- trunk/Source/WebCore/rendering/RenderButton.h 2013-08-29 18:28:03 UTC (rev 154825)
+++ trunk/Source/WebCore/rendering/RenderButton.h 2013-08-29 18:38:44 UTC (rev 154826)
@@ -67,6 +67,8 @@
void timerFired(Timer<RenderButton>*);
+ virtual LayoutSize intrinsicSize() const OVERRIDE FINAL { return LayoutSize(maxPreferredLogicalWidth() - borderAndPaddingLogicalWidth(), logicalHeight() - borderAndPaddingLogicalHeight()); }
+
RenderTextFragment* m_buttonText;
RenderBlock* m_inner;
Modified: trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp (154825 => 154826)
--- trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp 2013-08-29 18:28:03 UTC (rev 154825)
+++ trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp 2013-08-29 18:38:44 UTC (rev 154826)
@@ -211,7 +211,7 @@
m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(style()->maxWidth().value()));
}
- int toAdd = borderAndPaddingWidth();
+ int toAdd = borderAndPaddingLogicalWidth();
m_minPreferredLogicalWidth += toAdd;
m_maxPreferredLogicalWidth += toAdd;
Modified: trunk/Source/WebCore/rendering/RenderListBox.cpp (154825 => 154826)
--- trunk/Source/WebCore/rendering/RenderListBox.cpp 2013-08-29 18:28:03 UTC (rev 154825)
+++ trunk/Source/WebCore/rendering/RenderListBox.cpp 2013-08-29 18:38:44 UTC (rev 154826)
@@ -89,6 +89,7 @@
, m_inAutoscroll(false)
, m_optionsWidth(0)
, m_indexOffset(0)
+ , m_intrinsicLogicalHeight(0)
{
ASSERT(element);
ASSERT(element->isHTMLElement());
@@ -232,7 +233,7 @@
m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(style()->maxWidth().value()));
}
- LayoutUnit toAdd = borderAndPaddingWidth();
+ LayoutUnit toAdd = borderAndPaddingLogicalWidth();
m_minPreferredLogicalWidth += toAdd;
m_maxPreferredLogicalWidth += toAdd;
@@ -266,8 +267,8 @@
void RenderListBox::computeLogicalHeight(LayoutUnit, LayoutUnit logicalTop, LogicalExtentComputedValues& computedValues) const
{
- LayoutUnit height = itemHeight() * size() - rowSpacing + borderAndPaddingHeight();
- RenderBox::computeLogicalHeight(height, logicalTop, computedValues);
+ m_intrinsicLogicalHeight = itemHeight() * size() - rowSpacing + borderAndPaddingLogicalHeight();
+ RenderBox::computeLogicalHeight(m_intrinsicLogicalHeight, logicalTop, computedValues);
}
int RenderListBox::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode lineDirection, LinePositionMode linePositionMode) const
Modified: trunk/Source/WebCore/rendering/RenderListBox.h (154825 => 154826)
--- trunk/Source/WebCore/rendering/RenderListBox.h 2013-08-29 18:28:03 UTC (rev 154825)
+++ trunk/Source/WebCore/rendering/RenderListBox.h 2013-08-29 18:38:44 UTC (rev 154826)
@@ -88,6 +88,8 @@
virtual void autoscroll(const IntPoint&);
virtual void stopAutoscroll();
+ virtual LayoutSize intrinsicSize() const OVERRIDE FINAL { return LayoutSize(maxPreferredLogicalWidth() - borderAndPaddingLogicalWidth(), m_intrinsicLogicalHeight - borderAndPaddingLogicalHeight()); }
+
virtual bool shouldPanScroll() const { return true; }
virtual void panScroll(const IntPoint&);
@@ -149,6 +151,7 @@
bool m_inAutoscroll;
int m_optionsWidth;
int m_indexOffset;
+ mutable LayoutUnit m_intrinsicLogicalHeight;
RefPtr<Scrollbar> m_vBar;
};
Modified: trunk/Source/WebCore/rendering/RenderMenuList.h (154825 => 154826)
--- trunk/Source/WebCore/rendering/RenderMenuList.h 2013-08-29 18:28:03 UTC (rev 154825)
+++ trunk/Source/WebCore/rendering/RenderMenuList.h 2013-08-29 18:38:44 UTC (rev 154826)
@@ -75,6 +75,7 @@
virtual const char* renderName() const { return "RenderMenuList"; }
+ virtual LayoutSize intrinsicSize() const OVERRIDE FINAL { return LayoutSize(maxPreferredLogicalWidth() - borderAndPaddingLogicalWidth(), logicalHeight() - borderAndPaddingLogicalHeight()); }
virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const OVERRIDE;
virtual void computePreferredLogicalWidths() OVERRIDE;
Modified: trunk/Source/WebCore/rendering/RenderSlider.cpp (154825 => 154826)
--- trunk/Source/WebCore/rendering/RenderSlider.cpp 2013-08-29 18:28:03 UTC (rev 154825)
+++ trunk/Source/WebCore/rendering/RenderSlider.cpp 2013-08-29 18:38:44 UTC (rev 154826)
@@ -98,7 +98,7 @@
m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(style()->maxWidth().value()));
}
- LayoutUnit toAdd = borderAndPaddingWidth();
+ LayoutUnit toAdd = borderAndPaddingLogicalWidth();
m_minPreferredLogicalWidth += toAdd;
m_maxPreferredLogicalWidth += toAdd;
Modified: trunk/Source/WebCore/rendering/RenderTextControl.cpp (154825 => 154826)
--- trunk/Source/WebCore/rendering/RenderTextControl.cpp 2013-08-29 18:28:03 UTC (rev 154825)
+++ trunk/Source/WebCore/rendering/RenderTextControl.cpp 2013-08-29 18:38:44 UTC (rev 154826)
@@ -38,6 +38,7 @@
RenderTextControl::RenderTextControl(Element* element)
: RenderBlock(element)
+ , m_intrinsicLogicalHeight(0)
{
ASSERT(isHTMLTextFormControlElement(element));
}
@@ -142,21 +143,20 @@
return ScrollbarTheme::theme()->scrollbarThickness();
}
-void RenderTextControl::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues& computedValues) const
+void RenderTextControl::computeLogicalHeight(LayoutUnit, LayoutUnit logicalTop, LogicalExtentComputedValues& computedValues) const
{
HTMLElement* innerText = innerTextElement();
ASSERT(innerText);
if (RenderBox* innerTextBox = innerText->renderBox()) {
LayoutUnit nonContentHeight = innerTextBox->borderAndPaddingHeight() + innerTextBox->marginHeight();
- logicalHeight = computeControlLogicalHeight(innerTextBox->lineHeight(true, HorizontalLine, PositionOfInteriorLineBoxes), nonContentHeight) + borderAndPaddingHeight();
+ m_intrinsicLogicalHeight = computeControlLogicalHeight(innerTextBox->lineHeight(true, HorizontalLine, PositionOfInteriorLineBoxes), nonContentHeight) + borderAndPaddingLogicalHeight();
// We are able to have a horizontal scrollbar if the overflow style is scroll, or if its auto and there's no word wrap.
if ((isHorizontalWritingMode() && (style()->overflowX() == OSCROLL || (style()->overflowX() == OAUTO && innerText->renderer()->style()->overflowWrap() == NormalOverflowWrap)))
|| (!isHorizontalWritingMode() && (style()->overflowY() == OSCROLL || (style()->overflowY() == OAUTO && innerText->renderer()->style()->overflowWrap() == NormalOverflowWrap))))
- logicalHeight += scrollbarThickness();
+ m_intrinsicLogicalHeight += scrollbarThickness();
}
-
- RenderBox::computeLogicalHeight(logicalHeight, logicalTop, computedValues);
+ RenderBox::computeLogicalHeight(m_intrinsicLogicalHeight, logicalTop, computedValues);
}
void RenderTextControl::hitInnerTextElement(HitTestResult& result, const LayoutPoint& pointInContainer, const LayoutPoint& accumulatedOffset)
Modified: trunk/Source/WebCore/rendering/RenderTextControl.h (154825 => 154826)
--- trunk/Source/WebCore/rendering/RenderTextControl.h 2013-08-29 18:28:03 UTC (rev 154825)
+++ trunk/Source/WebCore/rendering/RenderTextControl.h 2013-08-29 18:38:44 UTC (rev 154826)
@@ -81,6 +81,10 @@
virtual bool canBeProgramaticallyScrolled() const { return true; }
virtual bool requiresForcedStyleRecalcPropagation() const { return true; }
+
+ virtual LayoutSize intrinsicSize() const OVERRIDE FINAL { return LayoutSize(maxPreferredLogicalWidth() - borderAndPaddingLogicalWidth(), m_intrinsicLogicalHeight - borderAndPaddingLogicalHeight()); }
+
+ mutable LayoutUnit m_intrinsicLogicalHeight;
};
inline RenderTextControl* toRenderTextControl(RenderObject* object)