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

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

Issue 2602823002: Validate objects are a box when clipping layers for clip-path. (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/clip/clip-path-inline-element-crash-expected.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 949 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 graphicsLayerParentLocation); 960 graphicsLayerParentLocation);
961 updateContentsOffsetInCompositingLayer(snappedOffsetFromCompositedAncestor, 961 updateContentsOffsetInCompositingLayer(snappedOffsetFromCompositedAncestor,
962 graphicsLayerParentLocation); 962 graphicsLayerParentLocation);
963 updateSquashingLayerGeometry( 963 updateSquashingLayerGeometry(
964 graphicsLayerParentLocation, compositingContainer, m_squashedLayers, 964 graphicsLayerParentLocation, compositingContainer, m_squashedLayers,
965 m_squashingLayer.get(), &m_squashingLayerOffsetFromTransformedAncestor, 965 m_squashingLayer.get(), &m_squashingLayerOffsetFromTransformedAncestor,
966 layersNeedingPaintInvalidation); 966 layersNeedingPaintInvalidation);
967 967
968 // If we have a layer that clips children, position it. 968 // If we have a layer that clips children, position it.
969 IntRect clippingBox; 969 IntRect clippingBox;
970 if (m_childContainmentLayer) 970 if (m_childContainmentLayer && layoutObject()->isBox())
971 clippingBox = clipBox(toLayoutBox(layoutObject())); 971 clippingBox = clipBox(toLayoutBox(layoutObject()));
972 972
973 updateChildTransformLayerGeometry(); 973 updateChildTransformLayerGeometry();
974 updateChildContainmentLayerGeometry(clippingBox, localCompositingBounds); 974 updateChildContainmentLayerGeometry(clippingBox, localCompositingBounds);
975 975
976 updateMaskLayerGeometry(); 976 updateMaskLayerGeometry();
977 updateTransformGeometry(snappedOffsetFromCompositedAncestor, 977 updateTransformGeometry(snappedOffsetFromCompositedAncestor,
978 relativeCompositingBounds); 978 relativeCompositingBounds);
979 updateForegroundLayerGeometry(contentsSize, clippingBox); 979 updateForegroundLayerGeometry(contentsSize, clippingBox);
980 updateBackgroundLayerGeometry(contentsSize); 980 updateBackgroundLayerGeometry(contentsSize);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 m_graphicsLayer->setBackfaceVisibility( 1036 m_graphicsLayer->setBackfaceVisibility(
1037 layoutObject()->style()->backfaceVisibility() == 1037 layoutObject()->style()->backfaceVisibility() ==
1038 BackfaceVisibilityVisible); 1038 BackfaceVisibilityVisible);
1039 } 1039 }
1040 1040
1041 void CompositedLayerMapping::computeGraphicsLayerParentLocation( 1041 void CompositedLayerMapping::computeGraphicsLayerParentLocation(
1042 const PaintLayer* compositingContainer, 1042 const PaintLayer* compositingContainer,
1043 const IntRect& ancestorCompositingBounds, 1043 const IntRect& ancestorCompositingBounds,
1044 IntPoint& graphicsLayerParentLocation) { 1044 IntPoint& graphicsLayerParentLocation) {
1045 if (compositingContainer && 1045 if (compositingContainer &&
1046 compositingContainer->compositedLayerMapping()->hasClippingLayer()) { 1046 compositingContainer->compositedLayerMapping()->hasClippingLayer() &&
1047 compositingContainer->layoutObject()->isBox()) {
1047 // If the compositing ancestor has a layer to clip children, we parent in 1048 // If the compositing ancestor has a layer to clip children, we parent in
1048 // that, and therefore position relative to it. 1049 // that, and therefore position relative to it.
1049 IntRect clippingBox = 1050 IntRect clippingBox =
1050 clipBox(toLayoutBox(compositingContainer->layoutObject())); 1051 clipBox(toLayoutBox(compositingContainer->layoutObject()));
1051 graphicsLayerParentLocation = 1052 graphicsLayerParentLocation =
1052 clippingBox.location() + 1053 clippingBox.location() +
1053 roundedIntSize(compositingContainer->subpixelAccumulation()); 1054 roundedIntSize(compositingContainer->subpixelAccumulation());
1054 } else if (compositingContainer && 1055 } else if (compositingContainer &&
1055 compositingContainer->compositedLayerMapping() 1056 compositingContainer->compositedLayerMapping()
1056 ->childTransformLayer()) { 1057 ->childTransformLayer()) {
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
1353 if (m_foregroundLayer) { 1354 if (m_foregroundLayer) {
1354 if (m_foregroundLayer->size() != m_scrollingContentsLayer->size()) 1355 if (m_foregroundLayer->size() != m_scrollingContentsLayer->size())
1355 m_foregroundLayer->setSize(m_scrollingContentsLayer->size()); 1356 m_foregroundLayer->setSize(m_scrollingContentsLayer->size());
1356 m_foregroundLayer->setNeedsDisplay(); 1357 m_foregroundLayer->setNeedsDisplay();
1357 m_foregroundLayer->setOffsetFromLayoutObject( 1358 m_foregroundLayer->setOffsetFromLayoutObject(
1358 m_scrollingContentsLayer->offsetFromLayoutObject()); 1359 m_scrollingContentsLayer->offsetFromLayoutObject());
1359 } 1360 }
1360 } 1361 }
1361 1362
1362 void CompositedLayerMapping::updateChildClippingMaskLayerGeometry() { 1363 void CompositedLayerMapping::updateChildClippingMaskLayerGeometry() {
1363 if (!m_childClippingMaskLayer || !layoutObject()->style()->clipPath()) 1364 if (!m_childClippingMaskLayer || !layoutObject()->style()->clipPath() ||
1365 !layoutObject()->isBox())
1364 return; 1366 return;
1365 LayoutBox* layoutBox = toLayoutBox(layoutObject()); 1367 LayoutBox* layoutBox = toLayoutBox(layoutObject());
1366 IntRect clientBox = enclosingIntRect(layoutBox->clientBoxRect()); 1368 IntRect clientBox = enclosingIntRect(layoutBox->clientBoxRect());
1367 1369
1368 m_childClippingMaskLayer->setPosition(m_graphicsLayer->position()); 1370 m_childClippingMaskLayer->setPosition(m_graphicsLayer->position());
1369 m_childClippingMaskLayer->setSize(m_graphicsLayer->size()); 1371 m_childClippingMaskLayer->setSize(m_graphicsLayer->size());
1370 m_childClippingMaskLayer->setOffsetFromLayoutObject( 1372 m_childClippingMaskLayer->setOffsetFromLayoutObject(
1371 toIntSize(clientBox.location())); 1373 toIntSize(clientBox.location()));
1372 1374
1373 // NOTE: also some stuff happening in updateChildContainmentLayerGeometry(). 1375 // NOTE: also some stuff happening in updateChildContainmentLayerGeometry().
(...skipping 2006 matching lines...) Expand 10 before | Expand all | Expand 10 after
3380 } else if (graphicsLayer == m_decorationOutlineLayer.get()) { 3382 } else if (graphicsLayer == m_decorationOutlineLayer.get()) {
3381 name = "Decoration Layer"; 3383 name = "Decoration Layer";
3382 } else { 3384 } else {
3383 ASSERT_NOT_REACHED(); 3385 ASSERT_NOT_REACHED();
3384 } 3386 }
3385 3387
3386 return name; 3388 return name;
3387 } 3389 }
3388 3390
3389 } // namespace blink 3391 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/clip/clip-path-inline-element-crash-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698