OLD | NEW |
1 /** | 1 /** |
2 * Copyright (C) 2006, 2007, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2010 Apple Inc. All rights reserved. |
3 * (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 3 * (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
4 * Copyright (C) 2010 Google Inc. All rights reserved. | 4 * Copyright (C) 2010 Google Inc. All rights reserved. |
5 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). | 5 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 return inputElement()->resultsButtonElement(); | 76 return inputElement()->resultsButtonElement(); |
77 } | 77 } |
78 | 78 |
79 inline HTMLElement* RenderSearchField::cancelButtonElement() const | 79 inline HTMLElement* RenderSearchField::cancelButtonElement() const |
80 { | 80 { |
81 return inputElement()->cancelButtonElement(); | 81 return inputElement()->cancelButtonElement(); |
82 } | 82 } |
83 | 83 |
84 void RenderSearchField::addSearchResult() | 84 void RenderSearchField::addSearchResult() |
85 { | 85 { |
86 HTMLInputElement* input = inputElement(); | 86 Handle<HTMLInputElement> input = inputElement(); |
87 if (input->maxResults() <= 0) | 87 if (input->maxResults() <= 0) |
88 return; | 88 return; |
89 | 89 |
90 String value = input->value(); | 90 String value = input->value(); |
91 if (value.isEmpty()) | 91 if (value.isEmpty()) |
92 return; | 92 return; |
93 | 93 |
94 int size = static_cast<int>(m_recentSearches.size()); | 94 int size = static_cast<int>(m_recentSearches.size()); |
95 for (int i = size - 1; i >= 0; --i) { | 95 for (int i = size - 1; i >= 0; --i) { |
96 if (m_recentSearches[i] == value) | 96 if (m_recentSearches[i] == value) |
(...skipping 21 matching lines...) Expand all Loading... |
118 | 118 |
119 if (!m_searchPopup->enabled()) | 119 if (!m_searchPopup->enabled()) |
120 return; | 120 return; |
121 | 121 |
122 m_searchPopupIsVisible = true; | 122 m_searchPopupIsVisible = true; |
123 | 123 |
124 const AtomicString& name = autosaveName(); | 124 const AtomicString& name = autosaveName(); |
125 m_searchPopup->loadRecentSearches(name, m_recentSearches); | 125 m_searchPopup->loadRecentSearches(name, m_recentSearches); |
126 | 126 |
127 // Trim the recent searches list if the maximum size has changed since we la
st saved. | 127 // Trim the recent searches list if the maximum size has changed since we la
st saved. |
128 HTMLInputElement* input = inputElement(); | 128 Handle<HTMLInputElement> input = inputElement(); |
129 if (static_cast<int>(m_recentSearches.size()) > input->maxResults()) { | 129 if (static_cast<int>(m_recentSearches.size()) > input->maxResults()) { |
130 do { | 130 do { |
131 m_recentSearches.removeLast(); | 131 m_recentSearches.removeLast(); |
132 } while (static_cast<int>(m_recentSearches.size()) > input->maxResults()
); | 132 } while (static_cast<int>(m_recentSearches.size()) > input->maxResults()
); |
133 | 133 |
134 m_searchPopup->saveRecentSearches(name, m_recentSearches); | 134 m_searchPopup->saveRecentSearches(name, m_recentSearches); |
135 } | 135 } |
136 | 136 |
137 m_searchPopup->popupMenu()->show(pixelSnappedIntRect(absoluteBoundingBoxRect
()), document()->view(), -1); | 137 m_searchPopup->popupMenu()->show(pixelSnappedIntRect(absoluteBoundingBoxRect
()), document()->view(), -1); |
138 } | 138 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 | 195 |
196 const AtomicString& RenderSearchField::autosaveName() const | 196 const AtomicString& RenderSearchField::autosaveName() const |
197 { | 197 { |
198 return toElement(node())->getAttribute(autosaveAttr); | 198 return toElement(node())->getAttribute(autosaveAttr); |
199 } | 199 } |
200 | 200 |
201 // PopupMenuClient methods | 201 // PopupMenuClient methods |
202 void RenderSearchField::valueChanged(unsigned listIndex, bool fireEvents) | 202 void RenderSearchField::valueChanged(unsigned listIndex, bool fireEvents) |
203 { | 203 { |
204 ASSERT(static_cast<int>(listIndex) < listSize()); | 204 ASSERT(static_cast<int>(listIndex) < listSize()); |
205 HTMLInputElement* input = inputElement(); | 205 Handle<HTMLInputElement> input = inputElement(); |
206 if (static_cast<int>(listIndex) == (listSize() - 1)) { | 206 if (static_cast<int>(listIndex) == (listSize() - 1)) { |
207 if (fireEvents) { | 207 if (fireEvents) { |
208 m_recentSearches.clear(); | 208 m_recentSearches.clear(); |
209 const AtomicString& name = autosaveName(); | 209 const AtomicString& name = autosaveName(); |
210 if (!name.isEmpty()) { | 210 if (!name.isEmpty()) { |
211 if (!m_searchPopup) | 211 if (!m_searchPopup) |
212 m_searchPopup = document()->page()->chrome()->createSearchPo
pupMenu(this); | 212 m_searchPopup = document()->page()->chrome()->createSearchPo
pupMenu(this); |
213 m_searchPopup->saveRecentSearches(name, m_recentSearches); | 213 m_searchPopup->saveRecentSearches(name, m_recentSearches); |
214 } | 214 } |
215 } | 215 } |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 if (containerRenderer->logicalHeight() <= contentLogicalHeight()) | 372 if (containerRenderer->logicalHeight() <= contentLogicalHeight()) |
373 return; | 373 return; |
374 | 374 |
375 // A quirk for find-in-page box on Safari Windows. | 375 // A quirk for find-in-page box on Safari Windows. |
376 // http://webkit.org/b/63157 | 376 // http://webkit.org/b/63157 |
377 LayoutUnit logicalHeightDiff = containerRenderer->logicalHeight() - contentL
ogicalHeight(); | 377 LayoutUnit logicalHeightDiff = containerRenderer->logicalHeight() - contentL
ogicalHeight(); |
378 containerRenderer->setLogicalTop(containerRenderer->logicalTop() - (logicalH
eightDiff / 2 + layoutMod(logicalHeightDiff, 2))); | 378 containerRenderer->setLogicalTop(containerRenderer->logicalTop() - (logicalH
eightDiff / 2 + layoutMod(logicalHeightDiff, 2))); |
379 } | 379 } |
380 | 380 |
381 } | 381 } |
OLD | NEW |