Title: [235214] trunk/Source/WebCore
- Revision
- 235214
- Author
- [email protected]
- Date
- 2018-08-22 18:51:16 -0700 (Wed, 22 Aug 2018)
Log Message
Store RefPtr in FocusNavigationScope
https://bugs.webkit.org/show_bug.cgi?id=188864
Reviewed by Simon Fraser.
Use RefPtr to store the root node of a tree scope and a slot element instead of a reference and a raw pointer.
* page/FocusController.cpp:
(WebCore::FocusNavigationScope::parentInScope const):
(WebCore::FocusNavigationScope::firstNodeInScope const):
(WebCore::FocusNavigationScope::lastNodeInScope const):
(WebCore::FocusNavigationScope::FocusNavigationScope):
(WebCore::FocusNavigationScope::owner const):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (235213 => 235214)
--- trunk/Source/WebCore/ChangeLog 2018-08-23 01:40:47 UTC (rev 235213)
+++ trunk/Source/WebCore/ChangeLog 2018-08-23 01:51:16 UTC (rev 235214)
@@ -1,3 +1,19 @@
+2018-08-22 Ryosuke Niwa <[email protected]>
+
+ Store RefPtr in FocusNavigationScope
+ https://bugs.webkit.org/show_bug.cgi?id=188864
+
+ Reviewed by Simon Fraser.
+
+ Use RefPtr to store the root node of a tree scope and a slot element instead of a reference and a raw pointer.
+
+ * page/FocusController.cpp:
+ (WebCore::FocusNavigationScope::parentInScope const):
+ (WebCore::FocusNavigationScope::firstNodeInScope const):
+ (WebCore::FocusNavigationScope::lastNodeInScope const):
+ (WebCore::FocusNavigationScope::FocusNavigationScope):
+ (WebCore::FocusNavigationScope::owner const):
+
2018-08-22 Jiewen Tan <[email protected]>
Unreviewed, update "Web Authentication" from "Under Consideration" to "In Development"
Modified: trunk/Source/WebCore/page/FocusController.cpp (235213 => 235214)
--- trunk/Source/WebCore/page/FocusController.cpp 2018-08-23 01:40:47 UTC (rev 235213)
+++ trunk/Source/WebCore/page/FocusController.cpp 2018-08-23 01:51:16 UTC (rev 235214)
@@ -109,8 +109,8 @@
explicit FocusNavigationScope(TreeScope&);
explicit FocusNavigationScope(HTMLSlotElement&, SlotKind);
- TreeScope* m_rootTreeScope { nullptr };
- HTMLSlotElement* m_slotElement { nullptr };
+ RefPtr<ContainerNode> m_treeScopeRootNode;
+ RefPtr<HTMLSlotElement> m_slotElement;
SlotKind m_slotKind { SlotKind::Assigned };
};
@@ -131,7 +131,7 @@
Node* FocusNavigationScope::parentInScope(const Node& node) const
{
- if (m_rootTreeScope && &m_rootTreeScope->rootNode() == &node)
+ if (m_treeScopeRootNode == &node)
return nullptr;
if (UNLIKELY(m_slotElement)) {
@@ -184,8 +184,8 @@
ASSERT(m_slotKind == SlotKind::Fallback);
return m_slotElement->firstChild();
}
- ASSERT(m_rootTreeScope);
- return &m_rootTreeScope->rootNode();
+ ASSERT(m_treeScopeRootNode);
+ return m_treeScopeRootNode.get();
}
Node* FocusNavigationScope::lastNodeInScope() const
@@ -199,8 +199,8 @@
ASSERT(m_slotKind == SlotKind::Fallback);
return m_slotElement->lastChild();
}
- ASSERT(m_rootTreeScope);
- return &m_rootTreeScope->rootNode();
+ ASSERT(m_treeScopeRootNode);
+ return m_treeScopeRootNode.get();
}
Node* FocusNavigationScope::nextInScope(const Node* node) const
@@ -228,7 +228,7 @@
}
FocusNavigationScope::FocusNavigationScope(TreeScope& treeScope)
- : m_rootTreeScope(&treeScope)
+ : m_treeScopeRootNode(&treeScope.rootNode())
{
}
@@ -241,13 +241,12 @@
Element* FocusNavigationScope::owner() const
{
if (m_slotElement)
- return m_slotElement;
+ return m_slotElement.get();
- ASSERT(m_rootTreeScope);
- ContainerNode& root = m_rootTreeScope->rootNode();
- if (is<ShadowRoot>(root))
- return downcast<ShadowRoot>(root).host();
- if (Frame* frame = root.document().frame())
+ ASSERT(m_treeScopeRootNode);
+ if (is<ShadowRoot>(*m_treeScopeRootNode))
+ return downcast<ShadowRoot>(*m_treeScopeRootNode).host();
+ if (Frame* frame = m_treeScopeRootNode->document().frame())
return frame->ownerElement();
return nullptr;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes