Changeset 89984 in webkit
- Timestamp:
- Jun 28, 2011 6:28:51 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r89983 r89984 1 2011-06-28 Emil A Eklund <eae@chromium.org> 2 3 Reviewed by Eric Seidel. 4 5 Switch RenderLayer position/size to to new layout types 6 https://bugs.webkit.org/show_bug.cgi?id=63578 7 8 Switch location and size methods for RenderLayer over to the new layout unit abstraction. 9 10 No new tests, no functionality changes. 11 12 * rendering/RenderLayer.cpp: 13 (WebCore::RenderLayer::resize): 14 (WebCore::RenderLayer::visibleHeight): 15 (WebCore::RenderLayer::visibleWidth): 16 (WebCore::RenderLayer::offsetFromResizeCorner): 17 * rendering/RenderLayer.h: 18 (WebCore::RenderLayer::location): 19 (WebCore::RenderLayer::setLocation): 20 (WebCore::RenderLayer::size): 21 (WebCore::RenderLayer::setSize): 22 (WebCore::RenderLayer::rect): 23 (WebCore::RenderLayer::renderBoxLocation): 24 (WebCore::RenderLayer::renderBoxX): 25 (WebCore::RenderLayer::renderBoxY): 26 * rendering/RenderListBox.cpp: 27 (WebCore::RenderListBox::visibleHeight): 28 (WebCore::RenderListBox::visibleWidth): 29 * rendering/RenderListBox.h: 30 1 31 2011-06-28 Levi Weintraub <leviw@chromium.org> 2 32 -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r89474 r89984 1556 1556 } 1557 1557 1558 void RenderLayer::resize(const PlatformMouseEvent& evt, const IntSize& oldOffset)1558 void RenderLayer::resize(const PlatformMouseEvent& evt, const LayoutSize& oldOffset) 1559 1559 { 1560 1560 // FIXME: This should be possible on generated content but is not right now. … … 1577 1577 float zoomFactor = renderer->style()->effectiveZoom(); 1578 1578 1579 IntSize newOffset = offsetFromResizeCorner(document->view()->windowToContents(evt.pos()));1579 LayoutSize newOffset = offsetFromResizeCorner(document->view()->windowToContents(evt.pos())); 1580 1580 newOffset.setWidth(newOffset.width() / zoomFactor); 1581 1581 newOffset.setHeight(newOffset.height() / zoomFactor); 1582 1582 1583 IntSize currentSize = IntSize(renderer->width() / zoomFactor, renderer->height() / zoomFactor);1584 IntSize minimumSize = element->minimumSizeForResizing().shrunkTo(currentSize);1583 LayoutSize currentSize = LayoutSize(renderer->width() / zoomFactor, renderer->height() / zoomFactor); 1584 LayoutSize minimumSize = element->minimumSizeForResizing().shrunkTo(currentSize); 1585 1585 element->setMinimumSizeForResizing(minimumSize); 1586 1586 1587 IntSize adjustedOldOffset = IntSize(oldOffset.width() / zoomFactor, oldOffset.height() / zoomFactor);1588 1589 IntSize difference = (currentSize + newOffset - adjustedOldOffset).expandedTo(minimumSize) - currentSize;1587 LayoutSize adjustedOldOffset = LayoutSize(oldOffset.width() / zoomFactor, oldOffset.height() / zoomFactor); 1588 1589 LayoutSize difference = (currentSize + newOffset - adjustedOldOffset).expandedTo(minimumSize) - currentSize; 1590 1590 1591 1591 CSSStyleDeclaration* style = element->style(); … … 1600 1600 style->setProperty(CSSPropertyMarginRight, String::number(renderer->marginRight() / zoomFactor) + "px", false, ec); 1601 1601 } 1602 int baseWidth = renderer->width() - (isBoxSizingBorder ? 0 : renderer->borderAndPaddingWidth());1602 LayoutUnit baseWidth = renderer->width() - (isBoxSizingBorder ? 0 : renderer->borderAndPaddingWidth()); 1603 1603 baseWidth = baseWidth / zoomFactor; 1604 1604 style->setProperty(CSSPropertyWidth, String::number(baseWidth + difference.width()) + "px", false, ec); … … 1611 1611 style->setProperty(CSSPropertyMarginBottom, String::number(renderer->marginBottom() / zoomFactor) + "px", false, ec); 1612 1612 } 1613 int baseHeight = renderer->height() - (isBoxSizingBorder ? 0 : renderer->borderAndPaddingHeight());1613 LayoutUnit baseHeight = renderer->height() - (isBoxSizingBorder ? 0 : renderer->borderAndPaddingHeight()); 1614 1614 baseHeight = baseHeight / zoomFactor; 1615 1615 style->setProperty(CSSPropertyHeight, String::number(baseHeight + difference.height()) + "px", false, ec); … … 1800 1800 } 1801 1801 1802 int RenderLayer::visibleHeight() const1802 LayoutUnit RenderLayer::visibleHeight() const 1803 1803 { 1804 1804 return m_layerSize.height(); 1805 1805 } 1806 1806 1807 int RenderLayer::visibleWidth() const1807 LayoutUnit RenderLayer::visibleWidth() const 1808 1808 { 1809 1809 return m_layerSize.width(); … … 2004 2004 } 2005 2005 2006 IntSize RenderLayer::offsetFromResizeCorner(const IntPoint& absolutePoint) const2006 LayoutSize RenderLayer::offsetFromResizeCorner(const LayoutPoint& absolutePoint) const 2007 2007 { 2008 2008 // Currently the resize corner is always the bottom right corner 2009 2009 // FIXME: This assumes the location is 0, 0. Is this guaranteed to always be the case? 2010 IntPoint bottomRight = toPoint(size());2011 IntPoint localPoint = absoluteToContents(absolutePoint);2010 LayoutPoint bottomRight = toPoint(size()); 2011 LayoutPoint localPoint = absoluteToContents(absolutePoint); 2012 2012 return localPoint - bottomRight; 2013 2013 } -
trunk/Source/WebCore/rendering/RenderLayer.h
r89316 r89984 212 212 } 213 213 214 const IntPoint& location() const { return m_topLeft; }215 void setLocation( int x, int y) { m_topLeft = IntPoint(x, y); }216 217 const IntSize& size() const { return m_layerSize; }218 void setSize(const IntSize& size) { m_layerSize = size; }219 220 IntRect rect() const { return IntRect(location(), size()); }214 const LayoutPoint& location() const { return m_topLeft; } 215 void setLocation(LayoutUnit x, LayoutUnit y) { m_topLeft = LayoutPoint(x, y); } 216 217 const LayoutSize& size() const { return m_layerSize; } 218 void setSize(const LayoutSize& size) { m_layerSize = size; } 219 220 LayoutRect rect() const { return LayoutRect(location(), size()); } 221 221 222 222 int scrollWidth(); … … 262 262 bool isPointInResizeControl(const IntPoint& absolutePoint) const; 263 263 bool hitTestOverflowControls(HitTestResult&, const IntPoint& localPoint); 264 IntSize offsetFromResizeCorner(const IntPoint& absolutePoint) const;264 LayoutSize offsetFromResizeCorner(const LayoutPoint& absolutePoint) const; 265 265 266 266 void paintOverflowControls(GraphicsContext*, const IntPoint&, const IntRect& damageRect, bool paintingOverlayControls = false); … … 273 273 void autoscroll(); 274 274 275 void resize(const PlatformMouseEvent&, const IntSize&);275 void resize(const PlatformMouseEvent&, const LayoutSize&); 276 276 bool inResizeMode() const { return m_inResizeMode; } 277 277 void setInResizeMode(bool b) { m_inResizeMode = b; } … … 463 463 void setLastChild(RenderLayer* last) { m_last = last; } 464 464 465 IntPoint renderBoxLocation() const { return renderer()->isBox() ? toRenderBox(renderer())->location() : IntPoint(); }466 int renderBoxX() const { return renderBoxLocation().x(); }467 int renderBoxY() const { return renderBoxLocation().y(); }465 LayoutPoint renderBoxLocation() const { return renderer()->isBox() ? toRenderBox(renderer())->location() : LayoutPoint(); } 466 LayoutUnit renderBoxX() const { return renderBoxLocation().x(); } 467 LayoutUnit renderBoxY() const { return renderBoxLocation().y(); } 468 468 469 469 void collectLayers(Vector<RenderLayer*>*&, Vector<RenderLayer*>*&); … … 541 541 virtual IntPoint maximumScrollPosition() const; 542 542 virtual IntRect visibleContentRect(bool includeScrollbars) const; 543 virtual int visibleHeight() const;544 virtual int visibleWidth() const;543 virtual LayoutUnit visibleHeight() const; 544 virtual LayoutUnit visibleWidth() const; 545 545 virtual IntSize contentsSize() const; 546 546 virtual IntSize overhangAmount() const; … … 636 636 637 637 // Our (x,y) coordinates are in our parent layer's coordinate space. 638 IntPoint m_topLeft;638 LayoutPoint m_topLeft; 639 639 640 640 // The layer's width/height 641 IntSize m_layerSize;641 LayoutSize m_layerSize; 642 642 643 643 // Our scroll offsets if the view is scrolled. -
trunk/Source/WebCore/rendering/RenderListBox.cpp
r89983 r89984 778 778 } 779 779 780 int RenderListBox::visibleHeight() const780 LayoutUnit RenderListBox::visibleHeight() const 781 781 { 782 782 return height(); 783 783 } 784 784 785 int RenderListBox::visibleWidth() const785 LayoutUnit RenderListBox::visibleWidth() const 786 786 { 787 787 return width(); -
trunk/Source/WebCore/rendering/RenderListBox.h
r89983 r89984 114 114 virtual Scrollbar* verticalScrollbar() const { return m_vBar.get(); } 115 115 virtual IntSize contentsSize() const; 116 virtual int visibleHeight() const;117 virtual int visibleWidth() const;116 virtual LayoutUnit visibleHeight() const; 117 virtual LayoutUnit visibleWidth() const; 118 118 virtual IntPoint currentMousePosition() const; 119 119 virtual bool shouldSuspendScrollAnimations() const;
Note: See TracChangeset
for help on using the changeset viewer.