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

Side by Side Diff: third_party/WebKit/Source/core/dom/Node.cpp

Issue 2051703002: Implement closed shadow adjustment for Element.offsetParent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test Created 4 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 return document(); 629 return document();
630 Node* root = const_cast<Node*>(this); 630 Node* root = const_cast<Node*>(this);
631 while (Node* host = root->shadowHost()) 631 while (Node* host = root->shadowHost())
632 root = host; 632 root = host;
633 while (Node* ancestor = root->parentNode()) 633 while (Node* ancestor = root->parentNode())
634 root = ancestor; 634 root = ancestor;
635 DCHECK(!root->shadowHost()); 635 DCHECK(!root->shadowHost());
636 return *root; 636 return *root;
637 } 637 }
638 638
639 bool Node::isUnclosedNodeOf(const Node& other) const
640 {
641 if (!isInShadowTree() || treeScope() == other.treeScope())
642 return true;
643
644 const TreeScope* scope = &treeScope();
645 for (; scope->parentTreeScope(); scope = scope->parentTreeScope()) {
646 const ContainerNode& root = scope->rootNode();
647 if (root.isShadowRoot() && !toShadowRoot(root).isOpenOrV0())
648 break;
649 }
650
651 for (TreeScope* otherScope = &other.treeScope(); otherScope; otherScope = ot herScope->parentTreeScope()) {
652 if (otherScope == scope)
653 return true;
654 }
655 return false;
656 }
657
639 bool Node::needsDistributionRecalc() const 658 bool Node::needsDistributionRecalc() const
640 { 659 {
641 return shadowIncludingRoot().childNeedsDistributionRecalc(); 660 return shadowIncludingRoot().childNeedsDistributionRecalc();
642 } 661 }
643 662
644 void Node::updateDistribution() 663 void Node::updateDistribution()
645 { 664 {
646 // Extra early out to avoid spamming traces. 665 // Extra early out to avoid spamming traces.
647 if (inShadowIncludingDocument() && !document().childNeedsDistributionRecalc( )) 666 if (inShadowIncludingDocument() && !document().childNeedsDistributionRecalc( ))
648 return; 667 return;
(...skipping 1835 matching lines...) Expand 10 before | Expand all | Expand 10 after
2484 2503
2485 void showNodePath(const blink::Node* node) 2504 void showNodePath(const blink::Node* node)
2486 { 2505 {
2487 if (node) 2506 if (node)
2488 node->showNodePathForThis(); 2507 node->showNodePathForThis();
2489 else 2508 else
2490 fprintf(stderr, "Cannot showNodePath for (nil)\n"); 2509 fprintf(stderr, "Cannot showNodePath for (nil)\n");
2491 } 2510 }
2492 2511
2493 #endif 2512 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698