NEW 224050
Rename RenderBox::shouldIgnoreAspectRatio
https://bugs.webkit.org/show_bug.cgi?id=224050
Summary Rename RenderBox::shouldIgnoreAspectRatio
alan
Reported 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)
Attachments
Patch (2.87 KB, patch)
2021-04-01 09:00 PDT, alan
no flags
alan
Comment 1 2021-04-01 09:00:39 PDT
Simon Fraser (smfr)
Comment 2 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().
alan
Comment 3 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.
alan
Comment 4 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.
Simon Fraser (smfr)
Comment 5 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.
alan
Comment 6 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.
Radar WebKit Bug Importer
Comment 7 2021-04-08 08:57:13 PDT
Rob Buis
Comment 8 2021-04-30 08:56:57 PDT
I like the idea of the patch. Maybe something like canApplyAspectRatio?
Note You need to log in before you can comment on or make changes to this bug.