Bug 224050 - Rename RenderBox::shouldIgnoreAspectRatio
Summary: Rename RenderBox::shouldIgnoreAspectRatio
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: zalan
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-04-01 08:56 PDT by zalan
Modified: 2021-04-30 08:56 PDT (History)
11 users (show)

See Also:


Attachments
Patch (2.87 KB, patch)
2021-04-01 09:00 PDT, zalan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description zalan 2021-04-01 08:56:15 PDT
This function is about whether the aspect ratio value is applicable and set to a value other than auto and not whether we should ignore the aspect ratio (and we ignore the aspect ratio value for some other reasons)
Comment 1 zalan 2021-04-01 09:00:39 PDT
Created attachment 424900 [details]
Patch
Comment 2 Simon Fraser (smfr) 2021-04-01 09:26:21 PDT
Comment on attachment 424900 [details]
Patch

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

> Source/WebCore/rendering/RenderBox.cpp:5098
> +static inline bool hasAspectRatio(const RenderBox& renderer)

This name is worse than the old one. It should be more like canUseAspectRatio() or aspectRatioApplies().
Comment 3 zalan 2021-04-01 09:59:44 PDT
(In reply to Simon Fraser (smfr) from comment #2)
> Comment on attachment 424900 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=424900&action=review
> 
> > Source/WebCore/rendering/RenderBox.cpp:5098
> > +static inline bool hasAspectRatio(const RenderBox& renderer)
> 
> This name is worse than the old one. It should be more like
> canUseAspectRatio() or aspectRatioApplies().
The function name certainly can be improved but it is definitely not as misleading as the initial name.
Comment 4 zalan 2021-04-01 10:15:52 PDT
(In reply to zalan from comment #3)
> (In reply to Simon Fraser (smfr) from comment #2)
> > Comment on attachment 424900 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=424900&action=review
> > 
> > > Source/WebCore/rendering/RenderBox.cpp:5098
> > > +static inline bool hasAspectRatio(const RenderBox& renderer)
> > 
> > This name is worse than the old one. It should be more like
> > canUseAspectRatio() or aspectRatioApplies().
> The function name certainly can be improved but it is definitely not as
> misleading as the initial name.
This was supposed to be just an extended version of RenderStyle::hasAspectRatio() taking the box type into account.
Comment 5 Simon Fraser (smfr) 2021-04-01 10:54:36 PDT
(In reply to zalan from comment #4)
> (In reply to zalan from comment #3)
> > (In reply to Simon Fraser (smfr) from comment #2)
> > > Comment on attachment 424900 [details]
> > > Patch
> > > 
> > > View in context:
> > > https://bugs.webkit.org/attachment.cgi?id=424900&action=review
> > > 
> > > > Source/WebCore/rendering/RenderBox.cpp:5098
> > > > +static inline bool hasAspectRatio(const RenderBox& renderer)
> > > 
> > > This name is worse than the old one. It should be more like
> > > canUseAspectRatio() or aspectRatioApplies().
> > The function name certainly can be improved but it is definitely not as
> > misleading as the initial name.
> This was supposed to be just an extended version of
> RenderStyle::hasAspectRatio() taking the box type into account.

hasAspectRatio(const RenderBox& renderer) sounds like it's asking "does this box have aspect ratio", by which we really mean "does this box have dimensions controlled by the aspect-ratio property: But aspect-ratio has all these other constraints, like non-auto dimensions. I think it's different from transform in that way, so following hasTransform() is confusing.
Comment 6 zalan 2021-04-01 13:33:55 PDT
(In reply to Simon Fraser (smfr) from comment #5)
> (In reply to zalan from comment #4)
> > (In reply to zalan from comment #3)
> > > (In reply to Simon Fraser (smfr) from comment #2)
> > > > Comment on attachment 424900 [details]
> > > > Patch
> > > > 
> > > > View in context:
> > > > https://bugs.webkit.org/attachment.cgi?id=424900&action=review
> > > > 
> > > > > Source/WebCore/rendering/RenderBox.cpp:5098
> > > > > +static inline bool hasAspectRatio(const RenderBox& renderer)
> > > > 
> > > > This name is worse than the old one. It should be more like
> > > > canUseAspectRatio() or aspectRatioApplies().
> > > The function name certainly can be improved but it is definitely not as
> > > misleading as the initial name.
> > This was supposed to be just an extended version of
> > RenderStyle::hasAspectRatio() taking the box type into account.
> 
> hasAspectRatio(const RenderBox& renderer) sounds like it's asking "does this
> box have aspect ratio", by which we really mean "does this box have
> dimensions controlled by the aspect-ratio property: But aspect-ratio has all
> these other constraints, like non-auto dimensions. I think it's different
> from transform in that way, so following hasTransform() is confusing.
I agree it's not the same and that's why I moved it out of the class (to reduce visibility/misuse) I find it difficult to come up with a meaningful/proper name.
Comment 7 Radar WebKit Bug Importer 2021-04-08 08:57:13 PDT
<rdar://problem/76403114>
Comment 8 Rob Buis 2021-04-30 08:56:57 PDT
I like the idea of the patch. Maybe something like canApplyAspectRatio?