Title: [113407] trunk/Source/WebCore
- Revision
- 113407
- Author
- commit-qu...@webkit.org
- Date
- 2012-04-05 20:04:45 -0700 (Thu, 05 Apr 2012)
Log Message
Remove intrinsic padding from contentBoxRect(), etc.
https://bugs.webkit.org/show_bug.cgi?id=83092
Patch by David Barton <dbar...@mathscribe.com> on 2012-04-05
Reviewed by Julien Chaffraix.
"Intrinsic padding" does not count as CSS padding, but is treated as padding by basic
layout and rendering code, e.g. RenderBlock::layout(). A lot of code relies on the
equation border-box = content-box + padding + border (+ scrollbars). To keep this valid,
change 5 functions in RenderBox.h to not include intrinsic padding in the content box,
thus reverting to their behavior before the patch for bug 33593. Instead, have
sizingBox(renderer) in CSSComputedStyleDeclaration.cpp explicitly put the intrinsic
padding in computed CSS content-box values [for _javascript_ getComputedStyle()], so the
above equation still also holds for CSS computed values. This seems more consistent with
how the padding...() functions behave since the patch for bug 23487, and will work
better for MathML. For instance, a block's contentLogicalWidth() will be the
availableLogicalWidth() for use by child elements.
No new tests. The only real observable changes are illustrated in the bug 83092 attached
test case and discussion. These are minor and hard to automate.
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::sizingBox):
* editing/DeleteSelectionCommand.cpp:
(WebCore::DeleteSelectionCommand::removeNode):
* rendering/RenderBox.h:
(WebCore::RenderBox::contentBoxRect):
(WebCore::RenderBox::contentWidth):
(WebCore::RenderBox::contentHeight):
(WebCore::RenderBox::contentLogicalWidth):
(WebCore::RenderBox::contentLogicalHeight):
- Change these 5 functions to omit intrinsic padding from the content box.
* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::cellBaselinePosition):
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::firstLineBoxBaseline):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (113406 => 113407)
--- trunk/Source/WebCore/ChangeLog 2012-04-06 02:51:07 UTC (rev 113406)
+++ trunk/Source/WebCore/ChangeLog 2012-04-06 03:04:45 UTC (rev 113407)
@@ -1,3 +1,41 @@
+2012-04-05 David Barton <dbar...@mathscribe.com>
+
+ Remove intrinsic padding from contentBoxRect(), etc.
+ https://bugs.webkit.org/show_bug.cgi?id=83092
+
+ Reviewed by Julien Chaffraix.
+
+ "Intrinsic padding" does not count as CSS padding, but is treated as padding by basic
+ layout and rendering code, e.g. RenderBlock::layout(). A lot of code relies on the
+ equation border-box = content-box + padding + border (+ scrollbars). To keep this valid,
+ change 5 functions in RenderBox.h to not include intrinsic padding in the content box,
+ thus reverting to their behavior before the patch for bug 33593. Instead, have
+ sizingBox(renderer) in CSSComputedStyleDeclaration.cpp explicitly put the intrinsic
+ padding in computed CSS content-box values [for _javascript_ getComputedStyle()], so the
+ above equation still also holds for CSS computed values. This seems more consistent with
+ how the padding...() functions behave since the patch for bug 23487, and will work
+ better for MathML. For instance, a block's contentLogicalWidth() will be the
+ availableLogicalWidth() for use by child elements.
+
+ No new tests. The only real observable changes are illustrated in the bug 83092 attached
+ test case and discussion. These are minor and hard to automate.
+
+ * css/CSSComputedStyleDeclaration.cpp:
+ (WebCore::sizingBox):
+ * editing/DeleteSelectionCommand.cpp:
+ (WebCore::DeleteSelectionCommand::removeNode):
+ * rendering/RenderBox.h:
+ (WebCore::RenderBox::contentBoxRect):
+ (WebCore::RenderBox::contentWidth):
+ (WebCore::RenderBox::contentHeight):
+ (WebCore::RenderBox::contentLogicalWidth):
+ (WebCore::RenderBox::contentLogicalHeight):
+ - Change these 5 functions to omit intrinsic padding from the content box.
+ * rendering/RenderTableCell.cpp:
+ (WebCore::RenderTableCell::cellBaselinePosition):
+ * rendering/RenderTableSection.cpp:
+ (WebCore::RenderTableSection::firstLineBoxBaseline):
+
2012-04-05 Hironori Bono <hb...@chromium.org>
[Chromium] moving a cursor on a misspelled word should not remove a misspelled underline
Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (113406 => 113407)
--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp 2012-04-06 02:51:07 UTC (rev 113406)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp 2012-04-06 03:04:45 UTC (rev 113407)
@@ -670,7 +670,13 @@
return LayoutRect();
RenderBox* box = toRenderBox(renderer);
- return box->style()->boxSizing() == CONTENT_BOX ? box->contentBoxRect() : box->borderBoxRect();
+ if (box->style()->boxSizing() == BORDER_BOX)
+ return box->borderBoxRect();
+ LayoutUnit cssPaddingLeft = box->paddingLeft(ExcludeIntrinsicPadding);
+ LayoutUnit cssPaddingTop = box->paddingTop(ExcludeIntrinsicPadding);
+ LayoutUnit cssWidth = box->clientWidth() - cssPaddingLeft - box->paddingRight(ExcludeIntrinsicPadding);
+ LayoutUnit cssHeight = box->clientHeight() - cssPaddingTop - box->paddingBottom(ExcludeIntrinsicPadding);
+ return LayoutRect(box->borderLeft() + cssPaddingLeft, box->borderTop() + cssPaddingTop, cssWidth, cssHeight);
}
static inline bool hasCompositedLayer(RenderObject* renderer)
Modified: trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp (113406 => 113407)
--- trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp 2012-04-06 02:51:07 UTC (rev 113406)
+++ trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp 2012-04-06 03:04:45 UTC (rev 113407)
@@ -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(IncludeIntrinsicPadding) <= 0) {
+ if (r && r->isTableCell() && toRenderTableCell(r)->contentHeight() <= 0) {
Position firstEditablePosition = firstEditablePositionInNode(node.get());
if (firstEditablePosition.isNotNull())
insertBlockPlaceholder(firstEditablePosition);
Modified: trunk/Source/WebCore/rendering/RenderBox.h (113406 => 113407)
--- trunk/Source/WebCore/rendering/RenderBox.h 2012-04-06 02:51:07 UTC (rev 113406)
+++ trunk/Source/WebCore/rendering/RenderBox.h 2012-04-06 03:04:45 UTC (rev 113407)
@@ -137,7 +137,7 @@
virtual IntRect borderBoundingBox() const { return borderBoxRect(); }
// The content area of the box (excludes padding and border).
- LayoutRect contentBoxRect(PaddingOptions paddingOption = ExcludeIntrinsicPadding) const { return LayoutRect(borderLeft() + paddingLeft(paddingOption), borderTop() + paddingTop(paddingOption), contentWidth(paddingOption), contentHeight(paddingOption)); }
+ LayoutRect contentBoxRect() const { return LayoutRect(borderLeft() + paddingLeft(), borderTop() + paddingTop(), contentWidth(), contentHeight()); }
// The content box in absolute coords. Ignores transforms.
IntRect absoluteContentBox() const;
// The content box converted to absolute coords (taking transforms into account).
@@ -184,10 +184,10 @@
void updateLayerTransform();
- 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); }
+ 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(); }
// 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/RenderTableCell.cpp (113406 => 113407)
--- trunk/Source/WebCore/rendering/RenderTableCell.cpp 2012-04-06 02:51:07 UTC (rev 113406)
+++ trunk/Source/WebCore/rendering/RenderTableCell.cpp 2012-04-06 03:04:45 UTC (rev 113407)
@@ -327,7 +327,7 @@
LayoutUnit firstLineBaseline = firstLineBoxBaseline();
if (firstLineBaseline != -1)
return firstLineBaseline;
- return paddingBefore() + borderBefore() + contentLogicalHeight(IncludeIntrinsicPadding);
+ return paddingBefore() + borderBefore() + contentLogicalHeight();
}
void RenderTableCell::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
Modified: trunk/Source/WebCore/rendering/RenderTableSection.cpp (113406 => 113407)
--- trunk/Source/WebCore/rendering/RenderTableSection.cpp 2012-04-06 02:51:07 UTC (rev 113406)
+++ trunk/Source/WebCore/rendering/RenderTableSection.cpp 2012-04-06 03:04:45 UTC (rev 113407)
@@ -946,7 +946,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(IncludeIntrinsicPadding));
+ firstLineBaseline = max(firstLineBaseline, cell->logicalTop() + cell->paddingBefore() + cell->borderBefore() + cell->contentLogicalHeight());
}
return firstLineBaseline;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes