Commit 4dfc68a2 authored by darin@apple.com's avatar 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.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@27705 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b1bdd112
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.
......
......@@ -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();
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment