Diff
Modified: trunk/LayoutTests/ChangeLog (109817 => 109818)
--- trunk/LayoutTests/ChangeLog 2012-03-06 00:47:10 UTC (rev 109817)
+++ trunk/LayoutTests/ChangeLog 2012-03-06 00:51:37 UTC (rev 109818)
@@ -1,3 +1,16 @@
+2012-03-05 Alexis Menard <alexis.men...@openbossa.org>
+
+ getComputedStyle gives incorrect information for 'height' property
+ https://bugs.webkit.org/show_bug.cgi?id=33593
+
+ Reviewed by David Hyatt.
+
+ Make sure that the contentBoxRect doesn't take into account the
+ intrinsic padding.
+
+ * fast/css/getComputedStyle/getComputedStyle-height-expected.txt: Added.
+ * fast/css/getComputedStyle/getComputedStyle-height.html: Added.
+
2012-03-05 Robert Kroeger <rjkro...@chromium.org>
Correct a test to work the same on Gtk and non-Gtk chromium in
Added: trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-height-expected.txt (0 => 109818)
--- trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-height-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-height-expected.txt 2012-03-06 00:51:37 UTC (rev 109818)
@@ -0,0 +1,10 @@
+Test the computed height of a cell : https://bugs.webkit.org/show_bug.cgi?id=33593.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS computedStyle.getPropertyValue('height') is '200px'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-height.html (0 => 109818)
--- trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-height.html (rev 0)
+++ trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-height.html 2012-03-06 00:51:37 UTC (rev 109818)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style type="text/css">
+ table td {
+ padding: 20px;
+ border: 10px solid blue;
+ }
+
+ #cell1 {
+ height: 200px;
+ }
+</style>
+<script src=""
+</head>
+<body>
+<table border="0" cellspacing="0" cellpadding="0" id="table">
+ <tr id="row1">
+ <td id="cell1">height</td>
+ </tr>
+</table>
+<script>
+
+description("Test the computed height of a cell : https://bugs.webkit.org/show_bug.cgi?id=33593.")
+
+e = document.getElementById('cell1');
+table = document.getElementById('table');
+computedStyle = window.getComputedStyle(e, null);
+
+shouldBe("computedStyle.getPropertyValue('height')", "'200px'");
+
+document.body.removeChild(table);
+
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (109817 => 109818)
--- trunk/Source/WebCore/ChangeLog 2012-03-06 00:47:10 UTC (rev 109817)
+++ trunk/Source/WebCore/ChangeLog 2012-03-06 00:51:37 UTC (rev 109818)
@@ -1,3 +1,51 @@
+2012-03-05 Alexis Menard <alexis.men...@openbossa.org>
+
+ getComputedStyle gives incorrect information for 'height' property
+ https://bugs.webkit.org/show_bug.cgi?id=33593
+
+ Reviewed by David Hyatt.
+
+ Make sure that the contentBoxRect doesn't take into account the
+ intrinsic padding when querying it. As stated by http://www.w3.org/TR/css3-box/#the-lsquo0
+ the height is the content area which doesn't include the intrinsic padding, the border, and
+ the padding.
+
+ Test: fast/css/getComputedStyle/getComputedStyle-height.html
+
+ * css/CSSComputedStyleDeclaration.cpp:
+ (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
+ * editing/DeleteSelectionCommand.cpp:
+ (WebCore::DeleteSelectionCommand::removeNode):
+ * rendering/RenderBox.h:
+ (WebCore::RenderBox::contentBoxRect):
+ (WebCore::RenderBox::contentWidth):
+ (WebCore::RenderBox::contentHeight):
+ (WebCore::RenderBox::contentLogicalWidth):
+ (WebCore::RenderBox::contentLogicalHeight):
+ * rendering/RenderBoxModelObject.cpp:
+ (WebCore::RenderBoxModelObject::paddingTop):
+ (WebCore::RenderBoxModelObject::paddingBottom):
+ (WebCore::RenderBoxModelObject::paddingLeft):
+ (WebCore::RenderBoxModelObject::paddingRight):
+ (WebCore::RenderBoxModelObject::paddingBefore):
+ (WebCore::RenderBoxModelObject::paddingAfter):
+ (WebCore::RenderBoxModelObject::paddingStart):
+ (WebCore::RenderBoxModelObject::paddingEnd):
+ * rendering/RenderBoxModelObject.h:
+ (RenderBoxModelObject):
+ * rendering/RenderTableCell.cpp:
+ (WebCore::RenderTableCell::paddingTop):
+ (WebCore::RenderTableCell::paddingBottom):
+ (WebCore::RenderTableCell::paddingLeft):
+ (WebCore::RenderTableCell::paddingRight):
+ (WebCore::RenderTableCell::paddingBefore):
+ (WebCore::RenderTableCell::paddingAfter):
+ (WebCore::RenderTableCell::cellBaselinePosition):
+ * rendering/RenderTableCell.h:
+ (RenderTableCell):
+ * rendering/RenderTableSection.cpp:
+ (WebCore::RenderTableSection::firstLineBoxBaseline):
+
2012-03-05 MORITA Hajime <morr...@google.com>
https://bugs.webkit.org/show_bug.cgi?id=80257
Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (109817 => 109818)
--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp 2012-03-06 00:47:10 UTC (rev 109817)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp 2012-03-06 00:51:37 UTC (rev 109818)
@@ -1834,19 +1834,19 @@
return cssValuePool->createValue(style->overflowY());
case CSSPropertyPaddingTop:
if (renderer && renderer->isBox())
- return zoomAdjustedPixelValue(toRenderBox(renderer)->paddingTop(false), style.get(), cssValuePool);
+ return zoomAdjustedPixelValue(toRenderBox(renderer)->paddingTop(ExcludeIntrinsicPadding), style.get(), cssValuePool);
return zoomAdjustedPixelValueForLength(style->paddingTop(), style.get(), cssValuePool);
case CSSPropertyPaddingRight:
if (renderer && renderer->isBox())
- return zoomAdjustedPixelValue(toRenderBox(renderer)->paddingRight(false), style.get(), cssValuePool);
+ return zoomAdjustedPixelValue(toRenderBox(renderer)->paddingRight(ExcludeIntrinsicPadding), style.get(), cssValuePool);
return zoomAdjustedPixelValueForLength(style->paddingRight(), style.get(), cssValuePool);
case CSSPropertyPaddingBottom:
if (renderer && renderer->isBox())
- return zoomAdjustedPixelValue(toRenderBox(renderer)->paddingBottom(false), style.get(), cssValuePool);
+ return zoomAdjustedPixelValue(toRenderBox(renderer)->paddingBottom(ExcludeIntrinsicPadding), style.get(), cssValuePool);
return zoomAdjustedPixelValueForLength(style->paddingBottom(), style.get(), cssValuePool);
case CSSPropertyPaddingLeft:
if (renderer && renderer->isBox())
- return zoomAdjustedPixelValue(toRenderBox(renderer)->paddingLeft(false), style.get(), cssValuePool);
+ return zoomAdjustedPixelValue(toRenderBox(renderer)->paddingLeft(ExcludeIntrinsicPadding), style.get(), cssValuePool);
return zoomAdjustedPixelValueForLength(style->paddingLeft(), style.get(), cssValuePool);
case CSSPropertyPageBreakAfter:
return cssValuePool->createValue(style->pageBreakAfter());
Modified: trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp (109817 => 109818)
--- trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp 2012-03-06 00:47:10 UTC (rev 109817)
+++ trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp 2012-03-06 00:51:37 UTC (rev 109818)
@@ -363,7 +363,7 @@
// Make sure empty cell has some height, if a placeholder can be inserted.
document()->updateLayoutIgnorePendingStylesheets();
RenderObject *r = node->renderer();
- if (r && r->isTableCell() && toRenderTableCell(r)->contentHeight() <= 0) {
+ if (r && r->isTableCell() && toRenderTableCell(r)->contentHeight(IncludeIntrinsicPadding) <= 0) {
Position firstEditablePosition = firstEditablePositionInNode(node.get());
if (firstEditablePosition.isNotNull())
insertBlockPlaceholder(firstEditablePosition);
Modified: trunk/Source/WebCore/rendering/RenderBox.h (109817 => 109818)
--- trunk/Source/WebCore/rendering/RenderBox.h 2012-03-06 00:47:10 UTC (rev 109817)
+++ trunk/Source/WebCore/rendering/RenderBox.h 2012-03-06 00:51:37 UTC (rev 109818)
@@ -131,7 +131,7 @@
virtual LayoutRect borderBoundingBox() const { return borderBoxRect(); }
// The content area of the box (excludes padding and border).
- LayoutRect contentBoxRect() const { return LayoutRect(borderLeft() + paddingLeft(), borderTop() + paddingTop(), contentWidth(), contentHeight()); }
+ LayoutRect contentBoxRect(PaddingOptions paddingOption = ExcludeIntrinsicPadding) const { return LayoutRect(borderLeft() + paddingLeft(paddingOption), borderTop() + paddingTop(paddingOption), contentWidth(paddingOption), contentHeight(paddingOption)); }
// The content box in absolute coords. Ignores transforms.
LayoutRect absoluteContentBox() const;
// The content box converted to absolute coords (taking transforms into account).
@@ -178,10 +178,10 @@
void updateLayerTransform();
- LayoutUnit contentWidth() const { return clientWidth() - paddingLeft() - paddingRight(); }
- LayoutUnit contentHeight() const { return clientHeight() - paddingTop() - paddingBottom(); }
- LayoutUnit contentLogicalWidth() const { return style()->isHorizontalWritingMode() ? contentWidth() : contentHeight(); }
- LayoutUnit contentLogicalHeight() const { return style()->isHorizontalWritingMode() ? contentHeight() : contentWidth(); }
+ LayoutUnit contentWidth(PaddingOptions paddingOption = ExcludeIntrinsicPadding) const { return clientWidth() - paddingLeft(paddingOption) - paddingRight(paddingOption); }
+ LayoutUnit contentHeight(PaddingOptions paddingOption = ExcludeIntrinsicPadding) const { return clientHeight() - paddingTop(paddingOption) - paddingBottom(paddingOption); }
+ LayoutUnit contentLogicalWidth(PaddingOptions paddingOption = ExcludeIntrinsicPadding) const { return style()->isHorizontalWritingMode() ? contentWidth(paddingOption) : contentHeight(paddingOption); }
+ LayoutUnit contentLogicalHeight(PaddingOptions paddingOption = ExcludeIntrinsicPadding) const { return style()->isHorizontalWritingMode() ? contentHeight(paddingOption) : contentWidth(paddingOption); }
// IE extensions. Used to calculate offsetWidth/Height. Overridden by inlines (RenderFlow)
// to return the remaining width on a given line (and the height of a single line).
Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (109817 => 109818)
--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2012-03-06 00:47:10 UTC (rev 109817)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2012-03-06 00:51:37 UTC (rev 109818)
@@ -537,7 +537,7 @@
return offsetHeight();
}
-LayoutUnit RenderBoxModelObject::paddingTop(bool) const
+LayoutUnit RenderBoxModelObject::paddingTop(PaddingOptions) const
{
LayoutUnit w = 0;
Length padding = style()->paddingTop();
@@ -546,7 +546,7 @@
return padding.calcMinValue(w);
}
-LayoutUnit RenderBoxModelObject::paddingBottom(bool) const
+LayoutUnit RenderBoxModelObject::paddingBottom(PaddingOptions) const
{
LayoutUnit w = 0;
Length padding = style()->paddingBottom();
@@ -555,7 +555,7 @@
return padding.calcMinValue(w);
}
-LayoutUnit RenderBoxModelObject::paddingLeft(bool) const
+LayoutUnit RenderBoxModelObject::paddingLeft(PaddingOptions) const
{
LayoutUnit w = 0;
Length padding = style()->paddingLeft();
@@ -564,7 +564,7 @@
return padding.calcMinValue(w);
}
-LayoutUnit RenderBoxModelObject::paddingRight(bool) const
+LayoutUnit RenderBoxModelObject::paddingRight(PaddingOptions) const
{
LayoutUnit w = 0;
Length padding = style()->paddingRight();
@@ -573,7 +573,7 @@
return padding.calcMinValue(w);
}
-LayoutUnit RenderBoxModelObject::paddingBefore(bool) const
+LayoutUnit RenderBoxModelObject::paddingBefore(PaddingOptions) const
{
LayoutUnit w = 0;
Length padding = style()->paddingBefore();
@@ -582,7 +582,7 @@
return padding.calcMinValue(w);
}
-LayoutUnit RenderBoxModelObject::paddingAfter(bool) const
+LayoutUnit RenderBoxModelObject::paddingAfter(PaddingOptions) const
{
LayoutUnit w = 0;
Length padding = style()->paddingAfter();
@@ -591,7 +591,7 @@
return padding.calcMinValue(w);
}
-LayoutUnit RenderBoxModelObject::paddingStart(bool) const
+LayoutUnit RenderBoxModelObject::paddingStart(PaddingOptions) const
{
LayoutUnit w = 0;
Length padding = style()->paddingStart();
@@ -600,7 +600,7 @@
return padding.calcMinValue(w);
}
-LayoutUnit RenderBoxModelObject::paddingEnd(bool) const
+LayoutUnit RenderBoxModelObject::paddingEnd(PaddingOptions) const
{
LayoutUnit w = 0;
Length padding = style()->paddingEnd();
Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.h (109817 => 109818)
--- trunk/Source/WebCore/rendering/RenderBoxModelObject.h 2012-03-06 00:47:10 UTC (rev 109817)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.h 2012-03-06 00:51:37 UTC (rev 109818)
@@ -40,6 +40,8 @@
BackgroundBleedUseTransparencyLayer
};
+enum PaddingOptions { IncludeIntrinsicPadding, ExcludeIntrinsicPadding };
+
// This class is the base for all objects that adhere to the CSS box model as described
// at http://www.w3.org/TR/CSS21/box.html
@@ -78,14 +80,14 @@
virtual LayoutRect borderBoundingBox() const = 0;
// Virtual since table cells override
- virtual LayoutUnit paddingTop(bool includeIntrinsicPadding = true) const;
- virtual LayoutUnit paddingBottom(bool includeIntrinsicPadding = true) const;
- virtual LayoutUnit paddingLeft(bool includeIntrinsicPadding = true) const;
- virtual LayoutUnit paddingRight(bool includeIntrinsicPadding = true) const;
- virtual LayoutUnit paddingBefore(bool includeIntrinsicPadding = true) const;
- virtual LayoutUnit paddingAfter(bool includeIntrinsicPadding = true) const;
- virtual LayoutUnit paddingStart(bool includeIntrinsicPadding = true) const;
- virtual LayoutUnit paddingEnd(bool includeIntrinsicPadding = true) const;
+ virtual LayoutUnit paddingTop(PaddingOptions = IncludeIntrinsicPadding) const;
+ virtual LayoutUnit paddingBottom(PaddingOptions = IncludeIntrinsicPadding) const;
+ virtual LayoutUnit paddingLeft(PaddingOptions = IncludeIntrinsicPadding) const;
+ virtual LayoutUnit paddingRight(PaddingOptions = IncludeIntrinsicPadding) const;
+ virtual LayoutUnit paddingBefore(PaddingOptions = IncludeIntrinsicPadding) const;
+ virtual LayoutUnit paddingAfter(PaddingOptions = IncludeIntrinsicPadding) const;
+ virtual LayoutUnit paddingStart(PaddingOptions = IncludeIntrinsicPadding) const;
+ virtual LayoutUnit paddingEnd(PaddingOptions = IncludeIntrinsicPadding) const;
virtual int borderTop() const { return style()->borderTopWidth(); }
virtual int borderBottom() const { return style()->borderBottomWidth(); }
Modified: trunk/Source/WebCore/rendering/RenderTableCell.cpp (109817 => 109818)
--- trunk/Source/WebCore/rendering/RenderTableCell.cpp 2012-03-06 00:47:10 UTC (rev 109817)
+++ trunk/Source/WebCore/rendering/RenderTableCell.cpp 2012-03-06 00:51:37 UTC (rev 109818)
@@ -191,51 +191,51 @@
setCellWidthChanged(false);
}
-LayoutUnit RenderTableCell::paddingTop(bool includeIntrinsicPadding) const
+LayoutUnit RenderTableCell::paddingTop(PaddingOptions paddingOption) const
{
LayoutUnit result = RenderBlock::paddingTop();
- if (!includeIntrinsicPadding || !isHorizontalWritingMode())
+ if (paddingOption == ExcludeIntrinsicPadding || !isHorizontalWritingMode())
return result;
return result + (style()->writingMode() == TopToBottomWritingMode ? intrinsicPaddingBefore() : intrinsicPaddingAfter());
}
-LayoutUnit RenderTableCell::paddingBottom(bool includeIntrinsicPadding) const
+LayoutUnit RenderTableCell::paddingBottom(PaddingOptions paddingOption) const
{
LayoutUnit result = RenderBlock::paddingBottom();
- if (!includeIntrinsicPadding || !isHorizontalWritingMode())
+ if (paddingOption == ExcludeIntrinsicPadding || !isHorizontalWritingMode())
return result;
return result + (style()->writingMode() == TopToBottomWritingMode ? intrinsicPaddingAfter() : intrinsicPaddingBefore());
}
-LayoutUnit RenderTableCell::paddingLeft(bool includeIntrinsicPadding) const
+LayoutUnit RenderTableCell::paddingLeft(PaddingOptions paddingOption) const
{
LayoutUnit result = RenderBlock::paddingLeft();
- if (!includeIntrinsicPadding || isHorizontalWritingMode())
+ if (paddingOption == ExcludeIntrinsicPadding || isHorizontalWritingMode())
return result;
return result + (style()->writingMode() == LeftToRightWritingMode ? intrinsicPaddingBefore() : intrinsicPaddingAfter());
}
-LayoutUnit RenderTableCell::paddingRight(bool includeIntrinsicPadding) const
+LayoutUnit RenderTableCell::paddingRight(PaddingOptions paddingOption) const
{
LayoutUnit result = RenderBlock::paddingRight();
- if (!includeIntrinsicPadding || isHorizontalWritingMode())
+ if (paddingOption == ExcludeIntrinsicPadding || isHorizontalWritingMode())
return result;
return result + (style()->writingMode() == LeftToRightWritingMode ? intrinsicPaddingAfter() : intrinsicPaddingBefore());
}
-LayoutUnit RenderTableCell::paddingBefore(bool includeIntrinsicPadding) const
+LayoutUnit RenderTableCell::paddingBefore(PaddingOptions paddingOption) const
{
LayoutUnit result = RenderBlock::paddingBefore();
- if (!includeIntrinsicPadding)
+ if (paddingOption == ExcludeIntrinsicPadding)
return result;
return result + intrinsicPaddingBefore();
}
-LayoutUnit RenderTableCell::paddingAfter(bool includeIntrinsicPadding) const
+LayoutUnit RenderTableCell::paddingAfter(PaddingOptions paddingOption) const
{
LayoutUnit result = RenderBlock::paddingAfter();
- if (!includeIntrinsicPadding)
+ if (paddingOption == ExcludeIntrinsicPadding)
return result;
return result + intrinsicPaddingAfter();
}
@@ -328,7 +328,7 @@
LayoutUnit firstLineBaseline = firstLineBoxBaseline();
if (firstLineBaseline != -1)
return firstLineBaseline;
- return paddingBefore() + borderBefore() + contentLogicalHeight();
+ return paddingBefore() + borderBefore() + contentLogicalHeight(IncludeIntrinsicPadding);
}
void RenderTableCell::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
Modified: trunk/Source/WebCore/rendering/RenderTableCell.h (109817 => 109818)
--- trunk/Source/WebCore/rendering/RenderTableCell.h 2012-03-06 00:47:10 UTC (rev 109817)
+++ trunk/Source/WebCore/rendering/RenderTableCell.h 2012-03-06 00:51:37 UTC (rev 109818)
@@ -120,16 +120,16 @@
int intrinsicPaddingBefore() const { return m_intrinsicPaddingBefore; }
int intrinsicPaddingAfter() const { return m_intrinsicPaddingAfter; }
- virtual LayoutUnit paddingTop(bool includeIntrinsicPadding = true) const;
- virtual LayoutUnit paddingBottom(bool includeIntrinsicPadding = true) const;
- virtual LayoutUnit paddingLeft(bool includeIntrinsicPadding = true) const;
- virtual LayoutUnit paddingRight(bool includeIntrinsicPadding = true) const;
+ virtual LayoutUnit paddingTop(PaddingOptions = IncludeIntrinsicPadding) const;
+ virtual LayoutUnit paddingBottom(PaddingOptions = IncludeIntrinsicPadding) const;
+ virtual LayoutUnit paddingLeft(PaddingOptions = IncludeIntrinsicPadding) const;
+ virtual LayoutUnit paddingRight(PaddingOptions = IncludeIntrinsicPadding) const;
// FIXME: For now we just assume the cell has the same block flow direction as the table. It's likely we'll
// create an extra anonymous RenderBlock to handle mixing directionality anyway, in which case we can lock
// the block flow directionality of the cells to the table's directionality.
- virtual LayoutUnit paddingBefore(bool includeIntrinsicPadding = true) const;
- virtual LayoutUnit paddingAfter(bool includeIntrinsicPadding = true) const;
+ virtual LayoutUnit paddingBefore(PaddingOptions = IncludeIntrinsicPadding) const;
+ virtual LayoutUnit paddingAfter(PaddingOptions = IncludeIntrinsicPadding) const;
void setOverrideHeightFromRowHeight(LayoutUnit);
Modified: trunk/Source/WebCore/rendering/RenderTableSection.cpp (109817 => 109818)
--- trunk/Source/WebCore/rendering/RenderTableSection.cpp 2012-03-06 00:47:10 UTC (rev 109817)
+++ trunk/Source/WebCore/rendering/RenderTableSection.cpp 2012-03-06 00:51:37 UTC (rev 109818)
@@ -912,7 +912,7 @@
const CellStruct& cs = firstRow.at(i);
const RenderTableCell* cell = cs.primaryCell();
if (cell)
- firstLineBaseline = max(firstLineBaseline, cell->logicalTop() + cell->paddingBefore() + cell->borderBefore() + cell->contentLogicalHeight());
+ firstLineBaseline = max(firstLineBaseline, cell->logicalTop() + cell->paddingBefore() + cell->borderBefore() + cell->contentLogicalHeight(IncludeIntrinsicPadding));
}
return firstLineBaseline;