Diff
Modified: trunk/Source/WebCore/ChangeLog (94705 => 94706)
--- trunk/Source/WebCore/ChangeLog 2011-09-07 20:13:34 UTC (rev 94705)
+++ trunk/Source/WebCore/ChangeLog 2011-09-07 20:18:14 UTC (rev 94706)
@@ -1,3 +1,47 @@
+2011-09-02 Ojan Vafai <o...@chromium.org>
+
+ split overrideSize into overrideHeight and overrideWidth
+ https://bugs.webkit.org/show_bug.cgi?id=67550
+
+ Reviewed by Sam Weinig.
+
+ All uses of overrideSize only set one of the width or the height.
+ This change removes a bool from RenderObject and removes some
+ flexbox specific logic from RenderBox.
+
+ The only downside is that we have two global maps where we used
+ to have one.
+
+ No functional changes so existing tests are sufficient.
+
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::hasOverrideHeight):
+ (WebCore::RenderBox::hasOverrideWidth):
+ (WebCore::RenderBox::setOverrideHeight):
+ (WebCore::RenderBox::setOverrideWidth):
+ (WebCore::RenderBox::clearOverrideSize):
+ (WebCore::RenderBox::overrideWidth):
+ (WebCore::RenderBox::overrideHeight):
+ (WebCore::RenderBox::computeLogicalWidth):
+ (WebCore::RenderBox::computeLogicalHeight):
+ (WebCore::RenderBox::computePercentageLogicalHeight):
+ * rendering/RenderBox.h:
+ * rendering/RenderDeprecatedFlexibleBox.cpp:
+ (WebCore::RenderDeprecatedFlexibleBox::layoutHorizontalBox):
+ (WebCore::RenderDeprecatedFlexibleBox::layoutVerticalBox):
+ (WebCore::RenderDeprecatedFlexibleBox::applyLineClamp):
+ * rendering/RenderFlexibleBox.cpp:
+ (WebCore::RenderFlexibleBox::layoutAndPlaceChildrenHorizontal):
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::RenderObject):
+ * rendering/RenderObject.h:
+ * rendering/RenderTableCell.cpp:
+ (WebCore::RenderTableCell::setOverrideHeightFromRowHeight):
+ * rendering/RenderTableCell.h:
+ * rendering/RenderTableSection.cpp:
+ (WebCore::RenderTableSection::calcRowLogicalHeight):
+ (WebCore::RenderTableSection::layoutRows):
+
2011-09-07 Alexei Svitkine <asvitk...@chromium.org>
Add test infrastructure to test rubber-banding overhang drawing along with layout tests for existing Chromium Mac overhang drawing in the non-gpu path.
Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (94705 => 94706)
--- trunk/Source/WebCore/rendering/RenderBox.cpp 2011-09-07 20:13:34 UTC (rev 94705)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp 2011-09-07 20:18:14 UTC (rev 94706)
@@ -61,8 +61,9 @@
using namespace HTMLNames;
// Used by flexible boxes when flexing this element and by table cells.
-typedef WTF::HashMap<const RenderBox*, LayoutSize> OverrideSizeMap;
-static OverrideSizeMap* gOverrideSizeMap = 0;
+typedef WTF::HashMap<const RenderBox*, LayoutUnit> OverrideSizeMap;
+static OverrideSizeMap* gOverrideHeightMap = 0;
+static OverrideSizeMap* gOverrideWidthMap = 0;
bool RenderBox::s_hadOverflowClip = false;
@@ -692,37 +693,46 @@
return m_maxPreferredLogicalWidth;
}
-LayoutSize RenderBox::overrideSize() const
+bool RenderBox::hasOverrideHeight() const
{
- if (!hasOverrideSize())
- return LayoutSize(-1, -1);
- return gOverrideSizeMap->get(this);
+ return gOverrideHeightMap && gOverrideHeightMap->contains(this);
}
-void RenderBox::setOverrideSize(const LayoutSize& size)
+bool RenderBox::hasOverrideWidth() const
{
- if (!gOverrideSizeMap)
- gOverrideSizeMap = new OverrideSizeMap();
- setHasOverrideSize(true);
- gOverrideSizeMap->set(this, size);
+ return gOverrideWidthMap && gOverrideWidthMap->contains(this);
}
+void RenderBox::setOverrideHeight(LayoutUnit height)
+{
+ if (!gOverrideHeightMap)
+ gOverrideHeightMap = new OverrideSizeMap();
+ gOverrideHeightMap->set(this, height);
+}
+
+void RenderBox::setOverrideWidth(LayoutUnit width)
+{
+ if (!gOverrideWidthMap)
+ gOverrideWidthMap = new OverrideSizeMap();
+ gOverrideWidthMap->set(this, width);
+}
+
void RenderBox::clearOverrideSize()
{
- if (!hasOverrideSize())
- return;
- setHasOverrideSize(false);
- gOverrideSizeMap->remove(this);
+ if (hasOverrideHeight())
+ gOverrideHeightMap->remove(this);
+ if (hasOverrideWidth())
+ gOverrideWidthMap->remove(this);
}
LayoutUnit RenderBox::overrideWidth() const
{
- return hasOverrideSize() ? overrideSize().width() : width();
+ return hasOverrideWidth() ? gOverrideWidthMap->get(this) : width();
}
LayoutUnit RenderBox::overrideHeight() const
{
- return hasOverrideSize() ? overrideSize().height() : height();
+ return hasOverrideHeight() ? gOverrideHeightMap->get(this) : height();
}
LayoutUnit RenderBox::computeBorderBoxLogicalWidth(LayoutUnit width) const
@@ -1572,18 +1582,10 @@
// width. Use the width from the style context.
// FIXME: Account for block-flow in flexible boxes.
// https://bugs.webkit.org/show_bug.cgi?id=46418
- if (hasOverrideSize() && parent()->style()->boxOrient() == HORIZONTAL
- && parent()->isDeprecatedFlexibleBox() && parent()->isFlexingChildren()) {
+ if (hasOverrideWidth() && parent()->isFlexibleBoxIncludingDeprecated()) {
setLogicalWidth(overrideWidth());
return;
}
-#if ENABLE(CSS3_FLEXBOX)
- // FIXME: Check direction once flex-direction is implemented.
- if (hasOverrideSize() && parent()->isFlexibleBox()) {
- setLogicalWidth(overrideWidth());
- return;
- }
-#endif
// FIXME: Account for block-flow in flexible boxes.
// https://bugs.webkit.org/show_bug.cgi?id=46418
@@ -1800,8 +1802,7 @@
// grab our cached flexible height.
// FIXME: Account for block-flow in flexible boxes.
// https://bugs.webkit.org/show_bug.cgi?id=46418
- if (hasOverrideSize() && parent()->isDeprecatedFlexibleBox() && parent()->style()->boxOrient() == VERTICAL
- && parent()->isFlexingChildren())
+ if (hasOverrideHeight() && parent()->isFlexibleBoxIncludingDeprecated())
h = Length(overrideHeight() - borderAndPaddingLogicalHeight(), Fixed);
else if (treatAsReplaced)
h = Length(computeReplacedLogicalHeight(), Fixed);
@@ -1922,7 +1923,7 @@
// be a percentage of the cell's current content height.
if (cb->isTableCell()) {
if (!skippedAutoHeightContainingBlock) {
- if (!cb->hasOverrideSize()) {
+ if (!cb->hasOverrideHeight()) {
// Normally we would let the cell size intrinsically, but scrolling overflow has to be
// treated differently, since WinIE lets scrolled overflow regions shrink as needed.
// While we can't get all cases right, we can at least detect when the cell has a specified
Modified: trunk/Source/WebCore/rendering/RenderBox.h (94705 => 94706)
--- trunk/Source/WebCore/rendering/RenderBox.h 2011-09-07 20:13:34 UTC (rev 94705)
+++ trunk/Source/WebCore/rendering/RenderBox.h 2011-09-07 20:18:14 UTC (rev 94706)
@@ -242,10 +242,12 @@
virtual LayoutUnit minPreferredLogicalWidth() const;
virtual LayoutUnit maxPreferredLogicalWidth() const;
- LayoutSize overrideSize() const;
LayoutUnit overrideWidth() const;
LayoutUnit overrideHeight() const;
- void setOverrideSize(const LayoutSize&);
+ bool hasOverrideHeight() const;
+ bool hasOverrideWidth() const;
+ void setOverrideHeight(LayoutUnit);
+ void setOverrideWidth(LayoutUnit);
void clearOverrideSize();
virtual LayoutSize offsetFromContainer(RenderObject*, const LayoutPoint&) const;
Modified: trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp (94705 => 94706)
--- trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp 2011-09-07 20:13:34 UTC (rev 94705)
+++ trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp 2011-09-07 20:18:14 UTC (rev 94706)
@@ -516,7 +516,7 @@
if (allowedChildFlex(child, expanding, i)) {
LayoutUnit spaceAdd = static_cast<LayoutUnit>(spaceAvailableThisPass * (child->style()->boxFlex() / totalFlex));
if (spaceAdd) {
- child->setOverrideSize(LayoutSize(child->overrideWidth() + spaceAdd, 0));
+ child->setOverrideWidth(child->overrideWidth() + spaceAdd);
m_flexingChildren = true;
relayoutChildren = true;
}
@@ -533,7 +533,7 @@
LayoutUnit spaceAdd = groupRemainingSpace > 0 ? 1 : -1;
for (RenderBox* child = iterator.first(); child && groupRemainingSpace; child = iterator.next()) {
if (allowedChildFlex(child, expanding, i)) {
- child->setOverrideSize(LayoutSize(child->overrideWidth() + spaceAdd, 0));
+ child->setOverrideWidth(child->overrideWidth() + spaceAdd);
m_flexingChildren = true;
relayoutChildren = true;
remainingSpace -= spaceAdd;
@@ -762,7 +762,7 @@
if (allowedChildFlex(child, expanding, i)) {
LayoutUnit spaceAdd = static_cast<LayoutUnit>(spaceAvailableThisPass * (child->style()->boxFlex() / totalFlex));
if (spaceAdd) {
- child->setOverrideSize(LayoutSize(0, child->overrideHeight() + spaceAdd));
+ child->setOverrideHeight(child->overrideHeight() + spaceAdd);
m_flexingChildren = true;
relayoutChildren = true;
}
@@ -779,7 +779,7 @@
LayoutUnit spaceAdd = groupRemainingSpace > 0 ? 1 : -1;
for (RenderBox* child = iterator.first(); child && groupRemainingSpace; child = iterator.next()) {
if (allowedChildFlex(child, expanding, i)) {
- child->setOverrideSize(LayoutSize(0, child->overrideHeight() + spaceAdd));
+ child->setOverrideHeight(child->overrideHeight() + spaceAdd);
m_flexingChildren = true;
relayoutChildren = true;
remainingSpace -= spaceAdd;
@@ -893,7 +893,7 @@
continue;
child->setChildNeedsLayout(true, false);
- child->setOverrideSize(LayoutSize(0, newHeight));
+ child->setOverrideHeight(newHeight);
m_flexingChildren = true;
child->layoutIfNeeded();
m_flexingChildren = false;
Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (94705 => 94706)
--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp 2011-09-07 20:13:34 UTC (rev 94705)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp 2011-09-07 20:18:14 UTC (rev 94706)
@@ -252,7 +252,7 @@
for (RenderBox* child = iterator.first(); child; child = iterator.next(), ++i) {
LayoutUnit childPreferredSize = child->borderLeft() + child->paddingLeft() + childSizes[i] + child->paddingRight() + child->borderRight();
// FIXME: Handle vertical writing modes with horizontal flexing.
- child->setOverrideSize(LayoutSize(childPreferredSize, 0));
+ child->setOverrideWidth(childPreferredSize);
child->setChildNeedsLayout(true);
child->layoutIfNeeded();
Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (94705 => 94706)
--- trunk/Source/WebCore/rendering/RenderObject.cpp 2011-09-07 20:13:34 UTC (rev 94705)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp 2011-09-07 20:18:14 UTC (rev 94706)
@@ -215,7 +215,6 @@
, m_hasOverflowClip(false)
, m_hasTransform(false)
, m_hasReflection(false)
- , m_hasOverrideSize(false)
, m_hasCounterNodeMap(false)
, m_everHadLayout(false)
, m_childrenInline(false)
Modified: trunk/Source/WebCore/rendering/RenderObject.h (94705 => 94706)
--- trunk/Source/WebCore/rendering/RenderObject.h 2011-09-07 20:13:34 UTC (rev 94705)
+++ trunk/Source/WebCore/rendering/RenderObject.h 2011-09-07 20:18:14 UTC (rev 94706)
@@ -780,9 +780,6 @@
virtual bool willRenderImage(CachedImage*);
void selectionStartEnd(int& spos, int& epos) const;
-
- bool hasOverrideSize() const { return m_hasOverrideSize; }
- void setHasOverrideSize(bool b) { m_hasOverrideSize = b; }
void remove() { if (parent()) parent()->removeChild(this); }
@@ -873,8 +870,6 @@
bool m_hasOverflowClip : 1; // Set in the case of overflow:auto/scroll/hidden
bool m_hasTransform : 1;
bool m_hasReflection : 1;
-
- bool m_hasOverrideSize : 1;
public:
bool m_hasCounterNodeMap : 1;
Modified: trunk/Source/WebCore/rendering/RenderTableCell.cpp (94705 => 94706)
--- trunk/Source/WebCore/rendering/RenderTableCell.cpp 2011-09-07 20:13:34 UTC (rev 94705)
+++ trunk/Source/WebCore/rendering/RenderTableCell.cpp 2011-09-07 20:18:14 UTC (rev 94706)
@@ -212,10 +212,10 @@
return result + intrinsicPaddingAfter();
}
-void RenderTableCell::setOverrideSizeFromRowHeight(int rowHeight)
+void RenderTableCell::setOverrideHeightFromRowHeight(int rowHeight)
{
clearIntrinsicPadding();
- RenderBlock::setOverrideSize(LayoutSize(0, max<LayoutUnit>(0, rowHeight - borderBefore() - paddingBefore() - borderAfter() - paddingAfter())));
+ RenderBlock::setOverrideHeight(max<LayoutUnit>(0, rowHeight - borderBefore() - paddingBefore() - borderAfter() - paddingAfter()));
}
LayoutSize RenderTableCell::offsetFromContainer(RenderObject* o, const LayoutPoint& point) const
Modified: trunk/Source/WebCore/rendering/RenderTableCell.h (94705 => 94706)
--- trunk/Source/WebCore/rendering/RenderTableCell.h 2011-09-07 20:13:34 UTC (rev 94705)
+++ trunk/Source/WebCore/rendering/RenderTableCell.h 2011-09-07 20:18:14 UTC (rev 94706)
@@ -119,7 +119,7 @@
virtual LayoutUnit paddingBefore(bool includeIntrinsicPadding = true) const;
virtual LayoutUnit paddingAfter(bool includeIntrinsicPadding = true) const;
- void setOverrideSizeFromRowHeight(int);
+ void setOverrideHeightFromRowHeight(int);
bool hasVisualOverflow() const { return m_overflow && !borderBoxRect().contains(m_overflow->visualOverflowRect()); }
Modified: trunk/Source/WebCore/rendering/RenderTableSection.cpp (94705 => 94706)
--- trunk/Source/WebCore/rendering/RenderTableSection.cpp 2011-09-07 20:13:34 UTC (rev 94705)
+++ trunk/Source/WebCore/rendering/RenderTableSection.cpp 2011-09-07 20:18:14 UTC (rev 94706)
@@ -344,7 +344,7 @@
int indx = max(r - cell->rowSpan() + 1, 0);
- if (cell->hasOverrideSize()) {
+ if (cell->hasOverrideHeight()) {
if (!statePusher.didPush()) {
// Technically, we should also push state for the row, but since
// rows don't push a coordinate transform, that's not necessary.
@@ -572,7 +572,7 @@
// Alignment within a cell is based off the calculated
// height, which becomes irrelevant once the cell has
// been resized based off its percentage.
- cell->setOverrideSizeFromRowHeight(rHeight);
+ cell->setOverrideHeightFromRowHeight(rHeight);
cell->layoutIfNeeded();
// If the baseline moved, we may have to update the data for our row. Find out the new baseline.