| OLD | NEW |
| 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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 // so it is legitimate to compute and cache the composited bounds for this l
ayer. | 393 // so it is legitimate to compute and cache the composited bounds for this l
ayer. |
| 394 updateCompositedBounds(); | 394 updateCompositedBounds(); |
| 395 | 395 |
| 396 if (PaintLayerReflectionInfo* reflection = m_owningLayer.reflectionInfo()) { | 396 if (PaintLayerReflectionInfo* reflection = m_owningLayer.reflectionInfo()) { |
| 397 if (reflection->reflectionLayer()->hasCompositedLayerMapping()) | 397 if (reflection->reflectionLayer()->hasCompositedLayerMapping()) |
| 398 reflection->reflectionLayer()->compositedLayerMapping()->updateCompo
sitedBounds(); | 398 reflection->reflectionLayer()->compositedLayerMapping()->updateCompo
sitedBounds(); |
| 399 } | 399 } |
| 400 | 400 |
| 401 PaintLayerCompositor* compositor = this->compositor(); | 401 PaintLayerCompositor* compositor = this->compositor(); |
| 402 LayoutObject* layoutObject = this->layoutObject(); | 402 LayoutObject* layoutObject = this->layoutObject(); |
| 403 const ComputedStyle& style = layoutObject->styleRef(); |
| 403 | 404 |
| 404 bool layerConfigChanged = false; | 405 bool layerConfigChanged = false; |
| 405 setBackgroundLayerPaintsFixedRootBackground(compositor->needsFixedRootBackgr
oundLayer(&m_owningLayer)); | 406 setBackgroundLayerPaintsFixedRootBackground(compositor->needsFixedRootBackgr
oundLayer(&m_owningLayer)); |
| 406 | 407 |
| 407 // The background layer is currently only used for fixed root backgrounds. | 408 // The background layer is currently only used for fixed root backgrounds. |
| 408 if (updateBackgroundLayer(m_backgroundLayerPaintsFixedRootBackground)) | 409 if (updateBackgroundLayer(m_backgroundLayerPaintsFixedRootBackground)) |
| 409 layerConfigChanged = true; | 410 layerConfigChanged = true; |
| 410 | 411 |
| 411 if (updateForegroundLayer(compositor->needsContentsCompositingLayer(&m_ownin
gLayer))) | 412 if (updateForegroundLayer(compositor->needsContentsCompositingLayer(&m_ownin
gLayer))) |
| 412 layerConfigChanged = true; | 413 layerConfigChanged = true; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 431 | 432 |
| 432 bool scrollingConfigChanged = false; | 433 bool scrollingConfigChanged = false; |
| 433 if (updateScrollingLayers(m_owningLayer.needsCompositedScrolling())) { | 434 if (updateScrollingLayers(m_owningLayer.needsCompositedScrolling())) { |
| 434 layerConfigChanged = true; | 435 layerConfigChanged = true; |
| 435 scrollingConfigChanged = true; | 436 scrollingConfigChanged = true; |
| 436 } | 437 } |
| 437 | 438 |
| 438 if (updateOverflowControlsLayers(requiresHorizontalScrollbarLayer(), require
sVerticalScrollbarLayer(), requiresScrollCornerLayer(), needsAncestorClip)) | 439 if (updateOverflowControlsLayers(requiresHorizontalScrollbarLayer(), require
sVerticalScrollbarLayer(), requiresScrollCornerLayer(), needsAncestorClip)) |
| 439 layerConfigChanged = true; | 440 layerConfigChanged = true; |
| 440 | 441 |
| 441 bool hasPerspective = false; | 442 bool hasPerspective = style.hasPerspective(); |
| 442 // FIXME: Can |style| be really null that late in the DocumentCycle? | |
| 443 if (const ComputedStyle* style = layoutObject->style()) | |
| 444 hasPerspective = style->hasPerspective(); | |
| 445 bool needsChildTransformLayer = hasPerspective && layoutObject->isBox(); | 443 bool needsChildTransformLayer = hasPerspective && layoutObject->isBox(); |
| 446 if (updateChildTransformLayer(needsChildTransformLayer)) | 444 if (updateChildTransformLayer(needsChildTransformLayer)) |
| 447 layerConfigChanged = true; | 445 layerConfigChanged = true; |
| 448 | 446 |
| 449 if (updateSquashingLayers(!m_squashedLayers.isEmpty())) | 447 if (updateSquashingLayers(!m_squashedLayers.isEmpty())) |
| 450 layerConfigChanged = true; | 448 layerConfigChanged = true; |
| 451 | 449 |
| 452 updateScrollParent(scrollParent); | 450 updateScrollParent(scrollParent); |
| 453 updateClipParent(scrollParent); | 451 updateClipParent(scrollParent); |
| 454 | 452 |
| 455 if (layerConfigChanged) | 453 if (layerConfigChanged) |
| 456 updateInternalHierarchy(); | 454 updateInternalHierarchy(); |
| 457 | 455 |
| 458 if (scrollingConfigChanged) { | 456 if (scrollingConfigChanged) { |
| 459 if (layoutObject->view()) | 457 if (layoutObject->view()) |
| 460 compositor->scrollingLayerDidChange(&m_owningLayer); | 458 compositor->scrollingLayerDidChange(&m_owningLayer); |
| 461 } | 459 } |
| 462 | 460 |
| 463 // A mask layer is not part of the hierarchy proper, it's an auxiliary layer | 461 // A mask layer is not part of the hierarchy proper, it's an auxiliary layer |
| 464 // that's plugged into another GraphicsLayer that is part of the hierarchy. | 462 // that's plugged into another GraphicsLayer that is part of the hierarchy. |
| 465 // It has no parent or child GraphicsLayer. For that reason, we process it | 463 // It has no parent or child GraphicsLayer. For that reason, we process it |
| 466 // here, after the hierarchy has been updated. | 464 // here, after the hierarchy has been updated. |
| 467 bool maskLayerChanged = updateMaskLayer(layoutObject->hasMask()); | 465 bool maskLayerChanged = updateMaskLayer(layoutObject->hasMask()); |
| 468 if (maskLayerChanged) | 466 if (maskLayerChanged) |
| 469 m_graphicsLayer->setMaskLayer(m_maskLayer.get()); | 467 m_graphicsLayer->setMaskLayer(m_maskLayer.get()); |
| 470 | 468 |
| 471 bool hasChildClippingLayer = compositor->clipsCompositingDescendants(&m_owni
ngLayer) && (hasClippingLayer() || hasScrollingLayer()); | 469 bool hasChildClippingLayer = compositor->clipsCompositingDescendants(&m_owni
ngLayer) && (hasClippingLayer() || hasScrollingLayer()); |
| 472 // If we have a border radius or clip path on a scrolling layer, we need a c
lipping mask to properly | 470 // If we have a border radius or clip path on a scrolling layer, we need a c
lipping mask to properly |
| 473 // clip the scrolled contents, even if there are no composited descendants. | 471 // clip the scrolled contents, even if there are no composited descendants. |
| 474 bool hasClipPath = layoutObject->style()->clipPath(); | 472 bool hasClipPath = style.clipPath(); |
| 475 bool needsChildClippingMask = (hasClipPath || layoutObject->style()->hasBord
erRadius()) && (hasChildClippingLayer || isAcceleratedContents(layoutObject) ||
hasScrollingLayer()); | 473 bool needsChildClippingMask = (hasClipPath || style.hasBorderRadius()) && (h
asChildClippingLayer || isAcceleratedContents(layoutObject) || hasScrollingLayer
()); |
| 476 | 474 |
| 477 GraphicsLayer* layerToApplyChildClippingMask = nullptr; | 475 GraphicsLayer* layerToApplyChildClippingMask = nullptr; |
| 478 bool shouldApplyChildClippingMaskOnContents = false; | 476 bool shouldApplyChildClippingMaskOnContents = false; |
| 479 if (needsChildClippingMask) { | 477 if (needsChildClippingMask) { |
| 480 if (hasClipPath) { | 478 if (hasClipPath) { |
| 481 // Clip path clips the entire subtree, including scrollbars. It must
be attached directly onto | 479 // Clip path clips the entire subtree, including scrollbars. It must
be attached directly onto |
| 482 // the main m_graphicsLayer. | 480 // the main m_graphicsLayer. |
| 483 layerToApplyChildClippingMask = m_graphicsLayer.get(); | 481 layerToApplyChildClippingMask = m_graphicsLayer.get(); |
| 484 } else if (hasClippingLayer()) { | 482 } else if (hasClippingLayer()) { |
| 485 layerToApplyChildClippingMask = clippingLayer(); | 483 layerToApplyChildClippingMask = clippingLayer(); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 layerConfigChanged = true; | 547 layerConfigChanged = true; |
| 550 } | 548 } |
| 551 | 549 |
| 552 // Changes to either the internal hierarchy or the mask layer have an impact | 550 // Changes to either the internal hierarchy or the mask layer have an impact |
| 553 // on painting phases, so we need to update when either are updated. | 551 // on painting phases, so we need to update when either are updated. |
| 554 if (layerConfigChanged || maskLayerChanged) | 552 if (layerConfigChanged || maskLayerChanged) |
| 555 updatePaintingPhases(); | 553 updatePaintingPhases(); |
| 556 | 554 |
| 557 updateElementIdAndCompositorMutableProperties(); | 555 updateElementIdAndCompositorMutableProperties(); |
| 558 | 556 |
| 559 m_graphicsLayer->setHasWillChangeTransformHint(m_owningLayer.layoutObject()-
>styleRef().hasWillChangeTransformHint()); | 557 m_graphicsLayer->setHasWillChangeTransformHint(style.hasWillChangeTransformH
int()); |
| 558 |
| 559 m_owningLayer.update3DTransformedDescendantStatus(); |
| 560 if (style.preserves3D() && style.hasOpacity() && m_owningLayer.has3DTransfor
medDescendant()) |
| 561 UseCounter::count(layoutObject->document(), UseCounter::OpacityWithPrese
rve3DQuirk); |
| 560 | 562 |
| 561 return layerConfigChanged; | 563 return layerConfigChanged; |
| 562 } | 564 } |
| 563 | 565 |
| 564 static IntRect clipBox(LayoutBox* layoutObject) | 566 static IntRect clipBox(LayoutBox* layoutObject) |
| 565 { | 567 { |
| 566 LayoutRect result = LayoutRect(LayoutRect::infiniteIntRect()); | 568 LayoutRect result = LayoutRect(LayoutRect::infiniteIntRect()); |
| 567 if (layoutObject->hasOverflowClip() || layoutObject->style()->containsPaint(
)) | 569 if (layoutObject->hasOverflowClip() || layoutObject->style()->containsPaint(
)) |
| 568 result = layoutObject->overflowClipRect(LayoutPoint()); | 570 result = layoutObject->overflowClipRect(LayoutPoint()); |
| 569 | 571 |
| (...skipping 2005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2575 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { | 2577 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { |
| 2576 name = "Scrolling Contents Layer"; | 2578 name = "Scrolling Contents Layer"; |
| 2577 } else { | 2579 } else { |
| 2578 ASSERT_NOT_REACHED(); | 2580 ASSERT_NOT_REACHED(); |
| 2579 } | 2581 } |
| 2580 | 2582 |
| 2581 return name; | 2583 return name; |
| 2582 } | 2584 } |
| 2583 | 2585 |
| 2584 } // namespace blink | 2586 } // namespace blink |
| OLD | NEW |