Changeset 125984 in webkit
- Timestamp:
- Aug 19, 2012 6:08:05 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r125983 r125984 1 2012-08-19 Kentaro Hara <haraken@chromium.org> 2 3 Remove RefPtr from SearchInputType::m_resultsButton and SearchInputType::m_cancelButton 4 https://bugs.webkit.org/show_bug.cgi?id=94339 5 6 Reviewed by Kent Tamura. 7 8 To avoid reference cycles of RefPtr<Node>s, we want to remove unnecessary 9 RefPtr<Node>s. The rationale is described in bug 94324. 10 11 SearchInputType::m_resultsButton and SearchInputType::m_cancelButton do not 12 need to be RefPtr<Node>s, because they are guaranteed to point to the shadow 13 DOM tree of the SearchInputType node, which is guaranteed to exist in the 14 subtree of the SearchInputType node. 15 16 No tests. No change in behavior. 17 18 * html/SearchInputType.cpp: 19 (WebCore::SearchInputType::SearchInputType): 20 (WebCore::SearchInputType::createShadowSubtree): 21 (WebCore::SearchInputType::resultsButtonElement): 22 (WebCore::SearchInputType::cancelButtonElement): 23 (WebCore::SearchInputType::destroyShadowSubtree): 24 (WebCore::SearchInputType::subtreeHasChanged): 25 * html/SearchInputType.h: 26 (SearchInputType): 27 1 28 2012-08-19 Mike West <mkwst@chromium.org> 2 29 -
trunk/Source/WebCore/html/SearchInputType.cpp
r120569 r125984 46 46 inline SearchInputType::SearchInputType(HTMLInputElement* element) 47 47 : BaseTextInputType(element) 48 , m_resultsButton(0) 49 , m_cancelButton(0) 48 50 , m_searchEventTimer(this, &SearchInputType::searchEventTimerFired) 49 51 { … … 98 100 99 101 ExceptionCode ec = 0; 100 m_resultsButton = SearchFieldResultsButtonElement::create(element()->document()); 102 RefPtr<SearchFieldResultsButtonElement> resultsButton = SearchFieldResultsButtonElement::create(element()->document()); 103 m_resultsButton = resultsButton.get(); 101 104 container->insertBefore(m_resultsButton, textWrapper, ec); 102 105 103 m_cancelButton = SearchFieldCancelButtonElement::create(element()->document()); 106 RefPtr<SearchFieldCancelButtonElement> cancelButton = SearchFieldCancelButtonElement::create(element()->document()); 107 m_cancelButton = cancelButton.get(); 104 108 container->insertBefore(m_cancelButton, textWrapper->nextSibling(), ec); 105 109 } … … 107 111 HTMLElement* SearchInputType::resultsButtonElement() const 108 112 { 109 return m_resultsButton .get();113 return m_resultsButton; 110 114 } 111 115 112 116 HTMLElement* SearchInputType::cancelButtonElement() const 113 117 { 114 return m_cancelButton .get();118 return m_cancelButton; 115 119 } 116 120 … … 136 140 { 137 141 TextFieldInputType::destroyShadowSubtree(); 138 m_resultsButton .clear();139 m_cancelButton .clear();142 m_resultsButton = 0; 143 m_cancelButton = 0; 140 144 } 141 145 … … 173 177 void SearchInputType::subtreeHasChanged() 174 178 { 175 if (m_cancelButton .get())179 if (m_cancelButton) 176 180 toRenderSearchField(element()->renderer())->updateCancelButtonVisibility(); 177 181 -
trunk/Source/WebCore/html/SearchInputType.h
r120569 r125984 65 65 void startSearchEventTimer(); 66 66 67 RefPtr<HTMLElement>m_resultsButton;68 RefPtr<HTMLElement>m_cancelButton;67 HTMLElement* m_resultsButton; 68 HTMLElement* m_cancelButton; 69 69 Timer<SearchInputType> m_searchEventTimer; 70 70 };
Note: See TracChangeset
for help on using the changeset viewer.