[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

trey trey at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:27:37 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit b941f5fb7f41e6fb378b90d6cce3ccd32e295a36
Author: trey <trey at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Mar 6 07:29:48 2003 +0000

    	Autofill tweak.  In field names, replace all digits with spaces before matching
    	labels against them.  This turns the digits to word boundaries, so field names like
    	"address2" are matched by "address".
    
    	As part of this, I abandoned an earlier attempt to map Qt regexp syntax to Darwin's.
    	Now clients just have to use Darwin's.
    
            Reviewed by Maciej.
    
            * kwq/KWQKHTMLPart.mm:
            (regExpForLabels):
            (KWQKHTMLPart::matchLabelsAgainstElement):  Replace digits with space.
            * kwq/KWQRegExp.mm:
            (QRegExp::KWQRegExpPrivate::compile):  Don't try to support Qt syntax.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3757 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 1a47832..ab87a09 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,20 @@
+2003-03-05  Trey Matteson  <trey at apple.com>
+
+	Autofill tweak.  In field names, replace all digits with spaces before matching
+	labels against them.  This turns the digits to word boundaries, so field names like
+	"address2" are matched by "address".
+
+	As part of this, I abandoned an earlier attempt to map Qt regexp syntax to Darwin's.
+	Now clients just have to use Darwin's.
+
+        Reviewed by Maciej.
+
+        * kwq/KWQKHTMLPart.mm:
+        (regExpForLabels):
+        (KWQKHTMLPart::matchLabelsAgainstElement):  Replace digits with space.
+        * kwq/KWQRegExp.mm:
+        (QRegExp::KWQRegExpPrivate::compile):  Don't try to support Qt syntax.
+
 2003-03-05  Darin Adler  <darin at apple.com>
 
         Reviewed by John.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 1a47832..ab87a09 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,20 @@
+2003-03-05  Trey Matteson  <trey at apple.com>
+
+	Autofill tweak.  In field names, replace all digits with spaces before matching
+	labels against them.  This turns the digits to word boundaries, so field names like
+	"address2" are matched by "address".
+
+	As part of this, I abandoned an earlier attempt to map Qt regexp syntax to Darwin's.
+	Now clients just have to use Darwin's.
+
+        Reviewed by Maciej.
+
+        * kwq/KWQKHTMLPart.mm:
+        (regExpForLabels):
+        (KWQKHTMLPart::matchLabelsAgainstElement):  Replace digits with space.
+        * kwq/KWQRegExp.mm:
+        (QRegExp::KWQRegExpPrivate::compile):  Don't try to support Qt syntax.
+
 2003-03-05  Darin Adler  <darin at apple.com>
 
         Reviewed by John.
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index 90c1f73..708554b 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -250,7 +250,7 @@ HTMLFormElementImpl *KWQKHTMLPart::currentForm() const
 }
 
 // Either get cached regexp or build one that matches any of the labels.
-// The regexp we build is of the form:   \b(STR1|STR2|STRN)\b
+// The regexp we build is of the form:   [[:<:]](STR1|STR2|STRN)[[:>:]]
 QRegExp *regExpForLabels(NSArray *labels)
 {
     // Parallel arrays that we use to cache regExps.  In practice the number of expressions
@@ -267,7 +267,7 @@ QRegExp *regExpForLabels(NSArray *labels)
     if (cacheHit != NSNotFound) {
         result = regExps.at(cacheHit);
     } else {
-        QString pattern("\\b(");
+        QString pattern("[[:<:]](");
         unsigned int numLabels = [labels count];
         unsigned int i;
         for (i = 0; i < numLabels; i++) {
@@ -277,7 +277,7 @@ QRegExp *regExpForLabels(NSArray *labels)
             }
             pattern.append(label);
         }
-        pattern.append(")\\b");
+        pattern.append(")[[:>:]]");
         result = new QRegExp(pattern, false);
     }
 
@@ -349,6 +349,9 @@ NSString *KWQKHTMLPart::searchForLabelsBeforeElement(NSArray *labels, DOM::Eleme
 NSString *KWQKHTMLPart::matchLabelsAgainstElement(NSArray *labels, DOM::ElementImpl *element)
 {
     QString name = element->getAttribute(ATTR_NAME).string();
+    // Make numbers in field names behave like word boundaries, e.g., "address2"
+    name.replace(QRegExp("[[:digit:]]"), " ");
+    
     QRegExp *regExp = regExpForLabels(labels);
     // Use the largest match we can find in the whole name string
     int pos;
diff --git a/WebCore/kwq/KWQRegExp.mm b/WebCore/kwq/KWQRegExp.mm
index 81e302a..1dd52d6 100644
--- a/WebCore/kwq/KWQRegExp.mm
+++ b/WebCore/kwq/KWQRegExp.mm
@@ -82,31 +82,6 @@ static QString RegExpFromGlob(QString glob)
     return result;
 }
 
-static QString RegExpFromPattern(QString pattern)
-{
-    // map word boundary QRegExp assertion to RegEx beginning and end of word boundaries
-    // FIXME:  Not sure how we would deal with \b appearing within a string.
-    int length = pattern.length();
-    if (length < 2) {
-        return pattern;
-    }
-    
-    bool fixStart = (pattern[0] == '\\' && pattern[1] == 'b');
-    bool fixEnd = (pattern[length-2] == '\\' && pattern[length-1] == 'b');
-    if (fixStart || fixEnd) {
-        QString result = pattern;
-        if (fixStart) {
-            result.replace(0, 2, "[[:<:]]");
-        }
-        if (fixEnd) {
-            result.replace(result.length()-2, 2, "[[:>:]]");
-        }
-        return result;
-    } else {
-        return pattern;
-    }
-}
-
 void QRegExp::KWQRegExpPrivate::compile(bool caseSensitive, bool glob)
 {
     QString p;
@@ -114,12 +89,18 @@ void QRegExp::KWQRegExpPrivate::compile(bool caseSensitive, bool glob)
     if (glob) {
 	p = RegExpFromGlob(pattern);
     } else {
-	p = RegExpFromPattern(pattern);
+	p = pattern;
     }
+    // Note we don't honor the Qt syntax for various character classes.  If we convert
+    // to a different underlying engine, we may need to change client code that relies
+    // on the regex syntax (see KWQKHTMLPart.mm for a couple examples).
 
     const char *cpattern = p.latin1();
 
-    regcomp(&regex, cpattern, REG_EXTENDED | (caseSensitive ? 0 : REG_ICASE));
+    int err = regcomp(&regex, cpattern, REG_EXTENDED | (caseSensitive ? 0 : REG_ICASE));
+    if (err) {
+        ERROR("regcomp failed with error=%d", err);
+    }
 }
 
 QRegExp::KWQRegExpPrivate::~KWQRegExpPrivate()

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list