Modified: trunk/Source/WebCore/ChangeLog (113486 => 113487)
--- trunk/Source/WebCore/ChangeLog 2012-04-06 20:02:59 UTC (rev 113486)
+++ trunk/Source/WebCore/ChangeLog 2012-04-06 20:04:56 UTC (rev 113487)
@@ -1,3 +1,32 @@
+2012-04-06 Levi Weintraub <[email protected]>
+
+ Update LayoutUnit usage in RenderView
+ https://bugs.webkit.org/show_bug.cgi?id=83147
+
+ Reviewed by Julien Chaffraix.
+
+ Updating the usage of LayoutUnits in RenderView in preparation for sub-pixel layout. This mostly
+ affects paint and repaint functions, which take LayoutRects up to the RenderView level. This is
+ necessary as we continue to accumulate sub-pixel offsets up to this level.
+
+ No new tests. No change in behavior.
+
+ * rendering/RenderView.cpp:
+ (WebCore::RenderView::paint): Adding an assert that we're being called to paint on pixel
+ boundaries. We don't currently ever position RenderViews at sub-pixel offsets.
+ (WebCore::RenderView::shouldRepaint):
+ (WebCore::RenderView::repaintViewRectangle): Switching to a LayoutRect and cleaning up a fixme
+ that used decomposed offsets. Pixel snapping is applied before handing the rect up to the
+ FrameView.
+ (WebCore::RenderView::repaintRectangleInViewAndCompositedLayers): Pixel snapping before handing
+ the rect up to the Compositor.
+ (WebCore::RenderView::computeRectForRepaint):
+ (WebCore::RenderView::selectionBounds):
+ (WebCore::RenderView::viewRect):
+ (WebCore::RenderView::unscaledDocumentRect):
+ * rendering/RenderView.h:
+ (RenderView):
+
2012-04-06 Tim Horton <[email protected]>
Add autodetection of image orientation from EXIF information
Modified: trunk/Source/WebCore/rendering/RenderView.cpp (113486 => 113487)
--- trunk/Source/WebCore/rendering/RenderView.cpp 2012-04-06 20:02:59 UTC (rev 113486)
+++ trunk/Source/WebCore/rendering/RenderView.cpp 2012-04-06 20:04:56 UTC (rev 113487)
@@ -217,6 +217,8 @@
{
// If we ever require layout but receive a paint anyway, something has gone horribly wrong.
ASSERT(!needsLayout());
+ // RenderViews should never be called to paint with an offset not on device pixels.
+ ASSERT(LayoutPoint(IntPoint(paintOffset.x(), paintOffset.y())) == paintOffset);
paintObject(paintInfo, paintOffset);
}
@@ -294,7 +296,7 @@
}
}
-bool RenderView::shouldRepaint(const IntRect& r) const
+bool RenderView::shouldRepaint(const LayoutRect& r) const
{
if (printing() || r.width() == 0 || r.height() == 0)
return false;
@@ -308,7 +310,7 @@
return true;
}
-void RenderView::repaintViewRectangle(const IntRect& ur, bool immediate)
+void RenderView::repaintViewRectangle(const LayoutRect& ur, bool immediate)
{
if (!shouldRepaint(ur))
return;
@@ -317,23 +319,22 @@
// or even invisible.
Element* elt = document()->ownerElement();
if (!elt)
- m_frameView->repaintContentRectangle(ur, immediate);
+ m_frameView->repaintContentRectangle(pixelSnappedIntRect(ur), immediate);
else if (RenderBox* obj = elt->renderBox()) {
- IntRect vr = viewRect();
- IntRect r = intersection(ur, vr);
+ LayoutRect vr = viewRect();
+ LayoutRect r = intersection(ur, vr);
// Subtract out the contentsX and contentsY offsets to get our coords within the viewing
// rectangle.
r.moveBy(-vr.location());
-
+
// FIXME: Hardcoded offsets here are not good.
- r.move(obj->borderLeft() + obj->paddingLeft(),
- obj->borderTop() + obj->paddingTop());
+ r.moveBy(obj->contentBoxRect().location());
obj->repaintRectangle(r, immediate);
}
}
-void RenderView::repaintRectangleInViewAndCompositedLayers(const IntRect& ur, bool immediate)
+void RenderView::repaintRectangleInViewAndCompositedLayers(const LayoutRect& ur, bool immediate)
{
if (!shouldRepaint(ur))
return;
@@ -342,11 +343,11 @@
#if USE(ACCELERATED_COMPOSITING)
if (compositor()->inCompositingMode())
- compositor()->repaintCompositedLayersAbsoluteRect(ur);
+ compositor()->repaintCompositedLayersAbsoluteRect(pixelSnappedIntRect(ur));
#endif
}
-void RenderView::computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& rect, bool fixed) const
+void RenderView::computeRectForRepaint(RenderBoxModelObject* repaintContainer, LayoutRect& rect, bool fixed) const
{
// If a container was specified, and was not 0 or the RenderView,
// then we should have found it by now.
@@ -420,12 +421,12 @@
}
// Now create a single bounding box rect that encloses the whole selection.
- IntRect selRect;
+ LayoutRect selRect;
SelectionMap::iterator end = selectedObjects.end();
for (SelectionMap::iterator i = selectedObjects.begin(); i != end; ++i) {
RenderSelectionInfo* info = i->second;
// RenderSelectionInfo::rect() is in the coordinates of the repaintContainer, so map to page coordinates.
- IntRect currRect = info->rect();
+ LayoutRect currRect = info->rect();
if (RenderBoxModelObject* repaintContainer = info->repaintContainer()) {
FloatQuad absQuad = repaintContainer->localToAbsoluteQuad(FloatRect(currRect));
currRect = absQuad.enclosingBoundingBox();
@@ -433,7 +434,7 @@
selRect.unite(currRect);
delete info;
}
- return selRect;
+ return pixelSnappedIntRect(selRect);
}
#if USE(ACCELERATED_COMPOSITING)
@@ -706,21 +707,21 @@
releaseWidgets(renderWidgets);
}
-IntRect RenderView::viewRect() const
+LayoutRect RenderView::viewRect() const
{
if (printing())
- return IntRect(IntPoint(), size());
+ return LayoutRect(LayoutPoint(), size());
if (m_frameView)
return m_frameView->visibleContentRect();
- return IntRect();
+ return LayoutRect();
}
IntRect RenderView::unscaledDocumentRect() const
{
- IntRect overflowRect(layoutOverflowRect());
+ LayoutRect overflowRect(layoutOverflowRect());
flipForWritingMode(overflowRect);
- return overflowRect;
+ return pixelSnappedIntRect(overflowRect);
}
LayoutRect RenderView::backgroundRect(RenderBox* backgroundRenderer) const
Modified: trunk/Source/WebCore/rendering/RenderView.h (113486 => 113487)
--- trunk/Source/WebCore/rendering/RenderView.h 2012-04-06 20:02:59 UTC (rev 113486)
+++ trunk/Source/WebCore/rendering/RenderView.h 2012-04-06 20:04:56 UTC (rev 113487)
@@ -68,14 +68,14 @@
FrameView* frameView() const { return m_frameView; }
- virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect&, bool fixed = false) const;
- virtual void repaintViewRectangle(const IntRect&, bool immediate = false);
+ virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, LayoutRect&, bool fixed = false) const;
+ virtual void repaintViewRectangle(const LayoutRect&, bool immediate = false);
// Repaint the view, and all composited layers that intersect the given absolute rectangle.
// FIXME: ideally we'd never have to do this, if all repaints are container-relative.
- virtual void repaintRectangleInViewAndCompositedLayers(const IntRect&, bool immediate = false);
+ virtual void repaintRectangleInViewAndCompositedLayers(const LayoutRect&, bool immediate = false) OVERRIDE;
virtual void paint(PaintInfo&, const LayoutPoint&);
- virtual void paintBoxDecorations(PaintInfo&, const IntPoint&);
+ virtual void paintBoxDecorations(PaintInfo&, const LayoutPoint&) OVERRIDE;
enum SelectionRepaintMode { RepaintNewXOROld, RepaintNewMinusOld, RepaintNothing };
void setSelection(RenderObject* start, int startPos, RenderObject* end, int endPos, SelectionRepaintMode = RepaintNewXOROld);
@@ -98,7 +98,7 @@
#endif
int maximalOutlineSize() const { return m_maximalOutlineSize; }
- virtual IntRect viewRect() const;
+ virtual LayoutRect viewRect() const OVERRIDE;
void updateWidgetPositions();
void addWidget(RenderWidget*);
@@ -201,7 +201,7 @@
virtual void calcColumnWidth() OVERRIDE;
virtual ColumnInfo::PaginationUnit paginationUnit() const OVERRIDE;
- bool shouldRepaint(const IntRect& r) const;
+ bool shouldRepaint(const LayoutRect&) const;
// These functions may only be accessed by LayoutStateMaintainer.
void pushLayoutState(RenderFlowThread*, bool regionsChanged);