| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved. | 4 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 LayoutBoxRareData() | 68 LayoutBoxRareData() |
| 69 : m_spannerPlaceholder(nullptr), | 69 : m_spannerPlaceholder(nullptr), |
| 70 m_overrideLogicalContentWidth(-1), | 70 m_overrideLogicalContentWidth(-1), |
| 71 m_overrideLogicalContentHeight(-1), | 71 m_overrideLogicalContentHeight(-1), |
| 72 m_hasOverrideContainingBlockContentLogicalWidth(false), | 72 m_hasOverrideContainingBlockContentLogicalWidth(false), |
| 73 m_hasOverrideContainingBlockContentLogicalHeight(false), | 73 m_hasOverrideContainingBlockContentLogicalHeight(false), |
| 74 m_percentHeightContainer(nullptr), | 74 m_percentHeightContainer(nullptr), |
| 75 m_snapContainer(nullptr), | 75 m_snapContainer(nullptr), |
| 76 m_snapAreas(nullptr) {} | 76 m_snapAreas(nullptr) {} |
| 77 | 77 |
| 78 // For spanners, the spanner placeholder that lays us out within the multicol | 78 // For spanners, the spanner placeholder that lays us out within the multicol
container. |
| 79 // container. | |
| 80 LayoutMultiColumnSpannerPlaceholder* m_spannerPlaceholder; | 79 LayoutMultiColumnSpannerPlaceholder* m_spannerPlaceholder; |
| 81 | 80 |
| 82 LayoutUnit m_overrideLogicalContentWidth; | 81 LayoutUnit m_overrideLogicalContentWidth; |
| 83 LayoutUnit m_overrideLogicalContentHeight; | 82 LayoutUnit m_overrideLogicalContentHeight; |
| 84 | 83 |
| 85 bool m_hasOverrideContainingBlockContentLogicalWidth; | 84 bool m_hasOverrideContainingBlockContentLogicalWidth; |
| 86 bool m_hasOverrideContainingBlockContentLogicalHeight; | 85 bool m_hasOverrideContainingBlockContentLogicalHeight; |
| 87 LayoutUnit m_overrideContainingBlockContentLogicalWidth; | 86 LayoutUnit m_overrideContainingBlockContentLogicalWidth; |
| 88 LayoutUnit m_overrideContainingBlockContentLogicalHeight; | 87 LayoutUnit m_overrideContainingBlockContentLogicalHeight; |
| 89 | 88 |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 return; | 324 return; |
| 326 m_frameRect.setLocation(location); | 325 m_frameRect.setLocation(location); |
| 327 frameRectChanged(); | 326 frameRectChanged(); |
| 328 } | 327 } |
| 329 | 328 |
| 330 // The ancestor box that this object's location and topLeftLocation are | 329 // The ancestor box that this object's location and topLeftLocation are |
| 331 // relative to. | 330 // relative to. |
| 332 virtual LayoutBox* locationContainer() const; | 331 virtual LayoutBox* locationContainer() const; |
| 333 | 332 |
| 334 // FIXME: Currently scrollbars are using int geometry and positioned based on | 333 // FIXME: Currently scrollbars are using int geometry and positioned based on |
| 335 // pixelSnappedBorderBoxRect whose size may change when location changes | 334 // pixelSnappedBorderBoxRect whose size may change when location changes becau
se of |
| 336 // because of pixel snapping. This function is used to change location of the | 335 // pixel snapping. This function is used to change location of the LayoutBox o
utside |
| 337 // LayoutBox outside of LayoutBox::layout(). Will remove when we use | 336 // of LayoutBox::layout(). Will remove when we use LayoutUnits for scrollbars. |
| 338 // LayoutUnits for scrollbars. | |
| 339 void setLocationAndUpdateOverflowControlsIfNeeded(const LayoutPoint&); | 337 void setLocationAndUpdateOverflowControlsIfNeeded(const LayoutPoint&); |
| 340 | 338 |
| 341 void setSize(const LayoutSize& size) { | 339 void setSize(const LayoutSize& size) { |
| 342 if (size == m_frameRect.size()) | 340 if (size == m_frameRect.size()) |
| 343 return; | 341 return; |
| 344 m_frameRect.setSize(size); | 342 m_frameRect.setSize(size); |
| 345 frameRectChanged(); | 343 frameRectChanged(); |
| 346 } | 344 } |
| 347 void move(LayoutUnit dx, LayoutUnit dy) { | 345 void move(LayoutUnit dx, LayoutUnit dy) { |
| 348 if (!dx && !dy) | 346 if (!dx && !dy) |
| (...skipping 20 matching lines...) Expand all Loading... |
| 369 return LayoutRect(LayoutUnit(borderLeft()), LayoutUnit(borderTop()), | 367 return LayoutRect(LayoutUnit(borderLeft()), LayoutUnit(borderTop()), |
| 370 clientWidth(), clientHeight()); | 368 clientWidth(), clientHeight()); |
| 371 } | 369 } |
| 372 IntRect pixelSnappedBorderBoxRect() const { | 370 IntRect pixelSnappedBorderBoxRect() const { |
| 373 return IntRect(IntPoint(), m_frameRect.pixelSnappedSize()); | 371 return IntRect(IntPoint(), m_frameRect.pixelSnappedSize()); |
| 374 } | 372 } |
| 375 IntRect borderBoundingBox() const final { | 373 IntRect borderBoundingBox() const final { |
| 376 return pixelSnappedBorderBoxRect(); | 374 return pixelSnappedBorderBoxRect(); |
| 377 } | 375 } |
| 378 | 376 |
| 379 // The content area of the box (excludes padding - and intrinsic padding for | 377 // The content area of the box (excludes padding - and intrinsic padding for t
able cells, etc... - and border). |
| 380 // table cells, etc... - and border). | |
| 381 DISABLE_CFI_PERF LayoutRect contentBoxRect() const { | 378 DISABLE_CFI_PERF LayoutRect contentBoxRect() const { |
| 382 return LayoutRect(borderLeft() + paddingLeft(), borderTop() + paddingTop(), | 379 return LayoutRect(borderLeft() + paddingLeft(), borderTop() + paddingTop(), |
| 383 contentWidth(), contentHeight()); | 380 contentWidth(), contentHeight()); |
| 384 } | 381 } |
| 385 LayoutSize contentBoxOffset() const { | 382 LayoutSize contentBoxOffset() const { |
| 386 return LayoutSize(borderLeft() + paddingLeft(), borderTop() + paddingTop()); | 383 return LayoutSize(borderLeft() + paddingLeft(), borderTop() + paddingTop()); |
| 387 } | 384 } |
| 388 // The content box in absolute coords. Ignores transforms. | 385 // The content box in absolute coords. Ignores transforms. |
| 389 IntRect absoluteContentBox() const; | 386 IntRect absoluteContentBox() const; |
| 390 // The offset of the content box in absolute coords, ignoring transforms. | 387 // The offset of the content box in absolute coords, ignoring transforms. |
| 391 IntSize absoluteContentBoxOffset() const; | 388 IntSize absoluteContentBoxOffset() const; |
| 392 // The content box converted to absolute coords (taking transforms into | 389 // The content box converted to absolute coords (taking transforms into accoun
t). |
| 393 // account). | |
| 394 FloatQuad absoluteContentQuad() const; | 390 FloatQuad absoluteContentQuad() const; |
| 395 // The enclosing rectangle of the background with given opacity requirement. | 391 // The enclosing rectangle of the background with given opacity requirement. |
| 396 LayoutRect backgroundRect(BackgroundRectType) const; | 392 LayoutRect backgroundRect(BackgroundRectType) const; |
| 397 | 393 |
| 398 // This returns the content area of the box (excluding padding and border). | 394 // This returns the content area of the box (excluding padding and border). Th
e only difference with contentBoxRect is that computedCSSContentBoxRect |
| 399 // The only difference with contentBoxRect is that computedCSSContentBoxRect | 395 // does include the intrinsic padding in the content box as this is what some
callers expect (like getComputedStyle). |
| 400 // does include the intrinsic padding in the content box as this is what some | |
| 401 // callers expect (like getComputedStyle). | |
| 402 LayoutRect computedCSSContentBoxRect() const { | 396 LayoutRect computedCSSContentBoxRect() const { |
| 403 return LayoutRect( | 397 return LayoutRect( |
| 404 borderLeft() + computedCSSPaddingLeft(), | 398 borderLeft() + computedCSSPaddingLeft(), |
| 405 borderTop() + computedCSSPaddingTop(), | 399 borderTop() + computedCSSPaddingTop(), |
| 406 clientWidth() - computedCSSPaddingLeft() - computedCSSPaddingRight(), | 400 clientWidth() - computedCSSPaddingLeft() - computedCSSPaddingRight(), |
| 407 clientHeight() - computedCSSPaddingTop() - computedCSSPaddingBottom()); | 401 clientHeight() - computedCSSPaddingTop() - computedCSSPaddingBottom()); |
| 408 } | 402 } |
| 409 | 403 |
| 410 void addOutlineRects(Vector<LayoutRect>&, | 404 void addOutlineRects(Vector<LayoutRect>&, |
| 411 const LayoutPoint& additionalOffset, | 405 const LayoutPoint& additionalOffset, |
| 412 IncludeBlockVisualOverflowOrNot) const override; | 406 IncludeBlockVisualOverflowOrNot) const override; |
| 413 | 407 |
| 414 // Use this with caution! No type checking is done! | 408 // Use this with caution! No type checking is done! |
| 415 LayoutBox* previousSiblingBox() const; | 409 LayoutBox* previousSiblingBox() const; |
| 416 LayoutBox* previousInFlowSiblingBox() const; | 410 LayoutBox* previousInFlowSiblingBox() const; |
| 417 LayoutBox* nextSiblingBox() const; | 411 LayoutBox* nextSiblingBox() const; |
| 418 LayoutBox* nextInFlowSiblingBox() const; | 412 LayoutBox* nextInFlowSiblingBox() const; |
| 419 LayoutBox* parentBox() const; | 413 LayoutBox* parentBox() const; |
| 420 | 414 |
| 421 // Return the previous sibling column set or spanner placeholder. Only to be | 415 // Return the previous sibling column set or spanner placeholder. Only to be u
sed on multicol container children. |
| 422 // used on multicol container children. | |
| 423 LayoutBox* previousSiblingMultiColumnBox() const; | 416 LayoutBox* previousSiblingMultiColumnBox() const; |
| 424 // Return the next sibling column set or spanner placeholder. Only to be used | 417 // Return the next sibling column set or spanner placeholder. Only to be used
on multicol container children. |
| 425 // on multicol container children. | |
| 426 LayoutBox* nextSiblingMultiColumnBox() const; | 418 LayoutBox* nextSiblingMultiColumnBox() const; |
| 427 | 419 |
| 428 bool canResize() const; | 420 bool canResize() const; |
| 429 | 421 |
| 430 // Visual and layout overflow are in the coordinate space of the box. This | 422 // Visual and layout overflow are in the coordinate space of the box. This me
ans that they |
| 431 // means that they aren't purely physical directions. For horizontal-tb and | 423 // aren't purely physical directions. For horizontal-tb and vertical-lr they w
ill match physical |
| 432 // vertical-lr they will match physical directions, but for vertical-rl, the | 424 // directions, but for vertical-rl, the left/right are flipped when compared t
o their physical |
| 433 // left/right are flipped when compared to their physical counterparts. | 425 // counterparts. For example minX is on the left in vertical-lr, but it is on
the right in |
| 434 // For example minX is on the left in vertical-lr, but it is on the right in | |
| 435 // vertical-rl. | 426 // vertical-rl. |
| 436 LayoutRect noOverflowRect() const; | 427 LayoutRect noOverflowRect() const; |
| 437 LayoutRect layoutOverflowRect() const { | 428 LayoutRect layoutOverflowRect() const { |
| 438 return m_overflow ? m_overflow->layoutOverflowRect() : noOverflowRect(); | 429 return m_overflow ? m_overflow->layoutOverflowRect() : noOverflowRect(); |
| 439 } | 430 } |
| 440 IntRect pixelSnappedLayoutOverflowRect() const { | 431 IntRect pixelSnappedLayoutOverflowRect() const { |
| 441 return pixelSnappedIntRect(layoutOverflowRect()); | 432 return pixelSnappedIntRect(layoutOverflowRect()); |
| 442 } | 433 } |
| 443 LayoutSize maxLayoutOverflow() const { | 434 LayoutSize maxLayoutOverflow() const { |
| 444 return LayoutSize(layoutOverflowRect().maxX(), layoutOverflowRect().maxY()); | 435 return LayoutSize(layoutOverflowRect().maxX(), layoutOverflowRect().maxY()); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 462 : visualOverflowRect().maxY(); | 453 : visualOverflowRect().maxY(); |
| 463 } | 454 } |
| 464 | 455 |
| 465 LayoutRect selfVisualOverflowRect() const { | 456 LayoutRect selfVisualOverflowRect() const { |
| 466 return m_overflow ? m_overflow->selfVisualOverflowRect() : borderBoxRect(); | 457 return m_overflow ? m_overflow->selfVisualOverflowRect() : borderBoxRect(); |
| 467 } | 458 } |
| 468 LayoutRect contentsVisualOverflowRect() const { | 459 LayoutRect contentsVisualOverflowRect() const { |
| 469 return m_overflow ? m_overflow->contentsVisualOverflowRect() : LayoutRect(); | 460 return m_overflow ? m_overflow->contentsVisualOverflowRect() : LayoutRect(); |
| 470 } | 461 } |
| 471 | 462 |
| 472 // These methods don't mean the box *actually* has top/left overflow. They | 463 // These methods don't mean the box *actually* has top/left overflow. They me
an that |
| 473 // mean that *if* the box overflows, it will overflow to the top/left rather | 464 // *if* the box overflows, it will overflow to the top/left rather than the bo
ttom/right. |
| 474 // than the bottom/right. This happens when child content is laid out | 465 // This happens when child content is laid out right-to-left (e.g. direction:r
tl) or |
| 475 // right-to-left (e.g. direction:rtl) or or bottom-to-top (e.g. direction:rtl | 466 // or bottom-to-top (e.g. direction:rtl writing-mode:vertical-rl). |
| 476 // writing-mode:vertical-rl). | |
| 477 virtual bool hasTopOverflow() const; | 467 virtual bool hasTopOverflow() const; |
| 478 virtual bool hasLeftOverflow() const; | 468 virtual bool hasLeftOverflow() const; |
| 479 | 469 |
| 480 void addLayoutOverflow(const LayoutRect&); | 470 void addLayoutOverflow(const LayoutRect&); |
| 481 void addSelfVisualOverflow(const LayoutRect&); | 471 void addSelfVisualOverflow(const LayoutRect&); |
| 482 void addContentsVisualOverflow(const LayoutRect&); | 472 void addContentsVisualOverflow(const LayoutRect&); |
| 483 | 473 |
| 484 void addVisualEffectOverflow(); | 474 void addVisualEffectOverflow(); |
| 485 LayoutRectOutsets computeVisualEffectOverflowOutsets() const; | 475 LayoutRectOutsets computeVisualEffectOverflowOutsets() const; |
| 486 void addOverflowFromChild(LayoutBox* child) { | 476 void addOverflowFromChild(LayoutBox* child) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 503 } | 493 } |
| 504 LayoutUnit contentLogicalWidth() const { | 494 LayoutUnit contentLogicalWidth() const { |
| 505 return style()->isHorizontalWritingMode() ? contentWidth() | 495 return style()->isHorizontalWritingMode() ? contentWidth() |
| 506 : contentHeight(); | 496 : contentHeight(); |
| 507 } | 497 } |
| 508 LayoutUnit contentLogicalHeight() const { | 498 LayoutUnit contentLogicalHeight() const { |
| 509 return style()->isHorizontalWritingMode() ? contentHeight() | 499 return style()->isHorizontalWritingMode() ? contentHeight() |
| 510 : contentWidth(); | 500 : contentWidth(); |
| 511 } | 501 } |
| 512 | 502 |
| 513 // IE extensions. Used to calculate offsetWidth/Height. Overridden by inlines | 503 // IE extensions. Used to calculate offsetWidth/Height. Overridden by inlines
(LayoutFlow) |
| 514 // (LayoutFlow) to return the remaining width on a given line (and the height | 504 // to return the remaining width on a given line (and the height of a single l
ine). |
| 515 // of a single line). | |
| 516 LayoutUnit offsetWidth() const override { return m_frameRect.width(); } | 505 LayoutUnit offsetWidth() const override { return m_frameRect.width(); } |
| 517 LayoutUnit offsetHeight() const override { return m_frameRect.height(); } | 506 LayoutUnit offsetHeight() const override { return m_frameRect.height(); } |
| 518 | 507 |
| 519 int pixelSnappedOffsetWidth(const Element*) const final; | 508 int pixelSnappedOffsetWidth(const Element*) const final; |
| 520 int pixelSnappedOffsetHeight(const Element*) const final; | 509 int pixelSnappedOffsetHeight(const Element*) const final; |
| 521 | 510 |
| 522 // More IE extensions. clientWidth and clientHeight represent the interior of | 511 // More IE extensions. clientWidth and clientHeight represent the interior of
an object |
| 523 // an object excluding border and scrollbar. clientLeft/Top are just the | 512 // excluding border and scrollbar. clientLeft/Top are just the borderLeftWidt
h and borderTopWidth. |
| 524 // borderLeftWidth and borderTopWidth. | |
| 525 DISABLE_CFI_PERF LayoutUnit clientLeft() const { | 513 DISABLE_CFI_PERF LayoutUnit clientLeft() const { |
| 526 return LayoutUnit(borderLeft() + | 514 return LayoutUnit(borderLeft() + |
| 527 (shouldPlaceBlockDirectionScrollbarOnLogicalLeft() | 515 (shouldPlaceBlockDirectionScrollbarOnLogicalLeft() |
| 528 ? verticalScrollbarWidth() | 516 ? verticalScrollbarWidth() |
| 529 : 0)); | 517 : 0)); |
| 530 } | 518 } |
| 531 DISABLE_CFI_PERF LayoutUnit clientTop() const { | 519 DISABLE_CFI_PERF LayoutUnit clientTop() const { |
| 532 return LayoutUnit(borderTop()); | 520 return LayoutUnit(borderTop()); |
| 533 } | 521 } |
| 534 LayoutUnit clientWidth() const; | 522 LayoutUnit clientWidth() const; |
| 535 LayoutUnit clientHeight() const; | 523 LayoutUnit clientHeight() const; |
| 536 DISABLE_CFI_PERF LayoutUnit clientLogicalWidth() const { | 524 DISABLE_CFI_PERF LayoutUnit clientLogicalWidth() const { |
| 537 return style()->isHorizontalWritingMode() ? clientWidth() : clientHeight(); | 525 return style()->isHorizontalWritingMode() ? clientWidth() : clientHeight(); |
| 538 } | 526 } |
| 539 DISABLE_CFI_PERF LayoutUnit clientLogicalHeight() const { | 527 DISABLE_CFI_PERF LayoutUnit clientLogicalHeight() const { |
| 540 return style()->isHorizontalWritingMode() ? clientHeight() : clientWidth(); | 528 return style()->isHorizontalWritingMode() ? clientHeight() : clientWidth(); |
| 541 } | 529 } |
| 542 DISABLE_CFI_PERF LayoutUnit clientLogicalBottom() const { | 530 DISABLE_CFI_PERF LayoutUnit clientLogicalBottom() const { |
| 543 return borderBefore() + clientLogicalHeight(); | 531 return borderBefore() + clientLogicalHeight(); |
| 544 } | 532 } |
| 545 DISABLE_CFI_PERF LayoutRect clientBoxRect() const { | 533 DISABLE_CFI_PERF LayoutRect clientBoxRect() const { |
| 546 return LayoutRect(clientLeft(), clientTop(), clientWidth(), clientHeight()); | 534 return LayoutRect(clientLeft(), clientTop(), clientWidth(), clientHeight()); |
| 547 } | 535 } |
| 548 | 536 |
| 549 int pixelSnappedClientWidth() const; | 537 int pixelSnappedClientWidth() const; |
| 550 int pixelSnappedClientHeight() const; | 538 int pixelSnappedClientHeight() const; |
| 551 | 539 |
| 552 // scrollWidth/scrollHeight will be the same as clientWidth/clientHeight | 540 // scrollWidth/scrollHeight will be the same as clientWidth/clientHeight unles
s the |
| 553 // unless the object has overflow:hidden/scroll/auto specified and also has | 541 // object has overflow:hidden/scroll/auto specified and also has overflow. |
| 554 // overflow. scrollLeft/Top return the current scroll position. These methods | 542 // scrollLeft/Top return the current scroll position. These methods are virtu
al so that objects like |
| 555 // are virtual so that objects like textareas can scroll shadow content (but | 543 // textareas can scroll shadow content (but pretend that they are the objects
that are |
| 556 // pretend that they are the objects that are scrolling). | 544 // scrolling). |
| 557 virtual LayoutUnit scrollLeft() const; | 545 virtual LayoutUnit scrollLeft() const; |
| 558 virtual LayoutUnit scrollTop() const; | 546 virtual LayoutUnit scrollTop() const; |
| 559 virtual LayoutUnit scrollWidth() const; | 547 virtual LayoutUnit scrollWidth() const; |
| 560 virtual LayoutUnit scrollHeight() const; | 548 virtual LayoutUnit scrollHeight() const; |
| 561 int pixelSnappedScrollWidth() const; | 549 int pixelSnappedScrollWidth() const; |
| 562 int pixelSnappedScrollHeight() const; | 550 int pixelSnappedScrollHeight() const; |
| 563 virtual void setScrollLeft(LayoutUnit); | 551 virtual void setScrollLeft(LayoutUnit); |
| 564 virtual void setScrollTop(LayoutUnit); | 552 virtual void setScrollTop(LayoutUnit); |
| 565 | 553 |
| 566 void scrollToOffset(const DoubleSize&, | 554 void scrollToOffset(const DoubleSize&, |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 styleToUse->direction(), value); | 633 styleToUse->direction(), value); |
| 646 } | 634 } |
| 647 void setMarginEnd(LayoutUnit value, | 635 void setMarginEnd(LayoutUnit value, |
| 648 const ComputedStyle* overrideStyle = nullptr) { | 636 const ComputedStyle* overrideStyle = nullptr) { |
| 649 const ComputedStyle* styleToUse = overrideStyle ? overrideStyle : style(); | 637 const ComputedStyle* styleToUse = overrideStyle ? overrideStyle : style(); |
| 650 m_marginBoxOutsets.setEnd(styleToUse->getWritingMode(), | 638 m_marginBoxOutsets.setEnd(styleToUse->getWritingMode(), |
| 651 styleToUse->direction(), value); | 639 styleToUse->direction(), value); |
| 652 } | 640 } |
| 653 | 641 |
| 654 // The following functions are used to implement collapsing margins. | 642 // The following functions are used to implement collapsing margins. |
| 655 // All objects know their maximal positive and negative margins. The formula | 643 // All objects know their maximal positive and negative margins. The |
| 656 // for computing a collapsed margin is |maxPosMargin| - |maxNegmargin|. | 644 // formula for computing a collapsed margin is |maxPosMargin| - |maxNegmargin|
. |
| 657 // For a non-collapsing box, such as a leaf element, this formula will simply | 645 // For a non-collapsing box, such as a leaf element, this formula will simply
return |
| 658 // return the margin of the element. Blocks override the maxMarginBefore and | 646 // the margin of the element. Blocks override the maxMarginBefore and maxMarg
inAfter |
| 659 // maxMarginAfter methods. | 647 // methods. |
| 660 virtual bool isSelfCollapsingBlock() const { return false; } | 648 virtual bool isSelfCollapsingBlock() const { return false; } |
| 661 virtual LayoutUnit collapsedMarginBefore() const { return marginBefore(); } | 649 virtual LayoutUnit collapsedMarginBefore() const { return marginBefore(); } |
| 662 virtual LayoutUnit collapsedMarginAfter() const { return marginAfter(); } | 650 virtual LayoutUnit collapsedMarginAfter() const { return marginAfter(); } |
| 663 LayoutRectOutsets collapsedMarginBoxLogicalOutsets() const { | 651 LayoutRectOutsets collapsedMarginBoxLogicalOutsets() const { |
| 664 return LayoutRectOutsets(collapsedMarginBefore(), LayoutUnit(), | 652 return LayoutRectOutsets(collapsedMarginBefore(), LayoutUnit(), |
| 665 collapsedMarginAfter(), LayoutUnit()); | 653 collapsedMarginAfter(), LayoutUnit()); |
| 666 } | 654 } |
| 667 | 655 |
| 668 void absoluteRects(Vector<IntRect>&, | 656 void absoluteRects(Vector<IntRect>&, |
| 669 const LayoutPoint& accumulatedOffset) const override; | 657 const LayoutPoint& accumulatedOffset) const override; |
| 670 void absoluteQuads(Vector<FloatQuad>&) const override; | 658 void absoluteQuads(Vector<FloatQuad>&) const override; |
| 671 FloatRect localBoundingBoxRectForAccessibility() const final; | 659 FloatRect localBoundingBoxRectForAccessibility() const final; |
| 672 | 660 |
| 673 int reflectionOffset() const; | 661 int reflectionOffset() const; |
| 674 // Given a rect in the object's coordinate space, returns the corresponding | 662 // Given a rect in the object's coordinate space, returns the corresponding re
ct in the reflection. |
| 675 // rect in the reflection. | |
| 676 LayoutRect reflectedRect(const LayoutRect&) const; | 663 LayoutRect reflectedRect(const LayoutRect&) const; |
| 677 | 664 |
| 678 void layout() override; | 665 void layout() override; |
| 679 void paint(const PaintInfo&, const LayoutPoint&) const override; | 666 void paint(const PaintInfo&, const LayoutPoint&) const override; |
| 680 bool nodeAtPoint(HitTestResult&, | 667 bool nodeAtPoint(HitTestResult&, |
| 681 const HitTestLocation& locationInContainer, | 668 const HitTestLocation& locationInContainer, |
| 682 const LayoutPoint& accumulatedOffset, | 669 const LayoutPoint& accumulatedOffset, |
| 683 HitTestAction) override; | 670 HitTestAction) override; |
| 684 | 671 |
| 685 LayoutUnit minPreferredLogicalWidth() const override; | 672 LayoutUnit minPreferredLogicalWidth() const override; |
| 686 LayoutUnit maxPreferredLogicalWidth() const override; | 673 LayoutUnit maxPreferredLogicalWidth() const override; |
| 687 | 674 |
| 688 // FIXME: We should rename these back to overrideLogicalHeight/Width and have | 675 // FIXME: We should rename these back to overrideLogicalHeight/Width and have
them store |
| 689 // them store the border-box height/width like the regular height/width | 676 // the border-box height/width like the regular height/width accessors on Layo
utBox. |
| 690 // accessors on LayoutBox. Right now, these are different than contentHeight/ | 677 // Right now, these are different than contentHeight/contentWidth because they
still |
| 691 // contentWidth because they still include the scrollbar height/width. | 678 // include the scrollbar height/width. |
| 692 LayoutUnit overrideLogicalContentWidth() const; | 679 LayoutUnit overrideLogicalContentWidth() const; |
| 693 LayoutUnit overrideLogicalContentHeight() const; | 680 LayoutUnit overrideLogicalContentHeight() const; |
| 694 bool hasOverrideLogicalContentHeight() const; | 681 bool hasOverrideLogicalContentHeight() const; |
| 695 bool hasOverrideLogicalContentWidth() const; | 682 bool hasOverrideLogicalContentWidth() const; |
| 696 void setOverrideLogicalContentHeight(LayoutUnit); | 683 void setOverrideLogicalContentHeight(LayoutUnit); |
| 697 void setOverrideLogicalContentWidth(LayoutUnit); | 684 void setOverrideLogicalContentWidth(LayoutUnit); |
| 698 void clearOverrideSize(); | 685 void clearOverrideSize(); |
| 699 void clearOverrideLogicalContentHeight(); | 686 void clearOverrideLogicalContentHeight(); |
| 700 void clearOverrideLogicalContentWidth(); | 687 void clearOverrideLogicalContentWidth(); |
| 701 | 688 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 // (logical top or logical left). | 736 // (logical top or logical left). |
| 750 LayoutUnit m_position; | 737 LayoutUnit m_position; |
| 751 | 738 |
| 752 // |m_margins| represents the margins in the measured direction. | 739 // |m_margins| represents the margins in the measured direction. |
| 753 // Note that ComputedMarginValues has also the margins in | 740 // Note that ComputedMarginValues has also the margins in |
| 754 // the orthogonal direction to have clearer names but they are | 741 // the orthogonal direction to have clearer names but they are |
| 755 // ignored in the code. | 742 // ignored in the code. |
| 756 ComputedMarginValues m_margins; | 743 ComputedMarginValues m_margins; |
| 757 }; | 744 }; |
| 758 | 745 |
| 759 // Resolve auto margins in the chosen direction of the containing block so | 746 // Resolve auto margins in the chosen direction of the containing block so tha
t objects can be pushed to the start, middle or end |
| 760 // that objects can be pushed to the start, middle or end of the containing | 747 // of the containing block. |
| 761 // block. | |
| 762 void computeMarginsForDirection(MarginDirection forDirection, | 748 void computeMarginsForDirection(MarginDirection forDirection, |
| 763 const LayoutBlock* containingBlock, | 749 const LayoutBlock* containingBlock, |
| 764 LayoutUnit containerWidth, | 750 LayoutUnit containerWidth, |
| 765 LayoutUnit childWidth, | 751 LayoutUnit childWidth, |
| 766 LayoutUnit& marginStart, | 752 LayoutUnit& marginStart, |
| 767 LayoutUnit& marginEnd, | 753 LayoutUnit& marginEnd, |
| 768 Length marginStartLength, | 754 Length marginStartLength, |
| 769 Length marginStartEnd) const; | 755 Length marginStartEnd) const; |
| 770 | 756 |
| 771 // Used to resolve margins in the containing block's block-flow direction. | 757 // Used to resolve margins in the containing block's block-flow direction. |
| 772 void computeAndSetBlockDirectionMargins(const LayoutBlock* containingBlock); | 758 void computeAndSetBlockDirectionMargins(const LayoutBlock* containingBlock); |
| 773 | 759 |
| 774 LayoutUnit offsetFromLogicalTopOfFirstPage() const; | 760 LayoutUnit offsetFromLogicalTopOfFirstPage() const; |
| 775 | 761 |
| 776 // The page logical offset is the object's offset from the top of the page in | 762 // The page logical offset is the object's offset from the top of the page in
the page progression |
| 777 // the page progression direction (so an x-offset in vertical text and a | 763 // direction (so an x-offset in vertical text and a y-offset for horizontal te
xt). |
| 778 // y-offset for horizontal text). | |
| 779 LayoutUnit pageLogicalOffset() const { | 764 LayoutUnit pageLogicalOffset() const { |
| 780 return m_rareData ? m_rareData->m_pageLogicalOffset : LayoutUnit(); | 765 return m_rareData ? m_rareData->m_pageLogicalOffset : LayoutUnit(); |
| 781 } | 766 } |
| 782 void setPageLogicalOffset(LayoutUnit); | 767 void setPageLogicalOffset(LayoutUnit); |
| 783 | 768 |
| 784 // Specify which page or column to associate with an offset, if said offset is | 769 // Specify which page or column to associate with an offset, if said offset is
exactly at a page |
| 785 // exactly at a page or column boundary. | 770 // or column boundary. |
| 786 enum PageBoundaryRule { AssociateWithFormerPage, AssociateWithLatterPage }; | 771 enum PageBoundaryRule { AssociateWithFormerPage, AssociateWithLatterPage }; |
| 787 LayoutUnit pageLogicalHeightForOffset(LayoutUnit) const; | 772 LayoutUnit pageLogicalHeightForOffset(LayoutUnit) const; |
| 788 LayoutUnit pageRemainingLogicalHeightForOffset(LayoutUnit, | 773 LayoutUnit pageRemainingLogicalHeightForOffset(LayoutUnit, |
| 789 PageBoundaryRule) const; | 774 PageBoundaryRule) const; |
| 790 | 775 |
| 791 // Calculate the strut to insert in order fit content of size | 776 // Calculate the strut to insert in order fit content of size |contentLogicalH
eight|. |
| 792 // |contentLogicalHeight|. |strutToNextPage| is the strut to add to |offset| | 777 // |strutToNextPage| is the strut to add to |offset| to merely get to the top
of the next page |
| 793 // to merely get to the top of the next page or column. This is what will be | 778 // or column. This is what will be returned if the content can actually fit th
ere. Otherwise, |
| 794 // returned if the content can actually fit there. Otherwise, return the | 779 // return the distance to the next fragmentainer that can fit this piece of co
ntent. |
| 795 // distance to the next fragmentainer that can fit this piece of content. | |
| 796 virtual LayoutUnit calculatePaginationStrutToFitContent( | 780 virtual LayoutUnit calculatePaginationStrutToFitContent( |
| 797 LayoutUnit offset, | 781 LayoutUnit offset, |
| 798 LayoutUnit strutToNextPage, | 782 LayoutUnit strutToNextPage, |
| 799 LayoutUnit contentLogicalHeight) const; | 783 LayoutUnit contentLogicalHeight) const; |
| 800 | 784 |
| 801 void positionLineBox(InlineBox*); | 785 void positionLineBox(InlineBox*); |
| 802 void moveWithEdgeOfInlineContainerIfNecessary(bool isHorizontal); | 786 void moveWithEdgeOfInlineContainerIfNecessary(bool isHorizontal); |
| 803 | 787 |
| 804 virtual InlineBox* createInlineBox(); | 788 virtual InlineBox* createInlineBox(); |
| 805 void dirtyLineBoxes(bool fullLayout); | 789 void dirtyLineBoxes(bool fullLayout); |
| 806 | 790 |
| 807 // For atomic inline elements, this function returns the inline box that | 791 // For atomic inline elements, this function returns the inline box that conta
ins us. Enables |
| 808 // contains us. Enables the atomic inline LayoutObject to quickly determine | 792 // the atomic inline LayoutObject to quickly determine what line it is contain
ed on and to easily |
| 809 // what line it is contained on and to easily iterate over structures on the | 793 // iterate over structures on the line. |
| 810 // line. | |
| 811 InlineBox* inlineBoxWrapper() const { return m_inlineBoxWrapper; } | 794 InlineBox* inlineBoxWrapper() const { return m_inlineBoxWrapper; } |
| 812 void setInlineBoxWrapper(InlineBox*); | 795 void setInlineBoxWrapper(InlineBox*); |
| 813 void deleteLineBoxWrapper(); | 796 void deleteLineBoxWrapper(); |
| 814 | 797 |
| 815 void setSpannerPlaceholder(LayoutMultiColumnSpannerPlaceholder&); | 798 void setSpannerPlaceholder(LayoutMultiColumnSpannerPlaceholder&); |
| 816 void clearSpannerPlaceholder(); | 799 void clearSpannerPlaceholder(); |
| 817 LayoutMultiColumnSpannerPlaceholder* spannerPlaceholder() const final { | 800 LayoutMultiColumnSpannerPlaceholder* spannerPlaceholder() const final { |
| 818 return m_rareData ? m_rareData->m_spannerPlaceholder : 0; | 801 return m_rareData ? m_rareData->m_spannerPlaceholder : 0; |
| 819 } | 802 } |
| 820 | 803 |
| 821 // A pagination strut is the amount of space needed to push an in-flow block- | 804 // A pagination strut is the amount of space needed to push an in-flow block-l
evel object (or |
| 822 // level object (or float) to the logical top of the next page or column. It | 805 // float) to the logical top of the next page or column. It will be set both f
or forced breaks |
| 823 // will be set both for forced breaks (e.g. page-break-before:always) and soft | 806 // (e.g. page-break-before:always) and soft breaks (when there's not enough sp
ace in the current |
| 824 // breaks (when there's not enough space in the current page / column for the | 807 // page / column for the object). The strut is baked into the logicalTop() of
the object, so |
| 825 // object). The strut is baked into the logicalTop() of the object, so that | 808 // that logicalTop() - paginationStrut() == the original position in the previ
ous column before |
| 826 // logicalTop() - paginationStrut() == the original position in the previous | 809 // deciding to break. |
| 827 // column before deciding to break. | |
| 828 // | 810 // |
| 829 // Pagination struts are either set in front of a block-level box (here) or | 811 // Pagination struts are either set in front of a block-level box (here) or be
fore a line |
| 830 // before a line (RootInlineBox::paginationStrut()). | 812 // (RootInlineBox::paginationStrut()). |
| 831 LayoutUnit paginationStrut() const { | 813 LayoutUnit paginationStrut() const { |
| 832 return m_rareData ? m_rareData->m_paginationStrut : LayoutUnit(); | 814 return m_rareData ? m_rareData->m_paginationStrut : LayoutUnit(); |
| 833 } | 815 } |
| 834 void setPaginationStrut(LayoutUnit); | 816 void setPaginationStrut(LayoutUnit); |
| 835 void resetPaginationStrut() { | 817 void resetPaginationStrut() { |
| 836 if (m_rareData) | 818 if (m_rareData) |
| 837 m_rareData->m_paginationStrut = LayoutUnit(); | 819 m_rareData->m_paginationStrut = LayoutUnit(); |
| 838 } | 820 } |
| 839 | 821 |
| 840 // Is the specified break-before or break-after value supported on this | 822 // Is the specified break-before or break-after value supported on this object
? It needs to be |
| 841 // object? It needs to be in-flow all the way up to a fragmentation context | 823 // in-flow all the way up to a fragmentation context that supports the specifi
ed value. |
| 842 // that supports the specified value. | |
| 843 bool isBreakBetweenControllable(EBreak) const; | 824 bool isBreakBetweenControllable(EBreak) const; |
| 844 | 825 |
| 845 // Is the specified break-inside value supported on this object? It needs to | 826 // Is the specified break-inside value supported on this object? It needs to b
e contained by a |
| 846 // be contained by a fragmentation context that supports the specified value. | 827 // fragmentation context that supports the specified value. |
| 847 bool isBreakInsideControllable(EBreak) const; | 828 bool isBreakInsideControllable(EBreak) const; |
| 848 | 829 |
| 849 virtual EBreak breakAfter() const; | 830 virtual EBreak breakAfter() const; |
| 850 virtual EBreak breakBefore() const; | 831 virtual EBreak breakBefore() const; |
| 851 EBreak breakInside() const; | 832 EBreak breakInside() const; |
| 852 | 833 |
| 853 // Join two adjacent break values specified on break-before and/or break- | 834 // Join two adjacent break values specified on break-before and/or break-after
. avoid* values |
| 854 // after. avoid* values win over auto values, and forced break values win over | 835 // win over auto values, and forced break values win over avoid* values. |firs
tValue| is |
| 855 // avoid* values. |firstValue| is specified on an element earlier in the flow | 836 // specified on an element earlier in the flow than |secondValue|. This method
is used at class |
| 856 // than |secondValue|. This method is used at class A break points [1], to | 837 // A break points [1], to join the values of the previous break-after and the
next |
| 857 // join the values of the previous break-after and the next break-before, to | 838 // break-before, to figure out whether we may, must, or should not, break at t
hat point. It is |
| 858 // figure out whether we may, must, or should not, break at that point. It is | 839 // also used when propagating break-before values from first children and brea
k-after values on |
| 859 // also used when propagating break-before values from first children and | 840 // last children to their container. |
| 860 // break-after values on last children to their container. | |
| 861 // | 841 // |
| 862 // [1] https://drafts.csswg.org/css-break/#possible-breaks | 842 // [1] https://drafts.csswg.org/css-break/#possible-breaks |
| 863 static EBreak joinFragmentainerBreakValues(EBreak firstValue, | 843 static EBreak joinFragmentainerBreakValues(EBreak firstValue, |
| 864 EBreak secondValue); | 844 EBreak secondValue); |
| 865 | 845 |
| 866 static bool isForcedFragmentainerBreakValue(EBreak); | 846 static bool isForcedFragmentainerBreakValue(EBreak); |
| 867 | 847 |
| 868 EBreak classABreakPointValue(EBreak previousBreakAfterValue) const; | 848 EBreak classABreakPointValue(EBreak previousBreakAfterValue) const; |
| 869 | 849 |
| 870 // Return true if we should insert a break in front of this box. The box needs | 850 // Return true if we should insert a break in front of this box. The box needs
to start at a |
| 871 // to start at a valid class A break point in order to allow a forced break. | 851 // valid class A break point in order to allow a forced break. To determine wh
ether or not to |
| 872 // To determine whether or not to break, we also need to know the break-after | 852 // break, we also need to know the break-after value of the previous in-flow s
ibling. |
| 873 // value of the previous in-flow sibling. | |
| 874 bool needsForcedBreakBefore(EBreak previousBreakAfterValue) const; | 853 bool needsForcedBreakBefore(EBreak previousBreakAfterValue) const; |
| 875 | 854 |
| 876 bool paintedOutputOfObjectHasNoEffectRegardlessOfSize() const override; | 855 bool paintedOutputOfObjectHasNoEffectRegardlessOfSize() const override; |
| 877 LayoutRect localOverflowRectForPaintInvalidation() const override; | 856 LayoutRect localOverflowRectForPaintInvalidation() const override; |
| 878 bool mapToVisualRectInAncestorSpace( | 857 bool mapToVisualRectInAncestorSpace( |
| 879 const LayoutBoxModelObject* ancestor, | 858 const LayoutBoxModelObject* ancestor, |
| 880 LayoutRect&, | 859 LayoutRect&, |
| 881 VisualRectFlags = DefaultVisualRectFlags) const override; | 860 VisualRectFlags = DefaultVisualRectFlags) const override; |
| 882 | 861 |
| 883 LayoutUnit containingBlockLogicalHeightForGetComputedStyle() const; | 862 LayoutUnit containingBlockLogicalHeightForGetComputedStyle() const; |
| 884 | 863 |
| 885 LayoutUnit containingBlockLogicalWidthForContent() const override; | 864 LayoutUnit containingBlockLogicalWidthForContent() const override; |
| 886 LayoutUnit containingBlockLogicalHeightForContent( | 865 LayoutUnit containingBlockLogicalHeightForContent( |
| 887 AvailableLogicalHeightType) const; | 866 AvailableLogicalHeightType) const; |
| 888 | 867 |
| 889 LayoutUnit containingBlockAvailableLineWidth() const; | 868 LayoutUnit containingBlockAvailableLineWidth() const; |
| 890 LayoutUnit perpendicularContainingBlockLogicalHeight() const; | 869 LayoutUnit perpendicularContainingBlockLogicalHeight() const; |
| 891 | 870 |
| 892 virtual void updateLogicalWidth(); | 871 virtual void updateLogicalWidth(); |
| 893 void updateLogicalHeight(); | 872 void updateLogicalHeight(); |
| 894 virtual void computeLogicalHeight(LayoutUnit logicalHeight, | 873 virtual void computeLogicalHeight(LayoutUnit logicalHeight, |
| 895 LayoutUnit logicalTop, | 874 LayoutUnit logicalTop, |
| 896 LogicalExtentComputedValues&) const; | 875 LogicalExtentComputedValues&) const; |
| 897 // This function will compute the logical border-box height, without laying | 876 // This function will compute the logical border-box height, without laying ou
t the box. This means that the result |
| 898 // out the box. This means that the result is only "correct" when the height | 877 // is only "correct" when the height is explicitly specified. This function ex
ists so that intrinsic width calculations |
| 899 // is explicitly specified. This function exists so that intrinsic width | 878 // have a way to deal with children that have orthogonal flows. |
| 900 // calculations have a way to deal with children that have orthogonal flows. | 879 // When there is no explicit height, this function assumes a content height of
zero (and returns just border+padding) |
| 901 // When there is no explicit height, this function assumes a content height of | |
| 902 // zero (and returns just border+padding). | |
| 903 LayoutUnit computeLogicalHeightWithoutLayout() const; | 880 LayoutUnit computeLogicalHeightWithoutLayout() const; |
| 904 | 881 |
| 905 void computeLogicalWidth(LogicalExtentComputedValues&) const; | 882 void computeLogicalWidth(LogicalExtentComputedValues&) const; |
| 906 | 883 |
| 907 bool stretchesToViewport() const { | 884 bool stretchesToViewport() const { |
| 908 return document().inQuirksMode() && stretchesToViewportInQuirksMode(); | 885 return document().inQuirksMode() && stretchesToViewportInQuirksMode(); |
| 909 } | 886 } |
| 910 | 887 |
| 911 virtual LayoutSize intrinsicSize() const { return LayoutSize(); } | 888 virtual LayoutSize intrinsicSize() const { return LayoutSize(); } |
| 912 LayoutUnit intrinsicLogicalWidth() const { | 889 LayoutUnit intrinsicLogicalWidth() const { |
| 913 return style()->isHorizontalWritingMode() ? intrinsicSize().width() | 890 return style()->isHorizontalWritingMode() ? intrinsicSize().width() |
| 914 : intrinsicSize().height(); | 891 : intrinsicSize().height(); |
| 915 } | 892 } |
| 916 LayoutUnit intrinsicLogicalHeight() const { | 893 LayoutUnit intrinsicLogicalHeight() const { |
| 917 return style()->isHorizontalWritingMode() ? intrinsicSize().height() | 894 return style()->isHorizontalWritingMode() ? intrinsicSize().height() |
| 918 : intrinsicSize().width(); | 895 : intrinsicSize().width(); |
| 919 } | 896 } |
| 920 virtual LayoutUnit intrinsicContentLogicalHeight() const { | 897 virtual LayoutUnit intrinsicContentLogicalHeight() const { |
| 921 return m_intrinsicContentLogicalHeight; | 898 return m_intrinsicContentLogicalHeight; |
| 922 } | 899 } |
| 923 | 900 |
| 924 // Whether or not the element shrinks to its intrinsic width (rather than | 901 // Whether or not the element shrinks to its intrinsic width (rather than fill
ing the width |
| 925 // filling the width of a containing block). HTML4 buttons, <select>s, | 902 // of a containing block). HTML4 buttons, <select>s, <input>s, legends, and f
loating/compact elements do this. |
| 926 // <input>s, legends, and floating/compact elements do this. | |
| 927 bool sizesLogicalWidthToFitContent(const Length& logicalWidth) const; | 903 bool sizesLogicalWidthToFitContent(const Length& logicalWidth) const; |
| 928 | 904 |
| 929 LayoutUnit shrinkLogicalWidthToAvoidFloats(LayoutUnit childMarginStart, | 905 LayoutUnit shrinkLogicalWidthToAvoidFloats(LayoutUnit childMarginStart, |
| 930 LayoutUnit childMarginEnd, | 906 LayoutUnit childMarginEnd, |
| 931 const LayoutBlockFlow* cb) const; | 907 const LayoutBlockFlow* cb) const; |
| 932 | 908 |
| 933 LayoutUnit computeLogicalWidthUsing(SizeType, | 909 LayoutUnit computeLogicalWidthUsing(SizeType, |
| 934 const Length& logicalWidth, | 910 const Length& logicalWidth, |
| 935 LayoutUnit availableLogicalWidth, | 911 LayoutUnit availableLogicalWidth, |
| 936 const LayoutBlock* containingBlock) const; | 912 const LayoutBlock* containingBlock) const; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 956 LayoutUnit logicalHeight) const; | 932 LayoutUnit logicalHeight) const; |
| 957 | 933 |
| 958 virtual LayoutUnit computeReplacedLogicalWidth( | 934 virtual LayoutUnit computeReplacedLogicalWidth( |
| 959 ShouldComputePreferred = ComputeActual) const; | 935 ShouldComputePreferred = ComputeActual) const; |
| 960 virtual LayoutUnit computeReplacedLogicalHeight( | 936 virtual LayoutUnit computeReplacedLogicalHeight( |
| 961 LayoutUnit estimatedUsedWidth = LayoutUnit()) const; | 937 LayoutUnit estimatedUsedWidth = LayoutUnit()) const; |
| 962 | 938 |
| 963 bool percentageLogicalHeightIsResolvable() const; | 939 bool percentageLogicalHeightIsResolvable() const; |
| 964 LayoutUnit computePercentageLogicalHeight(const Length& height) const; | 940 LayoutUnit computePercentageLogicalHeight(const Length& height) const; |
| 965 | 941 |
| 966 // Block flows subclass availableWidth/Height to handle multi column layout | 942 // Block flows subclass availableWidth/Height to handle multi column layout (s
hrinking the width/height available to children when laying out.) |
| 967 // (shrinking the width/height available to children when laying out.) | |
| 968 LayoutUnit availableLogicalWidth() const { return contentLogicalWidth(); } | 943 LayoutUnit availableLogicalWidth() const { return contentLogicalWidth(); } |
| 969 LayoutUnit availableLogicalHeight(AvailableLogicalHeightType) const; | 944 LayoutUnit availableLogicalHeight(AvailableLogicalHeightType) const; |
| 970 LayoutUnit availableLogicalHeightUsing(const Length&, | 945 LayoutUnit availableLogicalHeightUsing(const Length&, |
| 971 AvailableLogicalHeightType) const; | 946 AvailableLogicalHeightType) const; |
| 972 | 947 |
| 973 // There are a few cases where we need to refer specifically to the available | 948 // There are a few cases where we need to refer specifically to the available
physical width and available physical height. |
| 974 // physical width and available physical height. Relative positioning is one | 949 // Relative positioning is one of those cases, since left/top offsets are phys
ical. |
| 975 // of those cases, since left/top offsets are physical. | |
| 976 LayoutUnit availableWidth() const { | 950 LayoutUnit availableWidth() const { |
| 977 return style()->isHorizontalWritingMode() | 951 return style()->isHorizontalWritingMode() |
| 978 ? availableLogicalWidth() | 952 ? availableLogicalWidth() |
| 979 : availableLogicalHeight(IncludeMarginBorderPadding); | 953 : availableLogicalHeight(IncludeMarginBorderPadding); |
| 980 } | 954 } |
| 981 LayoutUnit availableHeight() const { | 955 LayoutUnit availableHeight() const { |
| 982 return style()->isHorizontalWritingMode() | 956 return style()->isHorizontalWritingMode() |
| 983 ? availableLogicalHeight(IncludeMarginBorderPadding) | 957 ? availableLogicalHeight(IncludeMarginBorderPadding) |
| 984 : availableLogicalWidth(); | 958 : availableLogicalWidth(); |
| 985 } | 959 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1030 } | 1004 } |
| 1031 virtual bool scrollsOverflowX() const { | 1005 virtual bool scrollsOverflowX() const { |
| 1032 return hasOverflowClip() && (style()->overflowX() == OverflowScroll || | 1006 return hasOverflowClip() && (style()->overflowX() == OverflowScroll || |
| 1033 hasAutoHorizontalScrollbar()); | 1007 hasAutoHorizontalScrollbar()); |
| 1034 } | 1008 } |
| 1035 virtual bool scrollsOverflowY() const { | 1009 virtual bool scrollsOverflowY() const { |
| 1036 return hasOverflowClip() && (style()->overflowY() == OverflowScroll || | 1010 return hasOverflowClip() && (style()->overflowY() == OverflowScroll || |
| 1037 hasAutoVerticalScrollbar()); | 1011 hasAutoVerticalScrollbar()); |
| 1038 } | 1012 } |
| 1039 | 1013 |
| 1040 // Elements such as the <input> field override this to specify that they are | 1014 // Elements such as the <input> field override this to specify that they are s
crollable |
| 1041 // scrollable outside the context of the CSS overflow style | 1015 // outside the context of the CSS overflow style |
| 1042 virtual bool isIntrinsicallyScrollable( | 1016 virtual bool isIntrinsicallyScrollable( |
| 1043 ScrollbarOrientation orientation) const { | 1017 ScrollbarOrientation orientation) const { |
| 1044 return false; | 1018 return false; |
| 1045 } | 1019 } |
| 1046 | 1020 |
| 1047 bool hasUnsplittableScrollingOverflow() const; | 1021 bool hasUnsplittableScrollingOverflow() const; |
| 1048 | 1022 |
| 1049 // Page / column breakability inside block-level objects. | 1023 // Page / column breakability inside block-level objects. |
| 1050 enum PaginationBreakability { | 1024 enum PaginationBreakability { |
| 1051 AllowAnyBreaks, // No restrictions on breaking. May examine children to | 1025 AllowAnyBreaks, // No restrictions on breaking. May examine children to fin
d possible break points. |
| 1052 // find possible break points. | 1026 ForbidBreaks, // Forbid breaks inside this object. Content cannot be spli
t nicely into smaller pieces. |
| 1053 ForbidBreaks, // Forbid breaks inside this object. Content cannot be split | 1027 AvoidBreaks // Preferably avoid breaks. If not possible, examine childr
en to find possible break points. |
| 1054 // nicely into smaller pieces. | |
| 1055 AvoidBreaks // Preferably avoid breaks. If not possible, examine children | |
| 1056 // to find possible break points. | |
| 1057 }; | 1028 }; |
| 1058 PaginationBreakability getPaginationBreakability() const; | 1029 PaginationBreakability getPaginationBreakability() const; |
| 1059 | 1030 |
| 1060 LayoutRect localCaretRect( | 1031 LayoutRect localCaretRect( |
| 1061 InlineBox*, | 1032 InlineBox*, |
| 1062 int caretOffset, | 1033 int caretOffset, |
| 1063 LayoutUnit* extraWidthToEndOfLine = nullptr) override; | 1034 LayoutUnit* extraWidthToEndOfLine = nullptr) override; |
| 1064 | 1035 |
| 1065 virtual LayoutRect overflowClipRect( | 1036 virtual LayoutRect overflowClipRect( |
| 1066 const LayoutPoint& location, | 1037 const LayoutPoint& location, |
| 1067 OverlayScrollbarClipBehavior = IgnoreOverlayScrollbarSize) const; | 1038 OverlayScrollbarClipBehavior = IgnoreOverlayScrollbarSize) const; |
| 1068 LayoutRect clipRect(const LayoutPoint& location) const; | 1039 LayoutRect clipRect(const LayoutPoint& location) const; |
| 1069 virtual bool hasControlClip() const { return false; } | 1040 virtual bool hasControlClip() const { return false; } |
| 1070 virtual LayoutRect controlClipRect(const LayoutPoint&) const { | 1041 virtual LayoutRect controlClipRect(const LayoutPoint&) const { |
| 1071 return LayoutRect(); | 1042 return LayoutRect(); |
| 1072 } | 1043 } |
| 1073 | 1044 |
| 1074 // Returns the combination of overflow clip, contain: paint clip and CSS clip | 1045 // Returns the combination of overflow clip, contain: paint clip and CSS clip
for this object, in local space. |
| 1075 // for this object, in local space. | |
| 1076 LayoutRect clippingRect() const; | 1046 LayoutRect clippingRect() const; |
| 1077 | 1047 |
| 1078 virtual void paintBoxDecorationBackground(const PaintInfo&, | 1048 virtual void paintBoxDecorationBackground(const PaintInfo&, |
| 1079 const LayoutPoint&) const; | 1049 const LayoutPoint&) const; |
| 1080 virtual void paintMask(const PaintInfo&, const LayoutPoint&) const; | 1050 virtual void paintMask(const PaintInfo&, const LayoutPoint&) const; |
| 1081 void imageChanged(WrappedImagePtr, const IntRect* = nullptr) override; | 1051 void imageChanged(WrappedImagePtr, const IntRect* = nullptr) override; |
| 1082 ResourcePriority computeResourcePriority() const final; | 1052 ResourcePriority computeResourcePriority() const final; |
| 1083 | 1053 |
| 1084 void logicalExtentAfterUpdatingLogicalWidth(const LayoutUnit& logicalTop, | 1054 void logicalExtentAfterUpdatingLogicalWidth(const LayoutUnit& logicalTop, |
| 1085 LogicalExtentComputedValues&); | 1055 LogicalExtentComputedValues&); |
| 1086 | 1056 |
| 1087 PositionWithAffinity positionForPoint(const LayoutPoint&) override; | 1057 PositionWithAffinity positionForPoint(const LayoutPoint&) override; |
| 1088 | 1058 |
| 1089 void removeFloatingOrPositionedChildFromBlockLists(); | 1059 void removeFloatingOrPositionedChildFromBlockLists(); |
| 1090 | 1060 |
| 1091 PaintLayer* enclosingFloatPaintingLayer() const; | 1061 PaintLayer* enclosingFloatPaintingLayer() const; |
| 1092 | 1062 |
| 1093 virtual int firstLineBoxBaseline() const { return -1; } | 1063 virtual int firstLineBoxBaseline() const { return -1; } |
| 1094 virtual int inlineBlockBaseline(LineDirectionMode) const { | 1064 virtual int inlineBlockBaseline(LineDirectionMode) const { |
| 1095 return -1; | 1065 return -1; |
| 1096 } // Returns -1 if we should skip this box when computing the baseline of an | 1066 } // Returns -1 if we should skip this box when computing the baseline of an
inline-block. |
| 1097 // inline-block. | |
| 1098 | 1067 |
| 1099 virtual Node* nodeForHitTest() const { return node(); } | 1068 virtual Node* nodeForHitTest() const { return node(); } |
| 1100 | 1069 |
| 1101 bool shrinkToAvoidFloats() const; | 1070 bool shrinkToAvoidFloats() const; |
| 1102 virtual bool avoidsFloats() const; | 1071 virtual bool avoidsFloats() const; |
| 1103 | 1072 |
| 1104 void markChildForPaginationRelayoutIfNeeded(LayoutBox& child, | 1073 void markChildForPaginationRelayoutIfNeeded(LayoutBox& child, |
| 1105 SubtreeLayoutScope&); | 1074 SubtreeLayoutScope&); |
| 1106 | 1075 |
| 1107 bool isWritingModeRoot() const { | 1076 bool isWritingModeRoot() const { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1139 bool firstLine, | 1108 bool firstLine, |
| 1140 LineDirectionMode, | 1109 LineDirectionMode, |
| 1141 LinePositionMode = PositionOnContainingLine) const override; | 1110 LinePositionMode = PositionOnContainingLine) const override; |
| 1142 | 1111 |
| 1143 LayoutUnit offsetLeft(const Element*) const override; | 1112 LayoutUnit offsetLeft(const Element*) const override; |
| 1144 LayoutUnit offsetTop(const Element*) const override; | 1113 LayoutUnit offsetTop(const Element*) const override; |
| 1145 | 1114 |
| 1146 LayoutPoint flipForWritingModeForChild(const LayoutBox* child, | 1115 LayoutPoint flipForWritingModeForChild(const LayoutBox* child, |
| 1147 const LayoutPoint&) const; | 1116 const LayoutPoint&) const; |
| 1148 LayoutUnit flipForWritingMode(LayoutUnit position) const WARN_UNUSED_RETURN { | 1117 LayoutUnit flipForWritingMode(LayoutUnit position) const WARN_UNUSED_RETURN { |
| 1149 // The offset is in the block direction (y for horizontal writing modes, x | 1118 // The offset is in the block direction (y for horizontal writing modes, x f
or vertical writing modes). |
| 1150 // for vertical writing modes). | |
| 1151 if (!UNLIKELY(hasFlippedBlocksWritingMode())) | 1119 if (!UNLIKELY(hasFlippedBlocksWritingMode())) |
| 1152 return position; | 1120 return position; |
| 1153 return logicalHeight() - position; | 1121 return logicalHeight() - position; |
| 1154 } | 1122 } |
| 1155 LayoutPoint flipForWritingMode(const LayoutPoint& position) const | 1123 LayoutPoint flipForWritingMode(const LayoutPoint& position) const |
| 1156 WARN_UNUSED_RETURN { | 1124 WARN_UNUSED_RETURN { |
| 1157 if (!UNLIKELY(hasFlippedBlocksWritingMode())) | 1125 if (!UNLIKELY(hasFlippedBlocksWritingMode())) |
| 1158 return position; | 1126 return position; |
| 1159 return isHorizontalWritingMode() | 1127 return isHorizontalWritingMode() |
| 1160 ? LayoutPoint(position.x(), m_frameRect.height() - position.y()) | 1128 ? LayoutPoint(position.x(), m_frameRect.height() - position.y()) |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1207 bool hasVisualOverflow() const { | 1175 bool hasVisualOverflow() const { |
| 1208 return m_overflow && !borderBoxRect().contains(visualOverflowRect()); | 1176 return m_overflow && !borderBoxRect().contains(visualOverflowRect()); |
| 1209 } | 1177 } |
| 1210 | 1178 |
| 1211 virtual bool needsPreferredWidthsRecalculation() const; | 1179 virtual bool needsPreferredWidthsRecalculation() const; |
| 1212 | 1180 |
| 1213 // See README.md for an explanation of scroll origin. | 1181 // See README.md for an explanation of scroll origin. |
| 1214 virtual IntSize originAdjustmentForScrollbars() const; | 1182 virtual IntSize originAdjustmentForScrollbars() const; |
| 1215 IntSize scrolledContentOffset() const; | 1183 IntSize scrolledContentOffset() const; |
| 1216 | 1184 |
| 1217 // Maps a rect in scrolling contents space to box space and apply overflow | 1185 // Maps a rect in scrolling contents space to box space and apply overflow cli
p if needed. |
| 1218 // clip if needed. Returns true if no clipping applied or the rect actually | 1186 // Returns true if no clipping applied or the rect actually intersects the cli
pping region. |
| 1219 // intersects the clipping region. If edgeInclusive is true, then this method | 1187 // If edgeInclusive is true, then this method may return true even |
| 1220 // may return true even if the resulting rect has zero area. | 1188 // if the resulting rect has zero area. |
| 1221 bool mapScrollingContentsRectToBoxSpace( | 1189 bool mapScrollingContentsRectToBoxSpace( |
| 1222 LayoutRect&, | 1190 LayoutRect&, |
| 1223 ApplyOverflowClipFlag, | 1191 ApplyOverflowClipFlag, |
| 1224 VisualRectFlags = DefaultVisualRectFlags) const; | 1192 VisualRectFlags = DefaultVisualRectFlags) const; |
| 1225 | 1193 |
| 1226 virtual bool hasRelativeLogicalWidth() const; | 1194 virtual bool hasRelativeLogicalWidth() const; |
| 1227 virtual bool hasRelativeLogicalHeight() const; | 1195 virtual bool hasRelativeLogicalHeight() const; |
| 1228 | 1196 |
| 1229 bool hasHorizontalLayoutOverflow() const { | 1197 bool hasHorizontalLayoutOverflow() const { |
| 1230 if (!m_overflow) | 1198 if (!m_overflow) |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1315 void willBeRemovedFromTree() override; | 1283 void willBeRemovedFromTree() override; |
| 1316 | 1284 |
| 1317 void styleWillChange(StyleDifference, const ComputedStyle& newStyle) override; | 1285 void styleWillChange(StyleDifference, const ComputedStyle& newStyle) override; |
| 1318 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override; | 1286 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override; |
| 1319 void updateFromStyle() override; | 1287 void updateFromStyle() override; |
| 1320 | 1288 |
| 1321 virtual ItemPosition selfAlignmentNormalBehavior() const { | 1289 virtual ItemPosition selfAlignmentNormalBehavior() const { |
| 1322 return ItemPositionStretch; | 1290 return ItemPositionStretch; |
| 1323 } | 1291 } |
| 1324 | 1292 |
| 1325 // Returns false if it could not cheaply compute the extent (e.g. fixed | 1293 // Returns false if it could not cheaply compute the extent (e.g. fixed backgr
ound), in which case the returned rect may be incorrect. |
| 1326 // background), in which case the returned rect may be incorrect. | 1294 // FIXME: make this a const method once the LayoutBox reference in BoxPainter
is const. |
| 1327 // FIXME: make this a const method once the LayoutBox reference in BoxPainter | |
| 1328 // is const. | |
| 1329 bool getBackgroundPaintedExtent(LayoutRect&) const; | 1295 bool getBackgroundPaintedExtent(LayoutRect&) const; |
| 1330 virtual bool foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect, | 1296 virtual bool foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect, |
| 1331 unsigned maxDepthToTest) const; | 1297 unsigned maxDepthToTest) const; |
| 1332 bool computeBackgroundIsKnownToBeObscured() const override; | 1298 bool computeBackgroundIsKnownToBeObscured() const override; |
| 1333 | 1299 |
| 1334 virtual void computePositionedLogicalWidth( | 1300 virtual void computePositionedLogicalWidth( |
| 1335 LogicalExtentComputedValues&) const; | 1301 LogicalExtentComputedValues&) const; |
| 1336 | 1302 |
| 1337 LayoutUnit computeIntrinsicLogicalWidthUsing( | 1303 LayoutUnit computeIntrinsicLogicalWidthUsing( |
| 1338 const Length& logicalWidthLength, | 1304 const Length& logicalWidthLength, |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1451 const Length& logicalBottom, | 1417 const Length& logicalBottom, |
| 1452 const Length& marginLogicalTop, | 1418 const Length& marginLogicalTop, |
| 1453 const Length& marginLogicalBottom, | 1419 const Length& marginLogicalBottom, |
| 1454 LogicalExtentComputedValues&) const; | 1420 LogicalExtentComputedValues&) const; |
| 1455 | 1421 |
| 1456 LayoutUnit fillAvailableMeasure(LayoutUnit availableLogicalWidth) const; | 1422 LayoutUnit fillAvailableMeasure(LayoutUnit availableLogicalWidth) const; |
| 1457 LayoutUnit fillAvailableMeasure(LayoutUnit availableLogicalWidth, | 1423 LayoutUnit fillAvailableMeasure(LayoutUnit availableLogicalWidth, |
| 1458 LayoutUnit& marginStart, | 1424 LayoutUnit& marginStart, |
| 1459 LayoutUnit& marginEnd) const; | 1425 LayoutUnit& marginEnd) const; |
| 1460 | 1426 |
| 1461 // Calculates the intrinsic(https://drafts.csswg.org/css-sizing-3/#intrinsic) | 1427 // Calculates the intrinsic(https://drafts.csswg.org/css-sizing-3/#intrinsic)
logical widths for this layout box. |
| 1462 // logical widths for this layout box. | |
| 1463 // | 1428 // |
| 1464 // intrinsicWidth is defined as: | 1429 // intrinsicWidth is defined as: |
| 1465 // intrinsic size of content (without our border and padding) + | 1430 // intrinsic size of content (without our border and padding) + scrollbarW
idth. |
| 1466 // scrollbarWidth. | |
| 1467 // | 1431 // |
| 1468 // preferredWidth is defined as: | 1432 // preferredWidth is defined as: |
| 1469 // fixedWidth OR (intrinsicWidth plus border and padding). | 1433 // fixedWidth OR (intrinsicWidth plus border and padding). |
| 1470 // Note: fixedWidth includes border and padding and scrollbarWidth. | 1434 // Note: fixedWidth includes border and padding and scrollbarWidth. |
| 1471 virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, | 1435 virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, |
| 1472 LayoutUnit& maxLogicalWidth) const; | 1436 LayoutUnit& maxLogicalWidth) const; |
| 1473 | 1437 |
| 1474 // This function calculates the preferred widths for an object. | 1438 // This function calculates the preferred widths for an object. |
| 1475 // | 1439 // |
| 1476 // This function is only expected to be called if | 1440 // This function is only expected to be called if |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1597 } | 1561 } |
| 1598 | 1562 |
| 1599 inline LayoutBox* LayoutBox::nextSiblingMultiColumnBox() const { | 1563 inline LayoutBox* LayoutBox::nextSiblingMultiColumnBox() const { |
| 1600 ASSERT(isLayoutMultiColumnSpannerPlaceholder() || isLayoutMultiColumnSet()); | 1564 ASSERT(isLayoutMultiColumnSpannerPlaceholder() || isLayoutMultiColumnSet()); |
| 1601 return nextSiblingBox(); | 1565 return nextSiblingBox(); |
| 1602 } | 1566 } |
| 1603 | 1567 |
| 1604 inline void LayoutBox::setInlineBoxWrapper(InlineBox* boxWrapper) { | 1568 inline void LayoutBox::setInlineBoxWrapper(InlineBox* boxWrapper) { |
| 1605 if (boxWrapper) { | 1569 if (boxWrapper) { |
| 1606 ASSERT(!m_inlineBoxWrapper); | 1570 ASSERT(!m_inlineBoxWrapper); |
| 1607 // m_inlineBoxWrapper should already be nullptr. Deleting it is a safeguard | 1571 // m_inlineBoxWrapper should already be nullptr. Deleting it is a safeguard
against security issues. |
| 1608 // against security issues. Otherwise, there will two line box wrappers | 1572 // Otherwise, there will two line box wrappers keeping the reference to this
layoutObject, and |
| 1609 // keeping the reference to this layoutObject, and only one will be notified | 1573 // only one will be notified when the layoutObject is getting destroyed. The
second line box wrapper |
| 1610 // when the layoutObject is getting destroyed. The second line box wrapper | |
| 1611 // will keep a stale reference. | 1574 // will keep a stale reference. |
| 1612 if (UNLIKELY(m_inlineBoxWrapper != nullptr)) | 1575 if (UNLIKELY(m_inlineBoxWrapper != nullptr)) |
| 1613 deleteLineBoxWrapper(); | 1576 deleteLineBoxWrapper(); |
| 1614 } | 1577 } |
| 1615 | 1578 |
| 1616 m_inlineBoxWrapper = boxWrapper; | 1579 m_inlineBoxWrapper = boxWrapper; |
| 1617 } | 1580 } |
| 1618 | 1581 |
| 1619 inline bool LayoutBox::isForcedFragmentainerBreakValue(EBreak breakValue) { | 1582 inline bool LayoutBox::isForcedFragmentainerBreakValue(EBreak breakValue) { |
| 1620 return breakValue == BreakColumn || breakValue == BreakLeft || | 1583 return breakValue == BreakColumn || breakValue == BreakLeft || |
| 1621 breakValue == BreakPage || breakValue == BreakRecto || | 1584 breakValue == BreakPage || breakValue == BreakRecto || |
| 1622 breakValue == BreakRight || breakValue == BreakVerso; | 1585 breakValue == BreakRight || breakValue == BreakVerso; |
| 1623 } | 1586 } |
| 1624 | 1587 |
| 1625 } // namespace blink | 1588 } // namespace blink |
| 1626 | 1589 |
| 1627 #endif // LayoutBox_h | 1590 #endif // LayoutBox_h |
| OLD | NEW |