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

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 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 (treeScope() == other.treeScope())
642 return true;
643
644 for (TreeScope* scope = &other.treeScope(); scope; scope = scope->parentTree Scope()) {
645 if (scope == treeScope())
646 return true;
647 }
648
649 ContainerNode& root = treeScope().rootNode();
650 if (root.isShadowRoot() && toShadowRoot(root).isOpenOrV0())
651 return other.isUnclosedNodeOf(toShadowRoot(root).host());
hayato 2016/06/09 08:22:03 Is this opposite of the definition? Could you re-c
kochi 2016/06/09 10:49:39 Oops, you're right. I read the latter half of the
652 return false;
653 }
654
639 bool Node::needsDistributionRecalc() const 655 bool Node::needsDistributionRecalc() const
640 { 656 {
641 return shadowIncludingRoot().childNeedsDistributionRecalc(); 657 return shadowIncludingRoot().childNeedsDistributionRecalc();
642 } 658 }
643 659
644 void Node::updateDistribution() 660 void Node::updateDistribution()
645 { 661 {
646 // Extra early out to avoid spamming traces. 662 // Extra early out to avoid spamming traces.
647 if (inShadowIncludingDocument() && !document().childNeedsDistributionRecalc( )) 663 if (inShadowIncludingDocument() && !document().childNeedsDistributionRecalc( ))
648 return; 664 return;
(...skipping 1835 matching lines...) Expand 10 before | Expand all | Expand 10 after
2484 2500
2485 void showNodePath(const blink::Node* node) 2501 void showNodePath(const blink::Node* node)
2486 { 2502 {
2487 if (node) 2503 if (node)
2488 node->showNodePathForThis(); 2504 node->showNodePathForThis();
2489 else 2505 else
2490 fprintf(stderr, "Cannot showNodePath for (nil)\n"); 2506 fprintf(stderr, "Cannot showNodePath for (nil)\n");
2491 } 2507 }
2492 2508
2493 #endif 2509 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698