NEW 218098
Duplicate checks in overridingContainingBlockContentXXX()
https://bugs.webkit.org/show_bug.cgi?id=218098
Summary Duplicate checks in overridingContainingBlockContentXXX()
Sergio Villar Senin
Reported 2020-10-22 13:44:47 PDT
RenderBoxModelObject.h defines overridingContainingBlockContentWidth() and overridingContainingBlockContentHeight(). Both of them return an Optional<LayoutUnit> apparently to deal with the case of not having an overriding size in the containing block. However the very same file also defines hasOverridingContainingBlockContentWidth() and hasOverridingContainingBlockContentHeight(). This means that there are multiple occurrences of: if (hasOverridingContainingBlockContentWidth()) if (auto width = overridingContainingBlockContentWidth()) return width.value(); duplicating the checks. We should figure out why that was done like this and remove the extra check if needed. Note that RenderBox.h replicates the same pattern with hasOverridingContainingBlockContentLogical{Height|Width}()
Attachments
Radar WebKit Bug Importer
Comment 1 2020-10-29 13:45:16 PDT
Rob Buis
Comment 2 2021-04-30 09:18:18 PDT
This is probably not possible. The code wants to distinguish between nullopt as in "there is nothing set" and "there is something set but it is not a number": if (logicalHeight.isPercentOrCalculated() && hasOverridingContainingBlockContentLogicalHeight()) return overridingContainingBlockContentLogicalHeight() == WTF::nullopt; It may be possible to set some magic value not nullopt for "there is something set but it is not a number" but I don't think it is worth it personally.
Note You need to log in before you can comment on or make changes to this bug.