OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
5 * | 5 * |
6 * Other contributors: | 6 * Other contributors: |
7 * Robert O'Callahan <roc+@cs.cmu.edu> | 7 * Robert O'Callahan <roc+@cs.cmu.edu> |
8 * David Baron <dbaron@fas.harvard.edu> | 8 * David Baron <dbaron@fas.harvard.edu> |
9 * Christian Biesinger <cbiesinger@web.de> | 9 * Christian Biesinger <cbiesinger@web.de> |
10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
107 , m_hasSelfPaintingLayerDescendant(false) | 107 , m_hasSelfPaintingLayerDescendant(false) |
108 , m_hasSelfPaintingLayerDescendantDirty(false) | 108 , m_hasSelfPaintingLayerDescendantDirty(false) |
109 , m_isRootLayer(renderer->isRenderView()) | 109 , m_isRootLayer(renderer->isRenderView()) |
110 , m_usedTransparency(false) | 110 , m_usedTransparency(false) |
111 , m_visibleContentStatusDirty(true) | 111 , m_visibleContentStatusDirty(true) |
112 , m_hasVisibleContent(false) | 112 , m_hasVisibleContent(false) |
113 , m_visibleDescendantStatusDirty(false) | 113 , m_visibleDescendantStatusDirty(false) |
114 , m_hasVisibleDescendant(false) | 114 , m_hasVisibleDescendant(false) |
115 , m_hasVisibleNonLayerContent(false) | 115 , m_hasVisibleNonLayerContent(false) |
116 , m_isPaginated(false) | 116 , m_isPaginated(false) |
117 #if ENABLE(ASSERT) | |
118 , m_needsPositionUpdate(true) | |
119 #endif | |
120 , m_3DTransformedDescendantStatusDirty(true) | 117 , m_3DTransformedDescendantStatusDirty(true) |
121 , m_has3DTransformedDescendant(false) | 118 , m_has3DTransformedDescendant(false) |
122 , m_containsDirtyOverlayScrollbars(false) | 119 , m_containsDirtyOverlayScrollbars(false) |
123 , m_hasFilterInfo(false) | 120 , m_hasFilterInfo(false) |
124 , m_needsAncestorDependentCompositingInputsUpdate(true) | 121 , m_needsAncestorDependentCompositingInputsUpdate(true) |
125 , m_needsDescendantDependentCompositingInputsUpdate(true) | 122 , m_needsDescendantDependentCompositingInputsUpdate(true) |
126 , m_childNeedsCompositingInputsUpdate(true) | 123 , m_childNeedsCompositingInputsUpdate(true) |
127 , m_hasCompositingDescendant(false) | 124 , m_hasCompositingDescendant(false) |
128 , m_hasNonCompositedChild(false) | 125 , m_hasNonCompositedChild(false) |
129 , m_shouldIsolateCompositedDescendants(false) | 126 , m_shouldIsolateCompositedDescendants(false) |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
257 // FIXME: Remove incremental compositing updates after fixing the chicke n/egg issues | 254 // FIXME: Remove incremental compositing updates after fixing the chicke n/egg issues |
258 // https://code.google.com/p/chromium/issues/detail?id=343756 | 255 // https://code.google.com/p/chromium/issues/detail?id=343756 |
259 DisableCompositingQueryAsserts disabler; | 256 DisableCompositingQueryAsserts disabler; |
260 bool needsPaginationUpdate = isPaginated() || enclosingPaginationLayer() ; | 257 bool needsPaginationUpdate = isPaginated() || enclosingPaginationLayer() ; |
261 updatePaginationRecursive(needsPaginationUpdate); | 258 updatePaginationRecursive(needsPaginationUpdate); |
262 } | 259 } |
263 } | 260 } |
264 | 261 |
265 void RenderLayer::updateLayerPositionRecursive() | 262 void RenderLayer::updateLayerPositionRecursive() |
266 { | 263 { |
267 updateLayerPosition(); | |
268 | |
269 if (hasOverflowControls()) { | 264 if (hasOverflowControls()) { |
270 // FIXME: We should figure out the right time to position the overflow c ontrols. | 265 // FIXME: We should figure out the right time to position the overflow c ontrols. |
271 // This call appears to be necessary to pass some layout test that use E ventSender, | 266 // This call appears to be necessary to pass some layout test that use E ventSender, |
272 // presumably because the normal time to position the controls is during paint. We | 267 // presumably because the normal time to position the controls is during paint. We |
273 // probably shouldn't position the overflow controls during paint either ... | 268 // probably shouldn't position the overflow controls during paint either ... |
274 DisableCompositingQueryAsserts disabler; | 269 DisableCompositingQueryAsserts disabler; |
275 scrollableArea()->positionOverflowControls(IntSize()); | 270 scrollableArea()->positionOverflowControls(IntSize()); |
276 } | 271 } |
277 | 272 |
278 if (m_reflectionInfo) | 273 if (m_reflectionInfo) |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
316 return renderer()->style()->position() == FixedPosition && renderer()->conta iningBlock()->enclosingLayer()->isRootLayer(); | 311 return renderer()->style()->position() == FixedPosition && renderer()->conta iningBlock()->enclosingLayer()->isRootLayer(); |
317 } | 312 } |
318 | 313 |
319 bool RenderLayer::scrollsWithRespectTo(const RenderLayer* other) const | 314 bool RenderLayer::scrollsWithRespectTo(const RenderLayer* other) const |
320 { | 315 { |
321 if (scrollsWithViewport() != other->scrollsWithViewport()) | 316 if (scrollsWithViewport() != other->scrollsWithViewport()) |
322 return true; | 317 return true; |
323 return ancestorScrollingLayer() != other->ancestorScrollingLayer(); | 318 return ancestorScrollingLayer() != other->ancestorScrollingLayer(); |
324 } | 319 } |
325 | 320 |
326 void RenderLayer::updateLayerPositionsAfterOverflowScroll() | |
327 { | |
328 m_clipper.clearClipRectsIncludingDescendants(); | |
329 updateLayerPositionsAfterScrollRecursive(); | |
330 } | |
331 | |
332 void RenderLayer::updateLayerPositionsAfterScrollRecursive() | |
333 { | |
334 if (updateLayerPosition()) | |
335 m_renderer->setPreviousPaintInvalidationRect(m_renderer->boundsRectForPa intInvalidation(m_renderer->containerForPaintInvalidation())); | |
336 | |
337 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) | |
338 child->updateLayerPositionsAfterScrollRecursive(); | |
339 } | |
340 | |
341 void RenderLayer::updateTransformationMatrix() | 321 void RenderLayer::updateTransformationMatrix() |
342 { | 322 { |
343 if (m_transform) { | 323 if (m_transform) { |
344 RenderBox* box = renderBox(); | 324 RenderBox* box = renderBox(); |
345 ASSERT(box); | 325 ASSERT(box); |
346 m_transform->makeIdentity(); | 326 m_transform->makeIdentity(); |
347 box->style()->applyTransform(*m_transform, box->pixelSnappedBorderBoxRec t().size(), RenderStyle::IncludeTransformOrigin); | 327 box->style()->applyTransform(*m_transform, box->pixelSnappedBorderBoxRec t().size(), RenderStyle::IncludeTransformOrigin); |
348 makeMatrixRenderable(*m_transform, compositor()->hasAcceleratedCompositi ng()); | 328 makeMatrixRenderable(*m_transform, compositor()->hasAcceleratedCompositi ng()); |
349 } | 329 } |
350 } | 330 } |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
790 } | 770 } |
791 | 771 |
792 // If we live in a 3d hierarchy, then the layer at the root of that hierarch y needs | 772 // If we live in a 3d hierarchy, then the layer at the root of that hierarch y needs |
793 // the m_has3DTransformedDescendant set. | 773 // the m_has3DTransformedDescendant set. |
794 if (preserves3D()) | 774 if (preserves3D()) |
795 return has3DTransform() || m_has3DTransformedDescendant; | 775 return has3DTransform() || m_has3DTransformedDescendant; |
796 | 776 |
797 return has3DTransform(); | 777 return has3DTransform(); |
798 } | 778 } |
799 | 779 |
800 bool RenderLayer::updateLayerPosition() | 780 const IntSize RenderLayer::size() const |
abarth-chromium
2014/08/07 21:51:12
No need for |const| here. IntSize is a value type
skobes
2014/08/07 22:21:09
Done.
| |
781 { | |
782 if (renderer()->isInline() && renderer()->isRenderInline()) | |
783 return toRenderInline(renderer())->linesBoundingBox().size(); | |
784 | |
785 // FIXME: Is snapping the size really needed here? | |
786 if (RenderBox* box = renderBox()) | |
787 return pixelSnappedIntSize(box->size(), box->location()); | |
788 | |
789 return IntSize(); | |
790 } | |
791 | |
792 const LayoutPoint RenderLayer::location() const | |
abarth-chromium
2014/08/07 21:51:12
No need for |const| here. LayoutPoint is a value
skobes
2014/08/07 22:21:09
Done.
| |
801 { | 793 { |
802 LayoutPoint localPoint; | 794 LayoutPoint localPoint; |
803 LayoutSize inlineBoundingBoxOffset; // We don't put this into the RenderLaye r x/y for inlines, so we need to subtract it out when done. | 795 LayoutSize inlineBoundingBoxOffset; // We don't put this into the RenderLaye r x/y for inlines, so we need to subtract it out when done. |
804 | 796 |
805 if (renderer()->isInline() && renderer()->isRenderInline()) { | 797 if (renderer()->isInline() && renderer()->isRenderInline()) { |
806 RenderInline* inlineFlow = toRenderInline(renderer()); | 798 RenderInline* inlineFlow = toRenderInline(renderer()); |
807 IntRect lineBox = inlineFlow->linesBoundingBox(); | 799 IntRect lineBox = inlineFlow->linesBoundingBox(); |
808 m_size = lineBox.size(); | |
809 inlineBoundingBoxOffset = toSize(lineBox.location()); | 800 inlineBoundingBoxOffset = toSize(lineBox.location()); |
810 localPoint += inlineBoundingBoxOffset; | 801 localPoint += inlineBoundingBoxOffset; |
811 } else if (RenderBox* box = renderBox()) { | 802 } else if (RenderBox* box = renderBox()) { |
812 // FIXME: Is snapping the size really needed here for the RenderBox case ? | |
813 m_size = pixelSnappedIntSize(box->size(), box->location()); | |
814 localPoint += box->topLeftLocationOffset(); | 803 localPoint += box->topLeftLocationOffset(); |
815 } | 804 } |
816 | 805 |
817 if (!renderer()->isOutOfFlowPositioned() && renderer()->parent()) { | 806 if (!renderer()->isOutOfFlowPositioned() && renderer()->parent()) { |
818 // We must adjust our position by walking up the render tree looking for the | 807 // We must adjust our position by walking up the render tree looking for the |
819 // nearest enclosing object with a layer. | 808 // nearest enclosing object with a layer. |
820 RenderObject* curr = renderer()->parent(); | 809 RenderObject* curr = renderer()->parent(); |
821 while (curr && !curr->hasLayer()) { | 810 while (curr && !curr->hasLayer()) { |
822 if (curr->isBox() && !curr->isTableRow()) { | 811 if (curr->isBox() && !curr->isTableRow()) { |
823 // Rows and cells share the same coordinate space (that of the s ection). | 812 // Rows and cells share the same coordinate space (that of the s ection). |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
860 else | 849 else |
861 localPoint += parent()->renderer()->columnOffset(localPoint); | 850 localPoint += parent()->renderer()->columnOffset(localPoint); |
862 } | 851 } |
863 | 852 |
864 if (parent()->renderer()->hasOverflowClip()) { | 853 if (parent()->renderer()->hasOverflowClip()) { |
865 IntSize scrollOffset = parent()->renderBox()->scrolledContentOffset( ); | 854 IntSize scrollOffset = parent()->renderBox()->scrolledContentOffset( ); |
866 localPoint -= scrollOffset; | 855 localPoint -= scrollOffset; |
867 } | 856 } |
868 } | 857 } |
869 | 858 |
870 bool positionOrOffsetChanged = false; | 859 localPoint.move(offsetForInFlowPosition()); |
871 if (renderer()->isRelPositioned()) { | |
872 LayoutSize newOffset = toRenderBoxModelObject(renderer())->offsetForInFl owPosition(); | |
873 positionOrOffsetChanged = newOffset != m_offsetForInFlowPosition; | |
874 m_offsetForInFlowPosition = newOffset; | |
875 localPoint.move(m_offsetForInFlowPosition); | |
876 } else { | |
877 m_offsetForInFlowPosition = LayoutSize(); | |
878 } | |
879 | 860 |
880 // FIXME: We'd really like to just get rid of the concept of a layer rectang le and rely on the renderers. | 861 // FIXME: We'd really like to just get rid of the concept of a layer rectang le and rely on the renderers. |
881 localPoint -= inlineBoundingBoxOffset; | 862 localPoint -= inlineBoundingBoxOffset; |
882 | 863 |
883 if (m_location != localPoint) | 864 return localPoint; |
884 positionOrOffsetChanged = true; | 865 } |
885 m_location = localPoint; | |
886 | 866 |
887 #if ENABLE(ASSERT) | 867 const LayoutSize RenderLayer::offsetForInFlowPosition() const |
888 m_needsPositionUpdate = false; | 868 { |
889 #endif | 869 return renderer()->isRelPositioned() ? toRenderBoxModelObject(renderer())->o ffsetForInFlowPosition() : LayoutSize(); |
890 return positionOrOffsetChanged; | |
891 } | 870 } |
892 | 871 |
893 TransformationMatrix RenderLayer::perspectiveTransform() const | 872 TransformationMatrix RenderLayer::perspectiveTransform() const |
894 { | 873 { |
895 if (!renderer()->hasTransform()) | 874 if (!renderer()->hasTransform()) |
896 return TransformationMatrix(); | 875 return TransformationMatrix(); |
897 | 876 |
898 RenderStyle* style = renderer()->style(); | 877 RenderStyle* style = renderer()->style(); |
899 if (!style->hasPerspective()) | 878 if (!style->hasPerspective()) |
900 return TransformationMatrix(); | 879 return TransformationMatrix(); |
(...skipping 2857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3758 } | 3737 } |
3759 } | 3738 } |
3760 | 3739 |
3761 void showLayerTree(const blink::RenderObject* renderer) | 3740 void showLayerTree(const blink::RenderObject* renderer) |
3762 { | 3741 { |
3763 if (!renderer) | 3742 if (!renderer) |
3764 return; | 3743 return; |
3765 showLayerTree(renderer->enclosingLayer()); | 3744 showLayerTree(renderer->enclosingLayer()); |
3766 } | 3745 } |
3767 #endif | 3746 #endif |
OLD | NEW |