Diff
Modified: trunk/Source/WebCore/ChangeLog (163972 => 163973)
--- trunk/Source/WebCore/ChangeLog 2014-02-12 20:32:46 UTC (rev 163972)
+++ trunk/Source/WebCore/ChangeLog 2014-02-12 20:34:57 UTC (rev 163973)
@@ -1,3 +1,41 @@
+2014-02-12 Zalan Bujtas <[email protected]>
+
+ Subpixel layout: Clean up LayoutPoint class.
+ https://bugs.webkit.org/show_bug.cgi?id=128515
+
+ Reviewed by Simon Fraser.
+
+ Remove redundant functions (keep the more explicit ones).
+
+ No change in functionality.
+
+ * page/FrameView.cpp:
+ (WebCore::FrameView::viewportConstrainedVisibleContentRect):
+ * platform/graphics/LayoutPoint.h:
+ (WebCore::toLayoutPoint):
+ (WebCore::toLayoutSize):
+ (WebCore::roundedIntPoint):
+ * platform/graphics/ca/GraphicsLayerCA.cpp:
+ (WebCore::GraphicsLayerCA::updateContentsRects):
+ * rendering/LayoutState.cpp:
+ (WebCore::LayoutState::LayoutState):
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::addFocusRingRects):
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::offsetFromContainer):
+ * rendering/RenderInline.cpp:
+ (WebCore::RenderInline::addFocusRingRects):
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::updateLayerPosition):
+ (WebCore::accumulateOffsetTowardsAncestor):
+ (WebCore::RenderLayer::paintBackgroundForFragments):
+ (WebCore::RenderLayer::paintForegroundForFragmentsWithPhase):
+ (WebCore::RenderLayer::paintOutlineForFragments):
+ (WebCore::RenderLayer::paintMaskForFragments):
+ (WebCore::RenderLayer::paintOverflowControlsForFragments):
+ * rendering/RenderScrollbarPart.cpp:
+ (WebCore::RenderScrollbarPart::paintIntoRect):
+
2014-02-12 Zan Dobersek <[email protected]>
[CoordinatedGraphics] Move CoordinatedGraphicsScene, CoordinatedLayerTreeHostProxy to std::function
Modified: trunk/Source/WebCore/page/FrameView.cpp (163972 => 163973)
--- trunk/Source/WebCore/page/FrameView.cpp 2014-02-12 20:32:46 UTC (rev 163972)
+++ trunk/Source/WebCore/page/FrameView.cpp 2014-02-12 20:34:57 UTC (rev 163973)
@@ -1538,7 +1538,7 @@
return customFixedPositionLayoutRect();
#endif
LayoutRect viewportRect = visibleContentRect();
- viewportRect.setLocation(toPoint(scrollOffsetForFixedPosition()));
+ viewportRect.setLocation(toLayoutPoint(scrollOffsetForFixedPosition()));
return viewportRect;
}
Modified: trunk/Source/WebCore/platform/graphics/LayoutPoint.h (163972 => 163973)
--- trunk/Source/WebCore/platform/graphics/LayoutPoint.h 2014-02-12 20:32:46 UTC (rev 163972)
+++ trunk/Source/WebCore/platform/graphics/LayoutPoint.h 2014-02-12 20:34:57 UTC (rev 163973)
@@ -140,21 +140,16 @@
return a.x() != b.x() || a.y() != b.y();
}
-inline LayoutPoint toPoint(const LayoutSize& size)
+inline LayoutPoint toLayoutPoint(const LayoutSize& size)
{
return LayoutPoint(size.width(), size.height());
}
-inline LayoutPoint toLayoutPoint(const LayoutSize& p)
+inline LayoutSize toLayoutSize(const LayoutPoint& point)
{
- return LayoutPoint(p.width(), p.height());
+ return LayoutSize(point.x(), point.y());
}
-inline LayoutSize toSize(const LayoutPoint& a)
-{
- return LayoutSize(a.x(), a.y());
-}
-
inline IntPoint flooredIntPoint(const LayoutPoint& point)
{
return IntPoint(point.x().floor(), point.y().floor());
@@ -167,7 +162,7 @@
inline IntPoint roundedIntPoint(const LayoutSize& size)
{
- return IntPoint(size.width().round(), size.height().round());
+ return roundedIntPoint(toLayoutPoint(size));
}
inline IntPoint ceiledIntPoint(const LayoutPoint& point)
@@ -199,17 +194,6 @@
#endif
}
-inline LayoutSize toLayoutSize(const LayoutPoint& p)
-{
- return LayoutSize(p.x(), p.y());
-}
-
-inline LayoutPoint flooredLayoutPoint(const FloatSize& s)
-{
- return flooredLayoutPoint(FloatPoint(s));
-}
-
-
} // namespace WebCore
#endif // LayoutPoint_h
Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (163972 => 163973)
--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2014-02-12 20:32:46 UTC (rev 163972)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2014-02-12 20:34:57 UTC (rev 163973)
@@ -2038,7 +2038,7 @@
clippingOrigin = m_contentsClippingRect.location();
clippingBounds.setSize(m_contentsClippingRect.size());
- contentOrigin = toPoint(m_contentsRect.location() - m_contentsClippingRect.location());
+ contentOrigin = toLayoutPoint(m_contentsRect.location() - m_contentsClippingRect.location());
m_contentsClippingLayer->setPosition(clippingOrigin);
m_contentsClippingLayer->setBounds(clippingBounds);
Modified: trunk/Source/WebCore/rendering/LayoutState.cpp (163972 => 163973)
--- trunk/Source/WebCore/rendering/LayoutState.cpp 2014-02-12 20:32:46 UTC (rev 163972)
+++ trunk/Source/WebCore/rendering/LayoutState.cpp 2014-02-12 20:34:57 UTC (rev 163973)
@@ -72,7 +72,7 @@
m_clipRect = m_next->m_clipRect;
if (renderer->hasOverflowClip()) {
- LayoutRect clipRect(toPoint(m_paintOffset) + renderer->view().layoutDelta(), renderer->cachedSizeForOverflowClip());
+ LayoutRect clipRect(toLayoutPoint(m_paintOffset) + renderer->view().layoutDelta(), renderer->cachedSizeForOverflowClip());
if (m_clipped)
m_clipRect.intersect(clipRect);
else {
@@ -161,7 +161,7 @@
if (container->hasOverflowClip()) {
m_clipped = true;
RenderBox* containerBox = toRenderBox(container);
- m_clipRect = LayoutRect(toPoint(m_paintOffset), containerBox->cachedSizeForOverflowClip());
+ m_clipRect = LayoutRect(toLayoutPoint(m_paintOffset), containerBox->cachedSizeForOverflowClip());
m_paintOffset -= containerBox->scrolledContentOffset();
}
}
Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (163972 => 163973)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2014-02-12 20:32:46 UTC (rev 163972)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2014-02-12 20:34:57 UTC (rev 163973)
@@ -5001,7 +5001,7 @@
}
if (inlineElementContinuation())
- inlineElementContinuation()->addFocusRingRects(rects, flooredLayoutPoint(additionalOffset + inlineElementContinuation()->containingBlock()->location() - location()), paintContainer);
+ inlineElementContinuation()->addFocusRingRects(rects, flooredLayoutPoint(LayoutPoint(additionalOffset + inlineElementContinuation()->containingBlock()->location() - location())), paintContainer);
}
RenderBox* RenderBlock::createAnonymousBoxWithSameTypeAs(const RenderObject* parent) const
Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (163972 => 163973)
--- trunk/Source/WebCore/rendering/RenderBox.cpp 2014-02-12 20:32:46 UTC (rev 163972)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp 2014-02-12 20:34:57 UTC (rev 163973)
@@ -1942,7 +1942,7 @@
RenderBlock* block = toRenderBlock(o);
LayoutRect columnRect(frameRect());
block->adjustStartEdgeForWritingModeIncludingColumns(columnRect);
- offset += toSize(columnRect.location());
+ offset += toLayoutSize(columnRect.location());
LayoutPoint columnPoint = block->flipForWritingModeIncludingColumns(point + offset);
offset = toLayoutSize(block->flipForWritingModeIncludingColumns(toLayoutPoint(offset)));
o->adjustForColumns(offset, columnPoint);
Modified: trunk/Source/WebCore/rendering/RenderInline.cpp (163972 => 163973)
--- trunk/Source/WebCore/rendering/RenderInline.cpp 2014-02-12 20:32:46 UTC (rev 163972)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp 2014-02-12 20:34:57 UTC (rev 163973)
@@ -1485,9 +1485,9 @@
if (RenderBoxModelObject* continuation = this->continuation()) {
if (continuation->isInline())
- continuation->addFocusRingRects(rects, flooredLayoutPoint(additionalOffset + continuation->containingBlock()->location() - containingBlock()->location()), paintContainer);
+ continuation->addFocusRingRects(rects, flooredLayoutPoint(LayoutPoint(additionalOffset + continuation->containingBlock()->location() - containingBlock()->location())), paintContainer);
else
- continuation->addFocusRingRects(rects, flooredLayoutPoint(additionalOffset + toRenderBox(continuation)->location() - containingBlock()->location()), paintContainer);
+ continuation->addFocusRingRects(rects, flooredLayoutPoint(LayoutPoint(additionalOffset + toRenderBox(continuation)->location() - containingBlock()->location())), paintContainer);
}
}
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (163972 => 163973)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2014-02-12 20:32:46 UTC (rev 163972)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2014-02-12 20:34:57 UTC (rev 163973)
@@ -1198,7 +1198,7 @@
RenderInline& inlineFlow = toRenderInline(renderer());
IntRect lineBox = inlineFlow.linesBoundingBox();
setSize(lineBox.size());
- inlineBoundingBoxOffset = toSize(lineBox.location());
+ inlineBoundingBoxOffset = toLayoutSize(lineBox.location());
localPoint += inlineBoundingBoxOffset;
} else if (RenderBox* box = renderBox()) {
// FIXME: Is snapping the size really needed here for the RenderBox case?
@@ -1930,13 +1930,13 @@
if (position == FixedPosition && fixedFlowThreadContainer) {
ASSERT(ancestorLayer);
if (ancestorLayer->isOutOfFlowRenderFlowThread()) {
- location += toSize(layer->location());
+ location += toLayoutSize(layer->location());
return ancestorLayer;
}
if (ancestorLayer == renderer.view().layer()) {
// Add location in flow thread coordinates.
- location += toSize(layer->location());
+ location += toLayoutSize(layer->location());
// Add flow thread offset in view coordinates since the view may be scrolled.
FloatPoint absPos = renderer.view().localToAbsolute(FloatPoint(), IsFixed);
@@ -1990,7 +1990,7 @@
if (!parentLayer)
return 0;
- location += toSize(layer->location());
+ location += toLayoutSize(layer->location());
if (adjustForColumns == RenderLayer::AdjustForColumns) {
if (RenderLayer* parentLayer = layer->parent()) {
@@ -4321,7 +4321,7 @@
// Paint the background.
// FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info.
PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect.rect()), PaintPhaseBlockBackground, paintBehavior, subtreePaintRootForRenderer, localPaintingInfo.region, 0, 0, &localPaintingInfo.rootLayer->renderer());
- renderer().paint(paintInfo, toPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subPixelAccumulation));
+ renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subPixelAccumulation));
if (localPaintingInfo.clipToDirtyRect)
restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.backgroundRect);
@@ -4396,7 +4396,7 @@
PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.foregroundRect.rect()), phase, paintBehavior, subtreePaintRootForRenderer, localPaintingInfo.region, 0, 0, &localPaintingInfo.rootLayer->renderer());
if (phase == PaintPhaseForeground)
paintInfo.overlapTestRequests = localPaintingInfo.overlapTestRequests;
- renderer().paint(paintInfo, toPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subPixelAccumulation));
+ renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subPixelAccumulation));
if (shouldClip)
restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.foregroundRect);
@@ -4414,7 +4414,7 @@
// Paint our own outline
PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.outlineRect.rect()), PaintPhaseSelfOutline, paintBehavior, subtreePaintRootForRenderer, localPaintingInfo.region, 0, 0, &localPaintingInfo.rootLayer->renderer());
clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.paintDirtyRect, fragment.outlineRect, DoNotIncludeSelfForBorderRadius);
- renderer().paint(paintInfo, toPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subPixelAccumulation));
+ renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subPixelAccumulation));
restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.outlineRect);
}
}
@@ -4433,7 +4433,7 @@
// Paint the mask.
// FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info.
PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect.rect()), PaintPhaseMask, PaintBehaviorNormal, subtreePaintRootForRenderer, localPaintingInfo.region, 0, 0, &localPaintingInfo.rootLayer->renderer());
- renderer().paint(paintInfo, toPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subPixelAccumulation));
+ renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subPixelAccumulation));
if (localPaintingInfo.clipToDirtyRect)
restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.backgroundRect);
@@ -4445,7 +4445,7 @@
for (size_t i = 0; i < layerFragments.size(); ++i) {
const LayerFragment& fragment = layerFragments.at(i);
clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.paintDirtyRect, fragment.backgroundRect);
- paintOverflowControls(context, roundedIntPoint(toPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subPixelAccumulation)),
+ paintOverflowControls(context, roundedIntPoint(toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subPixelAccumulation)),
pixelSnappedIntRect(fragment.backgroundRect.rect()), true);
restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.backgroundRect);
}
Modified: trunk/Source/WebCore/rendering/RenderScrollbarPart.cpp (163972 => 163973)
--- trunk/Source/WebCore/rendering/RenderScrollbarPart.cpp 2014-02-12 20:32:46 UTC (rev 163972)
+++ trunk/Source/WebCore/rendering/RenderScrollbarPart.cpp 2014-02-12 20:34:57 UTC (rev 163973)
@@ -160,7 +160,7 @@
void RenderScrollbarPart::paintIntoRect(GraphicsContext* graphicsContext, const LayoutPoint& paintOffset, const LayoutRect& rect)
{
// Make sure our dimensions match the rect.
- setLocation(rect.location() - toSize(paintOffset));
+ setLocation(rect.location() - toLayoutSize(paintOffset));
setWidth(rect.width());
setHeight(rect.height());