Title: [125984] trunk/Source/WebCore
- Revision
- 125984
- Author
- [email protected]
- Date
- 2012-08-19 18:08:05 -0700 (Sun, 19 Aug 2012)
Log Message
Remove RefPtr from SearchInputType::m_resultsButton and SearchInputType::m_cancelButton
https://bugs.webkit.org/show_bug.cgi?id=94339
Reviewed by Kent Tamura.
To avoid reference cycles of RefPtr<Node>s, we want to remove unnecessary
RefPtr<Node>s. The rationale is described in bug 94324.
SearchInputType::m_resultsButton and SearchInputType::m_cancelButton do not
need to be RefPtr<Node>s, because they are guaranteed to point to the shadow
DOM tree of the SearchInputType node, which is guaranteed to exist in the
subtree of the SearchInputType node.
No tests. No change in behavior.
* html/SearchInputType.cpp:
(WebCore::SearchInputType::SearchInputType):
(WebCore::SearchInputType::createShadowSubtree):
(WebCore::SearchInputType::resultsButtonElement):
(WebCore::SearchInputType::cancelButtonElement):
(WebCore::SearchInputType::destroyShadowSubtree):
(WebCore::SearchInputType::subtreeHasChanged):
* html/SearchInputType.h:
(SearchInputType):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (125983 => 125984)
--- trunk/Source/WebCore/ChangeLog 2012-08-19 22:39:54 UTC (rev 125983)
+++ trunk/Source/WebCore/ChangeLog 2012-08-20 01:08:05 UTC (rev 125984)
@@ -1,3 +1,30 @@
+2012-08-19 Kentaro Hara <[email protected]>
+
+ Remove RefPtr from SearchInputType::m_resultsButton and SearchInputType::m_cancelButton
+ https://bugs.webkit.org/show_bug.cgi?id=94339
+
+ Reviewed by Kent Tamura.
+
+ To avoid reference cycles of RefPtr<Node>s, we want to remove unnecessary
+ RefPtr<Node>s. The rationale is described in bug 94324.
+
+ SearchInputType::m_resultsButton and SearchInputType::m_cancelButton do not
+ need to be RefPtr<Node>s, because they are guaranteed to point to the shadow
+ DOM tree of the SearchInputType node, which is guaranteed to exist in the
+ subtree of the SearchInputType node.
+
+ No tests. No change in behavior.
+
+ * html/SearchInputType.cpp:
+ (WebCore::SearchInputType::SearchInputType):
+ (WebCore::SearchInputType::createShadowSubtree):
+ (WebCore::SearchInputType::resultsButtonElement):
+ (WebCore::SearchInputType::cancelButtonElement):
+ (WebCore::SearchInputType::destroyShadowSubtree):
+ (WebCore::SearchInputType::subtreeHasChanged):
+ * html/SearchInputType.h:
+ (SearchInputType):
+
2012-08-19 Mike West <[email protected]>
CSP 1.1: Add 'plugin-types' and 'form-action' DOM API.
Modified: trunk/Source/WebCore/html/SearchInputType.cpp (125983 => 125984)
--- trunk/Source/WebCore/html/SearchInputType.cpp 2012-08-19 22:39:54 UTC (rev 125983)
+++ trunk/Source/WebCore/html/SearchInputType.cpp 2012-08-20 01:08:05 UTC (rev 125984)
@@ -45,6 +45,8 @@
inline SearchInputType::SearchInputType(HTMLInputElement* element)
: BaseTextInputType(element)
+ , m_resultsButton(0)
+ , m_cancelButton(0)
, m_searchEventTimer(this, &SearchInputType::searchEventTimerFired)
{
}
@@ -97,21 +99,23 @@
ASSERT(textWrapper);
ExceptionCode ec = 0;
- m_resultsButton = SearchFieldResultsButtonElement::create(element()->document());
+ RefPtr<SearchFieldResultsButtonElement> resultsButton = SearchFieldResultsButtonElement::create(element()->document());
+ m_resultsButton = resultsButton.get();
container->insertBefore(m_resultsButton, textWrapper, ec);
- m_cancelButton = SearchFieldCancelButtonElement::create(element()->document());
+ RefPtr<SearchFieldCancelButtonElement> cancelButton = SearchFieldCancelButtonElement::create(element()->document());
+ m_cancelButton = cancelButton.get();
container->insertBefore(m_cancelButton, textWrapper->nextSibling(), ec);
}
HTMLElement* SearchInputType::resultsButtonElement() const
{
- return m_resultsButton.get();
+ return m_resultsButton;
}
HTMLElement* SearchInputType::cancelButtonElement() const
{
- return m_cancelButton.get();
+ return m_cancelButton;
}
void SearchInputType::handleKeydownEvent(KeyboardEvent* event)
@@ -135,8 +139,8 @@
void SearchInputType::destroyShadowSubtree()
{
TextFieldInputType::destroyShadowSubtree();
- m_resultsButton.clear();
- m_cancelButton.clear();
+ m_resultsButton = 0;
+ m_cancelButton = 0;
}
void SearchInputType::startSearchEventTimer()
@@ -172,7 +176,7 @@
void SearchInputType::subtreeHasChanged()
{
- if (m_cancelButton.get())
+ if (m_cancelButton)
toRenderSearchField(element()->renderer())->updateCancelButtonVisibility();
// If the incremental attribute is set, then dispatch the search event
Modified: trunk/Source/WebCore/html/SearchInputType.h (125983 => 125984)
--- trunk/Source/WebCore/html/SearchInputType.h 2012-08-19 22:39:54 UTC (rev 125983)
+++ trunk/Source/WebCore/html/SearchInputType.h 2012-08-20 01:08:05 UTC (rev 125984)
@@ -64,8 +64,8 @@
bool searchEventsShouldBeDispatched() const;
void startSearchEventTimer();
- RefPtr<HTMLElement> m_resultsButton;
- RefPtr<HTMLElement> m_cancelButton;
+ HTMLElement* m_resultsButton;
+ HTMLElement* m_cancelButton;
Timer<SearchInputType> m_searchEventTimer;
};
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes