| 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 4450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4461 Node* RenderLayer::enclosingElement() const | 4461 Node* RenderLayer::enclosingElement() const |
| 4462 { | 4462 { |
| 4463 for (RenderObject* r = renderer(); r; r = r->parent()) { | 4463 for (RenderObject* r = renderer(); r; r = r->parent()) { |
| 4464 if (Node* e = r->node()) | 4464 if (Node* e = r->node()) |
| 4465 return e; | 4465 return e; |
| 4466 } | 4466 } |
| 4467 ASSERT_NOT_REACHED(); | 4467 ASSERT_NOT_REACHED(); |
| 4468 return 0; | 4468 return 0; |
| 4469 } | 4469 } |
| 4470 | 4470 |
| 4471 #if ENABLE(DIALOG_ELEMENT) | |
| 4472 bool RenderLayer::isInTopLayer() const | 4471 bool RenderLayer::isInTopLayer() const |
| 4473 { | 4472 { |
| 4474 Node* node = renderer()->node(); | 4473 Node* node = renderer()->node(); |
| 4475 return node && node->isElementNode() && toElement(node)->isInTopLayer(); | 4474 return node && node->isElementNode() && toElement(node)->isInTopLayer(); |
| 4476 } | 4475 } |
| 4477 | 4476 |
| 4478 bool RenderLayer::isInTopLayerSubtree() const | 4477 bool RenderLayer::isInTopLayerSubtree() const |
| 4479 { | 4478 { |
| 4480 for (const RenderLayer* layer = this; layer; layer = layer->parent()) { | 4479 for (const RenderLayer* layer = this; layer; layer = layer->parent()) { |
| 4481 if (layer->isInTopLayer()) | 4480 if (layer->isInTopLayer()) |
| 4482 return true; | 4481 return true; |
| 4483 } | 4482 } |
| 4484 return false; | 4483 return false; |
| 4485 } | 4484 } |
| 4486 #endif | |
| 4487 | 4485 |
| 4488 // Compute the z-offset of the point in the transformState. | 4486 // Compute the z-offset of the point in the transformState. |
| 4489 // This is effectively projecting a ray normal to the plane of ancestor, finding
where that | 4487 // This is effectively projecting a ray normal to the plane of ancestor, finding
where that |
| 4490 // ray intersects target, and computing the z delta between those two points. | 4488 // ray intersects target, and computing the z delta between those two points. |
| 4491 static double computeZOffset(const HitTestingTransformState& transformState) | 4489 static double computeZOffset(const HitTestingTransformState& transformState) |
| 4492 { | 4490 { |
| 4493 // We got an affine transform, so no z-offset | 4491 // We got an affine transform, so no z-offset |
| 4494 if (transformState.m_accumulatedTransform.isAffine()) | 4492 if (transformState.m_accumulatedTransform.isAffine()) |
| 4495 return 0; | 4493 return 0; |
| 4496 | 4494 |
| (...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5766 if (!m_reflection || reflectionLayer() != child) | 5764 if (!m_reflection || reflectionLayer() != child) |
| 5767 child->collectLayers(includeHiddenLayers, behavior, posZOrderList, n
egZOrderList, layerToForceAsStackingContainer); | 5765 child->collectLayers(includeHiddenLayers, behavior, posZOrderList, n
egZOrderList, layerToForceAsStackingContainer); |
| 5768 | 5766 |
| 5769 // Sort the two lists. | 5767 // Sort the two lists. |
| 5770 if (posZOrderList) | 5768 if (posZOrderList) |
| 5771 std::stable_sort(posZOrderList->begin(), posZOrderList->end(), compareZI
ndex); | 5769 std::stable_sort(posZOrderList->begin(), posZOrderList->end(), compareZI
ndex); |
| 5772 | 5770 |
| 5773 if (negZOrderList) | 5771 if (negZOrderList) |
| 5774 std::stable_sort(negZOrderList->begin(), negZOrderList->end(), compareZI
ndex); | 5772 std::stable_sort(negZOrderList->begin(), negZOrderList->end(), compareZI
ndex); |
| 5775 | 5773 |
| 5776 #if ENABLE(DIALOG_ELEMENT) | |
| 5777 // Append layers for top layer elements after normal layer collection, to en
sure they are on top regardless of z-indexes. | 5774 // Append layers for top layer elements after normal layer collection, to en
sure they are on top regardless of z-indexes. |
| 5778 // The renderers of top layer elements are children of the view, sorted in t
op layer stacking order. | 5775 // The renderers of top layer elements are children of the view, sorted in t
op layer stacking order. |
| 5779 if (isRootLayer()) { | 5776 if (isRootLayer()) { |
| 5780 RenderObject* view = renderer()->view(); | 5777 RenderObject* view = renderer()->view(); |
| 5781 for (RenderObject* child = view->firstChild(); child; child = child->nex
tSibling()) { | 5778 for (RenderObject* child = view->firstChild(); child; child = child->nex
tSibling()) { |
| 5782 Element* childElement = (child->node() && child->node()->isElementNo
de()) ? toElement(child->node()) : 0; | 5779 Element* childElement = (child->node() && child->node()->isElementNo
de()) ? toElement(child->node()) : 0; |
| 5783 if (childElement && childElement->isInTopLayer()) { | 5780 if (childElement && childElement->isInTopLayer()) { |
| 5784 RenderLayer* layer = toRenderLayerModelObject(child)->layer(); | 5781 RenderLayer* layer = toRenderLayerModelObject(child)->layer(); |
| 5785 posZOrderList->append(layer); | 5782 posZOrderList->append(layer); |
| 5786 } | 5783 } |
| 5787 } | 5784 } |
| 5788 } | 5785 } |
| 5789 #endif | |
| 5790 | |
| 5791 } | 5786 } |
| 5792 | 5787 |
| 5793 void RenderLayer::updateNormalFlowList() | 5788 void RenderLayer::updateNormalFlowList() |
| 5794 { | 5789 { |
| 5795 if (!m_normalFlowListDirty) | 5790 if (!m_normalFlowListDirty) |
| 5796 return; | 5791 return; |
| 5797 | 5792 |
| 5798 ASSERT(m_layerListMutationAllowed); | 5793 ASSERT(m_layerListMutationAllowed); |
| 5799 | 5794 |
| 5800 for (RenderLayer* child = firstChild(); child; child = child->nextSibling())
{ | 5795 for (RenderLayer* child = firstChild(); child; child = child->nextSibling())
{ |
| 5801 // Ignore non-overflow layers and reflections. | 5796 // Ignore non-overflow layers and reflections. |
| 5802 if (child->isNormalFlowOnly() && (!m_reflection || reflectionLayer() !=
child)) { | 5797 if (child->isNormalFlowOnly() && (!m_reflection || reflectionLayer() !=
child)) { |
| 5803 if (!m_normalFlowList) | 5798 if (!m_normalFlowList) |
| 5804 m_normalFlowList = adoptPtr(new Vector<RenderLayer*>); | 5799 m_normalFlowList = adoptPtr(new Vector<RenderLayer*>); |
| 5805 m_normalFlowList->append(child); | 5800 m_normalFlowList->append(child); |
| 5806 } | 5801 } |
| 5807 } | 5802 } |
| 5808 | 5803 |
| 5809 m_normalFlowListDirty = false; | 5804 m_normalFlowListDirty = false; |
| 5810 } | 5805 } |
| 5811 | 5806 |
| 5812 void RenderLayer::collectLayers(bool includeHiddenLayers, CollectLayersBehavior
behavior, OwnPtr<Vector<RenderLayer*> >& posBuffer, OwnPtr<Vector<RenderLayer*>
>& negBuffer, const RenderLayer* layerToForceAsStackingContainer) | 5807 void RenderLayer::collectLayers(bool includeHiddenLayers, CollectLayersBehavior
behavior, OwnPtr<Vector<RenderLayer*> >& posBuffer, OwnPtr<Vector<RenderLayer*>
>& negBuffer, const RenderLayer* layerToForceAsStackingContainer) |
| 5813 { | 5808 { |
| 5814 #if ENABLE(DIALOG_ELEMENT) | |
| 5815 if (isInTopLayer()) | 5809 if (isInTopLayer()) |
| 5816 return; | 5810 return; |
| 5817 #endif | |
| 5818 | 5811 |
| 5819 updateDescendantDependentFlags(); | 5812 updateDescendantDependentFlags(); |
| 5820 | 5813 |
| 5821 bool isStacking = false; | 5814 bool isStacking = false; |
| 5822 | 5815 |
| 5823 switch (behavior) { | 5816 switch (behavior) { |
| 5824 case StopAtStackingContexts: | 5817 case StopAtStackingContexts: |
| 5825 isStacking = (this == layerToForceAsStackingContainer) || isStacking
Context(); | 5818 isStacking = (this == layerToForceAsStackingContainer) || isStacking
Context(); |
| 5826 break; | 5819 break; |
| 5827 | 5820 |
| (...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6564 } | 6557 } |
| 6565 } | 6558 } |
| 6566 | 6559 |
| 6567 void showLayerTree(const WebCore::RenderObject* renderer) | 6560 void showLayerTree(const WebCore::RenderObject* renderer) |
| 6568 { | 6561 { |
| 6569 if (!renderer) | 6562 if (!renderer) |
| 6570 return; | 6563 return; |
| 6571 showLayerTree(renderer->enclosingLayer()); | 6564 showLayerTree(renderer->enclosingLayer()); |
| 6572 } | 6565 } |
| 6573 #endif | 6566 #endif |
| OLD | NEW |