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

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

Issue 1876843002: Introduce few const getters for dom classes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 document.markers().removeMarkers(this); 332 document.markers().removeMarkers(this);
333 } 333 }
334 #endif 334 #endif
335 335
336 NodeRareData* Node::rareData() const 336 NodeRareData* Node::rareData() const
337 { 337 {
338 ASSERT_WITH_SECURITY_IMPLICATION(hasRareData()); 338 ASSERT_WITH_SECURITY_IMPLICATION(hasRareData());
339 return static_cast<NodeRareData*>(m_data.m_rareData); 339 return static_cast<NodeRareData*>(m_data.m_rareData);
340 } 340 }
341 341
342 NodeRareData* Node::maybeRareData() const
343 {
344 return hasRareData() ? rareData() : nullptr;
345 }
346
342 NodeRareData& Node::ensureRareData() 347 NodeRareData& Node::ensureRareData()
343 { 348 {
344 if (hasRareData()) 349 if (hasRareData())
345 return *rareData(); 350 return *rareData();
346 351
347 if (isElementNode()) 352 if (isElementNode())
348 m_data.m_rareData = ElementRareData::create(m_data.m_layoutObject); 353 m_data.m_rareData = ElementRareData::create(m_data.m_layoutObject);
349 else 354 else
350 m_data.m_rareData = NodeRareData::create(m_data.m_layoutObject); 355 m_data.m_rareData = NodeRareData::create(m_data.m_layoutObject);
351 356
(...skipping 1533 matching lines...) Expand 10 before | Expand all | Expand 10 after
1885 void Node::removeAllEventListenersRecursively() 1890 void Node::removeAllEventListenersRecursively()
1886 { 1891 {
1887 ScriptForbiddenScope forbidScriptDuringRawIteration; 1892 ScriptForbiddenScope forbidScriptDuringRawIteration;
1888 for (Node& node : NodeTraversal::startsAt(this)) { 1893 for (Node& node : NodeTraversal::startsAt(this)) {
1889 node.removeAllEventListeners(); 1894 node.removeAllEventListeners();
1890 for (ShadowRoot* root = node.youngestShadowRoot(); root; root = root->ol derShadowRoot()) 1895 for (ShadowRoot* root = node.youngestShadowRoot(); root; root = root->ol derShadowRoot())
1891 root->removeAllEventListenersRecursively(); 1896 root->removeAllEventListenersRecursively();
1892 } 1897 }
1893 } 1898 }
1894 1899
1895 using EventTargetDataMap = HeapHashMap<WeakMember<Node>, Member<EventTargetData> >; 1900 using EventTargetDataMap = HeapHashMap<WeakMember<const Node>, Member<EventTarge tData>>;
1896 static EventTargetDataMap& eventTargetDataMap() 1901 static EventTargetDataMap& eventTargetDataMap()
1897 { 1902 {
1898 DEFINE_STATIC_LOCAL(EventTargetDataMap, map, (new EventTargetDataMap)); 1903 DEFINE_STATIC_LOCAL(EventTargetDataMap, map, (new EventTargetDataMap));
1899 return map; 1904 return map;
1900 } 1905 }
1901 1906
1902 EventTargetData* Node::eventTargetData() 1907 EventTargetData* Node::eventTargetData() const
1903 { 1908 {
1904 return hasEventTargetData() ? eventTargetDataMap().get(this) : nullptr; 1909 return hasEventTargetData() ? eventTargetDataMap().get(this) : nullptr;
1905 } 1910 }
1906 1911
1907 EventTargetData& Node::ensureEventTargetData() 1912 EventTargetData& Node::ensureEventTargetData()
1908 { 1913 {
1909 if (hasEventTargetData()) 1914 if (hasEventTargetData())
1910 return *eventTargetDataMap().get(this); 1915 return *eventTargetDataMap().get(this);
1911 DCHECK(!eventTargetDataMap().contains(this)); 1916 DCHECK(!eventTargetDataMap().contains(this));
1912 setHasEventTargetData(true); 1917 setHasEventTargetData(true);
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
2453 2458
2454 void showNodePath(const blink::Node* node) 2459 void showNodePath(const blink::Node* node)
2455 { 2460 {
2456 if (node) 2461 if (node)
2457 node->showNodePathForThis(); 2462 node->showNodePathForThis();
2458 else 2463 else
2459 fprintf(stderr, "Cannot showNodePath for (nil)\n"); 2464 fprintf(stderr, "Cannot showNodePath for (nil)\n");
2460 } 2465 }
2461 2466
2462 #endif 2467 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Node.h ('k') | third_party/WebKit/Source/core/events/EventListenerMap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698