Bug 218098
Summary: | Duplicate checks in overridingContainingBlockContentXXX() | ||
---|---|---|---|
Product: | WebKit | Reporter: | Sergio Villar Senin <svillar> |
Component: | WebCore Misc. | Assignee: | Nobody <webkit-unassigned> |
Status: | NEW | ||
Severity: | Normal | CC: | rbuis, webkit-bug-importer |
Priority: | P2 | Keywords: | InRadar |
Version: | WebKit Nightly Build | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
Sergio Villar Senin
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 | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/70823764>
Rob Buis
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.