Changeset 85190 in webkit
- Timestamp:
- Apr 28, 2011 9:12:14 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r85187 r85190 1 2011-04-28 Satish Sampath <satish@chromium.org> 2 3 Reviewed by Tony Gentilcore. 4 5 Speech input button layout issues with padding and border. 6 https://bugs.webkit.org/show_bug.cgi?id=59613 7 8 * fast/speech/input-text-speechbutton-expected.txt: 9 * fast/speech/input-text-speechbutton.html: Updated to test with padding. 10 1 11 2011-04-28 Chris Fleizach <cfleizach@apple.com> 2 12 -
trunk/LayoutTests/fast/speech/input-text-speechbutton-expected.txt
r74097 r85190 4 4 5 5 6 PASS document.getElementById("speechInput").value is "Pictures of the moon" 7 PASS document.getElementById("speechInput").value is "Pictures of the moon" 6 PASS document.getElementById("speechInput1").value is "Pictures of the moon" 7 PASS document.getElementById("speechInput2").value is "Pictures of the moon" 8 PASS document.getElementById("speechInput3").value is "Pictures of the moon" 9 PASS document.getElementById("speechInput4").value is "Pictures of the moon" 8 10 PASS successfullyParsed is true 9 11 10 12 TEST COMPLETE 11 13 -
trunk/LayoutTests/fast/speech/input-text-speechbutton.html
r72591 r85190 11 11 description('Tests for speech button click with <input type="text" speech>.'); 12 12 13 function startSpeechInput(id) { 14 // Clicking the speech button should fill in mock speech-recognized text. 15 var input = document.getElementById(id); 16 var x = input.offsetLeft + input.offsetWidth - 4; 17 var y = input.offsetTop + input.offsetHeight / 2; 18 if (input.style.paddingRight.length) 19 x -= parseInt(input.style.paddingRight.substr(0, input.style.paddingRight.length - 2)); 20 eventSender.mouseMoveTo(x, y); 21 eventSender.mouseDown(); 22 eventSender.mouseUp(); 23 } 24 25 var testIndex = 1; 13 26 function onWebkitSpeechChange() { 14 shouldBeEqualToString('document.getElementById("speechInput").value', 'Pictures of the moon'); 27 shouldBeEqualToString('document.getElementById("speechInput' + testIndex + '").value', 'Pictures of the moon'); 28 if (testIndex == 4) { 29 finishJSTest(); 30 return; 31 } 32 ++testIndex; 15 33 setTimeout(function() { 16 var input = document.getElementById('speechInput'); 17 input.dir = 'rtl'; 18 input.value = ''; 19 input.onwebkitspeechchange = function() { 20 shouldBeEqualToString('document.getElementById("speechInput").value', 21 'Pictures of the moon'); 22 finishJSTest(); 23 }; 24 25 var x = input.offsetLeft + 4; 26 var y = input.offsetTop + input.offsetHeight / 2; 27 eventSender.mouseMoveTo(x, y); 28 eventSender.mouseDown(); 29 eventSender.mouseUp(); 34 startSpeechInput("speechInput" + testIndex); 30 35 }, 50); 31 36 } … … 34 39 if (window.layoutTestController && window.eventSender) { 35 40 layoutTestController.addMockSpeechInputResult('Pictures of the moon', 1.0, ''); 36 37 // Clicking the speech button should fill in mock speech-recognized text. 38 var input = document.getElementById('speechInput'); 39 var x = input.offsetLeft + input.offsetWidth - 4; 40 var y = input.offsetTop + input.offsetHeight / 2; 41 eventSender.mouseMoveTo(x, y); 42 eventSender.mouseDown(); 43 eventSender.mouseUp(); 41 startSpeechInput("speechInput" + testIndex); 44 42 } 45 43 } … … 50 48 </script> 51 49 <script src="../js/resources/js-test-post.js"></script> 52 <input id='speechInput' x-webkit-speech onwebkitspeechchange="onWebkitSpeechChange()"> 50 <input id='speechInput1' x-webkit-speech onwebkitspeechchange="onWebkitSpeechChange()"> 51 <input id='speechInput2' x-webkit-speech onwebkitspeechchange="onWebkitSpeechChange()" dir="rtl"> 52 <input id='speechInput3' x-webkit-speech onwebkitspeechchange="onWebkitSpeechChange()" style="padding:5px 10px"> 53 <input id='speechInput4' x-webkit-speech onwebkitspeechchange="onWebkitSpeechChange()" style="padding:5px 10px" dir="rtl"> 53 54 </body> 54 55 </html> 56 -
trunk/Source/WebCore/ChangeLog
r85188 r85190 1 2011-04-28 Satish Sampath <satish@chromium.org> 2 3 Reviewed by Tony Gentilcore. 4 5 Speech input button layout issues with padding and border. 6 https://bugs.webkit.org/show_bug.cgi?id=59613 7 8 * rendering/RenderTextControlSingleLine.cpp: 9 (WebCore::RenderTextControlSingleLine::layout): 10 (WebCore::RenderTextControlSingleLine::nodeAtPoint): 11 (WebCore::RenderTextControlSingleLine::forwardEvent): 12 1 13 2011-04-28 Carlos Garcia Campos <cgarcia@igalia.com> 2 14 -
trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp
r84695 r85190 309 309 button->setLocation(x, y); 310 310 } else { 311 // For non-search fields which are simpler and we let the defaut layout handle things 312 // except for small tweaking below. 313 button->setLocation(button->x() + paddingRight(), (height() - button->height()) / 2); 311 int x = width() - borderRight() - paddingRight() - button->width(); 312 RenderBox* spinBox = m_innerSpinButton ? m_innerSpinButton->renderBox() : 0; 313 if (style()->isLeftToRightDirection()) 314 x -= spinBox ? spinBox->width() : 0; 315 else 316 innerTextRenderer->setX(paddingLeft() + borderLeft() + (spinBox ? spinBox->width() : 0)); 317 int y = (height() - button->height()) / 2; 318 button->setLocation(x, y); 314 319 } 315 320 } … … 370 375 innerNode = m_resultsButton.get(); 371 376 377 #if ENABLE(INPUT_SPEECH) 378 if (!innerNode && m_speechButton && m_speechButton->renderer()) { 379 int buttonLeft = tx + x() + innerBlockRenderer->x() + innerBlockRenderer->width() - m_speechButton->renderBox()->width(); 380 if (xPos >= buttonLeft) 381 innerNode = m_speechButton.get(); 382 } 383 #endif 384 372 385 if (!innerNode) { 373 386 int textRight = textLeft + innerTextRenderer->width(); … … 406 419 #if ENABLE(INPUT_SPEECH) 407 420 if (RenderBox* speechBox = m_speechButton ? m_speechButton->renderBox() : 0) { 408 FloatPoint pointInTextControlCoords = absoluteToLocal(static_cast<MouseEvent*>(event)->absoluteLocation(), false, true); 421 RenderBox* parent = innerTextRenderer ? innerTextRenderer : this; 422 FloatPoint pointInTextControlCoords = parent->absoluteToLocal(static_cast<MouseEvent*>(event)->absoluteLocation(), false, true); 409 423 if (speechBox->frameRect().contains(roundedIntPoint(pointInTextControlCoords))) { 410 424 m_speechButton->defaultEventHandler(event);
Note: See TracChangeset
for help on using the changeset viewer.