Diff
Modified: trunk/Source/WebCore/ChangeLog (90516 => 90517)
--- trunk/Source/WebCore/ChangeLog 2011-07-06 23:49:25 UTC (rev 90516)
+++ trunk/Source/WebCore/ChangeLog 2011-07-06 23:55:06 UTC (rev 90517)
@@ -1,3 +1,57 @@
+2011-07-06 Levi Weintraub <[email protected]>
+
+ Switch Overflow and FrameRect methods in InlineBox to Layout Units
+ https://bugs.webkit.org/show_bug.cgi?id=64034
+
+ Reviewed by Eric Seidel.
+
+ Switching Overflow and FrameRect methods on InlineBox to new Layout Unit abstraction and
+ cleaning up some compilation errors that crop up when building with floating point layout units.
+
+ No new tests, no functionality changes.
+
+ * css/CSSComputedStyleDeclaration.cpp:
+ (WebCore::sizingBox):
+ * dom/Document.h:
+ * editing/DeleteButtonController.cpp:
+ (WebCore::isDeletableElement):
+ * inspector/DOMNodeHighlighter.cpp:
+ (WebCore::DOMNodeHighlighter::drawNodeHighlight):
+ * page/animation/AnimationBase.cpp:
+ (WebCore::blendFunc):
+ * platform/ScrollView.h:
+ (WebCore::ScrollView::visibleWidth):
+ (WebCore::ScrollView::visibleHeight):
+ * platform/ScrollableArea.h:
+ (WebCore::ScrollableArea::visibleHeight):
+ (WebCore::ScrollableArea::visibleWidth):
+ * platform/graphics/FloatPoint.h: Adding FloatPoint and FloatSize move[By] functions
+ (WebCore::FloatPoint::move):
+ (WebCore::FloatPoint::moveBy):
+ * rendering/AutoTableLayout.cpp:
+ (WebCore::AutoTableLayout::computePreferredLogicalWidths):
+ (WebCore::AutoTableLayout::layout):
+ * rendering/InlineFlowBox.h:
+ (WebCore::InlineFlowBox::layoutOverflowRect):
+ (WebCore::InlineFlowBox::logicalLeftLayoutOverflow):
+ (WebCore::InlineFlowBox::logicalRightLayoutOverflow):
+ (WebCore::InlineFlowBox::logicalTopLayoutOverflow):
+ (WebCore::InlineFlowBox::logicalBottomLayoutOverflow):
+ (WebCore::InlineFlowBox::logicalLayoutOverflowRect):
+ (WebCore::InlineFlowBox::visualOverflowRect):
+ (WebCore::InlineFlowBox::logicalLeftVisualOverflow):
+ (WebCore::InlineFlowBox::logicalRightVisualOverflow):
+ (WebCore::InlineFlowBox::logicalTopVisualOverflow):
+ (WebCore::InlineFlowBox::logicalBottomVisualOverflow):
+ (WebCore::InlineFlowBox::logicalVisualOverflowRect):
+ (WebCore::InlineFlowBox::frameRectIncludingLineHeight):
+ (WebCore::InlineFlowBox::logicalFrameRectIncludingLineHeight):
+ * rendering/RenderBlock.h:
+ (WebCore::RenderBlock::RenderBlockRareData::positiveMarginBeforeDefault):
+ (WebCore::RenderBlock::RenderBlockRareData::negativeMarginBeforeDefault):
+ (WebCore::RenderBlock::RenderBlockRareData::positiveMarginAfterDefault):
+ (WebCore::RenderBlock::RenderBlockRareData::negativeMarginAfterDefault):
+
2011-07-06 Emil A Eklund <[email protected]>
Reviewed by Eric Seidel.
Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (90516 => 90517)
--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp 2011-07-06 23:49:25 UTC (rev 90516)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp 2011-07-06 23:55:06 UTC (rev 90517)
@@ -444,10 +444,10 @@
return list.release();
}
-static IntRect sizingBox(RenderObject* renderer)
+static LayoutRect sizingBox(RenderObject* renderer)
{
if (!renderer->isBox())
- return IntRect();
+ return LayoutRect();
RenderBox* box = toRenderBox(renderer);
return box->style()->boxSizing() == CONTENT_BOX ? box->contentBoxRect() : box->borderBoxRect();
Modified: trunk/Source/WebCore/dom/Document.h (90516 => 90517)
--- trunk/Source/WebCore/dom/Document.h 2011-07-06 23:49:25 UTC (rev 90516)
+++ trunk/Source/WebCore/dom/Document.h 2011-07-06 23:55:06 UTC (rev 90517)
@@ -35,6 +35,7 @@
#include "DocumentTiming.h"
#include "IconURL.h"
#include "IntRect.h"
+#include "LayoutTypes.h"
#include "PageVisibilityState.h"
#include "QualifiedName.h"
#include "ScriptExecutionContext.h"
@@ -1378,7 +1379,7 @@
Timer<Document> m_fullScreenChangeDelayTimer;
Deque<RefPtr<Element> > m_fullScreenChangeEventTargetQueue;
bool m_isAnimatingFullScreen;
- IntRect m_savedPlaceholderFrameRect;
+ LayoutRect m_savedPlaceholderFrameRect;
RefPtr<RenderStyle> m_savedPlaceholderRenderStyle;
#endif
Modified: trunk/Source/WebCore/editing/DeleteButtonController.cpp (90516 => 90517)
--- trunk/Source/WebCore/editing/DeleteButtonController.cpp 2011-07-06 23:49:25 UTC (rev 90516)
+++ trunk/Source/WebCore/editing/DeleteButtonController.cpp 2011-07-06 23:55:06 UTC (rev 90517)
@@ -90,7 +90,7 @@
return false;
RenderBox* box = toRenderBox(renderer);
- IntRect borderBoundingBox = box->borderBoundingBox();
+ LayoutRect borderBoundingBox = box->borderBoundingBox();
if (borderBoundingBox.width() < minimumWidth || borderBoundingBox.height() < minimumHeight)
return false;
Modified: trunk/Source/WebCore/inspector/DOMNodeHighlighter.cpp (90516 => 90517)
--- trunk/Source/WebCore/inspector/DOMNodeHighlighter.cpp 2011-07-06 23:49:25 UTC (rev 90516)
+++ trunk/Source/WebCore/inspector/DOMNodeHighlighter.cpp 2011-07-06 23:55:06 UTC (rev 90517)
@@ -231,8 +231,8 @@
if (!renderer || !containingFrame)
return;
- IntSize mainFrameOffset = frameToMainFrameOffset(containingFrame);
- IntRect boundingBox = renderer->absoluteBoundingBoxRect(true);
+ LayoutSize mainFrameOffset = frameToMainFrameOffset(containingFrame);
+ LayoutRect boundingBox = renderer->absoluteBoundingBoxRect(true);
boundingBox.move(mainFrameOffset);
@@ -255,15 +255,15 @@
RenderBox* renderBox = toRenderBox(renderer);
// RenderBox returns the "pure" content area box, exclusive of the scrollbars (if present), which also count towards the content area in CSS.
- IntRect contentBox = renderBox->contentBoxRect();
+ LayoutRect contentBox = renderBox->contentBoxRect();
contentBox.setWidth(contentBox.width() + renderBox->verticalScrollbarWidth());
contentBox.setHeight(contentBox.height() + renderBox->horizontalScrollbarHeight());
- IntRect paddingBox(contentBox.x() - renderBox->paddingLeft(), contentBox.y() - renderBox->paddingTop(),
+ LayoutRect paddingBox(contentBox.x() - renderBox->paddingLeft(), contentBox.y() - renderBox->paddingTop(),
contentBox.width() + renderBox->paddingLeft() + renderBox->paddingRight(), contentBox.height() + renderBox->paddingTop() + renderBox->paddingBottom());
- IntRect borderBox(paddingBox.x() - renderBox->borderLeft(), paddingBox.y() - renderBox->borderTop(),
+ LayoutRect borderBox(paddingBox.x() - renderBox->borderLeft(), paddingBox.y() - renderBox->borderTop(),
paddingBox.width() + renderBox->borderLeft() + renderBox->borderRight(), paddingBox.height() + renderBox->borderTop() + renderBox->borderBottom());
- IntRect marginBox(borderBox.x() - renderBox->marginLeft(), borderBox.y() - renderBox->marginTop(),
+ LayoutRect marginBox(borderBox.x() - renderBox->marginLeft(), borderBox.y() - renderBox->marginTop(),
borderBox.width() + renderBox->marginLeft() + renderBox->marginRight(), borderBox.height() + renderBox->marginTop() + renderBox->marginBottom());
FrameView* containingView = containingFrame->view();
Modified: trunk/Source/WebCore/page/animation/AnimationBase.cpp (90516 => 90517)
--- trunk/Source/WebCore/page/animation/AnimationBase.cpp 2011-07-06 23:49:25 UTC (rev 90516)
+++ trunk/Source/WebCore/page/animation/AnimationBase.cpp 2011-07-06 23:55:06 UTC (rev 90517)
@@ -175,7 +175,7 @@
}
} else {
// Convert the TransformOperations into matrices
- IntSize size = anim->renderer()->isBox() ? toRenderBox(anim->renderer())->borderBoxRect().size() : IntSize();
+ LayoutSize size = anim->renderer()->isBox() ? toRenderBox(anim->renderer())->borderBoxRect().size() : LayoutSize();
TransformationMatrix fromT;
TransformationMatrix toT;
from.apply(size, fromT);
Modified: trunk/Source/WebCore/platform/ScrollView.h (90516 => 90517)
--- trunk/Source/WebCore/platform/ScrollView.h 2011-07-06 23:49:25 UTC (rev 90516)
+++ trunk/Source/WebCore/platform/ScrollView.h 2011-07-06 23:55:06 UTC (rev 90517)
@@ -145,8 +145,8 @@
IntRect visibleContentRect(bool includeScrollbars = false) const;
IntRect actualVisibleContentRect() const { return m_actualVisibleContentRect.isEmpty() ? visibleContentRect() : m_actualVisibleContentRect; }
void setActualVisibleContentRect(const IntRect& actualVisibleContentRect) { m_actualVisibleContentRect = actualVisibleContentRect; }
- int visibleWidth() const { return visibleContentRect().width(); }
- int visibleHeight() const { return visibleContentRect().height(); }
+ LayoutUnit visibleWidth() const { return visibleContentRect().width(); }
+ LayoutUnit visibleHeight() const { return visibleContentRect().height(); }
// Functions for getting/setting the size webkit should use to layout the contents. By default this is the same as the visible
// content size. Explicitly setting a layout size value will cause webkit to layout the contents using this size instead.
Modified: trunk/Source/WebCore/platform/ScrollableArea.h (90516 => 90517)
--- trunk/Source/WebCore/platform/ScrollableArea.h 2011-07-06 23:49:25 UTC (rev 90516)
+++ trunk/Source/WebCore/platform/ScrollableArea.h 2011-07-06 23:55:06 UTC (rev 90517)
@@ -26,7 +26,7 @@
#ifndef ScrollableArea_h
#define ScrollableArea_h
-#include "IntRect.h"
+#include "LayoutTypes.h"
#include "Scrollbar.h"
#include <wtf/Vector.h>
@@ -122,8 +122,8 @@
virtual IntPoint minimumScrollPosition() const { ASSERT_NOT_REACHED(); return IntPoint(); }
virtual IntPoint maximumScrollPosition() const { ASSERT_NOT_REACHED(); return IntPoint(); }
virtual IntRect visibleContentRect(bool /*includeScrollbars*/ = false) const { ASSERT_NOT_REACHED(); return IntRect(); }
- virtual int visibleHeight() const { ASSERT_NOT_REACHED(); return 0; }
- virtual int visibleWidth() const { ASSERT_NOT_REACHED(); return 0; }
+ virtual LayoutUnit visibleHeight() const { ASSERT_NOT_REACHED(); return 0; }
+ virtual LayoutUnit visibleWidth() const { ASSERT_NOT_REACHED(); return 0; }
virtual IntSize contentsSize() const { ASSERT_NOT_REACHED(); return IntSize(); }
virtual IntSize overhangAmount() const { ASSERT_NOT_REACHED(); return IntSize(); }
virtual IntPoint currentMousePosition() const { return IntPoint(); }
Modified: trunk/Source/WebCore/platform/graphics/FloatPoint.h (90516 => 90517)
--- trunk/Source/WebCore/platform/graphics/FloatPoint.h 2011-07-06 23:49:25 UTC (rev 90516)
+++ trunk/Source/WebCore/platform/graphics/FloatPoint.h 2011-07-06 23:55:06 UTC (rev 90517)
@@ -96,11 +96,21 @@
m_x += a.width();
m_y += a.height();
}
+ void move(const FloatSize& a)
+ {
+ m_x += a.width();
+ m_y += a.height();
+ }
void moveBy(const IntPoint& a)
{
m_x += a.x();
m_y += a.y();
}
+ void moveBy(const FloatPoint& a)
+ {
+ m_x += a.x();
+ m_y += a.y();
+ }
void scale(float sx, float sy)
{
m_x *= sx;
Modified: trunk/Source/WebCore/rendering/AutoTableLayout.cpp (90516 => 90517)
--- trunk/Source/WebCore/rendering/AutoTableLayout.cpp 2011-07-06 23:49:25 UTC (rev 90516)
+++ trunk/Source/WebCore/rendering/AutoTableLayout.cpp 2011-07-06 23:55:06 UTC (rev 90517)
@@ -252,8 +252,8 @@
if (scaleColumns) {
maxNonPercent = maxNonPercent * 100 / max(remainingPercent, epsilon);
// FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/63656
- maxWidth = max(maxWidth, static_cast<int>(min(maxNonPercent, numeric_limits<LayoutUnit>::max() / 2.0f)));
- maxWidth = max(maxWidth, static_cast<int>(min(maxPercent, numeric_limits<LayoutUnit>::max() / 2.0f)));
+ maxWidth = max<LayoutUnit>(maxWidth, static_cast<LayoutUnit>(min(maxNonPercent, numeric_limits<LayoutUnit>::max() / 2.0f)));
+ maxWidth = max<LayoutUnit>(maxWidth, static_cast<LayoutUnit>(min(maxPercent, numeric_limits<LayoutUnit>::max() / 2.0f)));
}
maxWidth = max(maxWidth, spanMaxLogicalWidth);
@@ -264,7 +264,7 @@
Length tableLogicalWidth = m_table->style()->logicalWidth();
if (tableLogicalWidth.isFixed() && tableLogicalWidth.value() > 0) {
- minWidth = max(minWidth, tableLogicalWidth.value());
+ minWidth = max<LayoutUnit>(minWidth, tableLogicalWidth.value());
maxWidth = minWidth;
} else if (!remainingPercent && maxNonPercent) {
// if there was no remaining percent, maxWidth is invalid.
@@ -551,7 +551,7 @@
LayoutUnit reduction = min(cellLogicalWidth, excess);
// the lines below might look inconsistent, but that's the way it's handled in mozilla
excess -= reduction;
- LayoutUnit newLogicalWidth = max(m_layoutStruct[i].effectiveMinLogicalWidth, cellLogicalWidth - reduction);
+ LayoutUnit newLogicalWidth = max<LayoutUnit>(m_layoutStruct[i].effectiveMinLogicalWidth, cellLogicalWidth - reduction);
available += cellLogicalWidth - newLogicalWidth;
m_layoutStruct[i].computedLogicalWidth = newLogicalWidth;
}
@@ -589,7 +589,7 @@
for (size_t i = 0; i < nEffCols; ++i) {
Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth;
if (logicalWidth.isAuto() && totalAuto && !m_layoutStruct[i].emptyCellsOnly) {
- LayoutUnit cellLogicalWidth = max(m_layoutStruct[i].computedLogicalWidth, static_cast<LayoutUnit>(available * static_cast<float>(m_layoutStruct[i].effectiveMaxLogicalWidth) / totalAuto));
+ LayoutUnit cellLogicalWidth = max<LayoutUnit>(m_layoutStruct[i].computedLogicalWidth, static_cast<LayoutUnit>(available * static_cast<float>(m_layoutStruct[i].effectiveMaxLogicalWidth) / totalAuto));
available -= cellLogicalWidth;
totalAuto -= m_layoutStruct[i].effectiveMaxLogicalWidth;
m_layoutStruct[i].computedLogicalWidth = cellLogicalWidth;
Modified: trunk/Source/WebCore/rendering/InlineFlowBox.h (90516 => 90517)
--- trunk/Source/WebCore/rendering/InlineFlowBox.h 2011-07-06 23:49:25 UTC (rev 90516)
+++ trunk/Source/WebCore/rendering/InlineFlowBox.h 2011-07-06 23:55:06 UTC (rev 90517)
@@ -196,70 +196,70 @@
// Line visual and layout overflow are in the coordinate space of the block. This means that they aren't purely physical directions.
// For horizontal-tb and vertical-lr they will match physical directions, but for horizontal-bt and vertical-rl, the top/bottom and left/right
// respectively are flipped when compared to their physical counterparts. For example minX is on the left in vertical-lr, but it is on the right in vertical-rl.
- IntRect layoutOverflowRect(int lineTop, int lineBottom) const
+ LayoutRect layoutOverflowRect(LayoutUnit lineTop, LayoutUnit lineBottom) const
{
return m_overflow ? m_overflow->layoutOverflowRect() : enclosingIntRect(frameRectIncludingLineHeight(lineTop, lineBottom));
}
- int logicalLeftLayoutOverflow() const { return m_overflow ? (isHorizontal() ? m_overflow->minXLayoutOverflow() : m_overflow->minYLayoutOverflow()) : logicalLeft(); }
- int logicalRightLayoutOverflow() const { return m_overflow ? (isHorizontal() ? m_overflow->maxXLayoutOverflow() : m_overflow->maxYLayoutOverflow()) : ceilf(logicalRight()); }
- int logicalTopLayoutOverflow(int lineTop) const
+ LayoutUnit logicalLeftLayoutOverflow() const { return m_overflow ? (isHorizontal() ? m_overflow->minXLayoutOverflow() : m_overflow->minYLayoutOverflow()) : logicalLeft(); }
+ LayoutUnit logicalRightLayoutOverflow() const { return m_overflow ? (isHorizontal() ? m_overflow->maxXLayoutOverflow() : m_overflow->maxYLayoutOverflow()) : ceilf(logicalRight()); }
+ LayoutUnit logicalTopLayoutOverflow(LayoutUnit lineTop) const
{
if (m_overflow)
return isHorizontal() ? m_overflow->minYLayoutOverflow() : m_overflow->minXLayoutOverflow();
return lineTop;
}
- int logicalBottomLayoutOverflow(int lineBottom) const
+ LayoutUnit logicalBottomLayoutOverflow(LayoutUnit lineBottom) const
{
if (m_overflow)
return isHorizontal() ? m_overflow->maxYLayoutOverflow() : m_overflow->maxXLayoutOverflow();
return lineBottom;
}
- IntRect logicalLayoutOverflowRect(int lineTop, int lineBottom) const
+ LayoutRect logicalLayoutOverflowRect(LayoutUnit lineTop, LayoutUnit lineBottom) const
{
- IntRect result = layoutOverflowRect(lineTop, lineBottom);
+ LayoutRect result = layoutOverflowRect(lineTop, lineBottom);
if (!renderer()->isHorizontalWritingMode())
result = result.transposedRect();
return result;
}
- IntRect visualOverflowRect(int lineTop, int lineBottom) const
+ LayoutRect visualOverflowRect(LayoutUnit lineTop, LayoutUnit lineBottom) const
{
return m_overflow ? m_overflow->visualOverflowRect() : enclosingIntRect(frameRectIncludingLineHeight(lineTop, lineBottom));
}
- int logicalLeftVisualOverflow() const { return m_overflow ? (isHorizontal() ? m_overflow->minXVisualOverflow() : m_overflow->minYVisualOverflow()) : logicalLeft(); }
- int logicalRightVisualOverflow() const { return m_overflow ? (isHorizontal() ? m_overflow->maxXVisualOverflow() : m_overflow->maxYVisualOverflow()) : ceilf(logicalRight()); }
- int logicalTopVisualOverflow(int lineTop) const
+ LayoutUnit logicalLeftVisualOverflow() const { return m_overflow ? (isHorizontal() ? m_overflow->minXVisualOverflow() : m_overflow->minYVisualOverflow()) : logicalLeft(); }
+ LayoutUnit logicalRightVisualOverflow() const { return m_overflow ? (isHorizontal() ? m_overflow->maxXVisualOverflow() : m_overflow->maxYVisualOverflow()) : ceilf(logicalRight()); }
+ LayoutUnit logicalTopVisualOverflow(LayoutUnit lineTop) const
{
if (m_overflow)
return isHorizontal() ? m_overflow->minYVisualOverflow() : m_overflow->minXVisualOverflow();
return lineTop;
}
- int logicalBottomVisualOverflow(int lineBottom) const
+ LayoutUnit logicalBottomVisualOverflow(LayoutUnit lineBottom) const
{
if (m_overflow)
return isHorizontal() ? m_overflow->maxYVisualOverflow() : m_overflow->maxXVisualOverflow();
return lineBottom;
}
- IntRect logicalVisualOverflowRect(int lineTop, int lineBottom) const
+ LayoutRect logicalVisualOverflowRect(LayoutUnit lineTop, LayoutUnit lineBottom) const
{
- IntRect result = visualOverflowRect(lineTop, lineBottom);
+ LayoutRect result = visualOverflowRect(lineTop, lineBottom);
if (!renderer()->isHorizontalWritingMode())
result = result.transposedRect();
return result;
}
- void setOverflowFromLogicalRects(const IntRect& logicalLayoutOverflow, const IntRect& logicalVisualOverflow, int lineTop, int lineBottom);
- void setLayoutOverflow(const IntRect&, int lineTop, int lineBottom);
- void setVisualOverflow(const IntRect&, int lineTop, int lineBottom);
+ void setOverflowFromLogicalRects(const LayoutRect& logicalLayoutOverflow, const IntRect& logicalVisualOverflow, LayoutUnit lineTop, LayoutUnit lineBottom);
+ void setLayoutOverflow(const LayoutRect&, LayoutUnit lineTop, LayoutUnit lineBottom);
+ void setVisualOverflow(const LayoutRect&, LayoutUnit lineTop, LayoutUnit lineBottom);
- FloatRect frameRectIncludingLineHeight(int lineTop, int lineBottom) const
+ FloatRect frameRectIncludingLineHeight(LayoutUnit lineTop, LayoutUnit lineBottom) const
{
if (isHorizontal())
return FloatRect(m_topLeft.x(), lineTop, width(), lineBottom - lineTop);
return FloatRect(lineTop, m_topLeft.y(), lineBottom - lineTop, height());
}
- FloatRect logicalFrameRectIncludingLineHeight(int lineTop, int lineBottom) const
+ FloatRect logicalFrameRectIncludingLineHeight(LayoutUnit lineTop, LayoutUnit lineBottom) const
{
return FloatRect(logicalLeft(), lineTop, logicalWidth(), lineBottom - lineTop);
}
Modified: trunk/Source/WebCore/rendering/RenderBlock.h (90516 => 90517)
--- trunk/Source/WebCore/rendering/RenderBlock.h 2011-07-06 23:49:25 UTC (rev 90516)
+++ trunk/Source/WebCore/rendering/RenderBlock.h 2011-07-06 23:55:06 UTC (rev 90517)
@@ -806,20 +806,20 @@
static int positiveMarginBeforeDefault(const RenderBlock* block)
{
- return std::max(block->marginBefore(), 0);
+ return std::max<LayoutUnit>(block->marginBefore(), 0);
}
static int negativeMarginBeforeDefault(const RenderBlock* block)
{
- return std::max(-block->marginBefore(), 0);
+ return std::max<LayoutUnit>(-block->marginBefore(), 0);
}
static int positiveMarginAfterDefault(const RenderBlock* block)
{
- return std::max(block->marginAfter(), 0);
+ return std::max<LayoutUnit>(block->marginAfter(), 0);
}
static int negativeMarginAfterDefault(const RenderBlock* block)
{
- return std::max(-block->marginAfter(), 0);
+ return std::max<LayoutUnit>(-block->marginAfter(), 0);
}
MarginValues m_margins;