[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/work/unity/WebKit/WebCore
From: Dirk Mueller <mueller () kde ! org>
Date: 2006-07-18 9:48:06
Message-ID: 1153216086.406342.27756.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 563710 by mueller:
some hacks to make it link without icu
M +8 -31 html/HTMLInputElement.cpp
M +15 -4 rendering/RenderText.cpp
--- branches/work/unity/WebKit/WebCore/html/HTMLInputElement.cpp #563709:563710
@@ -49,8 +49,9 @@
#include "RenderTextField.h"
#include "RenderTheme.h"
#include "SelectionController.h"
-#include <unicode/ubrk.h>
+#include <wtf/unicode/Unicode.h>
+
using namespace std;
namespace WebCore {
@@ -58,28 +59,6 @@
using namespace EventNames;
using namespace HTMLNames;
-static int numGraphemeClusters(const StringImpl* s)
-{
- UBreakIterator* it = characterBreakIterator(s);
- if (!it)
- return 0;
- int num = 0;
- while (ubrk_next(it) != UBRK_DONE)
- ++num;
- return num;
-}
-
-static int numCharactersInGraphemeClusters(const StringImpl* s, int \
numGraphemeClusters)
-{
- UBreakIterator* it = characterBreakIterator(s);
- if (!it)
- return 0;
- for (int i = 0; i < numGraphemeClusters; ++i)
- if (ubrk_next(it) == UBRK_DONE)
- return s->length();
- return ubrk_current(it);
-}
-
HTMLInputElement::HTMLInputElement(Document *doc, HTMLFormElement *f)
: HTMLGenericFormElement(inputTag, doc, f)
{
@@ -1348,15 +1327,8 @@
if (evt->isBeforeTextInsertedEvent()) {
// Make sure that the text to be inserted will not violate the maxLength.
- int oldLen = numGraphemeClusters(value().impl());
- ASSERT(oldLen <= maxLength());
- int selectionLen = \
numGraphemeClusters(document()->frame()->selection().toString().impl());
- ASSERT(oldLen >= selectionLen);
- int maxNewLen = maxLength() - (oldLen - selectionLen);
-
- // Truncate the inserted text to avoid violating the maxLength and other \
constraints.
BeforeTextInsertedEvent* textEvent = \
static_cast<BeforeTextInsertedEvent*>(evt);
- textEvent->setText(constrainValue(textEvent->text(), maxNewLen));
+ textEvent->setText(constrainValue(textEvent->text()));
}
if (isNonWidgetTextField() && (evt->isMouseEvent() || evt->isDragEvent() || \
evt->isWheelEvent() || evt->type() == blurEvent) && renderer()) @@ -1477,7 +1449,12 \
@@ {
if (isTextField()) {
StringImpl* s = proposedValue.impl();
+#if PLATFORM(QT)
+#warning FIXME UGLY HACK
+ int newLen = static_cast<int>(proposedValue.length());
+#else
int newLen = numCharactersInGraphemeClusters(s, maxLen);
+#endif
for (int i = 0; i < newLen; ++i)
if ((*s)[i] < ' ') {
newLen = i;
--- branches/work/unity/WebKit/WebCore/rendering/RenderText.cpp #563709:563710
@@ -33,15 +33,13 @@
#include "RenderArena.h"
#include "RenderBlock.h"
#include "break_lines.h"
-#include <unicode/ubrk.h>
#include <wtf/AlwaysInline.h>
#include <wtf/unicode/Unicode.h>
using namespace std;
-namespace WebCore {
-
-UBreakIterator* characterBreakIterator(const StringImpl* i)
+#if !PLATFORM(QT)
+static UBreakIterator* characterBreakIterator(const StringImpl* i)
{
if (!i)
return 0;
@@ -66,9 +64,16 @@
return iterator;
}
+#endif
+namespace WebCore {
+
int RenderText::previousOffset(int current) const
{
+#if PLATFORM(QT)
+#warning UGLY HACK FIX ME
+ return current - 1;
+#else
UBreakIterator* iterator = characterBreakIterator(str.get());
if (!iterator)
return current - 1;
@@ -78,10 +83,15 @@
result = current - 1;
return result;
+#endif
}
int RenderText::nextOffset(int current) const
{
+#if PLATFORM(QT)
+#warning UGLY HACK FIX ME
+ return current + 1;
+#else
UBreakIterator* iterator = characterBreakIterator(str.get());
if (!iterator)
return current + 1;
@@ -91,6 +101,7 @@
result = current + 1;
return result;
+#endif
}
RenderText::RenderText(WebCore::Node* node, StringImpl *_str)
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic