Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(202)

Side by Side Diff: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp

Issue 1774943003: blink: Rename platform/ methods to prefix with get when they collide. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clash-platform: rebase-yayyyyyyyy Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 updateChildContainmentLayerGeometry(clippingBox, localCompositingBounds); 730 updateChildContainmentLayerGeometry(clippingBox, localCompositingBounds);
731 731
732 updateMaskLayerGeometry(); 732 updateMaskLayerGeometry();
733 updateTransformGeometry(snappedOffsetFromCompositedAncestor, relativeComposi tingBounds); 733 updateTransformGeometry(snappedOffsetFromCompositedAncestor, relativeComposi tingBounds);
734 updateForegroundLayerGeometry(contentsSize, clippingBox); 734 updateForegroundLayerGeometry(contentsSize, clippingBox);
735 updateBackgroundLayerGeometry(contentsSize); 735 updateBackgroundLayerGeometry(contentsSize);
736 updateReflectionLayerGeometry(layersNeedingPaintInvalidation); 736 updateReflectionLayerGeometry(layersNeedingPaintInvalidation);
737 updateScrollingLayerGeometry(localCompositingBounds); 737 updateScrollingLayerGeometry(localCompositingBounds);
738 updateChildClippingMaskLayerGeometry(); 738 updateChildClippingMaskLayerGeometry();
739 739
740 if (m_owningLayer.scrollableArea() && m_owningLayer.scrollableArea()->scroll sOverflow()) 740 if (m_owningLayer.getScrollableArea() && m_owningLayer.getScrollableArea()-> scrollsOverflow())
741 m_owningLayer.scrollableArea()->positionOverflowControls(); 741 m_owningLayer.getScrollableArea()->positionOverflowControls();
742 742
743 if (RuntimeEnabledFeatures::cssCompositingEnabled()) { 743 if (RuntimeEnabledFeatures::cssCompositingEnabled()) {
744 updateLayerBlendMode(layoutObject()->styleRef()); 744 updateLayerBlendMode(layoutObject()->styleRef());
745 updateIsRootForIsolatedGroup(); 745 updateIsRootForIsolatedGroup();
746 } 746 }
747 747
748 updateContentsRect(); 748 updateContentsRect();
749 updateBackgroundColor(); 749 updateBackgroundColor();
750 updateDrawsContent(); 750 updateDrawsContent();
751 updateElementIdAndCompositorMutableProperties(); 751 updateElementIdAndCompositorMutableProperties();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 graphicsLayerParentLocation = roundedIntPoint(compositingContainer->subp ixelAccumulation()); 797 graphicsLayerParentLocation = roundedIntPoint(compositingContainer->subp ixelAccumulation());
798 } else if (compositingContainer) { 798 } else if (compositingContainer) {
799 graphicsLayerParentLocation = ancestorCompositingBounds.location(); 799 graphicsLayerParentLocation = ancestorCompositingBounds.location();
800 } else { 800 } else {
801 graphicsLayerParentLocation = layoutObject()->view()->documentRect().loc ation(); 801 graphicsLayerParentLocation = layoutObject()->view()->documentRect().loc ation();
802 } 802 }
803 803
804 if (compositingContainer && compositingContainer->needsCompositedScrolling() ) { 804 if (compositingContainer && compositingContainer->needsCompositedScrolling() ) {
805 LayoutBox* layoutBox = toLayoutBox(compositingContainer->layoutObject()) ; 805 LayoutBox* layoutBox = toLayoutBox(compositingContainer->layoutObject()) ;
806 IntSize scrollOffset = layoutBox->scrolledContentOffset(); 806 IntSize scrollOffset = layoutBox->scrolledContentOffset();
807 IntPoint scrollOrigin = compositingContainer->scrollableArea()->scrollOr igin(); 807 IntPoint scrollOrigin = compositingContainer->getScrollableArea()->scrol lOrigin();
808 scrollOrigin.move(-layoutBox->borderLeft(), -layoutBox->borderTop()); 808 scrollOrigin.move(-layoutBox->borderLeft(), -layoutBox->borderTop());
809 graphicsLayerParentLocation = -(scrollOrigin + scrollOffset); 809 graphicsLayerParentLocation = -(scrollOrigin + scrollOffset);
810 } 810 }
811 } 811 }
812 812
813 void CompositedLayerMapping::updateAncestorClippingLayerGeometry(const PaintLaye r* compositingContainer, const IntPoint& snappedOffsetFromCompositedAncestor, In tPoint& graphicsLayerParentLocation) 813 void CompositedLayerMapping::updateAncestorClippingLayerGeometry(const PaintLaye r* compositingContainer, const IntPoint& snappedOffsetFromCompositedAncestor, In tPoint& graphicsLayerParentLocation)
814 { 814 {
815 if (!compositingContainer || !m_ancestorClippingLayer) 815 if (!compositingContainer || !m_ancestorClippingLayer)
816 return; 816 return;
817 817
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 position += offsetFromStackingContainer; 850 position += offsetFromStackingContainer;
851 } 851 }
852 852
853 m_overflowControlsAncestorClippingLayer->setPosition(position); 853 m_overflowControlsAncestorClippingLayer->setPosition(position);
854 } else { 854 } else {
855 // The controls are in the same 2D space as the compositing containe r, so we can map them into the space of the container. 855 // The controls are in the same 2D space as the compositing containe r, so we can map them into the space of the container.
856 TransformState transformState(TransformState::ApplyTransformDirectio n, FloatPoint()); 856 TransformState transformState(TransformState::ApplyTransformDirectio n, FloatPoint());
857 m_owningLayer.layoutObject()->mapLocalToAncestor(compositingStacking Context->layoutObject(), transformState, ApplyContainerFlip); 857 m_owningLayer.layoutObject()->mapLocalToAncestor(compositingStacking Context->layoutObject(), transformState, ApplyContainerFlip);
858 transformState.flatten(); 858 transformState.flatten();
859 hostLayerPosition = LayoutPoint(transformState.lastPlanarPoint()); 859 hostLayerPosition = LayoutPoint(transformState.lastPlanarPoint());
860 if (PaintLayerScrollableArea* scrollableArea = compositingStackingCo ntext->scrollableArea()) 860 if (PaintLayerScrollableArea* scrollableArea = compositingStackingCo ntext->getScrollableArea())
861 hostLayerPosition.move(LayoutSize(scrollableArea->adjustedScroll Offset())); 861 hostLayerPosition.move(LayoutSize(scrollableArea->adjustedScroll Offset()));
862 } 862 }
863 } 863 }
864 864
865 // To clip correctly, m_overflowControlsHostLayer should match the border bo x rect, which is at 865 // To clip correctly, m_overflowControlsHostLayer should match the border bo x rect, which is at
866 // the origin of the LayoutObject. The parent is m_graphicsLayer, so we must adjust the position 866 // the origin of the LayoutObject. The parent is m_graphicsLayer, so we must adjust the position
867 // by the distance from m_graphicsLayer to the LayoutObject. 867 // by the distance from m_graphicsLayer to the LayoutObject.
868 868
869 IntSize offsetFromLayoutObject = m_graphicsLayer->offsetFromLayoutObject() - roundedIntSize(m_owningLayer.subpixelAccumulation()); 869 IntSize offsetFromLayoutObject = m_graphicsLayer->offsetFromLayoutObject() - roundedIntSize(m_owningLayer.subpixelAccumulation());
870 hostLayerPosition.move(-offsetFromLayoutObject); 870 hostLayerPosition.move(-offsetFromLayoutObject);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 } 958 }
959 959
960 void CompositedLayerMapping::updateScrollingLayerGeometry(const IntRect& localCo mpositingBounds) 960 void CompositedLayerMapping::updateScrollingLayerGeometry(const IntRect& localCo mpositingBounds)
961 { 961 {
962 if (!m_scrollingLayer) 962 if (!m_scrollingLayer)
963 return; 963 return;
964 964
965 ASSERT(m_scrollingContentsLayer); 965 ASSERT(m_scrollingContentsLayer);
966 LayoutBox* layoutBox = toLayoutBox(layoutObject()); 966 LayoutBox* layoutBox = toLayoutBox(layoutObject());
967 IntRect overflowClipRect = enclosingIntRect(layoutBox->overflowClipRect(Layo utPoint())); 967 IntRect overflowClipRect = enclosingIntRect(layoutBox->overflowClipRect(Layo utPoint()));
968 DoubleSize adjustedScrollOffset = m_owningLayer.scrollableArea()->adjustedSc rollOffset(); 968 DoubleSize adjustedScrollOffset = m_owningLayer.getScrollableArea()->adjuste dScrollOffset();
969 m_scrollingLayer->setPosition(FloatPoint(overflowClipRect.location() - local CompositingBounds.location() + roundedIntSize(m_owningLayer.subpixelAccumulation ()))); 969 m_scrollingLayer->setPosition(FloatPoint(overflowClipRect.location() - local CompositingBounds.location() + roundedIntSize(m_owningLayer.subpixelAccumulation ())));
970 m_scrollingLayer->setSize(FloatSize(overflowClipRect.size())); 970 m_scrollingLayer->setSize(FloatSize(overflowClipRect.size()));
971 971
972 IntSize oldScrollingLayerOffset = m_scrollingLayer->offsetFromLayoutObject() ; 972 IntSize oldScrollingLayerOffset = m_scrollingLayer->offsetFromLayoutObject() ;
973 m_scrollingLayer->setOffsetFromLayoutObject(-toIntSize(overflowClipRect.loca tion())); 973 m_scrollingLayer->setOffsetFromLayoutObject(-toIntSize(overflowClipRect.loca tion()));
974 974
975 if (m_childClippingMaskLayer && !layoutObject()->style()->clipPath()) { 975 if (m_childClippingMaskLayer && !layoutObject()->style()->clipPath()) {
976 m_childClippingMaskLayer->setPosition(m_scrollingLayer->position()); 976 m_childClippingMaskLayer->setPosition(m_scrollingLayer->position());
977 m_childClippingMaskLayer->setSize(m_scrollingLayer->size()); 977 m_childClippingMaskLayer->setSize(m_scrollingLayer->size());
978 m_childClippingMaskLayer->setOffsetFromLayoutObject(toIntSize(overflowCl ipRect.location())); 978 m_childClippingMaskLayer->setOffsetFromLayoutObject(toIntSize(overflowCl ipRect.location()));
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
1302 { 1302 {
1303 m_backgroundLayerPaintsFixedRootBackground = backgroundLayerPaintsFixedRootB ackground; 1303 m_backgroundLayerPaintsFixedRootBackground = backgroundLayerPaintsFixedRootB ackground;
1304 } 1304 }
1305 1305
1306 bool CompositedLayerMapping::toggleScrollbarLayerIfNeeded(OwnPtr<GraphicsLayer>& layer, bool needsLayer, CompositingReasons reason) 1306 bool CompositedLayerMapping::toggleScrollbarLayerIfNeeded(OwnPtr<GraphicsLayer>& layer, bool needsLayer, CompositingReasons reason)
1307 { 1307 {
1308 if (needsLayer == !!layer) 1308 if (needsLayer == !!layer)
1309 return false; 1309 return false;
1310 layer = needsLayer ? createGraphicsLayer(reason) : nullptr; 1310 layer = needsLayer ? createGraphicsLayer(reason) : nullptr;
1311 1311
1312 if (PaintLayerScrollableArea* scrollableArea = m_owningLayer.scrollableArea( )) { 1312 if (PaintLayerScrollableArea* scrollableArea = m_owningLayer.getScrollableAr ea()) {
1313 if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFro mLayer(m_owningLayer)) { 1313 if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFro mLayer(m_owningLayer)) {
1314 if (reason == CompositingReasonLayerForHorizontalScrollbar) 1314 if (reason == CompositingReasonLayerForHorizontalScrollbar)
1315 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(scro llableArea, HorizontalScrollbar); 1315 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(scro llableArea, HorizontalScrollbar);
1316 else if (reason == CompositingReasonLayerForVerticalScrollbar) 1316 else if (reason == CompositingReasonLayerForVerticalScrollbar)
1317 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(scro llableArea, VerticalScrollbar); 1317 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(scro llableArea, VerticalScrollbar);
1318 } 1318 }
1319 } 1319 }
1320 return true; 1320 return true;
1321 } 1321 }
1322 1322
1323 bool CompositedLayerMapping::updateOverflowControlsLayers(bool needsHorizontalSc rollbarLayer, bool needsVerticalScrollbarLayer, bool needsScrollCornerLayer, boo l needsAncestorClip) 1323 bool CompositedLayerMapping::updateOverflowControlsLayers(bool needsHorizontalSc rollbarLayer, bool needsVerticalScrollbarLayer, bool needsScrollCornerLayer, boo l needsAncestorClip)
1324 { 1324 {
1325 if (PaintLayerScrollableArea* scrollableArea = m_owningLayer.scrollableArea( )) { 1325 if (PaintLayerScrollableArea* scrollableArea = m_owningLayer.getScrollableAr ea()) {
1326 // If the scrollable area is marked as needing a new scrollbar layer, 1326 // If the scrollable area is marked as needing a new scrollbar layer,
1327 // destroy the layer now so that it will be created again below. 1327 // destroy the layer now so that it will be created again below.
1328 if (m_layerForHorizontalScrollbar && needsHorizontalScrollbarLayer && sc rollableArea->shouldRebuildHorizontalScrollbarLayer()) 1328 if (m_layerForHorizontalScrollbar && needsHorizontalScrollbarLayer && sc rollableArea->shouldRebuildHorizontalScrollbarLayer())
1329 toggleScrollbarLayerIfNeeded(m_layerForHorizontalScrollbar, false, C ompositingReasonLayerForHorizontalScrollbar); 1329 toggleScrollbarLayerIfNeeded(m_layerForHorizontalScrollbar, false, C ompositingReasonLayerForHorizontalScrollbar);
1330 if (m_layerForVerticalScrollbar && needsVerticalScrollbarLayer && scroll ableArea->shouldRebuildVerticalScrollbarLayer()) 1330 if (m_layerForVerticalScrollbar && needsVerticalScrollbarLayer && scroll ableArea->shouldRebuildVerticalScrollbarLayer())
1331 toggleScrollbarLayerIfNeeded(m_layerForVerticalScrollbar, false, Com positingReasonLayerForVerticalScrollbar); 1331 toggleScrollbarLayerIfNeeded(m_layerForVerticalScrollbar, false, Com positingReasonLayerForVerticalScrollbar);
1332 scrollableArea->resetRebuildScrollbarLayerFlags(); 1332 scrollableArea->resetRebuildScrollbarLayerFlags();
1333 } 1333 }
1334 1334
1335 // If the subtree is invisible, we don't actually need scrollbar layers. 1335 // If the subtree is invisible, we don't actually need scrollbar layers.
(...skipping 10 matching lines...) Expand all
1346 toggleScrollbarLayerIfNeeded(m_overflowControlsHostLayer, needsOverflowContr olsHostLayer, CompositingReasonLayerForOverflowControlsHost); 1346 toggleScrollbarLayerIfNeeded(m_overflowControlsHostLayer, needsOverflowContr olsHostLayer, CompositingReasonLayerForOverflowControlsHost);
1347 bool needsOverflowAncestorClipLayer = needsOverflowControlsHostLayer && need sAncestorClip; 1347 bool needsOverflowAncestorClipLayer = needsOverflowControlsHostLayer && need sAncestorClip;
1348 toggleScrollbarLayerIfNeeded(m_overflowControlsAncestorClippingLayer, needsO verflowAncestorClipLayer, CompositingReasonLayerForOverflowControlsHost); 1348 toggleScrollbarLayerIfNeeded(m_overflowControlsAncestorClippingLayer, needsO verflowAncestorClipLayer, CompositingReasonLayerForOverflowControlsHost);
1349 1349
1350 return horizontalScrollbarLayerChanged || verticalScrollbarLayerChanged || s crollCornerLayerChanged; 1350 return horizontalScrollbarLayerChanged || verticalScrollbarLayerChanged || s crollCornerLayerChanged;
1351 } 1351 }
1352 1352
1353 void CompositedLayerMapping::positionOverflowControlsLayers() 1353 void CompositedLayerMapping::positionOverflowControlsLayers()
1354 { 1354 {
1355 if (GraphicsLayer* layer = layerForHorizontalScrollbar()) { 1355 if (GraphicsLayer* layer = layerForHorizontalScrollbar()) {
1356 Scrollbar* hBar = m_owningLayer.scrollableArea()->horizontalScrollbar(); 1356 Scrollbar* hBar = m_owningLayer.getScrollableArea()->horizontalScrollbar ();
1357 if (hBar) { 1357 if (hBar) {
1358 layer->setPosition(hBar->frameRect().location()); 1358 layer->setPosition(hBar->frameRect().location());
1359 layer->setSize(FloatSize(hBar->frameRect().size())); 1359 layer->setSize(FloatSize(hBar->frameRect().size()));
1360 if (layer->hasContentsLayer()) 1360 if (layer->hasContentsLayer())
1361 layer->setContentsRect(IntRect(IntPoint(), hBar->frameRect().siz e())); 1361 layer->setContentsRect(IntRect(IntPoint(), hBar->frameRect().siz e()));
1362 } 1362 }
1363 layer->setDrawsContent(hBar && !layer->hasContentsLayer()); 1363 layer->setDrawsContent(hBar && !layer->hasContentsLayer());
1364 } 1364 }
1365 1365
1366 if (GraphicsLayer* layer = layerForVerticalScrollbar()) { 1366 if (GraphicsLayer* layer = layerForVerticalScrollbar()) {
1367 Scrollbar* vBar = m_owningLayer.scrollableArea()->verticalScrollbar(); 1367 Scrollbar* vBar = m_owningLayer.getScrollableArea()->verticalScrollbar() ;
1368 if (vBar) { 1368 if (vBar) {
1369 layer->setPosition(vBar->frameRect().location()); 1369 layer->setPosition(vBar->frameRect().location());
1370 layer->setSize(FloatSize(vBar->frameRect().size())); 1370 layer->setSize(FloatSize(vBar->frameRect().size()));
1371 if (layer->hasContentsLayer()) 1371 if (layer->hasContentsLayer())
1372 layer->setContentsRect(IntRect(IntPoint(), vBar->frameRect().siz e())); 1372 layer->setContentsRect(IntRect(IntPoint(), vBar->frameRect().siz e()));
1373 } 1373 }
1374 layer->setDrawsContent(vBar && !layer->hasContentsLayer()); 1374 layer->setDrawsContent(vBar && !layer->hasContentsLayer());
1375 } 1375 }
1376 1376
1377 if (GraphicsLayer* layer = layerForScrollCorner()) { 1377 if (GraphicsLayer* layer = layerForScrollCorner()) {
1378 const IntRect& scrollCornerAndResizer = m_owningLayer.scrollableArea()-> scrollCornerAndResizerRect(); 1378 const IntRect& scrollCornerAndResizer = m_owningLayer.getScrollableArea( )->scrollCornerAndResizerRect();
1379 layer->setPosition(FloatPoint(scrollCornerAndResizer.location())); 1379 layer->setPosition(FloatPoint(scrollCornerAndResizer.location()));
1380 layer->setSize(FloatSize(scrollCornerAndResizer.size())); 1380 layer->setSize(FloatSize(scrollCornerAndResizer.size()));
1381 layer->setDrawsContent(!scrollCornerAndResizer.isEmpty()); 1381 layer->setDrawsContent(!scrollCornerAndResizer.isEmpty());
1382 } 1382 }
1383 } 1383 }
1384 1384
1385 enum ApplyToGraphicsLayersModeFlags { 1385 enum ApplyToGraphicsLayersModeFlags {
1386 ApplyToLayersAffectedByPreserve3D = (1 << 0), 1386 ApplyToLayersAffectedByPreserve3D = (1 << 0),
1387 ApplyToSquashingLayer = (1 << 1), 1387 ApplyToSquashingLayer = (1 << 1),
1388 ApplyToScrollbarLayers = (1 << 2), 1388 ApplyToScrollbarLayers = (1 << 2),
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1607 m_scrollingLayer = createGraphicsLayer(CompositingReasonLayerForScro llingContainer); 1607 m_scrollingLayer = createGraphicsLayer(CompositingReasonLayerForScro llingContainer);
1608 m_scrollingLayer->setDrawsContent(false); 1608 m_scrollingLayer->setDrawsContent(false);
1609 m_scrollingLayer->setMasksToBounds(true); 1609 m_scrollingLayer->setMasksToBounds(true);
1610 1610
1611 // Inner layer which renders the content that scrolls. 1611 // Inner layer which renders the content that scrolls.
1612 m_scrollingContentsLayer = createGraphicsLayer(CompositingReasonLaye rForScrollingContents); 1612 m_scrollingContentsLayer = createGraphicsLayer(CompositingReasonLaye rForScrollingContents);
1613 m_scrollingLayer->addChild(m_scrollingContentsLayer.get()); 1613 m_scrollingLayer->addChild(m_scrollingContentsLayer.get());
1614 1614
1615 layerChanged = true; 1615 layerChanged = true;
1616 if (scrollingCoordinator) { 1616 if (scrollingCoordinator) {
1617 scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_ownin gLayer.scrollableArea()); 1617 scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_ownin gLayer.getScrollableArea());
1618 scrollingCoordinator->scrollableAreasDidChange(); 1618 scrollingCoordinator->scrollableAreasDidChange();
1619 } 1619 }
1620 } 1620 }
1621 } else if (m_scrollingLayer) { 1621 } else if (m_scrollingLayer) {
1622 m_scrollingLayer = nullptr; 1622 m_scrollingLayer = nullptr;
1623 m_scrollingContentsLayer = nullptr; 1623 m_scrollingContentsLayer = nullptr;
1624 layerChanged = true; 1624 layerChanged = true;
1625 if (scrollingCoordinator) { 1625 if (scrollingCoordinator) {
1626 scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_owningLay er.scrollableArea()); 1626 scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_owningLay er.getScrollableArea());
1627 scrollingCoordinator->scrollableAreasDidChange(); 1627 scrollingCoordinator->scrollableAreasDidChange();
1628 } 1628 }
1629 } 1629 }
1630 1630
1631 return layerChanged; 1631 return layerChanged;
1632 } 1632 }
1633 1633
1634 static void updateScrollParentForGraphicsLayer(GraphicsLayer* layer, GraphicsLay er* topmostLayer, const PaintLayer* scrollParent, ScrollingCoordinator* scrollin gCoordinator) 1634 static void updateScrollParentForGraphicsLayer(GraphicsLayer* layer, GraphicsLay er* topmostLayer, const PaintLayer* scrollParent, ScrollingCoordinator* scrollin gCoordinator)
1635 { 1635 {
1636 if (!layer) 1636 if (!layer)
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
1878 if (m_owningLayer.hasBoxDecorationsOrBackground() 1878 if (m_owningLayer.hasBoxDecorationsOrBackground()
1879 || imageLayoutObject->hasClip() 1879 || imageLayoutObject->hasClip()
1880 || imageLayoutObject->hasClipPath() 1880 || imageLayoutObject->hasClipPath()
1881 || imageLayoutObject->hasObjectFit()) 1881 || imageLayoutObject->hasObjectFit())
1882 return false; 1882 return false;
1883 1883
1884 if (ImageResource* cachedImage = imageLayoutObject->cachedImage()) { 1884 if (ImageResource* cachedImage = imageLayoutObject->cachedImage()) {
1885 if (!cachedImage->hasImage()) 1885 if (!cachedImage->hasImage())
1886 return false; 1886 return false;
1887 1887
1888 Image* image = cachedImage->image(); 1888 Image* image = cachedImage->getImage();
1889 if (!image->isBitmapImage()) 1889 if (!image->isBitmapImage())
1890 return false; 1890 return false;
1891 1891
1892 return true; 1892 return true;
1893 } 1893 }
1894 1894
1895 return false; 1895 return false;
1896 } 1896 }
1897 1897
1898 void CompositedLayerMapping::contentChanged(ContentChangeType changeType) 1898 void CompositedLayerMapping::contentChanged(ContentChangeType changeType)
(...skipping 11 matching lines...) Expand all
1910 1910
1911 void CompositedLayerMapping::updateImageContents() 1911 void CompositedLayerMapping::updateImageContents()
1912 { 1912 {
1913 ASSERT(layoutObject()->isImage()); 1913 ASSERT(layoutObject()->isImage());
1914 LayoutImage* imageLayoutObject = toLayoutImage(layoutObject()); 1914 LayoutImage* imageLayoutObject = toLayoutImage(layoutObject());
1915 1915
1916 ImageResource* cachedImage = imageLayoutObject->cachedImage(); 1916 ImageResource* cachedImage = imageLayoutObject->cachedImage();
1917 if (!cachedImage) 1917 if (!cachedImage)
1918 return; 1918 return;
1919 1919
1920 Image* image = cachedImage->image(); 1920 Image* image = cachedImage->getImage();
1921 if (!image) 1921 if (!image)
1922 return; 1922 return;
1923 1923
1924 // This is a no-op if the layer doesn't have an inner layer for the image. 1924 // This is a no-op if the layer doesn't have an inner layer for the image.
1925 m_graphicsLayer->setContentsToImage(image, LayoutObject::shouldRespectImageO rientation(imageLayoutObject)); 1925 m_graphicsLayer->setContentsToImage(image, LayoutObject::shouldRespectImageO rientation(imageLayoutObject));
1926 1926
1927 m_graphicsLayer->setFilterQuality(layoutObject()->style()->imageRendering() == ImageRenderingPixelated ? kNone_SkFilterQuality : kLow_SkFilterQuality); 1927 m_graphicsLayer->setFilterQuality(layoutObject()->style()->imageRendering() == ImageRenderingPixelated ? kNone_SkFilterQuality : kLow_SkFilterQuality);
1928 1928
1929 // Prevent double-drawing: https://bugs.webkit.org/show_bug.cgi?id=58632 1929 // Prevent double-drawing: https://bugs.webkit.org/show_bug.cgi?id=58632
1930 updateDrawsContent(); 1930 updateDrawsContent();
(...skipping 26 matching lines...) Expand all
1957 1957
1958 LayoutRect CompositedLayerMapping::contentsBox() const 1958 LayoutRect CompositedLayerMapping::contentsBox() const
1959 { 1959 {
1960 LayoutRect contentsBox = LayoutRect(contentsRect(layoutObject())); 1960 LayoutRect contentsBox = LayoutRect(contentsRect(layoutObject()));
1961 contentsBox.move(contentOffsetInCompositingLayer()); 1961 contentsBox.move(contentOffsetInCompositingLayer());
1962 return contentsBox; 1962 return contentsBox;
1963 } 1963 }
1964 1964
1965 bool CompositedLayerMapping::needsToReparentOverflowControls() const 1965 bool CompositedLayerMapping::needsToReparentOverflowControls() const
1966 { 1966 {
1967 return m_owningLayer.scrollableArea() 1967 return m_owningLayer.getScrollableArea()
1968 && m_owningLayer.scrollableArea()->hasOverlayScrollbars() 1968 && m_owningLayer.getScrollableArea()->hasOverlayScrollbars()
1969 && m_owningLayer.scrollableArea()->topmostScrollChild(); 1969 && m_owningLayer.getScrollableArea()->topmostScrollChild();
1970 } 1970 }
1971 1971
1972 GraphicsLayer* CompositedLayerMapping::detachLayerForOverflowControls(const Pain tLayer& enclosingLayer) 1972 GraphicsLayer* CompositedLayerMapping::detachLayerForOverflowControls(const Pain tLayer& enclosingLayer)
1973 { 1973 {
1974 GraphicsLayer* host = m_overflowControlsAncestorClippingLayer.get(); 1974 GraphicsLayer* host = m_overflowControlsAncestorClippingLayer.get();
1975 if (!host) 1975 if (!host)
1976 host = m_overflowControlsHostLayer.get(); 1976 host = m_overflowControlsHostLayer.get();
1977 host->removeFromParent(); 1977 host->removeFromParent();
1978 return host; 1978 return host;
1979 } 1979 }
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
2164 PaintLayerPainter(*paintInfo.paintLayer).paintLayerContents(context, paintingInfo, paintLayerFlags | PaintLayerPaintingOverlayScrollbars); 2164 PaintLayerPainter(*paintInfo.paintLayer).paintLayerContents(context, paintingInfo, paintLayerFlags | PaintLayerPaintingOverlayScrollbars);
2165 } else { 2165 } else {
2166 PaintLayerPaintingInfo paintingInfo(paintInfo.paintLayer, LayoutRect(dir tyRect), GlobalPaintNormalPhase, paintInfo.paintLayer->subpixelAccumulation()); 2166 PaintLayerPaintingInfo paintingInfo(paintInfo.paintLayer, LayoutRect(dir tyRect), GlobalPaintNormalPhase, paintInfo.paintLayer->subpixelAccumulation());
2167 2167
2168 // PaintLayer::paintLayer assumes that the caller clips to the passed re ct. Squashed layers need to do this clipping in software, 2168 // PaintLayer::paintLayer assumes that the caller clips to the passed re ct. Squashed layers need to do this clipping in software,
2169 // since there is no graphics layer to clip them precisely. Furthermore, in some cases we squash layers that need clipping in software 2169 // since there is no graphics layer to clip them precisely. Furthermore, in some cases we squash layers that need clipping in software
2170 // from clipping ancestors (see CompositedLayerMapping::localClipRectFor SquashedLayer()). 2170 // from clipping ancestors (see CompositedLayerMapping::localClipRectFor SquashedLayer()).
2171 // FIXME: Is it correct to clip to dirtyRect in slimming paint mode? 2171 // FIXME: Is it correct to clip to dirtyRect in slimming paint mode?
2172 // FIXME: Combine similar code here and LayerClipRecorder. 2172 // FIXME: Combine similar code here and LayerClipRecorder.
2173 dirtyRect.intersect(paintInfo.localClipRectForSquashedLayer); 2173 dirtyRect.intersect(paintInfo.localClipRectForSquashedLayer);
2174 context.paintController().createAndAppend<ClipDisplayItem>(graphicsLayer , DisplayItem::ClipLayerOverflowControls, dirtyRect); 2174 context.getPaintController().createAndAppend<ClipDisplayItem>(graphicsLa yer, DisplayItem::ClipLayerOverflowControls, dirtyRect);
2175 2175
2176 PaintLayerPainter(*paintInfo.paintLayer).paintLayer(context, paintingInf o, paintLayerFlags); 2176 PaintLayerPainter(*paintInfo.paintLayer).paintLayer(context, paintingInf o, paintLayerFlags);
2177 context.paintController().endItem<EndClipDisplayItem>(graphicsLayer, Dis playItem::clipTypeToEndClipType(DisplayItem::ClipLayerOverflowControls)); 2177 context.getPaintController().endItem<EndClipDisplayItem>(graphicsLayer, DisplayItem::clipTypeToEndClipType(DisplayItem::ClipLayerOverflowControls));
2178 } 2178 }
2179 } 2179 }
2180 2180
2181 static void paintScrollbar(const Scrollbar* scrollbar, GraphicsContext& context, const IntRect& clip) 2181 static void paintScrollbar(const Scrollbar* scrollbar, GraphicsContext& context, const IntRect& clip)
2182 { 2182 {
2183 if (!scrollbar) 2183 if (!scrollbar)
2184 return; 2184 return;
2185 2185
2186 const IntRect& scrollbarRect = scrollbar->frameRect(); 2186 const IntRect& scrollbarRect = scrollbar->frameRect();
2187 TransformRecorder transformRecorder(context, *scrollbar, AffineTransform::tr anslation(-scrollbarRect.x(), -scrollbarRect.y())); 2187 TransformRecorder transformRecorder(context, *scrollbar, AffineTransform::tr anslation(-scrollbarRect.x(), -scrollbarRect.y()));
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
2358 paintInfo.paintLayer = &m_owningLayer; 2358 paintInfo.paintLayer = &m_owningLayer;
2359 paintInfo.compositedBounds = compositedBounds(); 2359 paintInfo.compositedBounds = compositedBounds();
2360 paintInfo.offsetFromLayoutObject = graphicsLayer->offsetFromLayoutObject (); 2360 paintInfo.offsetFromLayoutObject = graphicsLayer->offsetFromLayoutObject ();
2361 2361
2362 // We have to use the same root as for hit testing, because both methods can compute and cache clipRects. 2362 // We have to use the same root as for hit testing, because both methods can compute and cache clipRects.
2363 doPaintTask(paintInfo, *graphicsLayer, paintLayerFlags, context, interes tRect); 2363 doPaintTask(paintInfo, *graphicsLayer, paintLayerFlags, context, interes tRect);
2364 } else if (graphicsLayer == m_squashingLayer.get()) { 2364 } else if (graphicsLayer == m_squashingLayer.get()) {
2365 for (size_t i = 0; i < m_squashedLayers.size(); ++i) 2365 for (size_t i = 0; i < m_squashedLayers.size(); ++i)
2366 doPaintTask(m_squashedLayers[i], *graphicsLayer, paintLayerFlags, co ntext, interestRect); 2366 doPaintTask(m_squashedLayers[i], *graphicsLayer, paintLayerFlags, co ntext, interestRect);
2367 } else if (graphicsLayer == layerForHorizontalScrollbar()) { 2367 } else if (graphicsLayer == layerForHorizontalScrollbar()) {
2368 paintScrollbar(m_owningLayer.scrollableArea()->horizontalScrollbar(), co ntext, interestRect); 2368 paintScrollbar(m_owningLayer.getScrollableArea()->horizontalScrollbar(), context, interestRect);
2369 } else if (graphicsLayer == layerForVerticalScrollbar()) { 2369 } else if (graphicsLayer == layerForVerticalScrollbar()) {
2370 paintScrollbar(m_owningLayer.scrollableArea()->verticalScrollbar(), cont ext, interestRect); 2370 paintScrollbar(m_owningLayer.getScrollableArea()->verticalScrollbar(), c ontext, interestRect);
2371 } else if (graphicsLayer == layerForScrollCorner()) { 2371 } else if (graphicsLayer == layerForScrollCorner()) {
2372 IntPoint scrollCornerAndResizerLocation = m_owningLayer.scrollableArea() ->scrollCornerAndResizerRect().location(); 2372 IntPoint scrollCornerAndResizerLocation = m_owningLayer.getScrollableAre a()->scrollCornerAndResizerRect().location();
2373 CullRect cullRect(enclosingIntRect(interestRect)); 2373 CullRect cullRect(enclosingIntRect(interestRect));
2374 ScrollableAreaPainter(*m_owningLayer.scrollableArea()).paintScrollCorner (context, -scrollCornerAndResizerLocation, cullRect); 2374 ScrollableAreaPainter(*m_owningLayer.getScrollableArea()).paintScrollCor ner(context, -scrollCornerAndResizerLocation, cullRect);
2375 ScrollableAreaPainter(*m_owningLayer.scrollableArea()).paintResizer(cont ext, -scrollCornerAndResizerLocation, cullRect); 2375 ScrollableAreaPainter(*m_owningLayer.getScrollableArea()).paintResizer(c ontext, -scrollCornerAndResizerLocation, cullRect);
2376 } 2376 }
2377 InspectorInstrumentation::didPaint(m_owningLayer.layoutObject(), graphicsLay er, context, LayoutRect(interestRect)); 2377 InspectorInstrumentation::didPaint(m_owningLayer.layoutObject(), graphicsLay er, context, LayoutRect(interestRect));
2378 #if ENABLE(ASSERT) 2378 #if ENABLE(ASSERT)
2379 if (Page* page = layoutObject()->frame()->page()) 2379 if (Page* page = layoutObject()->frame()->page())
2380 page->setIsPainting(false); 2380 page->setIsPainting(false);
2381 #endif 2381 #endif
2382 } 2382 }
2383 2383
2384 bool CompositedLayerMapping::isTrackingPaintInvalidations() const 2384 bool CompositedLayerMapping::isTrackingPaintInvalidations() const
2385 { 2385 {
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
2547 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { 2547 } else if (graphicsLayer == m_scrollingContentsLayer.get()) {
2548 name = "Scrolling Contents Layer"; 2548 name = "Scrolling Contents Layer";
2549 } else { 2549 } else {
2550 ASSERT_NOT_REACHED(); 2550 ASSERT_NOT_REACHED();
2551 } 2551 }
2552 2552
2553 return name; 2553 return name;
2554 } 2554 }
2555 2555
2556 } // namespace blink 2556 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698