Bug 63540 - XMLDocumentParserQt.cpp incorrectly converts 0-based number into 1-based number
Summary: XMLDocumentParserQt.cpp incorrectly converts 0-based number into 1-based number
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Qt (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-28 09:56 PDT by Peter Rybin
Modified: 2011-09-16 11:46 PDT (History)
3 users (show)

See Also:


Attachments
Patch (97.88 KB, patch)
2011-09-14 16:13 PDT, Peter Rybin
no flags Details | Formatted Diff | Diff
Patch (98.95 KB, patch)
2011-09-15 09:01 PDT, Peter Rybin
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Rybin 2011-06-28 09:56:19 PDT
Its method textPositionOneBased has incorrect converting. Now that number are typed it is evident. Probably underlying m_stream.lineNumber is incorrectly reinterpreted as 0-based value.
Comment 1 Peter Rybin 2011-09-14 16:13:59 PDT
Created attachment 107418 [details]
Patch
Comment 2 Adam Barth 2011-09-14 16:43:25 PDT
Comment on attachment 107418 [details]
Patch

Usually we add "using WTF::ZeroBasedNumber" to the header so we don't need to use the WTF macro everywhere.  Have you validated that the new line numbers in the tests are all right?
Comment 3 Peter Rybin 2011-09-14 16:47:44 PDT
(In reply to comment #2)
> (From update of attachment 107418 [details])
> Usually we add "using WTF::ZeroBasedNumber" to the header so we don't need to use the WTF macro everywhere.  Have you validated that the new line numbers in the tests are all right?

I considered this type somewhat temporary (2 type are to be merged into "BasedNumber" maybe). However let me try to add 'using' anyway.

Yes, I went over all expectations and checked that the new numbers are correct.
Comment 4 Peter Rybin 2011-09-15 09:01:28 PDT
Created attachment 107501 [details]
Patch
Comment 5 Adam Barth 2011-09-15 11:25:30 PDT
Comment on attachment 107501 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=107501&action=review

Thanks.

> Source/WebCore/html/parser/HTMLDocumentParser.cpp:451
> -    return m_tokenizer->lineNumber();
> +    return ZeroBasedNumber::fromZeroBasedInt(m_tokenizer->lineNumber());

Should m_tokenizer->lineNumber() return a ZeroBasedNumber ?
Comment 6 WebKit Review Bot 2011-09-15 11:55:19 PDT
Comment on attachment 107501 [details]
Patch

Rejecting attachment 107501 [details] from commit-queue.

peter.rybin@gmail.com does not have committer permissions according to http://trac.webkit.org/browser/trunk/Tools/Scripts/webkitpy/common/config/committers.py.

- If you do not have committer rights please read http://webkit.org/coding/contributing.html for instructions on how to use bugzilla flags.

- If you have committer rights please correct the error in Tools/Scripts/webkitpy/common/config/committers.py by adding yourself to the file (no review needed).  The commit-queue restarts itself every 2 hours.  After restart the commit-queue will correctly respect your committer rights.
Comment 7 anton muhin 2011-09-15 12:31:09 PDT
Comment on attachment 107501 [details]
Patch

Let's give it a try again
Comment 8 WebKit Review Bot 2011-09-15 13:49:01 PDT
Comment on attachment 107501 [details]
Patch

Clearing flags on attachment: 107501

Committed r95223: <http://trac.webkit.org/changeset/95223>
Comment 9 WebKit Review Bot 2011-09-15 13:49:06 PDT
All reviewed patches have been landed.  Closing bug.
Comment 10 Peter Rybin 2011-09-16 11:46:01 PDT
> > Source/WebCore/html/parser/HTMLDocumentParser.cpp:451
> > -    return m_tokenizer->lineNumber();
> > +    return ZeroBasedNumber::fromZeroBasedInt(m_tokenizer->lineNumber());
> 
> Should m_tokenizer->lineNumber() return a ZeroBasedNumber ?

I think so. I'm going to change it in the next bug/patch. However I realize that I won't be able to replace all integers with *BasedNumbers myself everywhere.