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

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

Powered by Google App Engine
This is Rietveld 408576698