|
Lines 280-289
VerticalGeometry FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeomet
a/Source/WebCore/layout/FormattingContextGeometry.cpp_sec1
|
| 280 |
auto top = computedValueIfNotAuto(style.logicalTop(), containingBlockWidth); |
280 |
auto top = computedValueIfNotAuto(style.logicalTop(), containingBlockWidth); |
| 281 |
auto bottom = computedValueIfNotAuto(style.logicalBottom(), containingBlockWidth); |
281 |
auto bottom = computedValueIfNotAuto(style.logicalBottom(), containingBlockWidth); |
| 282 |
auto height = usedHeight ? usedHeight.value() : computedHeightValue(layoutState, layoutBox, HeightType::Normal); |
282 |
auto height = usedHeight ? usedHeight.value() : computedHeightValue(layoutState, layoutBox, HeightType::Normal); |
| 283 |
auto computedMarginBefore = computedValueIfNotAuto(style.marginBefore(), containingBlockWidth); |
283 |
auto computedVerticalMargin = Geometry::computedVerticalMargin(layoutState, layoutBox); |
| 284 |
auto computedMarginAfter = computedValueIfNotAuto(style.marginAfter(), containingBlockWidth); |
284 |
UsedVerticalMargin::NonCollapsedValues usedVerticalMargin; |
| 285 |
auto usedMarginBefore = computedMarginBefore; |
|
|
| 286 |
auto usedMarginAfter = computedMarginAfter; |
| 287 |
auto paddingTop = displayBox.paddingTop().valueOr(0); |
285 |
auto paddingTop = displayBox.paddingTop().valueOr(0); |
| 288 |
auto paddingBottom = displayBox.paddingBottom().valueOr(0); |
286 |
auto paddingBottom = displayBox.paddingBottom().valueOr(0); |
| 289 |
auto borderTop = displayBox.borderTop(); |
287 |
auto borderTop = displayBox.borderTop(); |
|
Lines 293-364
VerticalGeometry FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeomet
a/Source/WebCore/layout/FormattingContextGeometry.cpp_sec2
|
| 293 |
top = staticVerticalPositionForOutOfFlowPositioned(layoutState, layoutBox); |
291 |
top = staticVerticalPositionForOutOfFlowPositioned(layoutState, layoutBox); |
| 294 |
|
292 |
|
| 295 |
if (top && height && bottom) { |
293 |
if (top && height && bottom) { |
| 296 |
if (!usedMarginBefore && !usedMarginAfter) { |
294 |
if (!computedVerticalMargin.before && !computedVerticalMargin.after) { |
| 297 |
auto marginBeforeAndAfter = containingBlockHeight - (*top + borderTop + paddingTop + *height + paddingBottom + borderBottom + *bottom); |
295 |
auto marginBeforeAndAfter = containingBlockHeight - (*top + borderTop + paddingTop + *height + paddingBottom + borderBottom + *bottom); |
| 298 |
usedMarginBefore = usedMarginAfter = marginBeforeAndAfter / 2; |
296 |
usedVerticalMargin = { marginBeforeAndAfter / 2, marginBeforeAndAfter / 2 }; |
| 299 |
} else if (!usedMarginBefore) |
297 |
} else if (!computedVerticalMargin.before) { |
| 300 |
usedMarginBefore = containingBlockHeight - (*top + borderTop + paddingTop + *height + paddingBottom + borderBottom + *usedMarginAfter + *bottom); |
298 |
usedVerticalMargin.after = *computedVerticalMargin.after; |
| 301 |
else |
299 |
usedVerticalMargin.before = containingBlockHeight - (*top + borderTop + paddingTop + *height + paddingBottom + borderBottom + usedVerticalMargin.after + *bottom); |
| 302 |
usedMarginAfter = containingBlockHeight - (*top + *usedMarginBefore + borderTop + paddingTop + *height + paddingBottom + borderBottom + *bottom); |
300 |
} else { |
|
|
301 |
usedVerticalMargin.before = *computedVerticalMargin.before; |
| 302 |
usedVerticalMargin.after = containingBlockHeight - (*top + usedVerticalMargin.before + borderTop + paddingTop + *height + paddingBottom + borderBottom + *bottom); |
| 303 |
} |
| 303 |
// Over-constrained? |
304 |
// Over-constrained? |
| 304 |
auto boxHeight = *top + *usedMarginBefore + borderTop + paddingTop + *height + paddingBottom + borderBottom + *usedMarginAfter + *bottom; |
305 |
auto boxHeight = *top + usedVerticalMargin.before + borderTop + paddingTop + *height + paddingBottom + borderBottom + usedVerticalMargin.after + *bottom; |
| 305 |
if (boxHeight > containingBlockHeight) |
306 |
if (boxHeight > containingBlockHeight) |
| 306 |
bottom = containingBlockHeight - (*top + *usedMarginBefore + borderTop + paddingTop + *height + paddingBottom + borderBottom + *usedMarginAfter); |
307 |
bottom = containingBlockHeight - (*top + usedVerticalMargin.before + borderTop + paddingTop + *height + paddingBottom + borderBottom + usedVerticalMargin.after); |
| 307 |
} |
308 |
} |
| 308 |
|
309 |
|
| 309 |
if (!top && !height && bottom) { |
310 |
if (!top && !height && bottom) { |
| 310 |
// #1 |
311 |
// #1 |
| 311 |
height = contentHeightForFormattingContextRoot(layoutState, layoutBox); |
312 |
height = contentHeightForFormattingContextRoot(layoutState, layoutBox); |
| 312 |
usedMarginBefore = usedMarginBefore.valueOr(0); |
313 |
usedVerticalMargin = { computedVerticalMargin.before.valueOr(0), computedVerticalMargin.after.valueOr(0) }; |
| 313 |
usedMarginAfter = usedMarginAfter.valueOr(0); |
314 |
top = containingBlockHeight - (usedVerticalMargin.before + borderTop + paddingTop + *height + paddingBottom + borderBottom + usedVerticalMargin.after + *bottom); |
| 314 |
top = containingBlockHeight - (*usedMarginBefore + borderTop + paddingTop + *height + paddingBottom + borderBottom + *usedMarginAfter + *bottom); |
|
|
| 315 |
} |
315 |
} |
| 316 |
|
316 |
|
| 317 |
if (!top && !bottom && height) { |
317 |
if (!top && !bottom && height) { |
| 318 |
// #2 |
318 |
// #2 |
| 319 |
top = staticVerticalPositionForOutOfFlowPositioned(layoutState, layoutBox); |
319 |
top = staticVerticalPositionForOutOfFlowPositioned(layoutState, layoutBox); |
| 320 |
usedMarginBefore = usedMarginBefore.valueOr(0); |
320 |
usedVerticalMargin = { computedVerticalMargin.before.valueOr(0), computedVerticalMargin.after.valueOr(0) }; |
| 321 |
usedMarginAfter = usedMarginAfter.valueOr(0); |
321 |
bottom = containingBlockHeight - (*top + usedVerticalMargin.before + borderTop + paddingTop + *height + paddingBottom + borderBottom + usedVerticalMargin.after); |
| 322 |
bottom = containingBlockHeight - (*top + *usedMarginBefore + borderTop + paddingTop + *height + paddingBottom + borderBottom + *usedMarginAfter); |
|
|
| 323 |
} |
322 |
} |
| 324 |
|
323 |
|
| 325 |
if (!height && !bottom && top) { |
324 |
if (!height && !bottom && top) { |
| 326 |
// #3 |
325 |
// #3 |
| 327 |
height = contentHeightForFormattingContextRoot(layoutState, layoutBox); |
326 |
height = contentHeightForFormattingContextRoot(layoutState, layoutBox); |
| 328 |
usedMarginBefore = usedMarginBefore.valueOr(0); |
327 |
usedVerticalMargin = { computedVerticalMargin.before.valueOr(0), computedVerticalMargin.after.valueOr(0) }; |
| 329 |
usedMarginAfter = usedMarginAfter.valueOr(0); |
328 |
bottom = containingBlockHeight - (*top + usedVerticalMargin.before + borderTop + paddingTop + *height + paddingBottom + borderBottom + usedVerticalMargin.after); |
| 330 |
bottom = containingBlockHeight - (*top + *usedMarginBefore + borderTop + paddingTop + *height + paddingBottom + borderBottom + *usedMarginAfter); |
|
|
| 331 |
} |
329 |
} |
| 332 |
|
330 |
|
| 333 |
if (!top && height && bottom) { |
331 |
if (!top && height && bottom) { |
| 334 |
// #4 |
332 |
// #4 |
| 335 |
usedMarginBefore = usedMarginBefore.valueOr(0); |
333 |
usedVerticalMargin = { computedVerticalMargin.before.valueOr(0), computedVerticalMargin.after.valueOr(0) }; |
| 336 |
usedMarginAfter = usedMarginAfter.valueOr(0); |
334 |
top = containingBlockHeight - (usedVerticalMargin.before + borderTop + paddingTop + *height + paddingBottom + borderBottom + usedVerticalMargin.after + *bottom); |
| 337 |
top = containingBlockHeight - (*usedMarginBefore + borderTop + paddingTop + *height + paddingBottom + borderBottom + *usedMarginAfter + *bottom); |
|
|
| 338 |
} |
335 |
} |
| 339 |
|
336 |
|
| 340 |
if (!height && top && bottom) { |
337 |
if (!height && top && bottom) { |
| 341 |
// #5 |
338 |
// #5 |
| 342 |
usedMarginBefore = usedMarginBefore.valueOr(0); |
339 |
usedVerticalMargin = { computedVerticalMargin.before.valueOr(0), computedVerticalMargin.after.valueOr(0) }; |
| 343 |
usedMarginAfter = usedMarginAfter.valueOr(0); |
340 |
height = containingBlockHeight - (*top + usedVerticalMargin.before + borderTop + paddingTop + paddingBottom + borderBottom + usedVerticalMargin.after + *bottom); |
| 344 |
height = containingBlockHeight - (*top + *usedMarginBefore + borderTop + paddingTop + paddingBottom + borderBottom + *usedMarginAfter + *bottom); |
|
|
| 345 |
} |
341 |
} |
| 346 |
|
342 |
|
| 347 |
if (!bottom && top && height) { |
343 |
if (!bottom && top && height) { |
| 348 |
// #6 |
344 |
// #6 |
| 349 |
usedMarginBefore = usedMarginBefore.valueOr(0); |
345 |
usedVerticalMargin = { computedVerticalMargin.before.valueOr(0), computedVerticalMargin.after.valueOr(0) }; |
| 350 |
usedMarginAfter = usedMarginAfter.valueOr(0); |
346 |
bottom = containingBlockHeight - (*top + usedVerticalMargin.before + borderTop + paddingTop + *height + paddingBottom + borderBottom + usedVerticalMargin.after); |
| 351 |
bottom = containingBlockHeight - (*top + *usedMarginBefore + borderTop + paddingTop + *height + paddingBottom + borderBottom + *usedMarginAfter); |
|
|
| 352 |
} |
347 |
} |
| 353 |
|
348 |
|
| 354 |
ASSERT(top); |
349 |
ASSERT(top); |
| 355 |
ASSERT(bottom); |
350 |
ASSERT(bottom); |
| 356 |
ASSERT(height); |
351 |
ASSERT(height); |
| 357 |
ASSERT(usedMarginBefore); |
|
|
| 358 |
ASSERT(usedMarginAfter); |
| 359 |
|
352 |
|
| 360 |
LOG_WITH_STREAM(FormattingContextLayout, stream << "[Position][Height][Margin] -> out-of-flow non-replaced -> top(" << *top << "px) bottom(" << *bottom << "px) height(" << *height << "px) margin(" << *usedMarginBefore << "px, " << *usedMarginAfter << "px) layoutBox(" << &layoutBox << ")"); |
353 |
LOG_WITH_STREAM(FormattingContextLayout, stream << "[Position][Height][Margin] -> out-of-flow non-replaced -> top(" << *top << "px) bottom(" << *bottom << "px) height(" << *height << "px) margin(" << usedVerticalMargin.before << "px, " << usedVerticalMargin.after << "px) layoutBox(" << &layoutBox << ")"); |
| 361 |
return { *top, *bottom, { *height, { { *usedMarginBefore, *usedMarginAfter }, { } } } }; |
354 |
return { *top, *bottom, { *height, { usedVerticalMargin, { } } } }; |
| 362 |
} |
355 |
} |
| 363 |
|
356 |
|
| 364 |
HorizontalGeometry FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry(LayoutState& layoutState, const Box& layoutBox, Optional<LayoutUnit> usedWidth) |
357 |
HorizontalGeometry FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry(LayoutState& layoutState, const Box& layoutBox, Optional<LayoutUnit> usedWidth) |
|
Lines 523-532
VerticalGeometry FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry(
a/Source/WebCore/layout/FormattingContextGeometry.cpp_sec3
|
| 523 |
auto top = computedValueIfNotAuto(style.logicalTop(), containingBlockWidth); |
516 |
auto top = computedValueIfNotAuto(style.logicalTop(), containingBlockWidth); |
| 524 |
auto bottom = computedValueIfNotAuto(style.logicalBottom(), containingBlockWidth); |
517 |
auto bottom = computedValueIfNotAuto(style.logicalBottom(), containingBlockWidth); |
| 525 |
auto height = inlineReplacedHeightAndMargin(layoutState, layoutBox, usedHeight).height; |
518 |
auto height = inlineReplacedHeightAndMargin(layoutState, layoutBox, usedHeight).height; |
| 526 |
auto computedMarginBefore = computedValueIfNotAuto(style.marginBefore(), containingBlockWidth); |
519 |
auto computedVerticalMargin = Geometry::computedVerticalMargin(layoutState, layoutBox); |
| 527 |
auto computedMarginAfter = computedValueIfNotAuto(style.marginAfter(), containingBlockWidth); |
520 |
UsedVerticalMargin::NonCollapsedValues usedVerticalMargin; |
| 528 |
auto usedMarginBefore = computedMarginBefore; |
|
|
| 529 |
auto usedMarginAfter = computedMarginAfter; |
| 530 |
auto paddingTop = displayBox.paddingTop().valueOr(0); |
521 |
auto paddingTop = displayBox.paddingTop().valueOr(0); |
| 531 |
auto paddingBottom = displayBox.paddingBottom().valueOr(0); |
522 |
auto paddingBottom = displayBox.paddingBottom().valueOr(0); |
| 532 |
auto borderTop = displayBox.borderTop(); |
523 |
auto borderTop = displayBox.borderTop(); |
|
Lines 539-574
VerticalGeometry FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry(
a/Source/WebCore/layout/FormattingContextGeometry.cpp_sec4
|
| 539 |
|
530 |
|
| 540 |
if (!bottom) { |
531 |
if (!bottom) { |
| 541 |
// #2 |
532 |
// #2 |
| 542 |
usedMarginBefore = usedMarginBefore.valueOr(0); |
533 |
usedVerticalMargin = { computedVerticalMargin.before.valueOr(0), computedVerticalMargin.after.valueOr(0) }; |
| 543 |
usedMarginAfter = usedMarginAfter.valueOr(0); |
|
|
| 544 |
} |
534 |
} |
| 545 |
|
535 |
|
| 546 |
if (!usedMarginBefore && !usedMarginAfter) { |
536 |
if (!computedVerticalMargin.before && !computedVerticalMargin.after) { |
| 547 |
// #3 |
537 |
// #3 |
| 548 |
auto marginBeforeAndAfter = containingBlockHeight - (*top + borderTop + paddingTop + height + paddingBottom + borderBottom + *bottom); |
538 |
auto marginBeforeAndAfter = containingBlockHeight - (*top + borderTop + paddingTop + height + paddingBottom + borderBottom + *bottom); |
| 549 |
usedMarginBefore = usedMarginAfter = marginBeforeAndAfter / 2; |
539 |
usedVerticalMargin = { marginBeforeAndAfter / 2, marginBeforeAndAfter / 2 }; |
| 550 |
} |
540 |
} |
| 551 |
|
541 |
|
| 552 |
// #4 |
542 |
// #4 |
| 553 |
if (!top) |
543 |
if (!top) |
| 554 |
top = containingBlockHeight - (*usedMarginBefore + borderTop + paddingTop + height + paddingBottom + borderBottom + *usedMarginAfter + *bottom); |
544 |
top = containingBlockHeight - (usedVerticalMargin.before + borderTop + paddingTop + height + paddingBottom + borderBottom + usedVerticalMargin.after + *bottom); |
| 555 |
|
545 |
|
| 556 |
if (!bottom) |
546 |
if (!bottom) |
| 557 |
bottom = containingBlockHeight - (*top + *usedMarginBefore + borderTop + paddingTop + height + paddingBottom + borderBottom + *usedMarginAfter); |
547 |
bottom = containingBlockHeight - (*top + usedVerticalMargin.before + borderTop + paddingTop + height + paddingBottom + borderBottom + usedVerticalMargin.after); |
| 558 |
|
548 |
|
| 559 |
if (!usedMarginBefore) |
549 |
if (!computedVerticalMargin.before) |
| 560 |
usedMarginBefore = containingBlockHeight - (*top + borderTop + paddingTop + height + paddingBottom + borderBottom + *usedMarginAfter + *bottom); |
550 |
usedVerticalMargin.before = containingBlockHeight - (*top + borderTop + paddingTop + height + paddingBottom + borderBottom + usedVerticalMargin.after + *bottom); |
| 561 |
|
551 |
|
| 562 |
if (!usedMarginAfter) |
552 |
if (!computedVerticalMargin.after) |
| 563 |
usedMarginAfter = containingBlockHeight - (*top + *usedMarginBefore + borderTop + paddingTop + height + paddingBottom + borderBottom + *bottom); |
553 |
usedVerticalMargin.after = containingBlockHeight - (*top + usedVerticalMargin.before + borderTop + paddingTop + height + paddingBottom + borderBottom + *bottom); |
| 564 |
|
554 |
|
| 565 |
// #5 |
555 |
// #5 |
| 566 |
auto boxHeight = *top + *usedMarginBefore + borderTop + paddingTop + height + paddingBottom + borderBottom + *usedMarginAfter + *bottom; |
556 |
auto boxHeight = *top + usedVerticalMargin.before + borderTop + paddingTop + height + paddingBottom + borderBottom + usedVerticalMargin.after + *bottom; |
| 567 |
if (boxHeight > containingBlockHeight) |
557 |
if (boxHeight > containingBlockHeight) |
| 568 |
bottom = containingBlockHeight - (*top + *usedMarginBefore + borderTop + paddingTop + height + paddingBottom + borderBottom + *usedMarginAfter); |
558 |
bottom = containingBlockHeight - (*top + usedVerticalMargin.before + borderTop + paddingTop + height + paddingBottom + borderBottom + usedVerticalMargin.after); |
| 569 |
|
559 |
|
| 570 |
LOG_WITH_STREAM(FormattingContextLayout, stream << "[Position][Height][Margin] -> out-of-flow replaced -> top(" << *top << "px) bottom(" << *bottom << "px) height(" << height << "px) margin(" << *usedMarginBefore << "px, " << *usedMarginAfter << "px) layoutBox(" << &layoutBox << ")"); |
560 |
LOG_WITH_STREAM(FormattingContextLayout, stream << "[Position][Height][Margin] -> out-of-flow replaced -> top(" << *top << "px) bottom(" << *bottom << "px) height(" << height << "px) margin(" << usedVerticalMargin.before << "px, " << usedVerticalMargin.after << "px) layoutBox(" << &layoutBox << ")"); |
| 571 |
return { *top, *bottom, { height, { { *usedMarginBefore, *usedMarginAfter }, { } } } }; |
561 |
return { *top, *bottom, { height, { usedVerticalMargin, { } } } }; |
| 572 |
} |
562 |
} |
| 573 |
|
563 |
|
| 574 |
HorizontalGeometry FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry(const LayoutState& layoutState, const Box& layoutBox, Optional<LayoutUnit> usedWidth) |
564 |
HorizontalGeometry FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry(const LayoutState& layoutState, const Box& layoutBox, Optional<LayoutUnit> usedWidth) |
|
Lines 679-697
HeightAndMargin FormattingContext::Geometry::complicatedCases(const LayoutState&
a/Source/WebCore/layout/FormattingContextGeometry.cpp_sec5
|
| 679 |
// 1. If 'margin-top', or 'margin-bottom' are 'auto', their used value is 0. |
669 |
// 1. If 'margin-top', or 'margin-bottom' are 'auto', their used value is 0. |
| 680 |
// 2. If 'height' is 'auto', the height depends on the element's descendants per 10.6.7. |
670 |
// 2. If 'height' is 'auto', the height depends on the element's descendants per 10.6.7. |
| 681 |
|
671 |
|
| 682 |
auto& style = layoutBox.style(); |
|
|
| 683 |
auto& containingBlock = *layoutBox.containingBlock(); |
| 684 |
auto& containingBlockDisplayBox = layoutState.displayBoxForLayoutBox(containingBlock); |
| 685 |
auto containingBlockWidth = containingBlockDisplayBox.contentBoxWidth(); |
| 686 |
|
| 687 |
auto height = usedHeight ? usedHeight.value() : computedHeightValue(layoutState, layoutBox, HeightType::Normal); |
672 |
auto height = usedHeight ? usedHeight.value() : computedHeightValue(layoutState, layoutBox, HeightType::Normal); |
| 688 |
auto computedMarginBefore = computedValueIfNotAuto(style.marginBefore(), containingBlockWidth); |
673 |
auto computedVerticalMargin = Geometry::computedVerticalMargin(layoutState, layoutBox); |
| 689 |
auto computedMarginAfter = computedValueIfNotAuto(style.marginAfter(), containingBlockWidth); |
|
|
| 690 |
|
| 691 |
// #1 |
674 |
// #1 |
| 692 |
auto usedMarginBefore = computedMarginBefore.valueOr(0); |
675 |
auto usedVerticalMargin = UsedVerticalMargin::NonCollapsedValues { computedVerticalMargin.before.valueOr(0), computedVerticalMargin.after.valueOr(0) }; |
| 693 |
auto usedMarginAfter = computedMarginAfter.valueOr(0); |
|
|
| 694 |
|
| 695 |
// #2 |
676 |
// #2 |
| 696 |
if (!height) { |
677 |
if (!height) { |
| 697 |
ASSERT(isHeightAuto(layoutBox)); |
678 |
ASSERT(isHeightAuto(layoutBox)); |
|
Lines 700-707
HeightAndMargin FormattingContext::Geometry::complicatedCases(const LayoutState&
a/Source/WebCore/layout/FormattingContextGeometry.cpp_sec6
|
| 700 |
|
681 |
|
| 701 |
ASSERT(height); |
682 |
ASSERT(height); |
| 702 |
|
683 |
|
| 703 |
LOG_WITH_STREAM(FormattingContextLayout, stream << "[Height][Margin] -> floating non-replaced -> height(" << *height << "px) margin(" << usedMarginBefore << "px, " << usedMarginAfter << "px) -> layoutBox(" << &layoutBox << ")"); |
684 |
LOG_WITH_STREAM(FormattingContextLayout, stream << "[Height][Margin] -> floating non-replaced -> height(" << *height << "px) margin(" << usedVerticalMargin.before << "px, " << usedVerticalMargin.after << "px) -> layoutBox(" << &layoutBox << ")"); |
| 704 |
return HeightAndMargin { *height, { { usedMarginBefore, usedMarginAfter }, { } } }; |
685 |
return HeightAndMargin { *height, { usedVerticalMargin, { } } }; |
| 705 |
} |
686 |
} |
| 706 |
|
687 |
|
| 707 |
WidthAndMargin FormattingContext::Geometry::floatingNonReplacedWidthAndMargin(LayoutState& layoutState, const Box& layoutBox, Optional<LayoutUnit> usedWidth) |
688 |
WidthAndMargin FormattingContext::Geometry::floatingNonReplacedWidthAndMargin(LayoutState& layoutState, const Box& layoutBox, Optional<LayoutUnit> usedWidth) |
|
Lines 802-809
HeightAndMargin FormattingContext::Geometry::inlineReplacedHeightAndMargin(const
a/Source/WebCore/layout/FormattingContextGeometry.cpp_sec7
|
| 802 |
// the height of the largest rectangle that has a 2:1 ratio, has a height not greater than 150px, and has a width not greater than the device width. |
783 |
// the height of the largest rectangle that has a 2:1 ratio, has a height not greater than 150px, and has a width not greater than the device width. |
| 803 |
|
784 |
|
| 804 |
// #1 |
785 |
// #1 |
| 805 |
auto margin = computedNonCollapsedVerticalMarginValue(layoutState, layoutBox); |
786 |
auto computedVerticalMargin = Geometry::computedVerticalMargin(layoutState, layoutBox); |
| 806 |
|
787 |
auto usedVerticalMargin = UsedVerticalMargin::NonCollapsedValues { computedVerticalMargin.before.valueOr(0), computedVerticalMargin.after.valueOr(0) }; |
| 807 |
auto& style = layoutBox.style(); |
788 |
auto& style = layoutBox.style(); |
| 808 |
auto replaced = layoutBox.replaced(); |
789 |
auto replaced = layoutBox.replaced(); |
| 809 |
|
790 |
|
|
Lines 828-835
HeightAndMargin FormattingContext::Geometry::inlineReplacedHeightAndMargin(const
a/Source/WebCore/layout/FormattingContextGeometry.cpp_sec8
|
| 828 |
|
809 |
|
| 829 |
ASSERT(height); |
810 |
ASSERT(height); |
| 830 |
|
811 |
|
| 831 |
LOG_WITH_STREAM(FormattingContextLayout, stream << "[Height][Margin] -> inflow replaced -> height(" << *height << "px) margin(" << margin.before << "px, " << margin.after << "px) -> layoutBox(" << &layoutBox << ")"); |
812 |
LOG_WITH_STREAM(FormattingContextLayout, stream << "[Height][Margin] -> inflow replaced -> height(" << *height << "px) margin(" << usedVerticalMargin.before << "px, " << usedVerticalMargin.after << "px) -> layoutBox(" << &layoutBox << ")"); |
| 832 |
return { *height, { margin, { } } }; |
813 |
return { *height, { usedVerticalMargin, { } } }; |
| 833 |
} |
814 |
} |
| 834 |
|
815 |
|
| 835 |
WidthAndMargin FormattingContext::Geometry::inlineReplacedWidthAndMargin(const LayoutState& layoutState, const Box& layoutBox, |
816 |
WidthAndMargin FormattingContext::Geometry::inlineReplacedWidthAndMargin(const LayoutState& layoutState, const Box& layoutBox, |
|
Lines 857-864
WidthAndMargin FormattingContext::Geometry::inlineReplacedWidthAndMargin(const L
a/Source/WebCore/layout/FormattingContextGeometry.cpp_sec9
|
| 857 |
// If 300px is too wide to fit the device, UAs should use the width of the largest rectangle that has a 2:1 ratio and fits the device instead. |
838 |
// If 300px is too wide to fit the device, UAs should use the width of the largest rectangle that has a 2:1 ratio and fits the device instead. |
| 858 |
|
839 |
|
| 859 |
auto& style = layoutBox.style(); |
840 |
auto& style = layoutBox.style(); |
| 860 |
auto& containingBlockDisplayBox = layoutState.displayBoxForLayoutBox(*layoutBox.containingBlock()); |
841 |
auto& containingBlock = *layoutBox.containingBlock(); |
| 861 |
auto containingBlockWidth = containingBlockDisplayBox.width(); |
842 |
auto containingBlockWidth = layoutState.displayBoxForLayoutBox(containingBlock).contentBoxWidth(); |
| 862 |
auto computedHorizontalMargin = Geometry::computedHorizontalMargin(layoutState, layoutBox); |
843 |
auto computedHorizontalMargin = Geometry::computedHorizontalMargin(layoutState, layoutBox); |
| 863 |
|
844 |
|
| 864 |
auto usedMarginStart = [&] { |
845 |
auto usedMarginStart = [&] { |
|
Lines 1008-1023
ComputedHorizontalMargin FormattingContext::Geometry::computedHorizontalMargin(c
a/Source/WebCore/layout/FormattingContextGeometry.cpp_sec10
|
| 1008 |
return { computedValueIfNotAuto(style.marginStart(), containingBlockWidth), computedValueIfNotAuto(style.marginEnd(), containingBlockWidth) }; |
989 |
return { computedValueIfNotAuto(style.marginStart(), containingBlockWidth), computedValueIfNotAuto(style.marginEnd(), containingBlockWidth) }; |
| 1009 |
} |
990 |
} |
| 1010 |
|
991 |
|
| 1011 |
VerticalMargin::ComputedValues FormattingContext::Geometry::computedNonCollapsedVerticalMarginValue(const LayoutState& layoutState, const Box& layoutBox) |
992 |
ComputedVerticalMargin FormattingContext::Geometry::computedVerticalMargin(const LayoutState& layoutState, const Box& layoutBox) |
| 1012 |
{ |
993 |
{ |
| 1013 |
auto& style = layoutBox.style(); |
994 |
auto& style = layoutBox.style(); |
| 1014 |
auto containingBlockWidth = layoutState.displayBoxForLayoutBox(*layoutBox.containingBlock()).contentBoxWidth(); |
995 |
auto containingBlockWidth = layoutState.displayBoxForLayoutBox(*layoutBox.containingBlock()).contentBoxWidth(); |
| 1015 |
|
996 |
|
| 1016 |
auto usedMarginBefore = computedValueIfNotAuto(style.marginBefore(), containingBlockWidth).valueOr(0_lu); |
997 |
return { computedValueIfNotAuto(style.marginBefore(), containingBlockWidth), computedValueIfNotAuto(style.marginAfter(), containingBlockWidth) }; |
| 1017 |
auto usedMarginAfter = computedValueIfNotAuto(style.marginAfter(), containingBlockWidth).valueOr(0_lu); |
|
|
| 1018 |
|
| 1019 |
LOG_WITH_STREAM(FormattingContextLayout, stream << "[Margin] -> non collapsed vertical -> margin(" << usedMarginBefore << "px, " << usedMarginAfter << "px) -> layoutBox: " << &layoutBox); |
| 1020 |
return { usedMarginBefore, usedMarginAfter }; |
| 1021 |
} |
998 |
} |
| 1022 |
|
999 |
|
| 1023 |
} |
1000 |
} |