Chromium Code Reviews| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 #include "config.h" | 44 #include "config.h" |
| 45 #include "core/rendering/RenderLayer.h" | 45 #include "core/rendering/RenderLayer.h" |
| 46 | 46 |
| 47 #include "CSSPropertyNames.h" | 47 #include "CSSPropertyNames.h" |
| 48 #include "HTMLNames.h" | 48 #include "HTMLNames.h" |
| 49 #include "RuntimeEnabledFeatures.h" | 49 #include "RuntimeEnabledFeatures.h" |
| 50 #include "SVGNames.h" | 50 #include "SVGNames.h" |
| 51 #include "core/css/PseudoStyleRequest.h" | 51 #include "core/css/PseudoStyleRequest.h" |
| 52 #include "core/dom/Document.h" | 52 #include "core/dom/Document.h" |
| 53 #include "core/dom/DocumentEventQueue.h" | 53 #include "core/dom/DocumentEventQueue.h" |
| 54 #include "core/dom/PseudoElement.h" | |
| 54 #include "core/dom/WebCoreMemoryInstrumentation.h" | 55 #include "core/dom/WebCoreMemoryInstrumentation.h" |
| 55 #include "core/dom/shadow/ShadowRoot.h" | 56 #include "core/dom/shadow/ShadowRoot.h" |
| 56 #include "core/editing/FrameSelection.h" | 57 #include "core/editing/FrameSelection.h" |
| 57 #include "core/html/HTMLFrameElement.h" | 58 #include "core/html/HTMLFrameElement.h" |
| 58 #include "core/html/HTMLFrameOwnerElement.h" | 59 #include "core/html/HTMLFrameOwnerElement.h" |
| 59 #include "core/inspector/InspectorInstrumentation.h" | 60 #include "core/inspector/InspectorInstrumentation.h" |
| 60 #include "core/page/EventHandler.h" | 61 #include "core/page/EventHandler.h" |
| 61 #include "core/page/FocusController.h" | 62 #include "core/page/FocusController.h" |
| 62 #include "core/page/Frame.h" | 63 #include "core/page/Frame.h" |
| 63 #include "core/page/FrameView.h" | 64 #include "core/page/FrameView.h" |
| (...skipping 4210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4274 ASSERT_NOT_REACHED(); | 4275 ASSERT_NOT_REACHED(); |
| 4275 return 0; | 4276 return 0; |
| 4276 } | 4277 } |
| 4277 | 4278 |
| 4278 bool RenderLayer::isInTopLayer() const | 4279 bool RenderLayer::isInTopLayer() const |
| 4279 { | 4280 { |
| 4280 Node* node = renderer()->node(); | 4281 Node* node = renderer()->node(); |
| 4281 return node && node->isElementNode() && toElement(node)->isInTopLayer(); | 4282 return node && node->isElementNode() && toElement(node)->isInTopLayer(); |
| 4282 } | 4283 } |
| 4283 | 4284 |
| 4284 bool RenderLayer::isInTopLayerSubtree() const | |
| 4285 { | |
| 4286 for (const RenderLayer* layer = this; layer; layer = layer->parent()) { | |
| 4287 if (layer->isInTopLayer()) | |
| 4288 return true; | |
| 4289 } | |
| 4290 return false; | |
| 4291 } | |
| 4292 | |
| 4293 // Compute the z-offset of the point in the transformState. | 4285 // Compute the z-offset of the point in the transformState. |
| 4294 // This is effectively projecting a ray normal to the plane of ancestor, finding where that | 4286 // This is effectively projecting a ray normal to the plane of ancestor, finding where that |
| 4295 // ray intersects target, and computing the z delta between those two points. | 4287 // ray intersects target, and computing the z delta between those two points. |
| 4296 static double computeZOffset(const HitTestingTransformState& transformState) | 4288 static double computeZOffset(const HitTestingTransformState& transformState) |
| 4297 { | 4289 { |
| 4298 // We got an affine transform, so no z-offset | 4290 // We got an affine transform, so no z-offset |
| 4299 if (transformState.m_accumulatedTransform.isAffine()) | 4291 if (transformState.m_accumulatedTransform.isAffine()) |
| 4300 return 0; | 4292 return 0; |
| 4301 | 4293 |
| 4302 // Flatten the point into the target plane | 4294 // Flatten the point into the target plane |
| (...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5626 if (negZOrderList) | 5618 if (negZOrderList) |
| 5627 std::stable_sort(negZOrderList->begin(), negZOrderList->end(), compareZI ndex); | 5619 std::stable_sort(negZOrderList->begin(), negZOrderList->end(), compareZI ndex); |
| 5628 | 5620 |
| 5629 // Append layers for top layer elements after normal layer collection, to en sure they are on top regardless of z-indexes. | 5621 // Append layers for top layer elements after normal layer collection, to en sure they are on top regardless of z-indexes. |
| 5630 // The renderers of top layer elements are children of the view, sorted in t op layer stacking order. | 5622 // The renderers of top layer elements are children of the view, sorted in t op layer stacking order. |
| 5631 if (isRootLayer()) { | 5623 if (isRootLayer()) { |
| 5632 RenderObject* view = renderer()->view(); | 5624 RenderObject* view = renderer()->view(); |
| 5633 for (RenderObject* child = view->firstChild(); child; child = child->nex tSibling()) { | 5625 for (RenderObject* child = view->firstChild(); child; child = child->nex tSibling()) { |
| 5634 Element* childElement = (child->node() && child->node()->isElementNo de()) ? toElement(child->node()) : 0; | 5626 Element* childElement = (child->node() && child->node()->isElementNo de()) ? toElement(child->node()) : 0; |
| 5635 if (childElement && childElement->isInTopLayer()) { | 5627 if (childElement && childElement->isInTopLayer()) { |
| 5636 RenderLayer* layer = toRenderLayerModelObject(child)->layer(); | 5628 if (Element* backdrop = childElement->pseudoElement(BACKDROP)) |
| 5637 posZOrderList->append(layer); | 5629 posZOrderList->append(toRenderLayerModelObject(backdrop->ren derer())->layer()); |
|
Julien - ping for review
2013/06/27 22:49:00
I haven't seen why it's a fine assumption to assum
falken
2013/06/28 08:06:52
Done. ::backdrop gets a non-auto z-index now, like
| |
| 5630 posZOrderList->append(toRenderLayerModelObject(child)->layer()); | |
|
Julien - ping for review
2013/06/27 22:49:00
The ordering is wrong as |backdrop| should be *bel
falken
2013/06/28 08:06:52
It's correct. The layer list is ordered from botto
| |
| 5638 } | 5631 } |
| 5639 } | 5632 } |
| 5640 } | 5633 } |
| 5641 } | 5634 } |
| 5642 | 5635 |
| 5643 void RenderLayer::updateNormalFlowList() | 5636 void RenderLayer::updateNormalFlowList() |
| 5644 { | 5637 { |
| 5645 if (!m_normalFlowListDirty) | 5638 if (!m_normalFlowListDirty) |
| 5646 return; | 5639 return; |
| 5647 | 5640 |
| 5648 ASSERT(m_layerListMutationAllowed); | 5641 ASSERT(m_layerListMutationAllowed); |
| 5649 | 5642 |
| 5650 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) { | 5643 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) { |
| 5651 // Ignore non-overflow layers and reflections. | 5644 // Ignore non-overflow layers and reflections. |
| 5652 if (child->isNormalFlowOnly() && (!m_reflection || reflectionLayer() != child)) { | 5645 if (child->isNormalFlowOnly() && (!m_reflection || reflectionLayer() != child)) { |
| 5653 if (!m_normalFlowList) | 5646 if (!m_normalFlowList) |
| 5654 m_normalFlowList = adoptPtr(new Vector<RenderLayer*>); | 5647 m_normalFlowList = adoptPtr(new Vector<RenderLayer*>); |
| 5655 m_normalFlowList->append(child); | 5648 m_normalFlowList->append(child); |
| 5656 } | 5649 } |
| 5657 } | 5650 } |
| 5658 | 5651 |
| 5659 m_normalFlowListDirty = false; | 5652 m_normalFlowListDirty = false; |
| 5660 } | 5653 } |
| 5661 | 5654 |
| 5662 void RenderLayer::collectLayers(bool includeHiddenLayers, OwnPtr<Vector<RenderLa yer*> >& posBuffer, OwnPtr<Vector<RenderLayer*> >& negBuffer, const RenderLayer* layerToForceAsStackingContainer, CollectLayersBehavior collectLayersBehavior) | 5655 void RenderLayer::collectLayers(bool includeHiddenLayers, OwnPtr<Vector<RenderLa yer*> >& posBuffer, OwnPtr<Vector<RenderLayer*> >& negBuffer, const RenderLayer* layerToForceAsStackingContainer, CollectLayersBehavior collectLayersBehavior) |
| 5663 { | 5656 { |
| 5664 if (isInTopLayer()) | 5657 if (isInTopLayer() || isBackdrop()) |
| 5665 return; | 5658 return; |
| 5666 | 5659 |
| 5667 updateDescendantDependentFlags(); | 5660 updateDescendantDependentFlags(); |
| 5668 | 5661 |
| 5669 bool isStacking = false; | 5662 bool isStacking = false; |
| 5670 bool isNormalFlow = false; | 5663 bool isNormalFlow = false; |
| 5671 | 5664 |
| 5672 switch (collectLayersBehavior) { | 5665 switch (collectLayersBehavior) { |
| 5673 case ForceLayerToStackingContainer: | 5666 case ForceLayerToStackingContainer: |
| 5674 ASSERT(layerToForceAsStackingContainer); | 5667 ASSERT(layerToForceAsStackingContainer); |
| (...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6395 } | 6388 } |
| 6396 } | 6389 } |
| 6397 | 6390 |
| 6398 void showLayerTree(const WebCore::RenderObject* renderer) | 6391 void showLayerTree(const WebCore::RenderObject* renderer) |
| 6399 { | 6392 { |
| 6400 if (!renderer) | 6393 if (!renderer) |
| 6401 return; | 6394 return; |
| 6402 showLayerTree(renderer->enclosingLayer()); | 6395 showLayerTree(renderer->enclosingLayer()); |
| 6403 } | 6396 } |
| 6404 #endif | 6397 #endif |
| OLD | NEW |