Reviewed by Mark Rowe.
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Nov 2007 04:51:55 +0000 (04:51 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Nov 2007 04:51:55 +0000 (04:51 +0000)
        - fix line numbers that were off since my recent patch

        * platform/SegmentedString.h:
        (WebCore::SegmentedSubstring::SegmentedSubstring): Reversed the sense of m_excludeLineNumbers
        and rename it to m_doNotExcludeLineNumbers.
        (WebCore::SegmentedSubstring::excludeLineNumbers): Updated.
        (WebCore::SegmentedSubstring::doNotExcludeLineNumbers): Added.
        (WebCore::SegmentedSubstring::setExcludeLineNumbers): Updated.
        (WebCore::SegmentedString::advance): Use doNotExcludeLineNumbers to reverse the sense and fix
        the regression, but keep the speediness. I accidentally had removed a ! here.

        * platform/SegmentedString.cpp:
        (WebCore::SegmentedString::advanceSlowCase): Use doNotExcludeLineNumbers.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27705 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/platform/SegmentedString.cpp
WebCore/platform/SegmentedString.h

index 0e417ca779fb8d99fd566d554161c780f21b464a..6fb558eab33a2cbe43232d496f2acf48a0825c33 100644 (file)
@@ -1,3 +1,21 @@
+2007-11-11  Darin Adler  <darin@apple.com>
+
+        Reviewed by Mark Rowe.
+
+        - fix line numbers that were off since my recent patch
+
+        * platform/SegmentedString.h:
+        (WebCore::SegmentedSubstring::SegmentedSubstring): Reversed the sense of m_excludeLineNumbers
+        and rename it to m_doNotExcludeLineNumbers.
+        (WebCore::SegmentedSubstring::excludeLineNumbers): Updated.
+        (WebCore::SegmentedSubstring::doNotExcludeLineNumbers): Added.
+        (WebCore::SegmentedSubstring::setExcludeLineNumbers): Updated.
+        (WebCore::SegmentedString::advance): Use doNotExcludeLineNumbers to reverse the sense and fix
+        the regression, but keep the speediness. I accidentally had removed a ! here.
+
+        * platform/SegmentedString.cpp:
+        (WebCore::SegmentedString::advanceSlowCase): Use doNotExcludeLineNumbers.
+
 2007-11-11  Oliver Hunt  <oliver@apple.com>
 
         Reviewed by Darin.
index 410c6e2b71dd410e62346d0e641979de369fc8a6..0b3c7e9b71ba177a90a6ec5e119b05e3affd8a1d 100644 (file)
@@ -191,7 +191,7 @@ void SegmentedString::advanceSlowCase(int& lineNumber)
         m_pushedChar1 = m_pushedChar2;
         m_pushedChar2 = 0;
     } else if (m_currentString.m_current) {
-        if (*m_currentString.m_current++ == '\n' && !m_currentString.excludeLineNumbers())
+        if (*m_currentString.m_current++ == '\n' && m_currentString.doNotExcludeLineNumbers())
             ++lineNumber;
         if (--m_currentString.m_length == 0)
             advanceSubstring();
index 58420987c03602d680626ea703a54c265fb478fa..b6157709f8e804c1e7d936762df08fc2c946499a 100644 (file)
@@ -31,17 +31,19 @@ class SegmentedSubstring {
 private:
     friend class SegmentedString;
     
-    SegmentedSubstring() : m_length(0), m_current(0), m_excludeLineNumbers(false) {}
-    SegmentedSubstring(const String& str) : m_string(str), m_length(str.length()), m_excludeLineNumbers(false) {
+    SegmentedSubstring() : m_length(0), m_current(0), m_doNotExcludeLineNumbers(true) {}
+    SegmentedSubstring(const String& str) : m_string(str), m_length(str.length()), m_doNotExcludeLineNumbers(true) {
         m_current = m_length == 0 ? 0 : m_string.characters();
     }
 
-    SegmentedSubstring(const UChar* str, int length) : m_length(length), m_current(length == 0 ? 0 : str), m_excludeLineNumbers(false) {}
+    SegmentedSubstring(const UChar* str, int length) : m_length(length), m_current(length == 0 ? 0 : str), m_doNotExcludeLineNumbers(true) {}
 
     void clear() { m_length = 0; m_current = 0; }
     
-    bool excludeLineNumbers() const { return m_excludeLineNumbers; }
-    void setExcludeLineNumbers() { m_excludeLineNumbers = true; }
+    bool excludeLineNumbers() const { return !m_doNotExcludeLineNumbers; }
+    bool doNotExcludeLineNumbers() const { return m_doNotExcludeLineNumbers; }
+
+    void setExcludeLineNumbers() { m_doNotExcludeLineNumbers = false; }
 
     void appendTo(String& str) const {
         if (m_string.characters() == m_current) {
@@ -57,7 +59,7 @@ private:
     String m_string;
     int m_length;
     const UChar* m_current;
-    bool m_excludeLineNumbers;
+    bool m_doNotExcludeLineNumbers;
 };
 
 class SegmentedString {
@@ -108,7 +110,7 @@ public:
     void advance(int& lineNumber)
     {
         if (!m_pushedChar1 && m_currentString.m_length > 1) {
-            lineNumber += (*m_currentString.m_current == '\n') & m_currentString.excludeLineNumbers();
+            lineNumber += (*m_currentString.m_current == '\n') & m_currentString.doNotExcludeLineNumbers();
             --m_currentString.m_length;
             m_currentChar = ++m_currentString.m_current;
             return;