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

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

Issue 19900002: Use the two Custom Elements node bits to explicitly represent four states. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Play nice with MSVC. 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
« no previous file with comments | « Source/core/dom/Node.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2663 matching lines...) Expand 10 before | Expand all | Expand 10 after
2674 ASSERT(isUserActionElement()); 2674 ASSERT(isUserActionElement());
2675 return document()->userActionElements().isHovered(this); 2675 return document()->userActionElements().isHovered(this);
2676 } 2676 }
2677 2677
2678 bool Node::isUserActionElementFocused() const 2678 bool Node::isUserActionElementFocused() const
2679 { 2679 {
2680 ASSERT(isUserActionElement()); 2680 ASSERT(isUserActionElement());
2681 return document()->userActionElements().isFocused(this); 2681 return document()->userActionElements().isFocused(this);
2682 } 2682 }
2683 2683
2684 void Node::setIsCustomElement() 2684 void Node::setCustomElementState(CustomElementState newState)
2685 { 2685 {
2686 CustomElementState oldState = customElementState();
2687
2688 switch (newState) {
2689 case NotCustomElement:
2690 ASSERT_NOT_REACHED(); // Everything starts in this state
2691 return;
2692
2693 case UpgradeCandidate:
2694 ASSERT(NotCustomElement == oldState);
2695 break;
2696
2697 case Defined:
2698 ASSERT(UpgradeCandidate == oldState || NotCustomElement == oldState);
2699 break;
2700
2701 case Upgraded:
2702 ASSERT(Defined == oldState);
2703 break;
2704 }
2705
2686 ASSERT(isHTMLElement() || isSVGElement()); 2706 ASSERT(isHTMLElement() || isSVGElement());
2687 setFlag(IsCustomElement); 2707 setFlag(newState & 1, CustomElementIsUpgradeCandidateOrUpgraded);
2688 } 2708 setFlag(newState & 2, CustomElementHasDefinitionOrIsUpgraded);
2689 2709
2690 void Node::setIsUpgradedCustomElement() 2710 if (oldState == NotCustomElement || newState == Upgraded)
2691 { 2711 setNeedsStyleRecalc(); // :unresolved has changed
2692 ASSERT(isCustomElement());
2693 setFlag(IsUpgradedCustomElement);
2694 setNeedsStyleRecalc(); // :unresolved has changed
2695 } 2712 }
2696 2713
2697 } // namespace WebCore 2714 } // namespace WebCore
2698 2715
2699 #ifndef NDEBUG 2716 #ifndef NDEBUG
2700 2717
2701 void showTree(const WebCore::Node* node) 2718 void showTree(const WebCore::Node* node)
2702 { 2719 {
2703 if (node) 2720 if (node)
2704 node->showTreeForThis(); 2721 node->showTreeForThis();
2705 } 2722 }
2706 2723
2707 void showNodePath(const WebCore::Node* node) 2724 void showNodePath(const WebCore::Node* node)
2708 { 2725 {
2709 if (node) 2726 if (node)
2710 node->showNodePathForThis(); 2727 node->showNodePathForThis();
2711 } 2728 }
2712 2729
2713 #endif 2730 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/Node.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698