12012-08-13 Levi Weintraub <leviw@chromium.org>
2
3 Accumulate sub-pixel offsets through layers and transforms
4 https://bugs.webkit.org/show_bug.cgi?id=89238
5
6 Reviewed by NOBODY (OOPS!).
7
8 Pixel snapping logic makes use of sub-pixel offsets accumulated when walking down
9 the render tree. When we align RenderLayers to paint on pixel boundaries, we were
10 also losing that accumulated value. This preserves the fractional offset and passes
11 it to the RenderLayer's RenderObjects so they paint the proper size and offset.
12
13 This also necessitates a new mode of mapLocalToContainer whereby we pixel snap the
14 offset used in transforms. Otherwise, they wouldn't account for the pixel snapping
15 done elsewhere in the render tree.
16
17 Test: fast/sub-pixel/sub-pixel-accumulates-to-layers.html
18
19 * css/CSSComputedStyleDeclaration.cpp:
20 (WebCore::pixelSnappedSizingBox): The LayoutUnit version of sizingBox returns a
21 LayoutRect with the location zeroed out. This leads to incorrect pixel snapping, so
22 we shouldn't put these numbers into a transform. Sadly, I couldn't figure out a
23 test for this without the rest of the patch.
24 (WebCore):
25 (WebCore::computedTransform): Using pixel-snapped values when generating transforms.
26 * rendering/RenderBox.cpp:
27 (WebCore::RenderBox::mapLocalToContainer): Adding a mode whereby the values inputed
28 into the transform are properly pixel snapped.
29 (WebCore::RenderBox::computeRectForRepaint): Using pixel snapped values for the transform.
30 * rendering/RenderBox.h:
31 (RenderBox):
32 * rendering/RenderGeometryMap.cpp:
33 (WebCore::RenderGeometryMap::mapToAbsolute):
34 * rendering/RenderInline.cpp:
35 (WebCore::RenderInline::mapLocalToContainer):
36 * rendering/RenderInline.h:
37 (RenderInline):
38 * rendering/RenderLayer.cpp:
39 (WebCore::RenderLayer::updateTransform): Using pixel snapped values for the transform.
40 (WebCore::RenderLayer::currentTransform): Ditto.
41 (WebCore::RenderLayer::perspectiveTransform): Ditto.
42 (WebCore::RenderLayer::paint): Support passing along the accumulated sub-pixel offset instead
43 of rounding and use enclosingIntRect for the damageRect.
44 (WebCore::RenderLayer::paintOverlayScrollbars): Updating to the new paintLayer contract
45 (WebCore::RenderLayer::paintLayer): Adding a sub-pixel accumulation LayoutSize. We pass this
46 delta to the Layer's RenderObject when we paint, but align the graphics context to the proper
47 pixel value.
48 (WebCore::RenderLayer::paintLayerContentsAndReflection): Ditto.
49 (WebCore::RenderLayer::paintLayerContents): Ditto.
50 (WebCore::RenderLayer::paintList): Ditto.
51 (WebCore::RenderLayer::paintChildLayerIntoColumns): Ditto.
52 (WebCore::RenderLayer::calculateClipRects): Avoid unnecessary rounding when sub-pixel is enabled.
53 (WebCore::RenderLayer::calculateRects): Remove unnecessary pixel snapping.
54 * rendering/RenderLayer.h:
55 (RenderLayer):
56 * rendering/RenderLayerBacking.cpp:
57 (WebCore::RenderLayerBacking::updateLayerTransform): Use pixel-snapped values for transforms.
58 (WebCore::RenderLayerBacking::paintIntoLayer): Update to new paintLayer contract.
59 * rendering/RenderObject.cpp:
60 (WebCore::RenderObject::localToContainerQuad): Adding a mode for optionally pixel snapping.
61 (WebCore::RenderObject::localToContainerPoint): Ditto.
62 * rendering/RenderObject.h:
63 (WebCore::RenderObject::localToAbsoluteQuad): Ditto.
64 (RenderObject):
65 * rendering/RenderReplica.cpp:
66 (WebCore::RenderReplica::paint): Updating to new paintLayer contract.
67 * rendering/RenderView.h:
68 (RenderView):
69 * rendering/svg/RenderSVGForeignObject.cpp:
70 (WebCore::RenderSVGForeignObject::mapLocalToContainer):
71 * rendering/svg/RenderSVGForeignObject.h:
72 (RenderSVGForeignObject):
73 * rendering/svg/RenderSVGInline.cpp:
74 (WebCore::RenderSVGInline::mapLocalToContainer):
75 * rendering/svg/RenderSVGInline.h:
76 (RenderSVGInline):
77 * rendering/svg/RenderSVGModelObject.cpp:
78 (WebCore::RenderSVGModelObject::mapLocalToContainer):
79 * rendering/svg/RenderSVGModelObject.h:
80 (RenderSVGModelObject):
81 * rendering/svg/RenderSVGRoot.h:
82 (RenderSVGRoot):
83 * rendering/svg/RenderSVGText.cpp:
84 (WebCore::RenderSVGText::mapLocalToContainer):
85 * rendering/svg/RenderSVGText.h:
86 (RenderSVGText):
87 * rendering/svg/SVGRenderSupport.cpp:
88 (WebCore::SVGRenderSupport::mapLocalToContainer):
89 * rendering/svg/SVGRenderSupport.h:
90 (SVGRenderSupport):
91