chuifeng / webkitdriver

Automatically exported from code.google.com/p/webkitdriver
0 stars 0 forks source link

Keyboard events handling for search input field #9

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Input type of type 'search' has special handing in WebKit code, making current 
implementation of sendKeys does not work correctly for this type of input - 
text is not inserted into the field.

As a temporary solution, this special handling was removed by re-implementing 
RenderTextControlSingleLine::createSubtreeIfNeeded() in 
WebCore/platform/hl/RenderTextControlSingleLine.cpp, however less intrusive 
solution is needed. 

Original issue reported on code.google.com by viarheic...@google.com on 9 Dec 2010 at 6:50

GoogleCodeExporter commented 8 years ago
Here is the diff. 

--- WebCore/rendering/RenderTextControlSingleLine.cpp   2010-12-09
13:05:30.371952244 +0000
+++ WebCore/platform/hl/RenderTextControlSingleLine.cpp 2010-12-09
17:28:33.149130881 +0000
@@ -446,31 +446,7 @@

 void RenderTextControlSingleLine::createSubtreeIfNeeded()
 {
-    if (!inputElement()->isSearchField()) {
        RenderTextControl::createSubtreeIfNeeded(m_innerBlock.get());
-        return;
-    }
-
-    if (!m_innerBlock) {
-        // Create the inner block element
-        m_innerBlock = new TextControlInnerElement(document(), node());
-        m_innerBlock->attachInnerElement(node(),
createInnerBlockStyle(style()), renderArena());
-    }
-
-    if (!m_resultsButton) {
-        // Create the search results button element
-        m_resultsButton = new
SearchFieldResultsButtonElement(document());
-        m_resultsButton->attachInnerElement(m_innerBlock.get(),
createResultsButtonStyle(m_innerBlock->renderer()->style()),
renderArena());
-    }
-
-    // Create innerText element before adding the cancel button
-    RenderTextControl::createSubtreeIfNeeded(m_innerBlock.get());
-
-    if (!m_cancelButton) {
-        // Create the cancel button element
-        m_cancelButton = new
SearchFieldCancelButtonElement(document());
-        m_cancelButton->attachInnerElement(m_innerBlock.get(),
createCancelButtonStyle(m_innerBlock->renderer()->style()),
renderArena());
-    }

}

Original comment by ba...@google.com on 10 Dec 2010 at 10:31