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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
195 oldSquashedLayer->setLostGroupedMapping(true); | 195 oldSquashedLayer->setLostGroupedMapping(true); |
196 } | 196 } |
197 } | 197 } |
198 | 198 |
199 updateClippingLayers(false, false); | 199 updateClippingLayers(false, false); |
200 updateOverflowControlsLayers(false, false, false, false); | 200 updateOverflowControlsLayers(false, false, false, false); |
201 updateChildTransformLayer(false); | 201 updateChildTransformLayer(false); |
202 updateForegroundLayer(false); | 202 updateForegroundLayer(false); |
203 updateBackgroundLayer(false); | 203 updateBackgroundLayer(false); |
204 updateMaskLayer(false); | 204 updateMaskLayer(false); |
205 updateClippingMaskLayers(false); | 205 updateChildClippingMaskLayer(false); |
206 updateScrollingLayers(false); | 206 updateScrollingLayers(false); |
207 updateSquashingLayers(false); | 207 updateSquashingLayers(false); |
208 destroyGraphicsLayers(); | 208 destroyGraphicsLayers(); |
209 } | 209 } |
210 | 210 |
211 PassOwnPtr<GraphicsLayer> CompositedLayerMapping::createGraphicsLayer(Compositin gReasons reasons) | 211 PassOwnPtr<GraphicsLayer> CompositedLayerMapping::createGraphicsLayer(Compositin gReasons reasons) |
212 { | 212 { |
213 GraphicsLayerFactory* graphicsLayerFactory = nullptr; | 213 GraphicsLayerFactory* graphicsLayerFactory = nullptr; |
214 if (Page* page = layoutObject()->frame()->page()) | 214 if (Page* page = layoutObject()->frame()->page()) |
215 graphicsLayerFactory = page->chromeClient().graphicsLayerFactory(); | 215 graphicsLayerFactory = page->chromeClient().graphicsLayerFactory(); |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
461 | 461 |
462 if (scrollingConfigChanged) { | 462 if (scrollingConfigChanged) { |
463 if (layoutObject->view()) | 463 if (layoutObject->view()) |
464 compositor->scrollingLayerDidChange(&m_owningLayer); | 464 compositor->scrollingLayerDidChange(&m_owningLayer); |
465 } | 465 } |
466 | 466 |
467 // A mask layer is not part of the hierarchy proper, it's an auxiliary layer | 467 // A mask layer is not part of the hierarchy proper, it's an auxiliary layer |
468 // that's plugged into another GraphicsLayer that is part of the hierarchy. | 468 // that's plugged into another GraphicsLayer that is part of the hierarchy. |
469 // It has no parent or child GraphicsLayer. For that reason, we process it | 469 // It has no parent or child GraphicsLayer. For that reason, we process it |
470 // here, after the hierarchy has been updated. | 470 // here, after the hierarchy has been updated. |
471 bool maskLayerChanged = false; | 471 bool maskLayerChanged = updateMaskLayer(layoutObject->hasMask()); |
472 if (updateMaskLayer(layoutObject->hasMask())) { | 472 if (maskLayerChanged) |
473 maskLayerChanged = true; | |
474 m_graphicsLayer->setMaskLayer(m_maskLayer.get()); | 473 m_graphicsLayer->setMaskLayer(m_maskLayer.get()); |
475 } | |
476 | 474 |
477 bool hasChildClippingLayer = compositor->clipsCompositingDescendants(&m_owni ngLayer) && (hasClippingLayer() || hasScrollingLayer()); | 475 bool hasChildClippingLayer = compositor->clipsCompositingDescendants(&m_owni ngLayer) && (hasClippingLayer() || hasScrollingLayer()); |
478 // If we have a border radius or clip path on a scrolling layer, we need a c lipping mask to properly | 476 // If we have a border radius or clip path on a scrolling layer, we need a c lipping mask to properly |
479 // clip the scrolled contents, even if there are no composited descendants. | 477 // clip the scrolled contents, even if there are no composited descendants. |
480 bool hasClipPath = layoutObject->style()->clipPath(); | 478 bool hasClipPath = layoutObject->style()->clipPath(); |
481 bool needsChildClippingMask = (hasClipPath || layoutObject->style()->hasBord erRadius()) && (hasChildClippingLayer || isAcceleratedContents(layoutObject) || hasScrollingLayer()); | 479 bool needsChildClippingMask = (hasClipPath || layoutObject->style()->hasBord erRadius()) && (hasChildClippingLayer || isAcceleratedContents(layoutObject) || hasScrollingLayer()); |
482 if (updateClippingMaskLayers(needsChildClippingMask)) { | 480 |
483 // Clip path clips the entire subtree, including scrollbars. It must be attached directly onto | 481 GraphicsLayer* layerToApplyChildClippingMask = nullptr; |
484 // the main m_graphicsLayer. | 482 bool shouldApplyChildClippingMaskOnContents = false; |
485 if (hasClipPath) | 483 if (needsChildClippingMask) { |
484 if (hasClipPath) { | |
chrishtr
2015/11/09 22:24:51
Is this and the below just refactoring? Or what is
| |
485 // Clip path clips the entire subtree, including scrollbars. It must be attached directly onto | |
486 // the main m_graphicsLayer. | |
487 layerToApplyChildClippingMask = m_graphicsLayer.get(); | |
488 } else if (hasClippingLayer()) { | |
489 layerToApplyChildClippingMask = clippingLayer(); | |
490 } else if (hasScrollingLayer()) { | |
491 layerToApplyChildClippingMask = scrollingLayer(); | |
492 } else if (isAcceleratedContents(layoutObject)) { | |
493 shouldApplyChildClippingMaskOnContents = true; | |
494 } | |
495 } | |
496 | |
497 updateChildClippingMaskLayer(needsChildClippingMask); | |
498 | |
499 if (layerToApplyChildClippingMask == m_graphicsLayer) { | |
500 if (m_graphicsLayer->maskLayer() != m_childClippingMaskLayer.get()) { | |
486 m_graphicsLayer->setMaskLayer(m_childClippingMaskLayer.get()); | 501 m_graphicsLayer->setMaskLayer(m_childClippingMaskLayer.get()); |
487 else if (hasClippingLayer()) | 502 maskLayerChanged = true; |
488 clippingLayer()->setMaskLayer(m_childClippingMaskLayer.get()); | 503 } |
489 else if (hasScrollingLayer()) | 504 } else if (m_graphicsLayer->maskLayer() && m_graphicsLayer->maskLayer() != m _maskLayer.get()) { |
490 scrollingLayer()->setMaskLayer(m_childClippingMaskLayer.get()); | 505 m_graphicsLayer->setMaskLayer(nullptr); |
491 else if (isAcceleratedContents(layoutObject)) | 506 maskLayerChanged = true; |
492 m_graphicsLayer->setContentsClippingMaskLayer(m_childClippingMaskLay er.get()); | |
493 } | 507 } |
508 if (hasClippingLayer()) | |
509 clippingLayer()->setMaskLayer(layerToApplyChildClippingMask == clippingL ayer() ? m_childClippingMaskLayer.get() : nullptr); | |
510 if (hasScrollingLayer()) | |
511 scrollingLayer()->setMaskLayer(layerToApplyChildClippingMask == clipping Layer() ? m_childClippingMaskLayer.get() : nullptr); | |
Xianzhu
2015/11/09 22:47:24
The above line is wrong. Fixing.
Xianzhu
2015/11/09 22:51:56
Done.
| |
512 m_graphicsLayer->setContentsClippingMaskLayer(shouldApplyChildClippingMaskOn Contents ? m_childClippingMaskLayer.get() : nullptr); | |
494 | 513 |
495 if (m_owningLayer.reflectionInfo()) { | 514 if (m_owningLayer.reflectionInfo()) { |
496 if (m_owningLayer.reflectionInfo()->reflectionLayer()->hasCompositedLaye rMapping()) { | 515 if (m_owningLayer.reflectionInfo()->reflectionLayer()->hasCompositedLaye rMapping()) { |
497 GraphicsLayer* reflectionLayer = m_owningLayer.reflectionInfo()->ref lectionLayer()->compositedLayerMapping()->mainGraphicsLayer(); | 516 GraphicsLayer* reflectionLayer = m_owningLayer.reflectionInfo()->ref lectionLayer()->compositedLayerMapping()->mainGraphicsLayer(); |
498 m_graphicsLayer->setReplicatedByLayer(reflectionLayer); | 517 m_graphicsLayer->setReplicatedByLayer(reflectionLayer); |
499 } | 518 } |
500 } else { | 519 } else { |
501 m_graphicsLayer->setReplicatedByLayer(nullptr); | 520 m_graphicsLayer->setReplicatedByLayer(nullptr); |
502 } | 521 } |
503 | 522 |
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1539 layerChanged = true; | 1558 layerChanged = true; |
1540 } | 1559 } |
1541 } else if (m_maskLayer) { | 1560 } else if (m_maskLayer) { |
1542 m_maskLayer = nullptr; | 1561 m_maskLayer = nullptr; |
1543 layerChanged = true; | 1562 layerChanged = true; |
1544 } | 1563 } |
1545 | 1564 |
1546 return layerChanged; | 1565 return layerChanged; |
1547 } | 1566 } |
1548 | 1567 |
1549 bool CompositedLayerMapping::updateClippingMaskLayers(bool needsChildClippingMas kLayer) | 1568 void CompositedLayerMapping::updateChildClippingMaskLayer(bool needsChildClippin gMaskLayer) |
1550 { | 1569 { |
1551 bool layerChanged = false; | |
1552 if (needsChildClippingMaskLayer) { | 1570 if (needsChildClippingMaskLayer) { |
1553 if (!m_childClippingMaskLayer) { | 1571 if (!m_childClippingMaskLayer) { |
1554 m_childClippingMaskLayer = createGraphicsLayer(CompositingReasonLaye rForClippingMask); | 1572 m_childClippingMaskLayer = createGraphicsLayer(CompositingReasonLaye rForClippingMask); |
1555 m_childClippingMaskLayer->setPaintingPhase(GraphicsLayerPaintChildCl ippingMask); | 1573 m_childClippingMaskLayer->setPaintingPhase(GraphicsLayerPaintChildCl ippingMask); |
1556 layerChanged = true; | |
1557 } | 1574 } |
1558 } else if (m_childClippingMaskLayer) { | 1575 return; |
1559 m_childClippingMaskLayer = nullptr; | |
1560 layerChanged = true; | |
1561 } | 1576 } |
1562 return layerChanged; | 1577 m_childClippingMaskLayer = nullptr; |
1563 } | 1578 } |
1564 | 1579 |
1565 bool CompositedLayerMapping::updateScrollingLayers(bool needsScrollingLayers) | 1580 bool CompositedLayerMapping::updateScrollingLayers(bool needsScrollingLayers) |
1566 { | 1581 { |
1567 ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m _owningLayer); | 1582 ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m _owningLayer); |
1568 | 1583 |
1569 bool layerChanged = false; | 1584 bool layerChanged = false; |
1570 if (needsScrollingLayers) { | 1585 if (needsScrollingLayers) { |
1571 if (!m_scrollingLayer) { | 1586 if (!m_scrollingLayer) { |
1572 // Outer layer which corresponds with the scroll view. | 1587 // Outer layer which corresponds with the scroll view. |
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2506 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { | 2521 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { |
2507 name = "Scrolling Block Selection Layer"; | 2522 name = "Scrolling Block Selection Layer"; |
2508 } else { | 2523 } else { |
2509 ASSERT_NOT_REACHED(); | 2524 ASSERT_NOT_REACHED(); |
2510 } | 2525 } |
2511 | 2526 |
2512 return name; | 2527 return name; |
2513 } | 2528 } |
2514 | 2529 |
2515 } // namespace blink | 2530 } // namespace blink |
OLD | NEW |