Bug 96704

Summary: Simplify some code in RenderBox::computePercentageLogicalHeight
Product: WebKit Reporter: Ojan Vafai <ojan>
Component: New BugsAssignee: Ojan Vafai <ojan>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, eric, hyatt, tony
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch tony: review+

Ojan Vafai
Reported 2012-09-13 16:23:12 PDT
Simplify some code in RenderBox::computePercentageLogicalHeight
Attachments
Patch (6.00 KB, patch)
2012-09-13 16:24 PDT, Ojan Vafai
no flags
Patch (7.42 KB, patch)
2012-09-14 11:17 PDT, Ojan Vafai
tony: review+
Ojan Vafai
Comment 1 2012-09-13 16:24:18 PDT
Tony Chang
Comment 2 2012-09-14 09:58:21 PDT
Comment on attachment 163996 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=163996&action=review > Source/WebCore/rendering/RenderBox.cpp:-2129 > - // In quirks mode, blocks with auto height are skipped, and we keep looking for an enclosing > - // block that may have a specified height and then use it. In strict mode, this violates the > - // specification, which states that percentage heights just revert to auto if the containing > - // block has an auto height. We still skip anonymous containing blocks in both modes, though, and look I kind of like the comment about how quirks mode and standards mode are different. Maybe just rewrite it into a shorter sentence? > Source/WebCore/rendering/RenderBox.cpp:2130 > + while ((document()->inQuirksMode() || cb->isAnonymousBlock()) > + && !cb->isRenderView() && !cb->isTableCell() && !cb->isOutOfFlowPositioned() && cb->style()->logicalHeight().isAuto() && isHorizontalWritingMode() == cb->isHorizontalWritingMode()) { I find this impossible to read, even the old code was easier to read. Can we make a helper function or something?
Tony Chang
Comment 3 2012-09-14 10:04:08 PDT
(In reply to comment #2) > (From update of attachment 163996 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=163996&action=review > > > Source/WebCore/rendering/RenderBox.cpp:2130 > > + while ((document()->inQuirksMode() || cb->isAnonymousBlock()) > > + && !cb->isRenderView() && !cb->isTableCell() && !cb->isOutOfFlowPositioned() && cb->style()->logicalHeight().isAuto() && isHorizontalWritingMode() == cb->isHorizontalWritingMode()) { > > I find this impossible to read, even the old code was easier to read. Can we make a helper function or something? Something like, bool shouldTraverseParentForPercentHeight() { return document()->inQuirksMode() || cb->isAnonymousBlock(); } and bool useParentHeightForPrecentHeight() { return !cb->isTableCell() && !cb->isOutOfFlowPositioned() && cb->style()->logicalHeight().isAuto() && isHorizontalWritingMode() == cb->isHorizontalWritingMode(); } So the while would be: while (!cb->isRenderView() && shouldTraverseParentForPercentHeight() && useParentHeightForPercentHeight()) { ... }
Ojan Vafai
Comment 4 2012-09-14 11:17:39 PDT
Ojan Vafai
Comment 5 2012-09-14 11:42:26 PDT
Note You need to log in before you can comment on or make changes to this bug.