Remove #if PLATFORM(IOS) in various places around customFixedPositionLayoutRect() code

https://bugs.webkit.org/show_bug.cgi?id=127373

Reviewed by Beth Dakin.

Instead of PLATFORM(IOS) #idefs at every call site for viewportConstrainedVisibleContentRect(),
move the #ifdef inside viewportConstrainedVisibleContentRect().

The one call site that needs special handling is RenderLayerBacking::updateCompositedBounds(),
which needs to avoid clipping fixed layers to the custom fixed position rect, but instead to
visibleContentRect() (which is really the document bounds on iOS). This ensures that the
fixed layers aren't clipped when zooming out.

* page/FrameView.cpp:
(WebCore::FrameView::viewportConstrainedVisibleContentRect):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::stickyPositionOffset):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateCompositedBounds):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::requiresCompositingForPosition):
(WebCore::RenderLayerCompositor::computeFixedViewportConstraints):
(WebCore::RenderLayerCompositor::computeStickyViewportConstraints):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162480 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 4a4c96dc
2014-01-21 Simon Fraser <simon.fraser@apple.com>
Remove #if PLATFORM(IOS) in various places around customFixedPositionLayoutRect() code
https://bugs.webkit.org/show_bug.cgi?id=127373
Reviewed by Beth Dakin.
Instead of PLATFORM(IOS) #idefs at every call site for viewportConstrainedVisibleContentRect(),
move the #ifdef inside viewportConstrainedVisibleContentRect().
The one call site that needs special handling is RenderLayerBacking::updateCompositedBounds(),
which needs to avoid clipping fixed layers to the custom fixed position rect, but instead to
visibleContentRect() (which is really the document bounds on iOS). This ensures that the
fixed layers aren't clipped when zooming out.
* page/FrameView.cpp:
(WebCore::FrameView::viewportConstrainedVisibleContentRect):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::stickyPositionOffset):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateCompositedBounds):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::requiresCompositingForPosition):
(WebCore::RenderLayerCompositor::computeFixedViewportConstraints):
(WebCore::RenderLayerCompositor::computeStickyViewportConstraints):
2014-01-21 Andy Estes <aestes@apple.com>
[iOS] Allow all clients to link against WebCore
......@@ -1618,6 +1618,10 @@ void FrameView::removeViewportConstrainedObject(RenderElement* object)
LayoutRect FrameView::viewportConstrainedVisibleContentRect() const
{
#if PLATFORM(IOS)
if (useCustomFixedPositionLayoutRect())
return customFixedPositionLayoutRect();
#endif
LayoutRect viewportRect = visibleContentRect();
viewportRect.setLocation(toPoint(scrollOffsetForFixedPosition()));
return viewportRect;
......
......@@ -432,11 +432,7 @@ LayoutSize RenderBoxModelObject::stickyPositionOffset() const
FloatPoint scrollOffset = FloatPoint() + enclosingClippingLayer->scrollOffset();
constrainingRect.setLocation(scrollOffset);
} else {
#if PLATFORM(IOS)
LayoutRect viewportRect = view().frameView().customFixedPositionLayoutRect();
#else
LayoutRect viewportRect = view().frameView().viewportConstrainedVisibleContentRect();
#endif
float scale = view().frameView().frame().frameScaleFactor();
viewportRect.scale(1 / scale);
constrainingRect = viewportRect;
......
......@@ -489,9 +489,13 @@ void RenderLayerBacking::updateCompositedBounds()
RenderLayer* rootLayer = view.layer();
LayoutRect clippingBounds;
if (renderer().style().position() == FixedPosition && renderer().container() == &view)
if (renderer().style().position() == FixedPosition && renderer().container() == &view) {
#if PLATFORM(IOS)
clippingBounds = view.frameView().visibleContentRect();
#else
clippingBounds = view.frameView().viewportConstrainedVisibleContentRect();
else
#endif
} else
clippingBounds = view.unscaledDocumentRect();
if (&m_owningLayer != rootLayer)
......
......@@ -2557,11 +2557,7 @@ bool RenderLayerCompositor::requiresCompositingForPosition(RenderLayerModelObjec
}
// Fixed position elements that are invisible in the current view don't get their own layer.
#if PLATFORM(IOS)
LayoutRect viewBounds = m_renderView.frameView().customFixedPositionLayoutRect();
#else
LayoutRect viewBounds = m_renderView.frameView().viewportConstrainedVisibleContentRect();
#endif
LayoutRect layerBounds = layer.calculateLayerBounds(&layer, 0, RenderLayer::UseLocalClipRectIfPossible | RenderLayer::IncludeLayerFilterOutsets | RenderLayer::UseFragmentBoxes
| RenderLayer::ExcludeHiddenDescendants | RenderLayer::DontConstrainForMask | RenderLayer::IncludeCompositedDescendants);
// Map to m_renderView to ignore page scale.
......@@ -3385,16 +3381,10 @@ FixedPositionViewportConstraints RenderLayerCompositor::computeFixedViewportCons
{
ASSERT(layer.isComposited());
#if PLATFORM(IOS)
LayoutRect viewportRect = m_renderView.frameView().customFixedPositionLayoutRect();
#else
GraphicsLayer* graphicsLayer = layer.backing()->graphicsLayer();
LayoutRect viewportRect = m_renderView.frameView().viewportConstrainedVisibleContentRect();
#endif
FixedPositionViewportConstraints constraints;
GraphicsLayer* graphicsLayer = layer.backing()->graphicsLayer();
constraints.setLayerPositionAtLastLayout(graphicsLayer->position());
constraints.setViewportRectAtLastLayout(viewportRect);
......@@ -3431,12 +3421,7 @@ StickyPositionViewportConstraints RenderLayerCompositor::computeStickyViewportCo
ASSERT(!layer.enclosingOverflowClipLayer(ExcludeSelf));
#endif
#if PLATFORM(IOS)
LayoutRect viewportRect = m_renderView.frameView().customFixedPositionLayoutRect();
#else
LayoutRect viewportRect = m_renderView.frameView().viewportConstrainedVisibleContentRect();
#endif
RenderBoxModelObject& renderer = toRenderBoxModelObject(layer.renderer());
StickyPositionViewportConstraints constraints;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment