Changeset 113431 in webkit
- Timestamp:
- Apr 6, 2012 7:10:43 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r113428 r113431 1 2012-04-06 Levi Weintraub <leviw@chromium.org> 2 3 Update LayoutUnit usage in RenderView 4 https://bugs.webkit.org/show_bug.cgi?id=83147 5 6 Reviewed by Julien Chaffraix. 7 8 Updating the usage of LayoutUnits in RenderView in preparation for sub-pixel layout. This mostly 9 affects paint and repaint functions, which take LayoutRects up to the RenderView level. This is 10 necessary as we continue to accumulate sub-pixel offsets up to this level. 11 12 No new tests. No change in behavior. 13 14 * rendering/RenderView.cpp: 15 (WebCore::RenderView::paint): Adding an assert that we're being called to paint on pixel 16 boundaries. We don't currently ever position RenderViews at sub-pixel offsets. 17 (WebCore::RenderView::shouldRepaint): 18 (WebCore::RenderView::repaintViewRectangle): Switching to a LayoutRect and cleaning up a fixme 19 that used decomposed offsets. Pixel snapping is applied before handing the rect up to the 20 FrameView. 21 (WebCore::RenderView::repaintRectangleInViewAndCompositedLayers): Pixel snapping before handing 22 the rect up to the Compositor. 23 (WebCore::RenderView::computeRectForRepaint): 24 (WebCore::RenderView::selectionBounds): 25 (WebCore::RenderView::viewRect): 26 (WebCore::RenderView::unscaledDocumentRect): 27 * rendering/RenderView.h: 28 (RenderView): 29 1 30 2012-04-06 Andrey Kosyakov <caseq@chromium.org> 2 31 -
trunk/Source/WebCore/rendering/RenderView.cpp
r112453 r113431 218 218 // If we ever require layout but receive a paint anyway, something has gone horribly wrong. 219 219 ASSERT(!needsLayout()); 220 // RenderViews should never be called to paint with an offset not on device pixels. 221 ASSERT(LayoutPoint(IntPoint(paintOffset.x(), paintOffset.y())) == paintOffset); 220 222 paintObject(paintInfo, paintOffset); 221 223 } … … 295 297 } 296 298 297 bool RenderView::shouldRepaint(const IntRect& r) const299 bool RenderView::shouldRepaint(const LayoutRect& r) const 298 300 { 299 301 if (printing() || r.width() == 0 || r.height() == 0) … … 309 311 } 310 312 311 void RenderView::repaintViewRectangle(const IntRect& ur, bool immediate)313 void RenderView::repaintViewRectangle(const LayoutRect& ur, bool immediate) 312 314 { 313 315 if (!shouldRepaint(ur)) … … 318 320 Element* elt = document()->ownerElement(); 319 321 if (!elt) 320 m_frameView->repaintContentRectangle( ur, immediate);322 m_frameView->repaintContentRectangle(pixelSnappedIntRect(ur), immediate); 321 323 else if (RenderBox* obj = elt->renderBox()) { 322 IntRect vr = viewRect();323 IntRect r = intersection(ur, vr);324 LayoutRect vr = viewRect(); 325 LayoutRect r = intersection(ur, vr); 324 326 325 327 // Subtract out the contentsX and contentsY offsets to get our coords within the viewing 326 328 // rectangle. 327 329 r.moveBy(-vr.location()); 328 330 329 331 // FIXME: Hardcoded offsets here are not good. 330 r.move(obj->borderLeft() + obj->paddingLeft(), 331 obj->borderTop() + obj->paddingTop()); 332 r.moveBy(obj->contentBoxRect().location()); 332 333 obj->repaintRectangle(r, immediate); 333 334 } 334 335 } 335 336 336 void RenderView::repaintRectangleInViewAndCompositedLayers(const IntRect& ur, bool immediate)337 void RenderView::repaintRectangleInViewAndCompositedLayers(const LayoutRect& ur, bool immediate) 337 338 { 338 339 if (!shouldRepaint(ur)) … … 343 344 #if USE(ACCELERATED_COMPOSITING) 344 345 if (compositor()->inCompositingMode()) 345 compositor()->repaintCompositedLayersAbsoluteRect( ur);346 compositor()->repaintCompositedLayersAbsoluteRect(pixelSnappedIntRect(ur)); 346 347 #endif 347 348 } 348 349 349 void RenderView::computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& rect, bool fixed) const350 void RenderView::computeRectForRepaint(RenderBoxModelObject* repaintContainer, LayoutRect& rect, bool fixed) const 350 351 { 351 352 // If a container was specified, and was not 0 or the RenderView, … … 421 422 422 423 // Now create a single bounding box rect that encloses the whole selection. 423 IntRect selRect;424 LayoutRect selRect; 424 425 SelectionMap::iterator end = selectedObjects.end(); 425 426 for (SelectionMap::iterator i = selectedObjects.begin(); i != end; ++i) { 426 427 RenderSelectionInfo* info = i->second; 427 428 // RenderSelectionInfo::rect() is in the coordinates of the repaintContainer, so map to page coordinates. 428 IntRect currRect = info->rect();429 LayoutRect currRect = info->rect(); 429 430 if (RenderBoxModelObject* repaintContainer = info->repaintContainer()) { 430 431 FloatQuad absQuad = repaintContainer->localToAbsoluteQuad(FloatRect(currRect)); … … 434 435 delete info; 435 436 } 436 return selRect;437 return pixelSnappedIntRect(selRect); 437 438 } 438 439 … … 707 708 } 708 709 709 IntRect RenderView::viewRect() const710 LayoutRect RenderView::viewRect() const 710 711 { 711 712 if (printing()) 712 return IntRect(IntPoint(), size());713 return LayoutRect(LayoutPoint(), size()); 713 714 if (m_frameView) 714 715 return m_frameView->visibleContentRect(); 715 return IntRect();716 return LayoutRect(); 716 717 } 717 718 … … 719 720 IntRect RenderView::unscaledDocumentRect() const 720 721 { 721 IntRect overflowRect(layoutOverflowRect());722 LayoutRect overflowRect(layoutOverflowRect()); 722 723 flipForWritingMode(overflowRect); 723 return overflowRect;724 return pixelSnappedIntRect(overflowRect); 724 725 } 725 726 -
trunk/Source/WebCore/rendering/RenderView.h
r112453 r113431 69 69 FrameView* frameView() const { return m_frameView; } 70 70 71 virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect&, bool fixed = false) const;72 virtual void repaintViewRectangle(const IntRect&, bool immediate = false);71 virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, LayoutRect&, bool fixed = false) const OVERRIDE; 72 virtual void repaintViewRectangle(const LayoutRect&, bool immediate = false) OVERRIDE; 73 73 // Repaint the view, and all composited layers that intersect the given absolute rectangle. 74 74 // FIXME: ideally we'd never have to do this, if all repaints are container-relative. 75 virtual void repaintRectangleInViewAndCompositedLayers(const IntRect&, bool immediate = false);75 virtual void repaintRectangleInViewAndCompositedLayers(const LayoutRect&, bool immediate = false) OVERRIDE; 76 76 77 77 virtual void paint(PaintInfo&, const LayoutPoint&); 78 virtual void paintBoxDecorations(PaintInfo&, const IntPoint&);78 virtual void paintBoxDecorations(PaintInfo&, const LayoutPoint&) OVERRIDE; 79 79 80 80 enum SelectionRepaintMode { RepaintNewXOROld, RepaintNewMinusOld, RepaintNothing }; … … 99 99 int maximalOutlineSize() const { return m_maximalOutlineSize; } 100 100 101 virtual IntRect viewRect() const;101 virtual LayoutRect viewRect() const OVERRIDE; 102 102 103 103 void updateWidgetPositions(); … … 202 202 virtual ColumnInfo::PaginationUnit paginationUnit() const OVERRIDE; 203 203 204 bool shouldRepaint(const IntRect& r) const;204 bool shouldRepaint(const LayoutRect&) const; 205 205 206 206 // These functions may only be accessed by LayoutStateMaintainer.
Note: See TracChangeset
for help on using the changeset viewer.