Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBox.h

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

Powered by Google App Engine
This is Rietveld 408576698