| 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 1326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5629 if (negZOrderList) | 5621 if (negZOrderList) |
| 5630 std::stable_sort(negZOrderList->begin(), negZOrderList->end(), compareZI
ndex); | 5622 std::stable_sort(negZOrderList->begin(), negZOrderList->end(), compareZI
ndex); |
| 5631 | 5623 |
| 5632 // Append layers for top layer elements after normal layer collection, to en
sure they are on top regardless of z-indexes. | 5624 // Append layers for top layer elements after normal layer collection, to en
sure they are on top regardless of z-indexes. |
| 5633 // The renderers of top layer elements are children of the view, sorted in t
op layer stacking order. | 5625 // The renderers of top layer elements are children of the view, sorted in t
op layer stacking order. |
| 5634 if (isRootLayer()) { | 5626 if (isRootLayer()) { |
| 5635 RenderObject* view = renderer()->view(); | 5627 RenderObject* view = renderer()->view(); |
| 5636 for (RenderObject* child = view->firstChild(); child; child = child->nex
tSibling()) { | 5628 for (RenderObject* child = view->firstChild(); child; child = child->nex
tSibling()) { |
| 5637 Element* childElement = (child->node() && child->node()->isElementNo
de()) ? toElement(child->node()) : 0; | 5629 Element* childElement = (child->node() && child->node()->isElementNo
de()) ? toElement(child->node()) : 0; |
| 5638 if (childElement && childElement->isInTopLayer()) { | 5630 if (childElement && childElement->isInTopLayer()) { |
| 5639 RenderLayer* layer = toRenderLayerModelObject(child)->layer(); | 5631 if (Element* backdrop = childElement->pseudoElement(BACKDROP)) |
| 5640 posZOrderList->append(layer); | 5632 posZOrderList->append(toRenderLayerModelObject(backdrop->ren
derer())->layer()); |
| 5633 posZOrderList->append(toRenderLayerModelObject(child)->layer()); |
| 5641 } | 5634 } |
| 5642 } | 5635 } |
| 5643 } | 5636 } |
| 5644 } | 5637 } |
| 5645 | 5638 |
| 5646 void RenderLayer::updateNormalFlowList() | 5639 void RenderLayer::updateNormalFlowList() |
| 5647 { | 5640 { |
| 5648 if (!m_normalFlowListDirty) | 5641 if (!m_normalFlowListDirty) |
| 5649 return; | 5642 return; |
| 5650 | 5643 |
| 5651 ASSERT(m_layerListMutationAllowed); | 5644 ASSERT(m_layerListMutationAllowed); |
| 5652 | 5645 |
| 5653 for (RenderLayer* child = firstChild(); child; child = child->nextSibling())
{ | 5646 for (RenderLayer* child = firstChild(); child; child = child->nextSibling())
{ |
| 5654 // Ignore non-overflow layers and reflections. | 5647 // Ignore non-overflow layers and reflections. |
| 5655 if (child->isNormalFlowOnly() && (!m_reflection || reflectionLayer() !=
child)) { | 5648 if (child->isNormalFlowOnly() && (!m_reflection || reflectionLayer() !=
child)) { |
| 5656 if (!m_normalFlowList) | 5649 if (!m_normalFlowList) |
| 5657 m_normalFlowList = adoptPtr(new Vector<RenderLayer*>); | 5650 m_normalFlowList = adoptPtr(new Vector<RenderLayer*>); |
| 5658 m_normalFlowList->append(child); | 5651 m_normalFlowList->append(child); |
| 5659 } | 5652 } |
| 5660 } | 5653 } |
| 5661 | 5654 |
| 5662 m_normalFlowListDirty = false; | 5655 m_normalFlowListDirty = false; |
| 5663 } | 5656 } |
| 5664 | 5657 |
| 5665 void RenderLayer::collectLayers(bool includeHiddenLayers, OwnPtr<Vector<RenderLa
yer*> >& posBuffer, OwnPtr<Vector<RenderLayer*> >& negBuffer, const RenderLayer*
layerToForceAsStackingContainer, CollectLayersBehavior collectLayersBehavior) | 5658 void RenderLayer::collectLayers(bool includeHiddenLayers, OwnPtr<Vector<RenderLa
yer*> >& posBuffer, OwnPtr<Vector<RenderLayer*> >& negBuffer, const RenderLayer*
layerToForceAsStackingContainer, CollectLayersBehavior collectLayersBehavior) |
| 5666 { | 5659 { |
| 5667 if (isInTopLayer()) | 5660 if (isInTopLayer() || isBackdrop()) |
| 5668 return; | 5661 return; |
| 5669 | 5662 |
| 5670 updateDescendantDependentFlags(); | 5663 updateDescendantDependentFlags(); |
| 5671 | 5664 |
| 5672 bool isStacking = false; | 5665 bool isStacking = false; |
| 5673 bool isNormalFlow = false; | 5666 bool isNormalFlow = false; |
| 5674 | 5667 |
| 5675 switch (collectLayersBehavior) { | 5668 switch (collectLayersBehavior) { |
| 5676 case ForceLayerToStackingContainer: | 5669 case ForceLayerToStackingContainer: |
| 5677 ASSERT(layerToForceAsStackingContainer); | 5670 ASSERT(layerToForceAsStackingContainer); |
| (...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6398 } | 6391 } |
| 6399 } | 6392 } |
| 6400 | 6393 |
| 6401 void showLayerTree(const WebCore::RenderObject* renderer) | 6394 void showLayerTree(const WebCore::RenderObject* renderer) |
| 6402 { | 6395 { |
| 6403 if (!renderer) | 6396 if (!renderer) |
| 6404 return; | 6397 return; |
| 6405 showLayerTree(renderer->enclosingLayer()); | 6398 showLayerTree(renderer->enclosingLayer()); |
| 6406 } | 6399 } |
| 6407 #endif | 6400 #endif |
| OLD | NEW |