Bug 137845 - Use is<>() / downcast<>() for all remaining RenderObject subclasses
Summary: Use is<>() / downcast<>() for all remaining RenderObject subclasses
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords:
Depends on: 137424
Blocks:
  Show dependency treegraph
 
Reported: 2014-10-17 21:07 PDT by Chris Dumez
Modified: 2014-10-19 20:42 PDT (History)
7 users (show)

See Also:


Attachments
Patch (154.33 KB, patch)
2014-10-17 21:23 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (154.52 KB, patch)
2014-10-18 10:51 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (154.62 KB, patch)
2014-10-19 19:54 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (154.64 KB, patch)
2014-10-19 19:57 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-10-17 21:07:22 PDT
Use is<>() / downcast<>() for all remaining RenderObject subclasses.
Comment 1 Chris Dumez 2014-10-17 21:23:48 PDT
Created attachment 240058 [details]
Patch
Comment 2 Chris Dumez 2014-10-18 10:51:26 PDT
Created attachment 240066 [details]
Patch
Comment 3 Chris Dumez 2014-10-18 11:41:18 PDT
Finally, all the RenderObjects are ported. Getting really close to killing TYPE_CASTS_BASE() macro.
Comment 4 Darin Adler 2014-10-19 19:45:34 PDT
Comment on attachment 240066 [details]
Patch

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

> Source/WebCore/html/HTMLEmbedElement.cpp:63
> +        do {
>              n = n->parentNode();
> -        while (n && !n->hasTagName(objectTag));
> +        } while (n && !is<HTMLObjectElement>(*n));

Why did you add the braces? Also surprised you didn’t rename the “n” variable.
Comment 5 Chris Dumez 2014-10-19 19:47:45 PDT
Comment on attachment 240066 [details]
Patch

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

>> Source/WebCore/html/HTMLEmbedElement.cpp:63
>> +        } while (n && !is<HTMLObjectElement>(*n));
> 
> Why did you add the braces? Also surprised you didn’t rename the “n” variable.

The style checker complained. Was the style script wrong? Are we supposed to omit them in this case?

I'll rename the variable.
Comment 6 Chris Dumez 2014-10-19 19:54:05 PDT
Created attachment 240094 [details]
Patch
Comment 7 Darin Adler 2014-10-19 19:55:39 PDT
Comment on attachment 240066 [details]
Patch

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

>>> Source/WebCore/html/HTMLEmbedElement.cpp:63
>>> +        } while (n && !is<HTMLObjectElement>(*n));
>> 
>> Why did you add the braces? Also surprised you didn’t rename the “n” variable.
> 
> The style checker complained. Was the style script wrong? Are we supposed to omit them in this case?
> 
> I'll rename the variable.

I’m not sure. The coding style document doesn’t say one way or another. I am kind of annoyed at the style script making rules that we didn’t write down first, but I suppose there’s a lot of that.

Since I personally prefer braces even for one line if statements, I suppose it would be good to have our strange if rule be only for if statements, and not for looping constructs.
Comment 8 WebKit Commit Bot 2014-10-19 19:56:56 PDT
Attachment 240094 [details] did not pass style-queue:


ERROR: Source/WebCore/html/HTMLEmbedElement.cpp:63:  Semicolon defining empty statement for this loop. Use { } instead.  [whitespace/semicolon] [5]
Total errors found: 1 in 63 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 9 Chris Dumez 2014-10-19 19:57:37 PDT
Created attachment 240095 [details]
Patch
Comment 10 Chris Dumez 2014-10-19 19:58:33 PDT
(In reply to comment #7)
> Comment on attachment 240066 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=240066&action=review
> 
> >>> Source/WebCore/html/HTMLEmbedElement.cpp:63
> >>> +        } while (n && !is<HTMLObjectElement>(*n));
> >> 
> >> Why did you add the braces? Also surprised you didn’t rename the “n” variable.
> > 
> > The style checker complained. Was the style script wrong? Are we supposed to omit them in this case?
> > 
> > I'll rename the variable.
> 
> I’m not sure. The coding style document doesn’t say one way or another. I am
> kind of annoyed at the style script making rules that we didn’t write down
> first, but I suppose there’s a lot of that.
> 
> Since I personally prefer braces even for one line if statements, I suppose
> it would be good to have our strange if rule be only for if statements, and
> not for looping constructs.

Ok, I also prefer the braces in this particular case. I left the braces in but renamed the n variable to node.
Comment 11 WebKit Commit Bot 2014-10-19 20:42:03 PDT
Comment on attachment 240095 [details]
Patch

Clearing flags on attachment: 240095

Committed r174875: <http://trac.webkit.org/changeset/174875>
Comment 12 WebKit Commit Bot 2014-10-19 20:42:09 PDT
All reviewed patches have been landed.  Closing bug.