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

Side by Side Diff: Source/core/dom/shadow/ShadowRoot.h

Issue 1265573003: Fix crash on null ptr dereference in EventPath propagation (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add another comment Created 5 years, 4 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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 { 63 {
64 return adoptRefWillBeNoop(new ShadowRoot(document, type)); 64 return adoptRefWillBeNoop(new ShadowRoot(document, type));
65 } 65 }
66 66
67 void recalcStyle(StyleRecalcChange); 67 void recalcStyle(StyleRecalcChange);
68 68
69 // Disambiguate between Node and TreeScope hierarchies; TreeScope's implemen tation is simpler. 69 // Disambiguate between Node and TreeScope hierarchies; TreeScope's implemen tation is simpler.
70 using TreeScope::document; 70 using TreeScope::document;
71 using TreeScope::getElementById; 71 using TreeScope::getElementById;
72 72
73 // TODO(kochi): crbug.com/507413 In non-Oilpan, host() may return null durin g queued
74 // async event handling.
73 Element* host() const { return toElement(parentOrShadowHostNode()); } 75 Element* host() const { return toElement(parentOrShadowHostNode()); }
74 ElementShadow* owner() const { return host() ? host()->shadow() : 0; } 76 ElementShadow* owner() const { return host() ? host()->shadow() : 0; }
75 77
76 ShadowRoot* youngerShadowRoot() const { return prev(); } 78 ShadowRoot* youngerShadowRoot() const { return prev(); }
77 79
78 ShadowRoot* olderShadowRootForBindings() const; 80 ShadowRoot* olderShadowRootForBindings() const;
79 bool isOpen() const { return type() == ShadowRootType::OpenByDefault || type () == ShadowRootType::Open; } 81 bool isOpen() const { return type() == ShadowRootType::OpenByDefault || type () == ShadowRootType::Open; }
80 82
81 bool isYoungest() const { return !youngerShadowRoot(); } 83 bool isYoungest() const { return !youngerShadowRoot(); }
82 bool isOldest() const { return !olderShadowRoot(); } 84 bool isOldest() const { return !olderShadowRoot(); }
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 return adjustedFocusedElement(); 170 return adjustedFocusedElement();
169 } 171 }
170 172
171 DEFINE_NODE_TYPE_CASTS(ShadowRoot, isShadowRoot()); 173 DEFINE_NODE_TYPE_CASTS(ShadowRoot, isShadowRoot());
172 DEFINE_TYPE_CASTS(ShadowRoot, TreeScope, treeScope, treeScope->rootNode().isShad owRoot(), treeScope.rootNode().isShadowRoot()); 174 DEFINE_TYPE_CASTS(ShadowRoot, TreeScope, treeScope, treeScope->rootNode().isShad owRoot(), treeScope.rootNode().isShadowRoot());
173 DEFINE_TYPE_CASTS(TreeScope, ShadowRoot, shadowRoot, true, true); 175 DEFINE_TYPE_CASTS(TreeScope, ShadowRoot, shadowRoot, true, true);
174 176
175 } // namespace blink 177 } // namespace blink
176 178
177 #endif // ShadowRoot_h 179 #endif // ShadowRoot_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698