[webkit-dev] HTMLInput issue

Sriram Neelakandan sriram.neelakandan at gmail.com
Wed Feb 20 08:20:49 PST 2008


Hi folks,

I had a HTMLInput issue with gtk-webkit :  input text box wont work at all
on HTML pages at all.

Interestingly, If i add a JavaScript handler, then the key press is
processed and captured by the JS, but not by the HTMLInputElement.

I debugged the issue in HTMLInputElement::constrainValue calls
numCharactersInGraphemeClusters(), which in turn creates a
TextBreakIterator.

The TextBreakIterator would not create for me .. and always return NULL !

The issue was finally with icu's ubrk_open failing to initialize !

The reason was this :    U_FILE_ACCESS_ERROR       =  4,     /**< The
requested file cannot be found */

ICU was unable to find its data file , in my case *icudt36l.dat*

I copied the file to my target, export ICU_DATA and things just started
working ! great !

Thanks to Mike (mike.emmel at gmail.com) for pointing me in the right direction
!

May be this is obvious for people familiar with ICU, but a dumbo like me,
took 2 weeks to trace myself through the webkit code and to get the
openStatus ERROR !

So, why not add a printf atleast (if not ASSERT) in debug mode, and indicate
that the characterBreakIterator failed to initalize. This will save some
else' 2 weeks and frustration  as well.

Kindly accept the patch

Here is a patch for file :

 WebCore/platform/text/TextBreakIteratorICU.cpp

***************
*** 25,30 ****
--- 25,34 ----
  #include "TextBreakIteratorInternalICU.h"

  #include <unicode/ubrk.h>
+ #include <wtf/Assertions.h>
+ #include <stdio.h>
+
+ using namespace std;

  namespace WebCore {

*************** static TextBreakIterator* setUpIterator(
*** 34,46 ****
      if (!string)
          return 0;

      if (!createdIterator) {
-         UErrorCode openStatus = U_ZERO_ERROR;
          iterator = static_cast<TextBreakIterator*>(ubrk_open(type,
currentTextBreakLocaleID(), 0, 0, &openStatus));
          createdIterator = true;
      }
      if (!iterator)
          return 0;

      UErrorCode setTextStatus = U_ZERO_ERROR;
      ubrk_setText(iterator, string, length, &setTextStatus);
--- 38,54 ----
      if (!string)
          return 0;

+     UErrorCode openStatus = U_ZERO_ERROR;
      if (!createdIterator) {
          iterator = static_cast<TextBreakIterator*>(ubrk_open(type,
currentTextBreakLocaleID(), 0, 0, &openStatus));
          createdIterator = true;
      }
      if (!iterator)
+     {
+         fprintf(stderr,"Could not create iterator instance @ %s:%d,
ICU_ERROR=%d\n",__FILE__,__LINE__,openStatus);
+         ASSERT(iterator);
          return 0;
+     }

      UErrorCode setTextStatus = U_ZERO_ERROR;
      ubrk_setText(iterator, string, length, &setTextStatus);







-- 
Sriram Neelakandan
Author - Embedded Linux System Design And Development (
http://tinyurl.com/2doosu)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.webkit.org/pipermail/webkit-dev/attachments/20080220/7a896642/attachment.html 


More information about the webkit-dev mailing list