Bug 64398

Summary: Character reference parser for new XML parser
Product: WebKit Reporter: Vicki Pfau <jeffrey+webkit>
Component: New BugsAssignee: Vicki Pfau <jeffrey+webkit>
Severity: Normal CC: abarth, jamesr, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 64396    
Description Flags
Patch for landing none

Description Vicki Pfau 2011-07-12 14:48:14 PDT
Character reference parser for new XML parser
Comment 1 Vicki Pfau 2011-07-12 16:36:05 PDT
Created attachment 100586 [details]
Comment 2 Adam Barth 2011-07-12 16:48:52 PDT
Comment on 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 Adam Barth 2011-07-12 16:52:10 PDT
Comment on attachment 100586 [details]

I'm going to make this r- to encourage you to share more code using a template.
Comment 4 Vicki Pfau 2011-07-13 17:57:44 PDT
Created attachment 100743 [details]
Comment 5 Adam Barth 2011-07-13 18:45:50 PDT
Comment on 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 Adam Barth 2011-07-13 18:46:21 PDT
You should also listen to whatever suggestions jamesr has.
Comment 7 Vicki Pfau 2011-07-14 12:15:35 PDT
Created attachment 100840 [details]
Patch for landing
Comment 8 WebKit Review Bot 2011-07-14 13:08:23 PDT
Comment on attachment 100840 [details]
Patch for landing

Clearing flags on attachment: 100840

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