Bug 137184 - Use the new is<>() / downcast<>() for more Node subclasses
Summary: Use the new is<>() / downcast<>() for more Node subclasses
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords:
Depends on: 137056
Blocks:
  Show dependency treegraph
 
Reported: 2014-09-27 15:43 PDT by Chris Dumez
Modified: 2014-09-27 22:21 PDT (History)
4 users (show)

See Also:


Attachments
Patch (28.21 KB, patch)
2014-09-27 15:47 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (28.00 KB, patch)
2014-09-27 20:44 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (28.05 KB, patch)
2014-09-27 21:39 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2014-09-27 15:43:58 PDT
Use the new is<>() / downcast<>() for more Node subclasses
Comment 1 Chris Dumez 2014-09-27 15:47:13 PDT
Created attachment 238792 [details]
Patch
Comment 2 Ryosuke Niwa 2014-09-27 19:46:46 PDT
Comment on attachment 238792 [details]
Patch

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

> Source/WebCore/dom/Range.cpp:665
>      case Node::PROCESSING_INSTRUCTION_NODE:
> -        return toProcessingInstruction(node)->data().length();
> +        return downcast<ProcessingInstruction>(*node).data().length();

Since ProcessingInstruction inherits from CharacterData, can't we combine this with the case above??

> Source/WebCore/dom/Range.cpp:1163
>          case Node::PROCESSING_INSTRUCTION_NODE:
> -            if (static_cast<unsigned>(offset) > toProcessingInstruction(n)->data().length())
> +            if (static_cast<unsigned>(offset) > downcast<ProcessingInstruction>(*n).data().length())

Ditto about merging this case with CharacterData.
Comment 3 Chris Dumez 2014-09-27 20:43:08 PDT
Comment on attachment 238792 [details]
Patch

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

>> Source/WebCore/dom/Range.cpp:665
>> +        return downcast<ProcessingInstruction>(*node).data().length();
> 
> Since ProcessingInstruction inherits from CharacterData, can't we combine this with the case above??

Nice catch, I don't see why not.
Comment 4 Chris Dumez 2014-09-27 20:44:22 PDT
Created attachment 238797 [details]
Patch
Comment 5 Chris Dumez 2014-09-27 21:39:07 PDT
Created attachment 238801 [details]
Patch
Comment 6 WebKit Commit Bot 2014-09-27 22:21:36 PDT
Comment on attachment 238801 [details]
Patch

Clearing flags on attachment: 238801

Committed r174039: <http://trac.webkit.org/changeset/174039>
Comment 7 WebKit Commit Bot 2014-09-27 22:21:40 PDT
All reviewed patches have been landed.  Closing bug.