Changeset 87137 in webkit
- Timestamp:
- May 24, 2011 2:02:49 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r87136 r87137 1 2011-05-24 Naoki Takano <takano.naoki@gmail.com> 2 3 Reviewed by Kent Tamura. 4 5 [Chromium]Add clipping for listBox in popup window to fix wrong location display when the autofill item is really long. 6 https://bugs.webkit.org/show_bug.cgi?id=61252 7 http://code.google.com/p/chromium/issues/detail?id=83539 8 9 Manual test: manual-tests/autofill-popup-location.html. 10 11 * manual-tests/autofill-popup-location.html: With long long text, test the shown location is correct. 12 * platform/chromium/PopupMenuChromium.cpp: 13 (WebCore::PopupListBox::setBaseWidth): Clip width with m_maxWindowWidth. 14 (WebCore::PopupListBox::PopupListBox): Add m_maxWindowWidth initialization. 15 (WebCore::PopupContainer::layoutAndCalculateWidgetRect): Call setMaxWidthAndLayout() when the width is clipped with screen size. 16 (WebCore::PopupListBox::setMaxWidthAndLayout): Set m_maxWindowWidth and call layout(). 17 (WebCore::PopupListBox::layout): Compare renewed windowWidth and m_maxWindowWidth, and clip the it. 18 1 19 2011-05-24 James Robinson <jamesr@chromium.org> 2 20 -
trunk/Source/WebCore/manual-tests/autofill-popup-location.html
r83237 r87137 17 17 <br> 18 18 <form><input name=q autofocus></form> 19 20 <ol> 21 <li> Type the text 'This is really long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long text.' in the following text input area. And press ENTER to submit.</li> 22 <li>Return to this page</li> 23 <li> Press 'T' and make sure the input text is shown in autofill popup window and it exceeds the width of screen. If your display resolution is very high, and the while text fits in the window, please fill more characters and try again till the text exceeds the width. 24 <li> Type the text 'This is short text.' in the following text input area. And press ENTER to submit.</li> 25 <li> Press 't' and make sure the input text which you typed in is displayed in autofill popup window.</li> 26 <li> Press 'h' and make sure the popup window location is correct.</li> 27 <li> Press arrow key down and make sure the popup window text is not broken.</li> 28 </ol> 29 <br> 30 <form><input name=p></form> 19 31 </body> 20 32 </html> -
trunk/Source/WebCore/platform/chromium/PopupMenuChromium.cpp
r85143 r87137 134 134 int numItems() const { return static_cast<int>(m_items.size()); } 135 135 136 void setBaseWidth(int width) { m_baseWidth = width; }136 void setBaseWidth(int width) { m_baseWidth = min(m_maxWindowWidth, width); } 137 137 138 138 // Computes the size of widget and children. … … 146 146 147 147 void setMaxHeight(int maxHeight) { m_maxHeight = maxHeight; } 148 149 void setMaxWidthAndLayout(int); 148 150 149 151 void disconnectClient() { m_popupClient = 0; } … … 166 168 , m_repeatingChar(0) 167 169 , m_lastCharTime(0) 170 , m_maxWindowWidth(std::numeric_limits<int>::max()) 168 171 { 169 172 setScrollbarModes(ScrollbarAlwaysOff, ScrollbarAlwaysOff); … … 272 275 // The last time the user hit a key. Used for typeAheadFind. 273 276 TimeStamp m_lastCharTime; 277 278 // If width exeeds screen width, we have to clip it. 279 int m_maxWindowWidth; 274 280 }; 275 281 … … 356 362 // If we have multiple screens and the browser rect is in one screen, we have 357 363 // to clip the window width to the screen width. 364 // When clipping, we also need to set a maximum width for the list box. 358 365 FloatRect windowRect = chromeClient->windowRect(); 359 366 if (windowRect.x() >= screen.x() && windowRect.maxX() <= screen.maxX()) { … … 361 368 widgetRect.setWidth(widgetRect.maxX() - screen.x()); 362 369 widgetRect.setX(screen.x()); 363 } else if (widgetRect.maxX() > screen.maxX()) 370 listBox()->setMaxWidthAndLayout(max(widgetRect.width() - kBorderSize * 2, 0)); 371 } else if (widgetRect.maxX() > screen.maxX()) { 364 372 widgetRect.setWidth(screen.maxX() - widgetRect.x()); 373 listBox()->setMaxWidthAndLayout(max(widgetRect.width() - kBorderSize * 2, 0)); 374 } 365 375 } 366 376 … … 1284 1294 } 1285 1295 1296 void PopupListBox::setMaxWidthAndLayout(int maxWidth) 1297 { 1298 m_maxWindowWidth = maxWidth; 1299 layout(); 1300 } 1301 1286 1302 void PopupListBox::layout() 1287 1303 { … … 1363 1379 } else { 1364 1380 windowWidth = baseWidth + scrollbarWidth + paddingWidth; 1365 contentWidth = baseWidth + paddingWidth; 1381 if (windowWidth > m_maxWindowWidth) { 1382 // windowWidth exceeds m_maxWindowWidth, so we have to clip. 1383 windowWidth = m_maxWindowWidth; 1384 baseWidth = windowWidth - scrollbarWidth - paddingWidth; 1385 m_baseWidth = baseWidth; 1386 } 1387 contentWidth = windowWidth - scrollbarWidth; 1366 1388 1367 1389 if (windowWidth < m_baseWidth) {
Note: See TracChangeset
for help on using the changeset viewer.