Changeset 66879 in webkit


Ignore:
Timestamp:
Sep 7, 2010 6:27:54 AM (14 years ago)
Author:
satish@chromium.org
Message:

2010-09-07 Satish Sampath <satish@chromium.org>

Reviewed by Steve Block.

Fix speech button's hit test logic for RTL rendering.
https://bugs.webkit.org/show_bug.cgi?id=45288

  • fast/speech/input-text-speechbutton.html: Added RTL test case and merged JS code.
  • fast/speech/script-tests/input-text-speechbutton.js: Removed.

2010-09-07 Satish Sampath <satish@chromium.org>

Reviewed by Steve Block.

Fix speech button's hit test logic for RTL rendering.
https://bugs.webkit.org/show_bug.cgi?id=45288

  • rendering/RenderTextControlSingleLine.cpp: (WebCore::RenderTextControlSingleLine::forwardEvent):
Location:
trunk
Files:
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r66878 r66879  
     12010-09-07  Satish Sampath  <satish@chromium.org>
     2
     3        Reviewed by Steve Block.
     4
     5        Fix speech button's hit test logic for RTL rendering.
     6        https://bugs.webkit.org/show_bug.cgi?id=45288
     7
     8        * fast/speech/input-text-speechbutton.html: Added RTL test case and merged JS code.
     9        * fast/speech/script-tests/input-text-speechbutton.js: Removed.
     10
    1112010-09-07  Satish Sampath  <satish@chromium.org>
    212
  • trunk/LayoutTests/fast/speech/input-text-speechbutton.html

    r64749 r66879  
    88<p id="description"></p>
    99<div id="console"></div>
    10 <script src="script-tests/input-text-speechbutton.js"></script>
     10<script type="text/javascript">
     11description('Tests for speech button click with &lt;input type="text" speech>.');
     12
     13function onChange() {
     14    shouldBeEqualToString('document.getElementById("speechInput").value', 'Pictures of the moon');
     15    setTimeout(function() {
     16        var input = document.getElementById('speechInput');
     17        input.dir = 'rtl';
     18        input.value = '';
     19        input.onchange = 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();
     30    }, 50);
     31}
     32
     33function run() {
     34    var input = document.createElement('input');
     35    input.id = 'speechInput';
     36    input.speech = 'speech';
     37    input.onchange = onChange;
     38    document.body.appendChild(input);
     39
     40    if (window.layoutTestController && window.eventSender) {
     41        layoutTestController.setMockSpeechInputResult('Pictures of the moon');
     42
     43        // Clicking the speech button should fill in mock speech-recognized text.
     44        var x = input.offsetLeft + input.offsetWidth - 4;
     45        var y = input.offsetTop + input.offsetHeight / 2;
     46        eventSender.mouseMoveTo(x, y);
     47        eventSender.mouseDown();
     48        eventSender.mouseUp();
     49    }
     50}
     51
     52window.onload = run;
     53window.jsTestIsAsync = true;
     54window.successfullyParsed = true;
     55</script>
    1156<script src="../js/resources/js-test-post.js"></script>
    1257</body>
  • trunk/WebCore/ChangeLog

    r66878 r66879  
     12010-09-07  Satish Sampath  <satish@chromium.org>
     2
     3        Reviewed by Steve Block.
     4
     5        Fix speech button's hit test logic for RTL rendering.
     6        https://bugs.webkit.org/show_bug.cgi?id=45288
     7
     8        * rendering/RenderTextControlSingleLine.cpp:
     9        (WebCore::RenderTextControlSingleLine::forwardEvent):
     10
    1112010-09-07  Satish Sampath  <satish@chromium.org>
    212
  • trunk/WebCore/rendering/RenderTextControlSingleLine.cpp

    r65856 r66879  
    375375    }
    376376
    377     FloatPoint localPoint = innerTextRenderer->absoluteToLocal(static_cast<MouseEvent*>(event)->absoluteLocation(), false, true);
    378     int textRight = innerTextRenderer->borderBoxRect().right();
    379 
    380377#if ENABLE(INPUT_SPEECH)
    381378    if (RenderBox* speechBox = m_speechButton ? m_speechButton->renderBox() : 0) {
    382         if (localPoint.x() >= speechBox->x() && localPoint.x() < speechBox->x() + speechBox->width()) {
     379        FloatPoint pointInTextControlCoords = absoluteToLocal(static_cast<MouseEvent*>(event)->absoluteLocation(), false, true);
     380        if (speechBox->frameRect().contains(roundedIntPoint(pointInTextControlCoords))) {
    383381            m_speechButton->defaultEventHandler(event);
    384382            return;
     
    386384    }
    387385#endif
     386
     387    FloatPoint localPoint = innerTextRenderer->absoluteToLocal(static_cast<MouseEvent*>(event)->absoluteLocation(), false, true);
     388    int textRight = innerTextRenderer->borderBoxRect().right();
    388389
    389390    if (m_resultsButton && localPoint.x() < innerTextRenderer->borderBoxRect().x())
Note: See TracChangeset for help on using the changeset viewer.