[Webkit-unassigned] [Bug 176620] New: In regular block layout, the width of a child's margin box should always be equal to that of its containing block
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Fri Sep 8 11:25:58 PDT 2017
https://bugs.webkit.org/show_bug.cgi?id=176620
Bug ID: 176620
Summary: In regular block layout, the width of a child's margin
box should always be equal to that of its containing
block
Product: WebKit
Version: Safari 10
Hardware: Unspecified
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: Layout and Rendering
Assignee: webkit-unassigned at lists.webkit.org
Reporter: facetothefate at gmail.com
CC: bfulgham at webkit.org, simon.fraser at apple.com,
zalan at apple.com
Hi,
Orignally, I have filed a bug in blink here:
https://bugs.chromium.org/p/chromium/issues/detail?id=708751
Today I find I repoduce it on my safari.
After checking the code, it looks we have same root cause here
LayoutUnit newMargin = containerLogicalWidth - computedValues.m_extent - cb.marginStartForChild(*this);
bool hasInvertedDirection = cb.style().isLeftToRightDirection() != style().isLeftToRightDirection();
if (hasInvertedDirection)
computedValues.m_margins.m_start = newMargin;
else
computedValues.m_margins.m_end = newMargin;
Simply because at this time marginStartForChild have not been set yet.
if you saw here:
void RenderBox::updateLogicalWidth()
{
LogicalExtentComputedValues computedValues;
computeLogicalWidthInRegion(computedValues);
setLogicalWidth(computedValues.m_extent);
setLogicalLeft(computedValues.m_position);
setMarginStart(computedValues.m_margins.m_start);
setMarginEnd(computedValues.m_margins.m_end);
}
we are calling computeLogicalWidthInRegion first, then use the result to update the margin.
Therefore below path will fix it as I did for blink:
LayoutUnit newMarginTotal = containerLogicalWidth - computedValues.m_extent;
bool hasInvertedDirection = cb.style().isLeftToRightDirection() != style().isLeftToRightDirection();
if (hasInvertedDirection)
computedValues.m_margins.m_start =
newMarginTotal - computedValues..m_margins.m_end;
else
computedValues.m_margins.m_end =
newMarginTotal - computedValues..m_margins.m_start;
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20170908/7231a1ae/attachment-0001.html>
More information about the webkit-unassigned
mailing list