Push pixel snapping logic into TransformState
authorleviw@chromium.org <leviw@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 16 Dec 2012 21:50:20 +0000 (21:50 +0000)
committerleviw@chromium.org <leviw@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 16 Dec 2012 21:50:20 +0000 (21:50 +0000)
commit72da00e414aff11cf8815fee0edcc6e8cbefd416
treeb22558eda5607dbe6708e392097e7a30235b9550
parent3efc1f14c8cfd4023e279a7227ab6f4b11493dbe
Push pixel snapping logic into TransformState
https://bugs.webkit.org/show_bug.cgi?id=101779

Reviewed by Simon Fraser.

Source/WebCore:

The old SnapOffsetForTransforms behavior fell apart when there was content nested in
multiple levels of containers with sub-pixel offsets. The point of this flag was to
mirror the pixel snapping that occurs in paint, where offsets are accumulated bottom-
up through the render tree and snapped at the end. This change eliminates this flag
and pushes pixel snapping logic down into TransformState.

TransformState now tracks a LayoutSize accumulated offset when there's no transform
or we're just translating. We then snap and apply this offset before accumulating
values into a transform, and when returning planar coordinates to callers.

Test: fast/sub-pixel/transformed-iframe-copy-on-scroll.html added,
      fast/sub-pixel/sub-pixel-iframe-copy-on-scroll.html modified to also catch this bug.

* platform/graphics/transforms/TransformState.cpp:
(WebCore::TransformState::operator=): Pass accumulated offset.
(WebCore::TransformState::translateTransform): Extracted this functionality for
re-use when applying the accumulated offset, or accumulating from a call to move.
(WebCore::TransformState::translateMappedCoordinates): Same as above when we're not
acculating into a transform.
(WebCore::TransformState::move): Changed to accumulate into m_accumulatedOffset when
not accumulating into a transform.
(WebCore::TransformState::applyAccumulatedOffset):
(WebCore::TransformState::applyTransform): Applies the accumulated offset before the
transform.
(WebCore::TransformState::flatten): Ditto for flattening.
(WebCore::TransformState::mappedPoint): Translates by the accumulated offset before
returning.
(WebCore::TransformState::mappedQuad): Ditto.
* platform/graphics/transforms/TransformState.h:
(TransformState): Added m_accumulatedOffset.
* rendering/RenderGeometryMap.cpp:
(WebCore::RenderGeometryMap::mapToContainer): When not using a transform, we still need
to snap our offset before applying to our float result. Also, flatten when we have a
non-uniform step.
* rendering/RenderGeometryMap.h:
(RenderGeometryMap): Remove use of SnapOffsetForTransforms.

Everything below simply drops the use of SnapOffsetForTransforms:

* dom/ContainerNode.cpp:
(WebCore::ContainerNode::getUpperLeftCorner):
* dom/MouseRelatedEvent.cpp:
(WebCore::MouseRelatedEvent::computeRelativePosition):
* editing/FrameSelection.cpp:
(WebCore::CaretBase::absoluteBoundsForLocalRect):
* editing/RenderedPosition.cpp:
(WebCore::RenderedPosition::absoluteRect):
* editing/VisiblePosition.cpp:
(WebCore::VisiblePosition::absoluteCaretBounds):
* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::listBoxDefaultEventHandler):
* html/shadow/SliderThumbElement.cpp:
(WebCore::SliderThumbElement::setPositionFromPoint):
* html/shadow/SpinButtonElement.cpp:
(WebCore::SpinButtonElement::defaultEventHandler):
* page/FrameView.cpp:
(WebCore::FrameView::convertFromRenderer):
(WebCore::FrameView::convertToRenderer):
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::paintDocumentMarker):
(WebCore::InlineTextBox::paintTextMatchMarker):
(WebCore::InlineTextBox::computeRectForReplacementMarker):
* rendering/LayoutState.cpp:
(WebCore::LayoutState::LayoutState):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::mapLocalToContainer):
(WebCore::RenderBox::pushMappingToContainer):
* rendering/RenderBox.h:
(RenderBox):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::computeStickyPositionConstraints):
* rendering/RenderEmbeddedObject.cpp:
(WebCore::RenderEmbeddedObject::isInUnavailablePluginIndicator):
* rendering/RenderFrameSet.cpp:
(WebCore::RenderFrameSet::userResize):
* rendering/RenderInline.cpp:
(WebCore::RenderInline::mapLocalToContainer):
(WebCore::RenderInline::pushMappingToContainer):
* rendering/RenderInline.h:
(RenderInline):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::absoluteToContents):
(WebCore::RenderLayer::scrollTo):
(WebCore::RenderLayer::childrenClipRect):
(WebCore::RenderLayer::selfClipRect):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::contentsVisible):
* rendering/RenderMediaControls.cpp:
(WebCore::RenderMediaControls::volumeSliderOffsetFromMuteButton):
* rendering/RenderMenuList.cpp:
(WebCore::RenderMenuList::showPopup):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::absoluteFocusRingQuads):
* rendering/RenderObject.h:
* rendering/RenderText.cpp:
(WebCore::RenderText::absoluteRectsForRange):
(WebCore::RenderText::absoluteQuads):
(WebCore::RenderText::absoluteQuadsForRange):
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::volumeSliderOffsetFromMuteButton):
* rendering/RenderView.cpp:
(WebCore::RenderView::selectionBounds):
* rendering/RenderView.h:
(RenderView):
* rendering/RenderWidget.cpp:
(WebCore::RenderWidget::updateWidgetGeometry):
* 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):

Source/WebKit/chromium:

Eliminating use of SnapOffsetForTransforms as it's no longer needed.

* src/FindInPageCoordinates.cpp:
(WebKit::toNormalizedRect):
* src/LinkHighlight.cpp:
(WebKit::convertTargetSpaceQuadToCompositedLayer):
* src/WebInputEventConversion.cpp:
(WebKit::convertAbsoluteLocationForRenderObject):
* src/WebPluginContainerImpl.cpp:
(WebKit::WebPluginContainerImpl::windowToLocalPoint):

Source/WebKit/mac:

* WebView/WebFullScreenController.mm:
(screenRectOfContents): Removed SnapOffsetForTransforms as it's no longer needed.

Source/WebKit2:

Eliminating use of SnapOffsetForTransforms as it's no longer needed.

* WebProcess/FullScreen/WebFullScreenManager.cpp:
(WebKit::screenRectOfContents):

LayoutTests:

* fast/dom/Window/webkitConvertPoint.html: Updating values to match corrected pixel snapping.
* fast/multicol/break-properties.html: Fixing sub-pixel layout feature checking.
* fast/multicol/vertical-lr/break-properties.html: Ditto.
* fast/multicol/vertical-rl/break-properties.html: Ditto.
* fast/sub-pixel/sub-pixel-iframe-copy-on-scroll.html: Updating to catch the bug where the old
pixel snapping logic did the wrong thing when nested.
* fast/sub-pixel/transformed-iframe-copy-on-scroll.html: Added.
* platform/chromium-linux/fast/sub-pixel/sub-pixel-iframe-copy-on-scroll-expected.png:
* platform/chromium-linux/fast/sub-pixel/transformed-iframe-copy-on-scroll-expected.png: Added.
* platform/chromium-linux/fast/sub-pixel/transformed-iframe-copy-on-scroll-expected.txt: Added.
* platform/chromium-win/fast/sub-pixel/sub-pixel-iframe-copy-on-scroll-expected.txt:
* platform/chromium/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@137847 268f45cc-cd09-0410-ab3c-d52691b4dbfc
69 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/Window/webkitConvertPoint.html
LayoutTests/fast/multicol/break-properties.html
LayoutTests/fast/multicol/vertical-lr/break-properties.html
LayoutTests/fast/multicol/vertical-rl/break-properties.html
LayoutTests/fast/sub-pixel/sub-pixel-iframe-copy-on-scroll.html
LayoutTests/fast/sub-pixel/transformed-iframe-copy-on-scroll.html [new file with mode: 0644]
LayoutTests/platform/chromium-linux/fast/sub-pixel/sub-pixel-iframe-copy-on-scroll-expected.png
LayoutTests/platform/chromium-linux/fast/sub-pixel/transformed-iframe-copy-on-scroll-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-linux/fast/sub-pixel/transformed-iframe-copy-on-scroll-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-win/fast/sub-pixel/sub-pixel-iframe-copy-on-scroll-expected.txt
LayoutTests/platform/chromium/TestExpectations
LayoutTests/platform/mac/accessibility/radio-button-group-members-expected.txt
LayoutTests/platform/mac/fast/dom/Window/webkitConvertPoint-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/dom/ContainerNode.cpp
Source/WebCore/dom/MouseRelatedEvent.cpp
Source/WebCore/editing/FrameSelection.cpp
Source/WebCore/editing/RenderedPosition.cpp
Source/WebCore/editing/VisiblePosition.cpp
Source/WebCore/html/HTMLSelectElement.cpp
Source/WebCore/html/shadow/SliderThumbElement.cpp
Source/WebCore/html/shadow/SpinButtonElement.cpp
Source/WebCore/page/FrameView.cpp
Source/WebCore/platform/graphics/transforms/TransformState.cpp
Source/WebCore/platform/graphics/transforms/TransformState.h
Source/WebCore/rendering/InlineTextBox.cpp
Source/WebCore/rendering/LayoutState.cpp
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderBox.h
Source/WebCore/rendering/RenderBoxModelObject.cpp
Source/WebCore/rendering/RenderEmbeddedObject.cpp
Source/WebCore/rendering/RenderFrameSet.cpp
Source/WebCore/rendering/RenderGeometryMap.cpp
Source/WebCore/rendering/RenderGeometryMap.h
Source/WebCore/rendering/RenderInline.cpp
Source/WebCore/rendering/RenderInline.h
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderLayerBacking.cpp
Source/WebCore/rendering/RenderMediaControls.cpp
Source/WebCore/rendering/RenderMenuList.cpp
Source/WebCore/rendering/RenderObject.cpp
Source/WebCore/rendering/RenderObject.h
Source/WebCore/rendering/RenderText.cpp
Source/WebCore/rendering/RenderTheme.cpp
Source/WebCore/rendering/RenderView.cpp
Source/WebCore/rendering/RenderView.h
Source/WebCore/rendering/RenderWidget.cpp
Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp
Source/WebCore/rendering/svg/RenderSVGForeignObject.h
Source/WebCore/rendering/svg/RenderSVGInline.cpp
Source/WebCore/rendering/svg/RenderSVGInline.h
Source/WebCore/rendering/svg/RenderSVGModelObject.cpp
Source/WebCore/rendering/svg/RenderSVGModelObject.h
Source/WebCore/rendering/svg/RenderSVGRoot.h
Source/WebCore/rendering/svg/RenderSVGText.cpp
Source/WebCore/rendering/svg/RenderSVGText.h
Source/WebCore/rendering/svg/SVGRenderSupport.cpp
Source/WebCore/rendering/svg/SVGRenderSupport.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/FindInPageCoordinates.cpp
Source/WebKit/chromium/src/LinkHighlight.cpp
Source/WebKit/chromium/src/WebInputEventConversion.cpp
Source/WebKit/chromium/src/WebPluginContainerImpl.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebFullScreenController.mm
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.cpp
WebKit.xcworkspace/xcshareddata/xcschemes/All Source.xcscheme