Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(210)

Side by Side Diff: Source/core/rendering/RenderLayer.cpp

Issue 17654008: Implement the ::backdrop pseudo-element for modal <dialog>. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add helper function and descendant selector test Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 4194 matching lines...) Expand 10 before | Expand all | Expand 10 after
4258 ASSERT_NOT_REACHED(); 4259 ASSERT_NOT_REACHED();
4259 return 0; 4260 return 0;
4260 } 4261 }
4261 4262
4262 bool RenderLayer::isInTopLayer() const 4263 bool RenderLayer::isInTopLayer() const
4263 { 4264 {
4264 Node* node = renderer()->node(); 4265 Node* node = renderer()->node();
4265 return node && node->isElementNode() && toElement(node)->isInTopLayer(); 4266 return node && node->isElementNode() && toElement(node)->isInTopLayer();
4266 } 4267 }
4267 4268
4268 bool RenderLayer::isInTopLayerSubtree() const
4269 {
4270 for (const RenderLayer* layer = this; layer; layer = layer->parent()) {
4271 if (layer->isInTopLayer())
4272 return true;
4273 }
4274 return false;
4275 }
4276
4277 // Compute the z-offset of the point in the transformState. 4269 // Compute the z-offset of the point in the transformState.
4278 // This is effectively projecting a ray normal to the plane of ancestor, finding where that 4270 // This is effectively projecting a ray normal to the plane of ancestor, finding where that
4279 // ray intersects target, and computing the z delta between those two points. 4271 // ray intersects target, and computing the z delta between those two points.
4280 static double computeZOffset(const HitTestingTransformState& transformState) 4272 static double computeZOffset(const HitTestingTransformState& transformState)
4281 { 4273 {
4282 // We got an affine transform, so no z-offset 4274 // We got an affine transform, so no z-offset
4283 if (transformState.m_accumulatedTransform.isAffine()) 4275 if (transformState.m_accumulatedTransform.isAffine())
4284 return 0; 4276 return 0;
4285 4277
4286 // Flatten the point into the target plane 4278 // Flatten the point into the target plane
(...skipping 1326 matching lines...) Expand 10 before | Expand all | Expand 10 after
5613 if (negZOrderList) 5605 if (negZOrderList)
5614 std::stable_sort(negZOrderList->begin(), negZOrderList->end(), compareZI ndex); 5606 std::stable_sort(negZOrderList->begin(), negZOrderList->end(), compareZI ndex);
5615 5607
5616 // Append layers for top layer elements after normal layer collection, to en sure they are on top regardless of z-indexes. 5608 // Append layers for top layer elements after normal layer collection, to en sure they are on top regardless of z-indexes.
5617 // The renderers of top layer elements are children of the view, sorted in t op layer stacking order. 5609 // The renderers of top layer elements are children of the view, sorted in t op layer stacking order.
5618 if (isRootLayer()) { 5610 if (isRootLayer()) {
5619 RenderObject* view = renderer()->view(); 5611 RenderObject* view = renderer()->view();
5620 for (RenderObject* child = view->firstChild(); child; child = child->nex tSibling()) { 5612 for (RenderObject* child = view->firstChild(); child; child = child->nex tSibling()) {
5621 Element* childElement = (child->node() && child->node()->isElementNo de()) ? toElement(child->node()) : 0; 5613 Element* childElement = (child->node() && child->node()->isElementNo de()) ? toElement(child->node()) : 0;
5622 if (childElement && childElement->isInTopLayer()) { 5614 if (childElement && childElement->isInTopLayer()) {
5623 RenderLayer* layer = toRenderLayerModelObject(child)->layer(); 5615 if (Element* backdrop = childElement->pseudoElement(BACKDROP))
5624 posZOrderList->append(layer); 5616 posZOrderList->append(toRenderLayerModelObject(backdrop->ren derer())->layer());
5617 posZOrderList->append(toRenderLayerModelObject(child)->layer());
5625 } 5618 }
5626 } 5619 }
5627 } 5620 }
5628 } 5621 }
5629 5622
5630 void RenderLayer::updateNormalFlowList() 5623 void RenderLayer::updateNormalFlowList()
5631 { 5624 {
5632 if (!m_normalFlowListDirty) 5625 if (!m_normalFlowListDirty)
5633 return; 5626 return;
5634 5627
5635 ASSERT(m_layerListMutationAllowed); 5628 ASSERT(m_layerListMutationAllowed);
5636 5629
5637 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) { 5630 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) {
5638 // Ignore non-overflow layers and reflections. 5631 // Ignore non-overflow layers and reflections.
5639 if (child->isNormalFlowOnly() && (!m_reflection || reflectionLayer() != child)) { 5632 if (child->isNormalFlowOnly() && (!m_reflection || reflectionLayer() != child)) {
5640 if (!m_normalFlowList) 5633 if (!m_normalFlowList)
5641 m_normalFlowList = adoptPtr(new Vector<RenderLayer*>); 5634 m_normalFlowList = adoptPtr(new Vector<RenderLayer*>);
5642 m_normalFlowList->append(child); 5635 m_normalFlowList->append(child);
5643 } 5636 }
5644 } 5637 }
5645 5638
5646 m_normalFlowListDirty = false; 5639 m_normalFlowListDirty = false;
5647 } 5640 }
5648 5641
5649 void RenderLayer::collectLayers(bool includeHiddenLayers, OwnPtr<Vector<RenderLa yer*> >& posBuffer, OwnPtr<Vector<RenderLayer*> >& negBuffer, const RenderLayer* layerToForceAsStackingContainer, CollectLayersBehavior collectLayersBehavior) 5642 void RenderLayer::collectLayers(bool includeHiddenLayers, OwnPtr<Vector<RenderLa yer*> >& posBuffer, OwnPtr<Vector<RenderLayer*> >& negBuffer, const RenderLayer* layerToForceAsStackingContainer, CollectLayersBehavior collectLayersBehavior)
5650 { 5643 {
5651 if (isInTopLayer()) 5644 if (isInTopLayer() || isBackdrop())
5652 return; 5645 return;
5653 5646
5654 updateDescendantDependentFlags(); 5647 updateDescendantDependentFlags();
5655 5648
5656 bool isStacking = false; 5649 bool isStacking = false;
5657 bool isNormalFlow = false; 5650 bool isNormalFlow = false;
5658 5651
5659 switch (collectLayersBehavior) { 5652 switch (collectLayersBehavior) {
5660 case ForceLayerToStackingContainer: 5653 case ForceLayerToStackingContainer:
5661 ASSERT(layerToForceAsStackingContainer); 5654 ASSERT(layerToForceAsStackingContainer);
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
6382 } 6375 }
6383 } 6376 }
6384 6377
6385 void showLayerTree(const WebCore::RenderObject* renderer) 6378 void showLayerTree(const WebCore::RenderObject* renderer)
6386 { 6379 {
6387 if (!renderer) 6380 if (!renderer)
6388 return; 6381 return;
6389 showLayerTree(renderer->enclosingLayer()); 6382 showLayerTree(renderer->enclosingLayer());
6390 } 6383 }
6391 #endif 6384 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698