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 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
704 } | 704 } |
705 | 705 |
706 // If we live in a 3d hierarchy, then the layer at the root of that hierarch y needs | 706 // If we live in a 3d hierarchy, then the layer at the root of that hierarch y needs |
707 // the m_has3DTransformedDescendant set. | 707 // the m_has3DTransformedDescendant set. |
708 if (preserves3D()) | 708 if (preserves3D()) |
709 return has3DTransform() || m_has3DTransformedDescendant; | 709 return has3DTransform() || m_has3DTransformedDescendant; |
710 | 710 |
711 return has3DTransform(); | 711 return has3DTransform(); |
712 } | 712 } |
713 | 713 |
714 LayoutPoint DeprecatedPaintLayer::locationExcludeOverflowScroll() const | |
715 { | |
716 // Our m_location already has scroll offset baked-in. We have to revert it h ere. | |
pdr.
2015/09/08 04:23:53
Ok, lets keep this and LocationQueryBehavior bug l
trchen
2015/09/15 04:48:40
Done.
| |
717 IntSize scrollOffset; | |
718 if (DeprecatedPaintLayer* positionedParent = layoutObject()->isOutOfFlowPosi tioned() ? enclosingPositionedAncestor() : nullptr) { | |
pdr.
2015/09/08 04:23:53
Nit: temporary code, but can we rewrite it like so
trchen
2015/09/15 04:48:40
Done.
| |
719 if (positionedParent->layoutObject()->hasOverflowClip()) | |
720 scrollOffset = positionedParent->layoutBox()->scrolledContentOffset( ); | |
721 } else if (parent() && parent()->layoutObject()->hasOverflowClip()) { | |
722 scrollOffset = parent()->layoutBox()->scrolledContentOffset(); | |
723 } | |
724 return m_location + LayoutSize(scrollOffset); | |
725 } | |
726 | |
714 bool DeprecatedPaintLayer::updateLayerPosition() | 727 bool DeprecatedPaintLayer::updateLayerPosition() |
715 { | 728 { |
716 LayoutPoint localPoint; | 729 LayoutPoint localPoint; |
717 LayoutPoint inlineBoundingBoxOffset; // We don't put this into the Layer x/y for inlines, so we need to subtract it out when done. | 730 LayoutPoint inlineBoundingBoxOffset; // We don't put this into the Layer x/y for inlines, so we need to subtract it out when done. |
718 | 731 |
719 if (layoutObject()->isInline() && layoutObject()->isLayoutInline()) { | 732 if (layoutObject()->isInline() && layoutObject()->isLayoutInline()) { |
720 LayoutInline* inlineFlow = toLayoutInline(layoutObject()); | 733 LayoutInline* inlineFlow = toLayoutInline(layoutObject()); |
721 IntRect lineBox = inlineFlow->linesBoundingBox(); | 734 IntRect lineBox = inlineFlow->linesBoundingBox(); |
722 m_size = lineBox.size(); | 735 m_size = lineBox.size(); |
723 inlineBoundingBoxOffset = lineBox.location(); | 736 inlineBoundingBoxOffset = lineBox.location(); |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1237 | 1250 |
1238 // Remove all descendant layers from the hierarchy and add them to the new p osition. | 1251 // Remove all descendant layers from the hierarchy and add them to the new p osition. |
1239 for (LayoutObject* curr = layoutObject()->slowFirstChild(); curr; curr = cur r->nextSibling()) | 1252 for (LayoutObject* curr = layoutObject()->slowFirstChild(); curr; curr = cur r->nextSibling()) |
1240 curr->moveLayers(m_parent, this); | 1253 curr->moveLayers(m_parent, this); |
1241 | 1254 |
1242 // Clear out all the clip rects. | 1255 // Clear out all the clip rects. |
1243 m_clipper.clearClipRectsIncludingDescendants(); | 1256 m_clipper.clearClipRectsIncludingDescendants(); |
1244 } | 1257 } |
1245 | 1258 |
1246 // Returns the layer reached on the walk up towards the ancestor. | 1259 // Returns the layer reached on the walk up towards the ancestor. |
1247 static inline const DeprecatedPaintLayer* accumulateOffsetTowardsAncestor(const DeprecatedPaintLayer* layer, const DeprecatedPaintLayer* ancestorLayer, LayoutPo int& location) | 1260 static inline const DeprecatedPaintLayer* accumulateOffsetTowardsAncestor(const DeprecatedPaintLayer* layer, const DeprecatedPaintLayer* ancestorLayer, LayoutPo int& location, DeprecatedPaintLayer::LocationQueryBehavior behavior) |
1248 { | 1261 { |
1249 ASSERT(ancestorLayer != layer); | 1262 ASSERT(ancestorLayer != layer); |
1250 | 1263 |
1251 const LayoutBoxModelObject* layoutObject = layer->layoutObject(); | 1264 const LayoutBoxModelObject* layoutObject = layer->layoutObject(); |
1252 EPosition position = layoutObject->style()->position(); | 1265 EPosition position = layoutObject->style()->position(); |
1253 | 1266 |
1254 if (position == FixedPosition && (!ancestorLayer || ancestorLayer == layoutO bject->view()->layer())) { | 1267 if (position == FixedPosition && (!ancestorLayer || ancestorLayer == layoutO bject->view()->layer())) { |
1255 // If the fixed layer's container is the root, just add in the offset of the view. We can obtain this by calling | 1268 // If the fixed layer's container is the root, just add in the offset of the view. We can obtain this by calling |
1256 // localToAbsolute() on the LayoutView. | 1269 // localToAbsolute() on the LayoutView. |
1257 FloatPoint absPos = layoutObject->localToAbsolute(FloatPoint(), IsFixed) ; | 1270 FloatPoint absPos = layoutObject->localToAbsolute(FloatPoint(), IsFixed) ; |
1258 location += LayoutSize(absPos.x(), absPos.y()); | 1271 location += LayoutSize(absPos.x(), absPos.y()); |
1259 return ancestorLayer; | 1272 return ancestorLayer; |
1260 } | 1273 } |
1261 | 1274 |
1262 DeprecatedPaintLayer* parentLayer; | 1275 DeprecatedPaintLayer* parentLayer; |
1263 if (position == AbsolutePosition || position == FixedPosition) { | 1276 if (position == AbsolutePosition || position == FixedPosition) { |
1264 bool foundAncestorFirst; | 1277 bool foundAncestorFirst; |
1265 parentLayer = layer->enclosingPositionedAncestor(ancestorLayer, &foundAn cestorFirst); | 1278 parentLayer = layer->enclosingPositionedAncestor(ancestorLayer, &foundAn cestorFirst); |
1266 | 1279 |
1267 if (foundAncestorFirst) { | 1280 if (foundAncestorFirst) { |
1268 // Found ancestorLayer before the container of the out-of-flow objec t, so compute offset | 1281 // Found ancestorLayer before the container of the out-of-flow objec t, so compute offset |
1269 // of both relative to the container and subtract. | 1282 // of both relative to the container and subtract. |
1270 | 1283 |
1271 LayoutPoint thisCoords; | 1284 LayoutPoint thisCoords; |
1272 layer->convertToLayerCoords(parentLayer, thisCoords); | 1285 layer->convertToLayerCoords(parentLayer, thisCoords, behavior); |
1273 | 1286 |
1274 LayoutPoint ancestorCoords; | 1287 LayoutPoint ancestorCoords; |
1275 ancestorLayer->convertToLayerCoords(parentLayer, ancestorCoords); | 1288 ancestorLayer->convertToLayerCoords(parentLayer, ancestorCoords, beh avior); |
1276 | 1289 |
1277 location += (thisCoords - ancestorCoords); | 1290 location += (thisCoords - ancestorCoords); |
1278 return ancestorLayer; | 1291 return ancestorLayer; |
1279 } | 1292 } |
1280 } else if (layoutObject->isColumnSpanAll()) { | 1293 } else if (layoutObject->isColumnSpanAll()) { |
1281 LayoutBlock* multicolContainer = layoutObject->containingBlock(); | 1294 LayoutBlock* multicolContainer = layoutObject->containingBlock(); |
1282 ASSERT(toLayoutBlockFlow(multicolContainer)->multiColumnFlowThread()); | 1295 ASSERT(toLayoutBlockFlow(multicolContainer)->multiColumnFlowThread()); |
1283 parentLayer = multicolContainer->layer(); | 1296 parentLayer = multicolContainer->layer(); |
1284 ASSERT(parentLayer); | 1297 ASSERT(parentLayer); |
1285 } else { | 1298 } else { |
1286 parentLayer = layer->parent(); | 1299 parentLayer = layer->parent(); |
1287 } | 1300 } |
1288 | 1301 |
1289 if (!parentLayer) | 1302 if (!parentLayer) |
1290 return nullptr; | 1303 return nullptr; |
1291 | 1304 |
1292 location += layer->location(); | 1305 location += layer->location(behavior); |
1293 return parentLayer; | 1306 return parentLayer; |
1294 } | 1307 } |
1295 | 1308 |
1296 void DeprecatedPaintLayer::convertToLayerCoords(const DeprecatedPaintLayer* ance storLayer, LayoutPoint& location) const | 1309 void DeprecatedPaintLayer::convertToLayerCoords(const DeprecatedPaintLayer* ance storLayer, LayoutPoint& location, LocationQueryBehavior behavior) const |
1297 { | 1310 { |
1298 if (ancestorLayer == this) | 1311 if (ancestorLayer == this) |
1299 return; | 1312 return; |
1300 | 1313 |
1301 const DeprecatedPaintLayer* currLayer = this; | 1314 const DeprecatedPaintLayer* currLayer = this; |
1302 while (currLayer && currLayer != ancestorLayer) | 1315 while (currLayer && currLayer != ancestorLayer) |
1303 currLayer = accumulateOffsetTowardsAncestor(currLayer, ancestorLayer, lo cation); | 1316 currLayer = accumulateOffsetTowardsAncestor(currLayer, ancestorLayer, lo cation, behavior); |
1304 } | 1317 } |
1305 | 1318 |
1306 void DeprecatedPaintLayer::convertToLayerCoords(const DeprecatedPaintLayer* ance storLayer, LayoutRect& rect) const | 1319 void DeprecatedPaintLayer::convertToLayerCoords(const DeprecatedPaintLayer* ance storLayer, LayoutRect& rect) const |
1307 { | 1320 { |
1308 LayoutPoint delta; | 1321 LayoutPoint delta; |
1309 convertToLayerCoords(ancestorLayer, delta); | 1322 convertToLayerCoords(ancestorLayer, delta); |
1310 rect.moveBy(delta); | 1323 rect.moveBy(delta); |
1311 } | 1324 } |
1312 | 1325 |
1313 LayoutPoint DeprecatedPaintLayer::visualOffsetFromAncestor(const DeprecatedPaint Layer* ancestorLayer) const | 1326 LayoutPoint DeprecatedPaintLayer::visualOffsetFromAncestor(const DeprecatedPaint Layer* ancestorLayer) const |
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2326 return m_compositedDeprecatedPaintLayerMapping && m_compositedDeprecatedPain tLayerMapping->hasMaskLayer(); | 2339 return m_compositedDeprecatedPaintLayerMapping && m_compositedDeprecatedPain tLayerMapping->hasMaskLayer(); |
2327 } | 2340 } |
2328 | 2341 |
2329 bool DeprecatedPaintLayer::hasCompositedClippingMask() const | 2342 bool DeprecatedPaintLayer::hasCompositedClippingMask() const |
2330 { | 2343 { |
2331 return m_compositedDeprecatedPaintLayerMapping && m_compositedDeprecatedPain tLayerMapping->hasChildClippingMaskLayer(); | 2344 return m_compositedDeprecatedPaintLayerMapping && m_compositedDeprecatedPain tLayerMapping->hasChildClippingMaskLayer(); |
2332 } | 2345 } |
2333 | 2346 |
2334 bool DeprecatedPaintLayer::paintsWithTransform(GlobalPaintFlags globalPaintFlags ) const | 2347 bool DeprecatedPaintLayer::paintsWithTransform(GlobalPaintFlags globalPaintFlags ) const |
2335 { | 2348 { |
2349 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | |
2350 return hasTransformRelatedProperty(); | |
2351 | |
2336 return (transform() || layoutObject()->style()->position() == FixedPosition) && ((globalPaintFlags & GlobalPaintFlattenCompositingLayers) || compositingStat e() != PaintsIntoOwnBacking); | 2352 return (transform() || layoutObject()->style()->position() == FixedPosition) && ((globalPaintFlags & GlobalPaintFlattenCompositingLayers) || compositingStat e() != PaintsIntoOwnBacking); |
2337 } | 2353 } |
2338 | 2354 |
2339 bool DeprecatedPaintLayer::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& l ocalRect) const | 2355 bool DeprecatedPaintLayer::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& l ocalRect) const |
2340 { | 2356 { |
2341 if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant()) | 2357 if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant()) |
2342 return false; | 2358 return false; |
2343 | 2359 |
2344 if (paintsWithTransparency(GlobalPaintNormalPhase)) | 2360 if (paintsWithTransparency(GlobalPaintNormalPhase)) |
2345 return false; | 2361 return false; |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2742 | 2758 |
2743 void showLayerTree(const blink::LayoutObject* layoutObject) | 2759 void showLayerTree(const blink::LayoutObject* layoutObject) |
2744 { | 2760 { |
2745 if (!layoutObject) { | 2761 if (!layoutObject) { |
2746 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); | 2762 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); |
2747 return; | 2763 return; |
2748 } | 2764 } |
2749 showLayerTree(layoutObject->enclosingLayer()); | 2765 showLayerTree(layoutObject->enclosingLayer()); |
2750 } | 2766 } |
2751 #endif | 2767 #endif |
OLD | NEW |