Bug 166628 - Remove PassRefPtr use from the "css" directory, related cleanup
Summary: Remove PassRefPtr use from the "css" directory, related cleanup
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Darin Adler
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-30 19:03 PST by Darin Adler
Modified: 2016-12-31 01:18 PST (History)
0 users

See Also:


Attachments
Patch (60.04 KB, patch)
2016-12-30 19:23 PST, Darin Adler
achristensen: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Adler 2016-12-30 19:03:50 PST
Remove PassRefPtr use from the "css" directory, related cleanup
Comment 1 Darin Adler 2016-12-30 19:23:28 PST
Created attachment 297867 [details]
Patch
Comment 2 Alex Christensen 2016-12-30 22:01:03 PST
Comment on attachment 297867 [details]
Patch

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

> Source/WebCore/css/CSSGradientValue.cpp:98
> +    ASSERT(is<CSSRadialGradientValue>(value));

If we add conical gradients but forget to update this, then this assertion will no longer necessarily be true.  I liked the old design.  It was safer.  If only we could switch(type) or something...

> Source/WebCore/css/CSSImageGeneratorValue.cpp:73
> -    m_clients.add(renderer);
> +    m_clients.add(&renderer);

Can we make m_clients a HashCountedSet<std::reference_wrapper<RenderElement>> ?

> Source/WebCore/rendering/style/StyleGeneratedImage.cpp:103
> +    ASSERT(renderer);

It seems like we should make the parameter type a RenderElement& instead of this.
Comment 3 Darin Adler 2016-12-31 01:17:45 PST
Comment on attachment 297867 [details]
Patch

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

>> Source/WebCore/css/CSSGradientValue.cpp:98
>> +    ASSERT(is<CSSRadialGradientValue>(value));
> 
> If we add conical gradients but forget to update this, then this assertion will no longer necessarily be true.  I liked the old design.  It was safer.  If only we could switch(type) or something...

A tiny bit safer in theory, but also an untested unreachable code path. I definitely did not like the old design. Maybe we should talk in person?

>> Source/WebCore/css/CSSImageGeneratorValue.cpp:73
>> +    m_clients.add(&renderer);
> 
> Can we make m_clients a HashCountedSet<std::reference_wrapper<RenderElement>> ?

I have no idea; this is a recurring pattern elsewhere so we should try that at some point.

>> Source/WebCore/rendering/style/StyleGeneratedImage.cpp:103
>> +    ASSERT(renderer);
> 
> It seems like we should make the parameter type a RenderElement& instead of this.

Absolutely; we can keep pulling on the thread of the functions that take pointers that should be references. I didn’t want to go even further in my refactoring in this patch, so this is one of the places where I drew the line.
Comment 4 Darin Adler 2016-12-31 01:18:29 PST
Committed r210215: <http://trac.webkit.org/changeset/210215>