-
leviw@chromium.org authored
https://bugs.webkit.org/show_bug.cgi?id=89238 Reviewed by Eric Seidel. Source/WebCore: Pixel snapping logic makes use of sub-pixel offsets accumulated when walking down the render tree. When we align RenderLayers to paint on pixel boundaries, we were also losing that accumulated value. This preserves the fractional offset and passes it to the RenderLayer's RenderObjects so they paint the proper size and offset. This also necessitates a new mode of mapLocalToContainer whereby we pixel snap the offset used in transforms. Otherwise, they wouldn't account for the pixel snapping done elsewhere in the render tree. Test: fast/sub-pixel/sub-pixel-accumulates-to-layers.html * css/CSSComputedStyleDeclaration.cpp: (WebCore::pixelSnappedSizingBox): The LayoutUnit version of sizingBox returns a LayoutRect with the location zeroed out. This leads to incorrect pixel snapping, so we shouldn't put these numbers into a transform. Sadly, I couldn't figure out a test for this without the rest of the patch. (WebCore): (WebCore::computedTransform): Using pixel-snapped values when generating transforms. * rendering/RenderBox.cpp: (WebCore::RenderBox::mapLocalToContainer): Adding a mode whereby the values inputed into the transform are properly pixel snapped. (WebCore::RenderBox::computeRectForRepaint): Using pixel snapped values for the transform. * rendering/RenderBox.h: (RenderBox): * rendering/RenderGeometryMap.cpp: (WebCore::RenderGeometryMap::mapToAbsolute): * rendering/RenderInline.cpp: (WebCore::RenderInline::mapLocalToContainer): * rendering/RenderInline.h: (RenderInline): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::updateTransform): Using pixel snapped values for the transform. (WebCore::RenderLayer::currentTransform): Ditto. (WebCore::RenderLayer::perspectiveTransform): Ditto. (WebCore::RenderLayer::paint): Support passing along the accumulated sub-pixel offset instead of rounding and use enclosingIntRect for the damageRect. (WebCore::RenderLayer::paintOverlayScrollbars): Updating to the new paintLayer contract (WebCore::RenderLayer::paintLayer): Adding a sub-pixel accumulation LayoutSize. We pass this delta to the Layer's RenderObject when we paint, but align the graphics context to the proper pixel value. (WebCore::RenderLayer::paintLayerContentsAndReflection): Ditto. (WebCore::RenderLayer::paintLayerContents): Ditto. (WebCore::RenderLayer::paintList): Ditto. (WebCore::RenderLayer::paintChildLayerIntoColumns): Ditto. (WebCore::RenderLayer::calculateClipRects): Avoid unnecessary rounding when sub-pixel is enabled. (WebCore::RenderLayer::calculateRects): Remove unnecessary pixel snapping. * rendering/RenderLayer.h: (RenderLayer): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateLayerTransform): Use pixel-snapped values for transforms. (WebCore::RenderLayerBacking::paintIntoLayer): Update to new paintLayer contract. * rendering/RenderObject.cpp: (WebCore::RenderObject::localToContainerQuad): Adding a mode for optionally pixel snapping. (WebCore::RenderObject::localToContainerPoint): Ditto. * rendering/RenderObject.h: (WebCore::RenderObject::localToAbsoluteQuad): Ditto. (RenderObject): * rendering/RenderReplica.cpp: (WebCore::RenderReplica::paint): Updating to new paintLayer contract. * rendering/RenderView.h: (RenderView): * rendering/svg/RenderSVGForeignObject.cpp: (WebCore::RenderSVGForeignObject::mapLocalToContainer): * rendering/svg/RenderSVGForeignObject.h: (RenderSVGForeignObject): * rendering/svg/RenderSVGInline.cpp: (WebCore::RenderSVGInline::mapLocalToContainer): * rendering/svg/RenderSVGInline.h: (RenderSVGInline): * rendering/svg/RenderSVGModelObject.cpp: (WebCore::RenderSVGModelObject::mapLocalToContainer): * rendering/svg/RenderSVGModelObject.h: (RenderSVGModelObject): * rendering/svg/RenderSVGRoot.h: (RenderSVGRoot): * rendering/svg/RenderSVGText.cpp: (WebCore::RenderSVGText::mapLocalToContainer): * rendering/svg/RenderSVGText.h: (RenderSVGText): * rendering/svg/SVGRenderSupport.cpp: (WebCore::SVGRenderSupport::mapLocalToContainer): * rendering/svg/SVGRenderSupport.h: (SVGRenderSupport): LayoutTests: * fast/sub-pixel/sub-pixel-accumulates-to-layers.html: Added. * platform/chromium-mac/compositing/shadows/shadow-drawing-expected.png: * platform/chromium-mac/fast/repaint/scroll-fixed-layer-with-transformed-parent-layer-expected.png: * platform/chromium-mac/fast/sub-pixel/sub-pixel-accumulates-to-layers-expected.png: Added. * platform/chromium-mac/fast/sub-pixel/sub-pixel-accumulates-to-layers-expected.txt: Added. * platform/chromium-mac/fast/transforms/transformed-document-element-expected.png: * platform/chromium-mac/media/audio-repaint-expected.png: * platform/chromium-mac/svg/transforms/svg-css-transforms-expected.png: * platform/chromium/TestExpectations: * platform/efl/Skipped: * platform/gtk/TestExpectations: * platform/mac-lion/Skipped: * platform/mac-snowleopard/Skipped: * platform/mac-wk2/Skipped: * platform/mac/Skipped: * platform/qt-4.8/Skipped: * platform/qt/Skipped: * platform/win-wk2/Skipped: * platform/win-xp/Skipped: * platform/win/Skipped: * platform/wincairo/Skipped: * platform/wk2/Skipped: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125794 268f45cc-cd09-0410-ab3c-d52691b4dbfc
248a7155