[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-1049-g2e11a8e

commit-queue at webkit.org commit-queue at webkit.org
Fri Jan 21 15:04:13 UTC 2011


The following commit has been merged in the debian/experimental branch:
commit 4a5c4eb918ad61bf36d856218ab08eceda8ae76c
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jan 6 20:53:25 2011 +0000

    2011-01-06  Joone Hur  <joone.hur at collabora.co.uk>
    
            Reviewed by Eric Seidel.
    
            WML Parser should treat line/column number in a consistent way
            https://bugs.webkit.org/show_bug.cgi?id=51601
    
            Add the equality operators to TextPosition class.
    
            * wtf/text/TextPosition.h:
            (WTF::TextPosition::operator==): Added.
            (WTF::TextPosition::operator!=): Added.
            (WTF::TextPosition::belowRangePosition): Use belowBase() instead of base().
            (WTF::ZeroBasedNumber::operator==): Added.
            (WTF::ZeroBasedNumber::operator!=): Added.
            (WTF::OneBasedNumber::operator==): Added.
            (WTF::OneBasedNumber::operator!=): Added.
    2011-01-06  Joone Hur  <joone.hur at collabora.co.uk>
    
            Reviewed by Eric Seidel.
    
            WML Parser should treat line/column number in a consistent way
            https://bugs.webkit.org/show_bug.cgi?id=51601
    
            XML Parser treats line/column number as 1-based values, but WML ErrorHandler treat them as 0-based.
            Therefore, this patch allows WML ErrorHandler to use 1-based values.
    
            * dom/XMLDocumentParser.cpp:
            (WebCore::XMLDocumentParser::handleError): Treat line/column number as 1 based values.
            * dom/XMLDocumentParser.h: Make textPositionOneBased public and Add TextPosition1(m_lastErrorPosition) to keep error line/column number.
            * dom/XMLDocumentParserLibxml2.cpp:
            (WebCore::XMLDocumentParser::XMLDocumentParser): Initialize m_lastErrorPosition.
            * dom/XMLDocumentParserQt.cpp:
            (WebCore::XMLDocumentParser::XMLDocumentParser): Initialize m_lastErrorPosition.
            * wml/WMLErrorHandling.cpp:
            (WebCore::reportWMLError): Use 1 based value instead of 0 based value to report error line/column number.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75188 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog
index 80858d7..0c2d315 100644
--- a/Source/JavaScriptCore/ChangeLog
+++ b/Source/JavaScriptCore/ChangeLog
@@ -1,3 +1,21 @@
+2011-01-06  Joone Hur  <joone.hur at collabora.co.uk>
+
+        Reviewed by Eric Seidel.
+
+        WML Parser should treat line/column number in a consistent way
+        https://bugs.webkit.org/show_bug.cgi?id=51601
+
+        Add the equality operators to TextPosition class.
+
+        * wtf/text/TextPosition.h:
+        (WTF::TextPosition::operator==): Added.
+        (WTF::TextPosition::operator!=): Added.
+        (WTF::TextPosition::belowRangePosition): Use belowBase() instead of base().
+        (WTF::ZeroBasedNumber::operator==): Added.
+        (WTF::ZeroBasedNumber::operator!=): Added.
+        (WTF::OneBasedNumber::operator==): Added.
+        (WTF::OneBasedNumber::operator!=): Added.
+
 2011-01-06  Patrick Gansterer  <paroga at webkit.org>
 
         Reviewed by Gavin Barraclough.
diff --git a/Source/JavaScriptCore/wtf/text/TextPosition.h b/Source/JavaScriptCore/wtf/text/TextPosition.h
index 63dc594..9f426ea 100644
--- a/Source/JavaScriptCore/wtf/text/TextPosition.h
+++ b/Source/JavaScriptCore/wtf/text/TextPosition.h
@@ -66,11 +66,14 @@ public:
     }
     TextPosition() {}
 
+    bool operator==(const TextPosition& other) { return m_line == other.m_line && m_column == other.m_column; }
+    bool operator!=(const TextPosition& other) { return !((*this) == other); }
+
     // A 'minimum' value of position, used as a default value.
     static TextPosition<NUMBER> minimumPosition() { return TextPosition<NUMBER>(NUMBER::base(), NUMBER::base()); }
 
     // A value with line value less than a minimum; used as an impossible position.
-    static TextPosition<NUMBER> belowRangePosition() { return TextPosition<NUMBER>(NUMBER::belowBase(), NUMBER::base()); }
+    static TextPosition<NUMBER> belowRangePosition() { return TextPosition<NUMBER>(NUMBER::belowBase(), NUMBER::belowBase()); }
 
     NUMBER m_line;
     NUMBER m_column;
@@ -89,6 +92,9 @@ public:
 
     OneBasedNumber convertToOneBased() const;
 
+    bool operator==(ZeroBasedNumber other) { return m_value == other.m_value; }
+    bool operator!=(ZeroBasedNumber other) { return !((*this) == other); }
+
     static ZeroBasedNumber base() { return 0; }
     static ZeroBasedNumber belowBase() { return -1; }
 
@@ -107,6 +113,9 @@ public:
     int convertAsZeroBasedInt() const { return m_value - 1; }
     ZeroBasedNumber convertToZeroBased() const { return ZeroBasedNumber::fromZeroBasedInt(m_value - 1); }
 
+    bool operator==(OneBasedNumber other) { return m_value == other.m_value; }
+    bool operator!=(OneBasedNumber other) { return !((*this) == other); }
+
     static OneBasedNumber base() { return 1; }
     static OneBasedNumber belowBase() { return 0; }
 
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 1874f55..faae1d8 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,23 @@
+2011-01-06  Joone Hur  <joone.hur at collabora.co.uk>
+
+        Reviewed by Eric Seidel.
+
+        WML Parser should treat line/column number in a consistent way
+        https://bugs.webkit.org/show_bug.cgi?id=51601
+
+        XML Parser treats line/column number as 1-based values, but WML ErrorHandler treat them as 0-based.
+        Therefore, this patch allows WML ErrorHandler to use 1-based values.
+
+        * dom/XMLDocumentParser.cpp:
+        (WebCore::XMLDocumentParser::handleError): Treat line/column number as 1 based values.
+        * dom/XMLDocumentParser.h: Make textPositionOneBased public and Add TextPosition1(m_lastErrorPosition) to keep error line/column number.
+        * dom/XMLDocumentParserLibxml2.cpp:
+        (WebCore::XMLDocumentParser::XMLDocumentParser): Initialize m_lastErrorPosition. 
+        * dom/XMLDocumentParserQt.cpp:
+        (WebCore::XMLDocumentParser::XMLDocumentParser): Initialize m_lastErrorPosition. 
+        * wml/WMLErrorHandling.cpp:
+        (WebCore::reportWMLError): Use 1 based value instead of 0 based value to report error line/column number.
+
 2011-01-05  Adam Roben  <aroben at apple.com>
 
         Remove some dead code from WKCACFLayerRenderer
diff --git a/WebCore/dom/XMLDocumentParser.cpp b/WebCore/dom/XMLDocumentParser.cpp
index 27b0fd4..68c8dd9 100644
--- a/WebCore/dom/XMLDocumentParser.cpp
+++ b/WebCore/dom/XMLDocumentParser.cpp
@@ -148,18 +148,22 @@ void XMLDocumentParser::append(const SegmentedString& s)
 
 void XMLDocumentParser::handleError(ErrorType type, const char* m, int lineNumber, int columnNumber)
 {
-    if (type == fatal || (m_errorCount < maxErrors && m_lastErrorLine != lineNumber && m_lastErrorColumn != columnNumber)) {
+    handleError(type, m, TextPosition1(WTF::OneBasedNumber::fromOneBasedInt(lineNumber), WTF::OneBasedNumber::fromOneBasedInt(columnNumber)));
+}
+
+void XMLDocumentParser::handleError(ErrorType type, const char* m, TextPosition1 position)
+{
+    if (type == fatal || (m_errorCount < maxErrors && m_lastErrorPosition.m_line != position.m_line && m_lastErrorPosition.m_column != position.m_column)) {
         switch (type) {
             case warning:
-                m_errorMessages += makeString("warning on line ", String::number(lineNumber), " at column ", String::number(columnNumber), ": ", m);
+                m_errorMessages += makeString("warning on line ", String::number(position.m_line.oneBasedInt()), " at column ", String::number(position.m_column.oneBasedInt()), ": ", m);
                 break;
             case fatal:
             case nonFatal:
-                m_errorMessages += makeString("error on line ", String::number(lineNumber), " at column ", String::number(columnNumber), ": ", m);
+                m_errorMessages += makeString("error on line ", String::number(position.m_line.oneBasedInt()), " at column ", String::number(position.m_column.oneBasedInt()), ": ", m);
         }
 
-        m_lastErrorLine = lineNumber;
-        m_lastErrorColumn = columnNumber;
+        m_lastErrorPosition = position;
         ++m_errorCount;
     }
 
diff --git a/WebCore/dom/XMLDocumentParser.h b/WebCore/dom/XMLDocumentParser.h
index 11370fa..7533c5b 100644
--- a/WebCore/dom/XMLDocumentParser.h
+++ b/WebCore/dom/XMLDocumentParser.h
@@ -86,6 +86,7 @@ namespace WebCore {
         // Exposed for callbacks:
         enum ErrorType { warning, nonFatal, fatal };
         void handleError(ErrorType, const char* message, int lineNumber, int columnNumber);
+        void handleError(ErrorType, const char* message, TextPosition1);
 
         void setIsXHTMLDocument(bool isXHTML) { m_isXHTMLDocument = isXHTML; }
         bool isXHTMLDocument() const { return m_isXHTMLDocument; }
@@ -101,7 +102,9 @@ namespace WebCore {
 
         // WMLErrorHandling uses these functions.
         virtual bool wellFormed() const { return !m_sawError; }
+
         TextPosition0 textPosition() const;
+        TextPosition1 textPositionOneBased() const;
 
         static bool supportsXMLVersion(const String&);
 
@@ -130,13 +133,6 @@ namespace WebCore {
 
         bool appendFragmentSource(const String&);
 
-
-        // This method is introduced to temporary legalize existing line/column
-        // coordinate bug: it is believed that numbers that originally were zero-based
-        // eventually becomes one-based.
-        // FIXME: Investigate and get rid of this method.
-        TextPosition1 textPositionOneBased() const;
-
 #if USE(QXMLSTREAM)
 private:
         void parse();
@@ -210,8 +206,7 @@ public:
         bool m_finishCalled;
 
         int m_errorCount;
-        int m_lastErrorLine;
-        int m_lastErrorColumn;
+        TextPosition1 m_lastErrorPosition;
         String m_errorMessages;
 
         CachedResourceHandle<CachedScript> m_pendingScript;
diff --git a/WebCore/dom/XMLDocumentParserLibxml2.cpp b/WebCore/dom/XMLDocumentParserLibxml2.cpp
index 23f9883..0f6b4b4 100644
--- a/WebCore/dom/XMLDocumentParserLibxml2.cpp
+++ b/WebCore/dom/XMLDocumentParserLibxml2.cpp
@@ -557,8 +557,7 @@ XMLDocumentParser::XMLDocumentParser(Document* document, FrameView* frameView)
     , m_requestingScript(false)
     , m_finishCalled(false)
     , m_errorCount(0)
-    , m_lastErrorLine(0)
-    , m_lastErrorColumn(0)
+    , m_lastErrorPosition(TextPosition1::belowRangePosition())
     , m_pendingScript(0)
     , m_scriptStartPosition(TextPosition1::belowRangePosition())
     , m_parsingFragment(false)
@@ -584,8 +583,7 @@ XMLDocumentParser::XMLDocumentParser(DocumentFragment* fragment, Element* parent
     , m_requestingScript(false)
     , m_finishCalled(false)
     , m_errorCount(0)
-    , m_lastErrorLine(0)
-    , m_lastErrorColumn(0)
+    , m_lastErrorPosition(TextPosition1::belowRangePosition())
     , m_pendingScript(0)
     , m_scriptStartPosition(TextPosition1::belowRangePosition())
     , m_parsingFragment(true)
diff --git a/WebCore/dom/XMLDocumentParserQt.cpp b/WebCore/dom/XMLDocumentParserQt.cpp
index e905e31..d0bf88d 100644
--- a/WebCore/dom/XMLDocumentParserQt.cpp
+++ b/WebCore/dom/XMLDocumentParserQt.cpp
@@ -102,8 +102,7 @@ XMLDocumentParser::XMLDocumentParser(Document* document, FrameView* frameView)
     , m_requestingScript(false)
     , m_finishCalled(false)
     , m_errorCount(0)
-    , m_lastErrorLine(0)
-    , m_lastErrorColumn(0)
+    , m_lastErrorPosition(TextPosition1::belowRangePosition())
     , m_pendingScript(0)
     , m_scriptStartPosition(TextPosition1::belowRangePosition())
     , m_parsingFragment(false)
@@ -129,8 +128,7 @@ XMLDocumentParser::XMLDocumentParser(DocumentFragment* fragment, Element* parent
     , m_requestingScript(false)
     , m_finishCalled(false)
     , m_errorCount(0)
-    , m_lastErrorLine(0)
-    , m_lastErrorColumn(0)
+    , m_lastErrorPosition(TextPosition1::belowRangePosition())
     , m_pendingScript(0)
     , m_scriptStartPosition(TextPosition1::belowRangePosition())
     , m_parsingFragment(true)
diff --git a/WebCore/wml/WMLErrorHandling.cpp b/WebCore/wml/WMLErrorHandling.cpp
index dc0b8df..a49a71b 100644
--- a/WebCore/wml/WMLErrorHandling.cpp
+++ b/WebCore/wml/WMLErrorHandling.cpp
@@ -48,7 +48,7 @@ void reportWMLError(Document* doc, WMLErrorCode error)
         if (!parser->wellFormed())
             return;
 
-        parser->handleError(XMLDocumentParser::fatal, errorMessage.latin1().data(), parser->textPosition().m_line.zeroBasedInt(), parser->textPosition().m_column.zeroBasedInt());
+        parser->handleError(XMLDocumentParser::fatal, errorMessage.latin1().data(), parser->textPositionOneBased());
     } else {
         Frame* frame = doc->frame();
         if (!frame)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list