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

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: rebase 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 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 return document(); 628 return document();
629 Node* root = const_cast<Node*>(this); 629 Node* root = const_cast<Node*>(this);
630 while (Node* host = root->shadowHost()) 630 while (Node* host = root->shadowHost())
631 root = host; 631 root = host;
632 while (Node* ancestor = root->parentNode()) 632 while (Node* ancestor = root->parentNode())
633 root = ancestor; 633 root = ancestor;
634 DCHECK(!root->shadowHost()); 634 DCHECK(!root->shadowHost());
635 return *root; 635 return *root;
636 } 636 }
637 637
638 bool Node::isUnclosedNodeOf(const Node& other) const
639 {
640 if (!isInShadowTree() || treeScope() == other.treeScope())
641 return true;
642
643 const TreeScope* scope = &treeScope();
644 for (; scope->parentTreeScope(); scope = scope->parentTreeScope()) {
645 const ContainerNode& root = scope->rootNode();
646 if (root.isShadowRoot() && !toShadowRoot(root).isOpenOrV0())
647 break;
648 }
649
650 for (TreeScope* otherScope = &other.treeScope(); otherScope; otherScope = ot herScope->parentTreeScope()) {
651 if (otherScope == scope)
652 return true;
653 }
654 return false;
655 }
656
638 bool Node::needsDistributionRecalc() const 657 bool Node::needsDistributionRecalc() const
639 { 658 {
640 return shadowIncludingRoot().childNeedsDistributionRecalc(); 659 return shadowIncludingRoot().childNeedsDistributionRecalc();
641 } 660 }
642 661
643 void Node::updateDistribution() 662 void Node::updateDistribution()
644 { 663 {
645 // Extra early out to avoid spamming traces. 664 // Extra early out to avoid spamming traces.
646 if (inShadowIncludingDocument() && !document().childNeedsDistributionRecalc( )) 665 if (inShadowIncludingDocument() && !document().childNeedsDistributionRecalc( ))
647 return; 666 return;
(...skipping 1833 matching lines...) Expand 10 before | Expand all | Expand 10 after
2481 2500
2482 void showNodePath(const blink::Node* node) 2501 void showNodePath(const blink::Node* node)
2483 { 2502 {
2484 if (node) 2503 if (node)
2485 node->showNodePathForThis(); 2504 node->showNodePathForThis();
2486 else 2505 else
2487 fprintf(stderr, "Cannot showNodePath for (nil)\n"); 2506 fprintf(stderr, "Cannot showNodePath for (nil)\n");
2488 } 2507 }
2489 2508
2490 #endif 2509 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698