Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Side by Side Diff: Source/WebCore/rendering/RenderLayer.cpp

Issue 10790105: Merge 122861 - Incorrect offset used for scrollWidth/Height calculation (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1180/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/WebCore/rendering/RenderBox.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * 3 *
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
5 * 5 *
6 * Other contributors: 6 * Other contributors:
7 * Robert O'Callahan <roc+@cs.cmu.edu> 7 * Robert O'Callahan <roc+@cs.cmu.edu>
8 * David Baron <dbaron@fas.harvard.edu> 8 * David Baron <dbaron@fas.harvard.edu>
9 * Christian Biesinger <cbiesinger@web.de> 9 * Christian Biesinger <cbiesinger@web.de>
10 * Randall Jesup <rjesup@wgate.com> 10 * Randall Jesup <rjesup@wgate.com>
(...skipping 1562 matching lines...) Expand 10 before | Expand all | Expand 10 after
1573 } 1573 }
1574 } 1574 }
1575 1575
1576 void RenderLayer::scrollToOffset(int x, int y, ScrollOffsetClamping clamp) 1576 void RenderLayer::scrollToOffset(int x, int y, ScrollOffsetClamping clamp)
1577 { 1577 {
1578 if (clamp == ScrollOffsetClamped) { 1578 if (clamp == ScrollOffsetClamped) {
1579 RenderBox* box = renderBox(); 1579 RenderBox* box = renderBox();
1580 if (!box) 1580 if (!box)
1581 return; 1581 return;
1582 1582
1583 int maxX = scrollWidth() - box->clientWidth(); 1583 int maxX = scrollWidth() - box->pixelSnappedClientWidth();
1584 int maxY = scrollHeight() - box->clientHeight(); 1584 int maxY = scrollHeight() - box->pixelSnappedClientHeight();
1585 1585
1586 x = min(max(x, 0), maxX); 1586 x = min(max(x, 0), maxX);
1587 y = min(max(y, 0), maxY); 1587 y = min(max(y, 0), maxY);
1588 } 1588 }
1589 1589
1590 IntPoint newScrollOffset(x, y); 1590 IntPoint newScrollOffset(x, y);
1591 if (newScrollOffset != LayoutPoint(scrollXOffset(), scrollYOffset())) 1591 if (newScrollOffset != LayoutPoint(scrollXOffset(), scrollYOffset()))
1592 scrollToOffsetWithoutAnimation(newScrollOffset); 1592 scrollToOffsetWithoutAnimation(newScrollOffset);
1593 } 1593 }
1594 1594
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after
2402 m_scrollCorner->setFrameRect(scrollCorner); 2402 m_scrollCorner->setFrameRect(scrollCorner);
2403 if (m_resizer) 2403 if (m_resizer)
2404 m_resizer->setFrameRect(resizerCornerRect(this, borderBox)); 2404 m_resizer->setFrameRect(resizerCornerRect(this, borderBox));
2405 } 2405 }
2406 2406
2407 int RenderLayer::scrollWidth() const 2407 int RenderLayer::scrollWidth() const
2408 { 2408 {
2409 ASSERT(renderBox()); 2409 ASSERT(renderBox());
2410 if (m_scrollDimensionsDirty) 2410 if (m_scrollDimensionsDirty)
2411 const_cast<RenderLayer*>(this)->computeScrollDimensions(); 2411 const_cast<RenderLayer*>(this)->computeScrollDimensions();
2412 return snapSizeToPixel(m_scrollSize.width(), renderBox()->clientLeft()); 2412 return snapSizeToPixel(m_scrollSize.width(), renderBox()->clientLeft() + ren derBox()->x());
2413 } 2413 }
2414 2414
2415 int RenderLayer::scrollHeight() const 2415 int RenderLayer::scrollHeight() const
2416 { 2416 {
2417 ASSERT(renderBox()); 2417 ASSERT(renderBox());
2418 if (m_scrollDimensionsDirty) 2418 if (m_scrollDimensionsDirty)
2419 const_cast<RenderLayer*>(this)->computeScrollDimensions(); 2419 const_cast<RenderLayer*>(this)->computeScrollDimensions();
2420 return snapSizeToPixel(m_scrollSize.height(), renderBox()->clientTop()); 2420 return snapSizeToPixel(m_scrollSize.height(), renderBox()->clientTop() + ren derBox()->y());
2421 } 2421 }
2422 2422
2423 LayoutUnit RenderLayer::overflowTop() const 2423 LayoutUnit RenderLayer::overflowTop() const
2424 { 2424 {
2425 RenderBox* box = renderBox(); 2425 RenderBox* box = renderBox();
2426 LayoutRect overflowRect(box->layoutOverflowRect()); 2426 LayoutRect overflowRect(box->layoutOverflowRect());
2427 box->flipForWritingMode(overflowRect); 2427 box->flipForWritingMode(overflowRect);
2428 return overflowRect.y(); 2428 return overflowRect.y();
2429 } 2429 }
2430 2430
(...skipping 2604 matching lines...) Expand 10 before | Expand all | Expand 10 after
5035 } 5035 }
5036 } 5036 }
5037 5037
5038 void showLayerTree(const WebCore::RenderObject* renderer) 5038 void showLayerTree(const WebCore::RenderObject* renderer)
5039 { 5039 {
5040 if (!renderer) 5040 if (!renderer)
5041 return; 5041 return;
5042 showLayerTree(renderer->enclosingLayer()); 5042 showLayerTree(renderer->enclosingLayer());
5043 } 5043 }
5044 #endif 5044 #endif
OLDNEW
« no previous file with comments | « Source/WebCore/rendering/RenderBox.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698