Diff
Modified: trunk/Source/WebCore/ChangeLog (89983 => 89984)
--- trunk/Source/WebCore/ChangeLog 2011-06-29 01:06:00 UTC (rev 89983)
+++ trunk/Source/WebCore/ChangeLog 2011-06-29 01:28:51 UTC (rev 89984)
@@ -1,3 +1,33 @@
+2011-06-28 Emil A Eklund <[email protected]>
+
+ Reviewed by Eric Seidel.
+
+ Switch RenderLayer position/size to to new layout types
+ https://bugs.webkit.org/show_bug.cgi?id=63578
+
+ Switch location and size methods for RenderLayer over to the new layout unit abstraction.
+
+ No new tests, no functionality changes.
+
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::resize):
+ (WebCore::RenderLayer::visibleHeight):
+ (WebCore::RenderLayer::visibleWidth):
+ (WebCore::RenderLayer::offsetFromResizeCorner):
+ * rendering/RenderLayer.h:
+ (WebCore::RenderLayer::location):
+ (WebCore::RenderLayer::setLocation):
+ (WebCore::RenderLayer::size):
+ (WebCore::RenderLayer::setSize):
+ (WebCore::RenderLayer::rect):
+ (WebCore::RenderLayer::renderBoxLocation):
+ (WebCore::RenderLayer::renderBoxX):
+ (WebCore::RenderLayer::renderBoxY):
+ * rendering/RenderListBox.cpp:
+ (WebCore::RenderListBox::visibleHeight):
+ (WebCore::RenderListBox::visibleWidth):
+ * rendering/RenderListBox.h:
+
2011-06-28 Levi Weintraub <[email protected]>
Reviewed by Eric Seidel.
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (89983 => 89984)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2011-06-29 01:06:00 UTC (rev 89983)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2011-06-29 01:28:51 UTC (rev 89984)
@@ -1555,7 +1555,7 @@
scrollRectToVisible(IntRect(currentDocumentPosition, IntSize(1, 1)), ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded);
}
-void RenderLayer::resize(const PlatformMouseEvent& evt, const IntSize& oldOffset)
+void RenderLayer::resize(const PlatformMouseEvent& evt, const LayoutSize& oldOffset)
{
// FIXME: This should be possible on generated content but is not right now.
if (!inResizeMode() || !renderer()->hasOverflowClip() || !renderer()->node())
@@ -1576,17 +1576,17 @@
float zoomFactor = renderer->style()->effectiveZoom();
- IntSize newOffset = offsetFromResizeCorner(document->view()->windowToContents(evt.pos()));
+ LayoutSize newOffset = offsetFromResizeCorner(document->view()->windowToContents(evt.pos()));
newOffset.setWidth(newOffset.width() / zoomFactor);
newOffset.setHeight(newOffset.height() / zoomFactor);
- IntSize currentSize = IntSize(renderer->width() / zoomFactor, renderer->height() / zoomFactor);
- IntSize minimumSize = element->minimumSizeForResizing().shrunkTo(currentSize);
+ LayoutSize currentSize = LayoutSize(renderer->width() / zoomFactor, renderer->height() / zoomFactor);
+ LayoutSize minimumSize = element->minimumSizeForResizing().shrunkTo(currentSize);
element->setMinimumSizeForResizing(minimumSize);
- IntSize adjustedOldOffset = IntSize(oldOffset.width() / zoomFactor, oldOffset.height() / zoomFactor);
+ LayoutSize adjustedOldOffset = LayoutSize(oldOffset.width() / zoomFactor, oldOffset.height() / zoomFactor);
- IntSize difference = (currentSize + newOffset - adjustedOldOffset).expandedTo(minimumSize) - currentSize;
+ LayoutSize difference = (currentSize + newOffset - adjustedOldOffset).expandedTo(minimumSize) - currentSize;
CSSStyleDeclaration* style = element->style();
bool isBoxSizingBorder = renderer->style()->boxSizing() == BORDER_BOX;
@@ -1599,7 +1599,7 @@
style->setProperty(CSSPropertyMarginLeft, String::number(renderer->marginLeft() / zoomFactor) + "px", false, ec);
style->setProperty(CSSPropertyMarginRight, String::number(renderer->marginRight() / zoomFactor) + "px", false, ec);
}
- int baseWidth = renderer->width() - (isBoxSizingBorder ? 0 : renderer->borderAndPaddingWidth());
+ LayoutUnit baseWidth = renderer->width() - (isBoxSizingBorder ? 0 : renderer->borderAndPaddingWidth());
baseWidth = baseWidth / zoomFactor;
style->setProperty(CSSPropertyWidth, String::number(baseWidth + difference.width()) + "px", false, ec);
}
@@ -1610,7 +1610,7 @@
style->setProperty(CSSPropertyMarginTop, String::number(renderer->marginTop() / zoomFactor) + "px", false, ec);
style->setProperty(CSSPropertyMarginBottom, String::number(renderer->marginBottom() / zoomFactor) + "px", false, ec);
}
- int baseHeight = renderer->height() - (isBoxSizingBorder ? 0 : renderer->borderAndPaddingHeight());
+ LayoutUnit baseHeight = renderer->height() - (isBoxSizingBorder ? 0 : renderer->borderAndPaddingHeight());
baseHeight = baseHeight / zoomFactor;
style->setProperty(CSSPropertyHeight, String::number(baseHeight + difference.height()) + "px", false, ec);
}
@@ -1799,12 +1799,12 @@
return IntSize(const_cast<RenderLayer*>(this)->scrollWidth(), const_cast<RenderLayer*>(this)->scrollHeight());
}
-int RenderLayer::visibleHeight() const
+LayoutUnit RenderLayer::visibleHeight() const
{
return m_layerSize.height();
}
-int RenderLayer::visibleWidth() const
+LayoutUnit RenderLayer::visibleWidth() const
{
return m_layerSize.width();
}
@@ -2003,12 +2003,12 @@
return m_hBar->height();
}
-IntSize RenderLayer::offsetFromResizeCorner(const IntPoint& absolutePoint) const
+LayoutSize RenderLayer::offsetFromResizeCorner(const LayoutPoint& absolutePoint) const
{
// Currently the resize corner is always the bottom right corner
// FIXME: This assumes the location is 0, 0. Is this guaranteed to always be the case?
- IntPoint bottomRight = toPoint(size());
- IntPoint localPoint = absoluteToContents(absolutePoint);
+ LayoutPoint bottomRight = toPoint(size());
+ LayoutPoint localPoint = absoluteToContents(absolutePoint);
return localPoint - bottomRight;
}
Modified: trunk/Source/WebCore/rendering/RenderLayer.h (89983 => 89984)
--- trunk/Source/WebCore/rendering/RenderLayer.h 2011-06-29 01:06:00 UTC (rev 89983)
+++ trunk/Source/WebCore/rendering/RenderLayer.h 2011-06-29 01:28:51 UTC (rev 89984)
@@ -211,13 +211,13 @@
return curr;
}
- const IntPoint& location() const { return m_topLeft; }
- void setLocation(int x, int y) { m_topLeft = IntPoint(x, y); }
+ const LayoutPoint& location() const { return m_topLeft; }
+ void setLocation(LayoutUnit x, LayoutUnit y) { m_topLeft = LayoutPoint(x, y); }
- const IntSize& size() const { return m_layerSize; }
- void setSize(const IntSize& size) { m_layerSize = size; }
+ const LayoutSize& size() const { return m_layerSize; }
+ void setSize(const LayoutSize& size) { m_layerSize = size; }
- IntRect rect() const { return IntRect(location(), size()); }
+ LayoutRect rect() const { return LayoutRect(location(), size()); }
int scrollWidth();
int scrollHeight();
@@ -261,7 +261,7 @@
bool hasOverflowControls() const;
bool isPointInResizeControl(const IntPoint& absolutePoint) const;
bool hitTestOverflowControls(HitTestResult&, const IntPoint& localPoint);
- IntSize offsetFromResizeCorner(const IntPoint& absolutePoint) const;
+ LayoutSize offsetFromResizeCorner(const LayoutPoint& absolutePoint) const;
void paintOverflowControls(GraphicsContext*, const IntPoint&, const IntRect& damageRect, bool paintingOverlayControls = false);
void paintScrollCorner(GraphicsContext*, const IntPoint&, const IntRect& damageRect);
@@ -272,7 +272,7 @@
bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1);
void autoscroll();
- void resize(const PlatformMouseEvent&, const IntSize&);
+ void resize(const PlatformMouseEvent&, const LayoutSize&);
bool inResizeMode() const { return m_inResizeMode; }
void setInResizeMode(bool b) { m_inResizeMode = b; }
@@ -462,9 +462,9 @@
void setFirstChild(RenderLayer* first) { m_first = first; }
void setLastChild(RenderLayer* last) { m_last = last; }
- IntPoint renderBoxLocation() const { return renderer()->isBox() ? toRenderBox(renderer())->location() : IntPoint(); }
- int renderBoxX() const { return renderBoxLocation().x(); }
- int renderBoxY() const { return renderBoxLocation().y(); }
+ LayoutPoint renderBoxLocation() const { return renderer()->isBox() ? toRenderBox(renderer())->location() : LayoutPoint(); }
+ LayoutUnit renderBoxX() const { return renderBoxLocation().x(); }
+ LayoutUnit renderBoxY() const { return renderBoxLocation().y(); }
void collectLayers(Vector<RenderLayer*>*&, Vector<RenderLayer*>*&);
@@ -540,8 +540,8 @@
virtual IntPoint minimumScrollPosition() const;
virtual IntPoint maximumScrollPosition() const;
virtual IntRect visibleContentRect(bool includeScrollbars) const;
- virtual int visibleHeight() const;
- virtual int visibleWidth() const;
+ virtual LayoutUnit visibleHeight() const;
+ virtual LayoutUnit visibleWidth() const;
virtual IntSize contentsSize() const;
virtual IntSize overhangAmount() const;
virtual IntPoint currentMousePosition() const;
@@ -635,10 +635,10 @@
IntSize m_relativeOffset;
// Our (x,y) coordinates are in our parent layer's coordinate space.
- IntPoint m_topLeft;
+ LayoutPoint m_topLeft;
// The layer's width/height
- IntSize m_layerSize;
+ LayoutSize m_layerSize;
// Our scroll offsets if the view is scrolled.
IntSize m_scrollOffset;
Modified: trunk/Source/WebCore/rendering/RenderListBox.cpp (89983 => 89984)
--- trunk/Source/WebCore/rendering/RenderListBox.cpp 2011-06-29 01:06:00 UTC (rev 89983)
+++ trunk/Source/WebCore/rendering/RenderListBox.cpp 2011-06-29 01:28:51 UTC (rev 89984)
@@ -777,12 +777,12 @@
return IntSize(scrollWidth(), scrollHeight());
}
-int RenderListBox::visibleHeight() const
+LayoutUnit RenderListBox::visibleHeight() const
{
return height();
}
-int RenderListBox::visibleWidth() const
+LayoutUnit RenderListBox::visibleWidth() const
{
return width();
}
Modified: trunk/Source/WebCore/rendering/RenderListBox.h (89983 => 89984)
--- trunk/Source/WebCore/rendering/RenderListBox.h 2011-06-29 01:06:00 UTC (rev 89983)
+++ trunk/Source/WebCore/rendering/RenderListBox.h 2011-06-29 01:28:51 UTC (rev 89984)
@@ -113,8 +113,8 @@
virtual IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, const IntPoint&) const;
virtual Scrollbar* verticalScrollbar() const { return m_vBar.get(); }
virtual IntSize contentsSize() const;
- virtual int visibleHeight() const;
- virtual int visibleWidth() const;
+ virtual LayoutUnit visibleHeight() const;
+ virtual LayoutUnit visibleWidth() const;
virtual IntPoint currentMousePosition() const;
virtual bool shouldSuspendScrollAnimations() const;
virtual bool isOnActivePage() const;