Commit e8882df6 authored by simon.fraser@apple.com's avatar simon.fraser@apple.com
Browse files

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> 2014-01-21 Andy Estes <aestes@apple.com>
   
[iOS] Allow all clients to link against WebCore [iOS] Allow all clients to link against WebCore
...@@ -1618,6 +1618,10 @@ void FrameView::removeViewportConstrainedObject(RenderElement* object) ...@@ -1618,6 +1618,10 @@ void FrameView::removeViewportConstrainedObject(RenderElement* object)
LayoutRect FrameView::viewportConstrainedVisibleContentRect() const LayoutRect FrameView::viewportConstrainedVisibleContentRect() const
{ {
#if PLATFORM(IOS)
if (useCustomFixedPositionLayoutRect())
return customFixedPositionLayoutRect();
#endif
LayoutRect viewportRect = visibleContentRect(); LayoutRect viewportRect = visibleContentRect();
viewportRect.setLocation(toPoint(scrollOffsetForFixedPosition())); viewportRect.setLocation(toPoint(scrollOffsetForFixedPosition()));
return viewportRect; return viewportRect;
......
...@@ -432,11 +432,7 @@ LayoutSize RenderBoxModelObject::stickyPositionOffset() const ...@@ -432,11 +432,7 @@ LayoutSize RenderBoxModelObject::stickyPositionOffset() const
FloatPoint scrollOffset = FloatPoint() + enclosingClippingLayer->scrollOffset(); FloatPoint scrollOffset = FloatPoint() + enclosingClippingLayer->scrollOffset();
constrainingRect.setLocation(scrollOffset); constrainingRect.setLocation(scrollOffset);
} else { } else {
#if PLATFORM(IOS)
LayoutRect viewportRect = view().frameView().customFixedPositionLayoutRect();
#else
LayoutRect viewportRect = view().frameView().viewportConstrainedVisibleContentRect(); LayoutRect viewportRect = view().frameView().viewportConstrainedVisibleContentRect();
#endif
float scale = view().frameView().frame().frameScaleFactor(); float scale = view().frameView().frame().frameScaleFactor();
viewportRect.scale(1 / scale); viewportRect.scale(1 / scale);
constrainingRect = viewportRect; constrainingRect = viewportRect;
......
...@@ -489,9 +489,13 @@ void RenderLayerBacking::updateCompositedBounds() ...@@ -489,9 +489,13 @@ void RenderLayerBacking::updateCompositedBounds()
RenderLayer* rootLayer = view.layer(); RenderLayer* rootLayer = view.layer();
LayoutRect clippingBounds; 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(); clippingBounds = view.frameView().viewportConstrainedVisibleContentRect();
else #endif
} else
clippingBounds = view.unscaledDocumentRect(); clippingBounds = view.unscaledDocumentRect();
if (&m_owningLayer != rootLayer) if (&m_owningLayer != rootLayer)
......
...@@ -2557,11 +2557,7 @@ bool RenderLayerCompositor::requiresCompositingForPosition(RenderLayerModelObjec ...@@ -2557,11 +2557,7 @@ bool RenderLayerCompositor::requiresCompositingForPosition(RenderLayerModelObjec
} }
// Fixed position elements that are invisible in the current view don't get their own layer. // 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(); LayoutRect viewBounds = m_renderView.frameView().viewportConstrainedVisibleContentRect();
#endif
LayoutRect layerBounds = layer.calculateLayerBounds(&layer, 0, RenderLayer::UseLocalClipRectIfPossible | RenderLayer::IncludeLayerFilterOutsets | RenderLayer::UseFragmentBoxes LayoutRect layerBounds = layer.calculateLayerBounds(&layer, 0, RenderLayer::UseLocalClipRectIfPossible | RenderLayer::IncludeLayerFilterOutsets | RenderLayer::UseFragmentBoxes
| RenderLayer::ExcludeHiddenDescendants | RenderLayer::DontConstrainForMask | RenderLayer::IncludeCompositedDescendants); | RenderLayer::ExcludeHiddenDescendants | RenderLayer::DontConstrainForMask | RenderLayer::IncludeCompositedDescendants);
// Map to m_renderView to ignore page scale. // Map to m_renderView to ignore page scale.
...@@ -3385,16 +3381,10 @@ FixedPositionViewportConstraints RenderLayerCompositor::computeFixedViewportCons ...@@ -3385,16 +3381,10 @@ FixedPositionViewportConstraints RenderLayerCompositor::computeFixedViewportCons
{ {
ASSERT(layer.isComposited()); ASSERT(layer.isComposited());
#if PLATFORM(IOS) GraphicsLayer* graphicsLayer = layer.backing()->graphicsLayer();
LayoutRect viewportRect = m_renderView.frameView().customFixedPositionLayoutRect();
#else
LayoutRect viewportRect = m_renderView.frameView().viewportConstrainedVisibleContentRect(); LayoutRect viewportRect = m_renderView.frameView().viewportConstrainedVisibleContentRect();
#endif
FixedPositionViewportConstraints constraints; FixedPositionViewportConstraints constraints;
GraphicsLayer* graphicsLayer = layer.backing()->graphicsLayer();
constraints.setLayerPositionAtLastLayout(graphicsLayer->position()); constraints.setLayerPositionAtLastLayout(graphicsLayer->position());
constraints.setViewportRectAtLastLayout(viewportRect); constraints.setViewportRectAtLastLayout(viewportRect);
...@@ -3431,12 +3421,7 @@ StickyPositionViewportConstraints RenderLayerCompositor::computeStickyViewportCo ...@@ -3431,12 +3421,7 @@ StickyPositionViewportConstraints RenderLayerCompositor::computeStickyViewportCo
ASSERT(!layer.enclosingOverflowClipLayer(ExcludeSelf)); ASSERT(!layer.enclosingOverflowClipLayer(ExcludeSelf));
#endif #endif
#if PLATFORM(IOS)
LayoutRect viewportRect = m_renderView.frameView().customFixedPositionLayoutRect();
#else
LayoutRect viewportRect = m_renderView.frameView().viewportConstrainedVisibleContentRect(); LayoutRect viewportRect = m_renderView.frameView().viewportConstrainedVisibleContentRect();
#endif
RenderBoxModelObject& renderer = toRenderBoxModelObject(layer.renderer()); RenderBoxModelObject& renderer = toRenderBoxModelObject(layer.renderer());
StickyPositionViewportConstraints constraints; 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