Bug 64398 - Character reference parser for new XML parser
: Character reference parser for new XML parser
Status: RESOLVED FIXED
: WebKit
New Bugs
: 528+ (Nightly build)
: Unspecified Unspecified
: P2 Normal
Assigned To:
:
:
:
: 64396
  Show dependency treegraph
 
Reported: 2011-07-12 14:48 PST by
Modified: 2011-07-14 13:08 PST (History)


Attachments
Patch (14.64 KB, patch)
2011-07-12 16:36 PST, Jeffrey Pfau
no flags Review Patch | Details | Formatted Diff | Diff
Patch (30.04 KB, patch)
2011-07-13 17:57 PST, Jeffrey Pfau
no flags Review Patch | Details | Formatted Diff | Diff
Patch for landing (30.03 KB, patch)
2011-07-14 12:15 PST, Jeffrey Pfau
no flags Review Patch | Details | Formatted Diff | Diff


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2011-07-12 14:48:14 PST
Character reference parser for new XML parser
------- Comment #1 From 2011-07-12 16:36:05 PST -------
Created an attachment (id=100586) [details]
Patch
------- Comment #2 From 2011-07-12 16:48:52 PST -------
(From update of attachment 100586 [details])
View in context: https://bugs.webkit.org/attachment.cgi?id=100586&action=review

> Source/WebCore/xml/parser/XMLCharacterReferenceParser.cpp:37
> +namespace {

No need to indent for namespaces.

> Source/WebCore/xml/parser/XMLCharacterReferenceParser.cpp:46
> +    inline UChar adjustEntity(UChar32 value)

You probably don't need this for XML.  This is a strange HTML legacy thing.

> Source/WebCore/xml/parser/XMLCharacterReferenceParser.cpp:94
> +bool consumeCharacterReference(SegmentedString& source, Vector<UChar, 16>& decodedCharacter, bool& notEnoughCharacters)

You should be able to share almost all of this code with the HTML version by taking convertToUTF16 as a template parameter.
------- Comment #3 From 2011-07-12 16:52:10 PST -------
(From update of attachment 100586 [details])
I'm going to make this r- to encourage you to share more code using a template.
------- Comment #4 From 2011-07-13 17:57:44 PST -------
Created an attachment (id=100743) [details]
Patch
------- Comment #5 From 2011-07-13 18:45:50 PST -------
(From update of attachment 100743 [details])
View in context: https://bugs.webkit.org/attachment.cgi?id=100743&action=review

This looks great.  We could od some work to fixup some naming mistakes I made when writing this code originally, but that's nto a big deal.  (The most pervasive one is renaming "cc" to either currentCharacter or "c" as appropriate.)

> Source/WebCore/xml/parser/CharacterReferenceParserInlineMethods.h:28
> +#ifndef CharacterReferenceParserInlineMethods_h
> +#define CharacterReferenceParserInlineMethods_h

I'd drop the word "Methods" from the name of this file/

> Source/WebCore/xml/parser/CharacterReferenceParserInlineMethods.h:51
> +template <typename ParserFunctions>
> +inline bool consumeCharacterReference(SegmentedString& source, Vector<UChar, 16>& decodedCharacter, bool& notEnoughCharacters, UChar additionalAllowedCharacter)

jamesr says to get rid of this inline keyword.  That's probably the right.  The compiler will probably just generate an unconditional jump anyway.

> Source/WebCore/xml/parser/XMLCharacterReferenceParser.cpp:45
> +        return 0xFFFD;

bad indents in this file.

> Source/WebCore/xml/parser/XMLCharacterReferenceParser.cpp:66
> +        ASSERT_NOT_REACHED();

Do you mean notImplemented() ?
------- Comment #6 From 2011-07-13 18:46:21 PST -------
You should also listen to whatever suggestions jamesr has.
------- Comment #7 From 2011-07-14 12:15:35 PST -------
Created an attachment (id=100840) [details]
Patch for landing
------- Comment #8 From 2011-07-14 13:08:23 PST -------
(From update of attachment 100840 [details])
Clearing flags on attachment: 100840

Committed r91025: <http://trac.webkit.org/changeset/91025>
------- Comment #9 From 2011-07-14 13:08:28 PST -------
All reviewed patches have been landed.  Closing bug.