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

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

Issue 2398623003: Re-land Reformat comments in core/layout up until LayoutBox (Closed)
Patch Set: Rebase w/HEAD 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 styleToUse->direction(), value); 644 styleToUse->direction(), value);
633 } 645 }
634 void setMarginEnd(LayoutUnit value, 646 void setMarginEnd(LayoutUnit value,
635 const ComputedStyle* overrideStyle = nullptr) { 647 const ComputedStyle* overrideStyle = nullptr) {
636 const ComputedStyle* styleToUse = overrideStyle ? overrideStyle : style(); 648 const ComputedStyle* styleToUse = overrideStyle ? overrideStyle : style();
637 m_marginBoxOutsets.setEnd(styleToUse->getWritingMode(), 649 m_marginBoxOutsets.setEnd(styleToUse->getWritingMode(),
638 styleToUse->direction(), value); 650 styleToUse->direction(), value);
639 } 651 }
640 652
641 // The following functions are used to implement collapsing margins. 653 // The following functions are used to implement collapsing margins.
642 // All objects know their maximal positive and negative margins. The 654 // All objects know their maximal positive and negative margins. The formula
643 // formula for computing a collapsed margin is |maxPosMargin| - |maxNegmargin| . 655 // for computing a collapsed margin is |maxPosMargin| - |maxNegmargin|.
644 // For a non-collapsing box, such as a leaf element, this formula will simply return 656 // For a non-collapsing box, such as a leaf element, this formula will simply
645 // the margin of the element. Blocks override the maxMarginBefore and maxMarg inAfter 657 // return the margin of the element. Blocks override the maxMarginBefore and
646 // methods. 658 // maxMarginAfter methods.
647 virtual bool isSelfCollapsingBlock() const { return false; } 659 virtual bool isSelfCollapsingBlock() const { return false; }
648 virtual LayoutUnit collapsedMarginBefore() const { return marginBefore(); } 660 virtual LayoutUnit collapsedMarginBefore() const { return marginBefore(); }
649 virtual LayoutUnit collapsedMarginAfter() const { return marginAfter(); } 661 virtual LayoutUnit collapsedMarginAfter() const { return marginAfter(); }
650 LayoutRectOutsets collapsedMarginBoxLogicalOutsets() const { 662 LayoutRectOutsets collapsedMarginBoxLogicalOutsets() const {
651 return LayoutRectOutsets(collapsedMarginBefore(), LayoutUnit(), 663 return LayoutRectOutsets(collapsedMarginBefore(), LayoutUnit(),
652 collapsedMarginAfter(), LayoutUnit()); 664 collapsedMarginAfter(), LayoutUnit());
653 } 665 }
654 666
655 void absoluteRects(Vector<IntRect>&, 667 void absoluteRects(Vector<IntRect>&,
656 const LayoutPoint& accumulatedOffset) const override; 668 const LayoutPoint& accumulatedOffset) const override;
657 void absoluteQuads(Vector<FloatQuad>&) const override; 669 void absoluteQuads(Vector<FloatQuad>&) const override;
658 FloatRect localBoundingBoxRectForAccessibility() const final; 670 FloatRect localBoundingBoxRectForAccessibility() const final;
659 671
660 int reflectionOffset() const; 672 int reflectionOffset() const;
661 // Given a rect in the object's coordinate space, returns the corresponding re ct in the reflection. 673 // Given a rect in the object's coordinate space, returns the corresponding
674 // rect in the reflection.
662 LayoutRect reflectedRect(const LayoutRect&) const; 675 LayoutRect reflectedRect(const LayoutRect&) const;
663 676
664 void layout() override; 677 void layout() override;
665 void paint(const PaintInfo&, const LayoutPoint&) const override; 678 void paint(const PaintInfo&, const LayoutPoint&) const override;
666 bool nodeAtPoint(HitTestResult&, 679 bool nodeAtPoint(HitTestResult&,
667 const HitTestLocation& locationInContainer, 680 const HitTestLocation& locationInContainer,
668 const LayoutPoint& accumulatedOffset, 681 const LayoutPoint& accumulatedOffset,
669 HitTestAction) override; 682 HitTestAction) override;
670 683
671 LayoutUnit minPreferredLogicalWidth() const override; 684 LayoutUnit minPreferredLogicalWidth() const override;
672 LayoutUnit maxPreferredLogicalWidth() const override; 685 LayoutUnit maxPreferredLogicalWidth() const override;
673 686
674 // FIXME: We should rename these back to overrideLogicalHeight/Width and have them store 687 // FIXME: We should rename these back to overrideLogicalHeight/Width and have
675 // the border-box height/width like the regular height/width accessors on Layo utBox. 688 // them store the border-box height/width like the regular height/width
676 // Right now, these are different than contentHeight/contentWidth because they still 689 // accessors on LayoutBox. Right now, these are different than contentHeight/
677 // include the scrollbar height/width. 690 // contentWidth because they still include the scrollbar height/width.
678 LayoutUnit overrideLogicalContentWidth() const; 691 LayoutUnit overrideLogicalContentWidth() const;
679 LayoutUnit overrideLogicalContentHeight() const; 692 LayoutUnit overrideLogicalContentHeight() const;
680 bool hasOverrideLogicalContentHeight() const; 693 bool hasOverrideLogicalContentHeight() const;
681 bool hasOverrideLogicalContentWidth() const; 694 bool hasOverrideLogicalContentWidth() const;
682 void setOverrideLogicalContentHeight(LayoutUnit); 695 void setOverrideLogicalContentHeight(LayoutUnit);
683 void setOverrideLogicalContentWidth(LayoutUnit); 696 void setOverrideLogicalContentWidth(LayoutUnit);
684 void clearOverrideSize(); 697 void clearOverrideSize();
685 void clearOverrideLogicalContentHeight(); 698 void clearOverrideLogicalContentHeight();
686 void clearOverrideLogicalContentWidth(); 699 void clearOverrideLogicalContentWidth();
687 700
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 // (logical top or logical left). 748 // (logical top or logical left).
736 LayoutUnit m_position; 749 LayoutUnit m_position;
737 750
738 // |m_margins| represents the margins in the measured direction. 751 // |m_margins| represents the margins in the measured direction.
739 // Note that ComputedMarginValues has also the margins in 752 // Note that ComputedMarginValues has also the margins in
740 // the orthogonal direction to have clearer names but they are 753 // the orthogonal direction to have clearer names but they are
741 // ignored in the code. 754 // ignored in the code.
742 ComputedMarginValues m_margins; 755 ComputedMarginValues m_margins;
743 }; 756 };
744 757
745 // Resolve auto margins in the chosen direction of the containing block so tha t objects can be pushed to the start, middle or end 758 // Resolve auto margins in the chosen direction of the containing block so
746 // of the containing block. 759 // that objects can be pushed to the start, middle or end of the containing
760 // block.
747 void computeMarginsForDirection(MarginDirection forDirection, 761 void computeMarginsForDirection(MarginDirection forDirection,
748 const LayoutBlock* containingBlock, 762 const LayoutBlock* containingBlock,
749 LayoutUnit containerWidth, 763 LayoutUnit containerWidth,
750 LayoutUnit childWidth, 764 LayoutUnit childWidth,
751 LayoutUnit& marginStart, 765 LayoutUnit& marginStart,
752 LayoutUnit& marginEnd, 766 LayoutUnit& marginEnd,
753 Length marginStartLength, 767 Length marginStartLength,
754 Length marginStartEnd) const; 768 Length marginStartEnd) const;
755 769
756 // Used to resolve margins in the containing block's block-flow direction. 770 // Used to resolve margins in the containing block's block-flow direction.
757 void computeAndSetBlockDirectionMargins(const LayoutBlock* containingBlock); 771 void computeAndSetBlockDirectionMargins(const LayoutBlock* containingBlock);
758 772
759 LayoutUnit offsetFromLogicalTopOfFirstPage() const; 773 LayoutUnit offsetFromLogicalTopOfFirstPage() const;
760 774
761 // The page logical offset is the object's offset from the top of the page in the page progression 775 // The page logical offset is the object's offset from the top of the page in
762 // direction (so an x-offset in vertical text and a y-offset for horizontal te xt). 776 // the page progression direction (so an x-offset in vertical text and a
777 // y-offset for horizontal text).
763 LayoutUnit pageLogicalOffset() const { 778 LayoutUnit pageLogicalOffset() const {
764 return m_rareData ? m_rareData->m_pageLogicalOffset : LayoutUnit(); 779 return m_rareData ? m_rareData->m_pageLogicalOffset : LayoutUnit();
765 } 780 }
766 void setPageLogicalOffset(LayoutUnit); 781 void setPageLogicalOffset(LayoutUnit);
767 782
768 // Specify which page or column to associate with an offset, if said offset is exactly at a page 783 // Specify which page or column to associate with an offset, if said offset is
769 // or column boundary. 784 // exactly at a page or column boundary.
770 enum PageBoundaryRule { AssociateWithFormerPage, AssociateWithLatterPage }; 785 enum PageBoundaryRule { AssociateWithFormerPage, AssociateWithLatterPage };
771 LayoutUnit pageLogicalHeightForOffset(LayoutUnit) const; 786 LayoutUnit pageLogicalHeightForOffset(LayoutUnit) const;
772 LayoutUnit pageRemainingLogicalHeightForOffset(LayoutUnit, 787 LayoutUnit pageRemainingLogicalHeightForOffset(LayoutUnit,
773 PageBoundaryRule) const; 788 PageBoundaryRule) const;
774 789
775 // Calculate the strut to insert in order fit content of size |contentLogicalH eight|. 790 // Calculate the strut to insert in order fit content of size
776 // |strutToNextPage| is the strut to add to |offset| to merely get to the top of the next page 791 // |contentLogicalHeight|. |strutToNextPage| is the strut to add to |offset|
777 // or column. This is what will be returned if the content can actually fit th ere. Otherwise, 792 // to merely get to the top of the next page or column. This is what will be
778 // return the distance to the next fragmentainer that can fit this piece of co ntent. 793 // returned if the content can actually fit there. Otherwise, return the
794 // distance to the next fragmentainer that can fit this piece of content.
779 virtual LayoutUnit calculatePaginationStrutToFitContent( 795 virtual LayoutUnit calculatePaginationStrutToFitContent(
780 LayoutUnit offset, 796 LayoutUnit offset,
781 LayoutUnit strutToNextPage, 797 LayoutUnit strutToNextPage,
782 LayoutUnit contentLogicalHeight) const; 798 LayoutUnit contentLogicalHeight) const;
783 799
784 void positionLineBox(InlineBox*); 800 void positionLineBox(InlineBox*);
785 void moveWithEdgeOfInlineContainerIfNecessary(bool isHorizontal); 801 void moveWithEdgeOfInlineContainerIfNecessary(bool isHorizontal);
786 802
787 virtual InlineBox* createInlineBox(); 803 virtual InlineBox* createInlineBox();
788 void dirtyLineBoxes(bool fullLayout); 804 void dirtyLineBoxes(bool fullLayout);
789 805
790 // For atomic inline elements, this function returns the inline box that conta ins us. Enables 806 // For atomic inline elements, this function returns the inline box that
791 // the atomic inline LayoutObject to quickly determine what line it is contain ed on and to easily 807 // contains us. Enables the atomic inline LayoutObject to quickly determine
792 // iterate over structures on the line. 808 // what line it is contained on and to easily iterate over structures on the
809 // line.
793 InlineBox* inlineBoxWrapper() const { return m_inlineBoxWrapper; } 810 InlineBox* inlineBoxWrapper() const { return m_inlineBoxWrapper; }
794 void setInlineBoxWrapper(InlineBox*); 811 void setInlineBoxWrapper(InlineBox*);
795 void deleteLineBoxWrapper(); 812 void deleteLineBoxWrapper();
796 813
797 void setSpannerPlaceholder(LayoutMultiColumnSpannerPlaceholder&); 814 void setSpannerPlaceholder(LayoutMultiColumnSpannerPlaceholder&);
798 void clearSpannerPlaceholder(); 815 void clearSpannerPlaceholder();
799 LayoutMultiColumnSpannerPlaceholder* spannerPlaceholder() const final { 816 LayoutMultiColumnSpannerPlaceholder* spannerPlaceholder() const final {
800 return m_rareData ? m_rareData->m_spannerPlaceholder : 0; 817 return m_rareData ? m_rareData->m_spannerPlaceholder : 0;
801 } 818 }
802 819
803 // A pagination strut is the amount of space needed to push an in-flow block-l evel object (or 820 // A pagination strut is the amount of space needed to push an in-flow block-
804 // float) to the logical top of the next page or column. It will be set both f or forced breaks 821 // level object (or float) to the logical top of the next page or column. It
805 // (e.g. page-break-before:always) and soft breaks (when there's not enough sp ace in the current 822 // will be set both for forced breaks (e.g. page-break-before:always) and soft
806 // page / column for the object). The strut is baked into the logicalTop() of the object, so 823 // breaks (when there's not enough space in the current page / column for the
807 // that logicalTop() - paginationStrut() == the original position in the previ ous column before 824 // object). The strut is baked into the logicalTop() of the object, so that
808 // deciding to break. 825 // logicalTop() - paginationStrut() == the original position in the previous
826 // column before deciding to break.
809 // 827 //
810 // Pagination struts are either set in front of a block-level box (here) or be fore a line 828 // Pagination struts are either set in front of a block-level box (here) or
811 // (RootInlineBox::paginationStrut()). 829 // before a line (RootInlineBox::paginationStrut()).
812 LayoutUnit paginationStrut() const { 830 LayoutUnit paginationStrut() const {
813 return m_rareData ? m_rareData->m_paginationStrut : LayoutUnit(); 831 return m_rareData ? m_rareData->m_paginationStrut : LayoutUnit();
814 } 832 }
815 void setPaginationStrut(LayoutUnit); 833 void setPaginationStrut(LayoutUnit);
816 void resetPaginationStrut() { 834 void resetPaginationStrut() {
817 if (m_rareData) 835 if (m_rareData)
818 m_rareData->m_paginationStrut = LayoutUnit(); 836 m_rareData->m_paginationStrut = LayoutUnit();
819 } 837 }
820 838
821 // Is the specified break-before or break-after value supported on this object ? It needs to be 839 // Is the specified break-before or break-after value supported on this
822 // in-flow all the way up to a fragmentation context that supports the specifi ed value. 840 // object? It needs to be in-flow all the way up to a fragmentation context
841 // that supports the specified value.
823 bool isBreakBetweenControllable(EBreak) const; 842 bool isBreakBetweenControllable(EBreak) const;
824 843
825 // Is the specified break-inside value supported on this object? It needs to b e contained by a 844 // Is the specified break-inside value supported on this object? It needs to
826 // fragmentation context that supports the specified value. 845 // be contained by a fragmentation context that supports the specified value.
827 bool isBreakInsideControllable(EBreak) const; 846 bool isBreakInsideControllable(EBreak) const;
828 847
829 virtual EBreak breakAfter() const; 848 virtual EBreak breakAfter() const;
830 virtual EBreak breakBefore() const; 849 virtual EBreak breakBefore() const;
831 EBreak breakInside() const; 850 EBreak breakInside() const;
832 851
833 // Join two adjacent break values specified on break-before and/or break-after . avoid* values 852 // Join two adjacent break values specified on break-before and/or break-
834 // win over auto values, and forced break values win over avoid* values. |firs tValue| is 853 // after. avoid* values win over auto values, and forced break values win over
835 // specified on an element earlier in the flow than |secondValue|. This method is used at class 854 // avoid* values. |firstValue| is specified on an element earlier in the flow
836 // A break points [1], to join the values of the previous break-after and the next 855 // than |secondValue|. This method is used at class A break points [1], to
837 // break-before, to figure out whether we may, must, or should not, break at t hat point. It is 856 // join the values of the previous break-after and the next break-before, to
838 // also used when propagating break-before values from first children and brea k-after values on 857 // figure out whether we may, must, or should not, break at that point. It is
839 // last children to their container. 858 // also used when propagating break-before values from first children and
859 // break-after values on last children to their container.
840 // 860 //
841 // [1] https://drafts.csswg.org/css-break/#possible-breaks 861 // [1] https://drafts.csswg.org/css-break/#possible-breaks
842 static EBreak joinFragmentainerBreakValues(EBreak firstValue, 862 static EBreak joinFragmentainerBreakValues(EBreak firstValue,
843 EBreak secondValue); 863 EBreak secondValue);
844 864
845 static bool isForcedFragmentainerBreakValue(EBreak); 865 static bool isForcedFragmentainerBreakValue(EBreak);
846 866
847 EBreak classABreakPointValue(EBreak previousBreakAfterValue) const; 867 EBreak classABreakPointValue(EBreak previousBreakAfterValue) const;
848 868
849 // Return true if we should insert a break in front of this box. The box needs to start at a 869 // Return true if we should insert a break in front of this box. The box needs
850 // valid class A break point in order to allow a forced break. To determine wh ether or not to 870 // to start at a valid class A break point in order to allow a forced break.
851 // break, we also need to know the break-after value of the previous in-flow s ibling. 871 // To determine whether or not to break, we also need to know the break-after
872 // value of the previous in-flow sibling.
852 bool needsForcedBreakBefore(EBreak previousBreakAfterValue) const; 873 bool needsForcedBreakBefore(EBreak previousBreakAfterValue) const;
853 874
854 bool paintedOutputOfObjectHasNoEffectRegardlessOfSize() const override; 875 bool paintedOutputOfObjectHasNoEffectRegardlessOfSize() const override;
855 LayoutRect localOverflowRectForPaintInvalidation() const override; 876 LayoutRect localOverflowRectForPaintInvalidation() const override;
856 bool mapToVisualRectInAncestorSpace( 877 bool mapToVisualRectInAncestorSpace(
857 const LayoutBoxModelObject* ancestor, 878 const LayoutBoxModelObject* ancestor,
858 LayoutRect&, 879 LayoutRect&,
859 VisualRectFlags = DefaultVisualRectFlags) const override; 880 VisualRectFlags = DefaultVisualRectFlags) const override;
860 881
861 LayoutUnit containingBlockLogicalHeightForGetComputedStyle() const; 882 LayoutUnit containingBlockLogicalHeightForGetComputedStyle() const;
862 883
863 LayoutUnit containingBlockLogicalWidthForContent() const override; 884 LayoutUnit containingBlockLogicalWidthForContent() const override;
864 LayoutUnit containingBlockLogicalHeightForContent( 885 LayoutUnit containingBlockLogicalHeightForContent(
865 AvailableLogicalHeightType) const; 886 AvailableLogicalHeightType) const;
866 887
867 LayoutUnit containingBlockAvailableLineWidth() const; 888 LayoutUnit containingBlockAvailableLineWidth() const;
868 LayoutUnit perpendicularContainingBlockLogicalHeight() const; 889 LayoutUnit perpendicularContainingBlockLogicalHeight() const;
869 890
870 virtual void updateLogicalWidth(); 891 virtual void updateLogicalWidth();
871 void updateLogicalHeight(); 892 void updateLogicalHeight();
872 virtual void computeLogicalHeight(LayoutUnit logicalHeight, 893 virtual void computeLogicalHeight(LayoutUnit logicalHeight,
873 LayoutUnit logicalTop, 894 LayoutUnit logicalTop,
874 LogicalExtentComputedValues&) const; 895 LogicalExtentComputedValues&) const;
875 // This function will compute the logical border-box height, without laying ou t the box. This means that the result 896 // This function will compute the logical border-box height, without laying
876 // is only "correct" when the height is explicitly specified. This function ex ists so that intrinsic width calculations 897 // out the box. This means that the result is only "correct" when the height
877 // have a way to deal with children that have orthogonal flows. 898 // is explicitly specified. This function exists so that intrinsic width
878 // When there is no explicit height, this function assumes a content height of zero (and returns just border+padding) 899 // calculations have a way to deal with children that have orthogonal flows.
900 // When there is no explicit height, this function assumes a content height of
901 // zero (and returns just border+padding).
879 LayoutUnit computeLogicalHeightWithoutLayout() const; 902 LayoutUnit computeLogicalHeightWithoutLayout() const;
880 903
881 void computeLogicalWidth(LogicalExtentComputedValues&) const; 904 void computeLogicalWidth(LogicalExtentComputedValues&) const;
882 905
883 bool stretchesToViewport() const { 906 bool stretchesToViewport() const {
884 return document().inQuirksMode() && stretchesToViewportInQuirksMode(); 907 return document().inQuirksMode() && stretchesToViewportInQuirksMode();
885 } 908 }
886 909
887 virtual LayoutSize intrinsicSize() const { return LayoutSize(); } 910 virtual LayoutSize intrinsicSize() const { return LayoutSize(); }
888 LayoutUnit intrinsicLogicalWidth() const { 911 LayoutUnit intrinsicLogicalWidth() const {
889 return style()->isHorizontalWritingMode() ? intrinsicSize().width() 912 return style()->isHorizontalWritingMode() ? intrinsicSize().width()
890 : intrinsicSize().height(); 913 : intrinsicSize().height();
891 } 914 }
892 LayoutUnit intrinsicLogicalHeight() const { 915 LayoutUnit intrinsicLogicalHeight() const {
893 return style()->isHorizontalWritingMode() ? intrinsicSize().height() 916 return style()->isHorizontalWritingMode() ? intrinsicSize().height()
894 : intrinsicSize().width(); 917 : intrinsicSize().width();
895 } 918 }
896 virtual LayoutUnit intrinsicContentLogicalHeight() const { 919 virtual LayoutUnit intrinsicContentLogicalHeight() const {
897 return m_intrinsicContentLogicalHeight; 920 return m_intrinsicContentLogicalHeight;
898 } 921 }
899 922
900 // Whether or not the element shrinks to its intrinsic width (rather than fill ing the width 923 // Whether or not the element shrinks to its intrinsic width (rather than
901 // of a containing block). HTML4 buttons, <select>s, <input>s, legends, and f loating/compact elements do this. 924 // filling the width of a containing block). HTML4 buttons, <select>s,
925 // <input>s, legends, and floating/compact elements do this.
902 bool sizesLogicalWidthToFitContent(const Length& logicalWidth) const; 926 bool sizesLogicalWidthToFitContent(const Length& logicalWidth) const;
903 927
904 LayoutUnit shrinkLogicalWidthToAvoidFloats(LayoutUnit childMarginStart, 928 LayoutUnit shrinkLogicalWidthToAvoidFloats(LayoutUnit childMarginStart,
905 LayoutUnit childMarginEnd, 929 LayoutUnit childMarginEnd,
906 const LayoutBlockFlow* cb) const; 930 const LayoutBlockFlow* cb) const;
907 931
908 LayoutUnit computeLogicalWidthUsing(SizeType, 932 LayoutUnit computeLogicalWidthUsing(SizeType,
909 const Length& logicalWidth, 933 const Length& logicalWidth,
910 LayoutUnit availableLogicalWidth, 934 LayoutUnit availableLogicalWidth,
911 const LayoutBlock* containingBlock) const; 935 const LayoutBlock* containingBlock) const;
(...skipping 19 matching lines...) Expand all
931 LayoutUnit logicalHeight) const; 955 LayoutUnit logicalHeight) const;
932 956
933 virtual LayoutUnit computeReplacedLogicalWidth( 957 virtual LayoutUnit computeReplacedLogicalWidth(
934 ShouldComputePreferred = ComputeActual) const; 958 ShouldComputePreferred = ComputeActual) const;
935 virtual LayoutUnit computeReplacedLogicalHeight( 959 virtual LayoutUnit computeReplacedLogicalHeight(
936 LayoutUnit estimatedUsedWidth = LayoutUnit()) const; 960 LayoutUnit estimatedUsedWidth = LayoutUnit()) const;
937 961
938 bool percentageLogicalHeightIsResolvable() const; 962 bool percentageLogicalHeightIsResolvable() const;
939 LayoutUnit computePercentageLogicalHeight(const Length& height) const; 963 LayoutUnit computePercentageLogicalHeight(const Length& height) const;
940 964
941 // Block flows subclass availableWidth/Height to handle multi column layout (s hrinking the width/height available to children when laying out.) 965 // Block flows subclass availableWidth/Height to handle multi column layout
966 // (shrinking the width/height available to children when laying out.)
942 LayoutUnit availableLogicalWidth() const { return contentLogicalWidth(); } 967 LayoutUnit availableLogicalWidth() const { return contentLogicalWidth(); }
943 LayoutUnit availableLogicalHeight(AvailableLogicalHeightType) const; 968 LayoutUnit availableLogicalHeight(AvailableLogicalHeightType) const;
944 LayoutUnit availableLogicalHeightUsing(const Length&, 969 LayoutUnit availableLogicalHeightUsing(const Length&,
945 AvailableLogicalHeightType) const; 970 AvailableLogicalHeightType) const;
946 971
947 // There are a few cases where we need to refer specifically to the available physical width and available physical height. 972 // There are a few cases where we need to refer specifically to the available
948 // Relative positioning is one of those cases, since left/top offsets are phys ical. 973 // physical width and available physical height. Relative positioning is one
974 // of those cases, since left/top offsets are physical.
949 LayoutUnit availableWidth() const { 975 LayoutUnit availableWidth() const {
950 return style()->isHorizontalWritingMode() 976 return style()->isHorizontalWritingMode()
951 ? availableLogicalWidth() 977 ? availableLogicalWidth()
952 : availableLogicalHeight(IncludeMarginBorderPadding); 978 : availableLogicalHeight(IncludeMarginBorderPadding);
953 } 979 }
954 LayoutUnit availableHeight() const { 980 LayoutUnit availableHeight() const {
955 return style()->isHorizontalWritingMode() 981 return style()->isHorizontalWritingMode()
956 ? availableLogicalHeight(IncludeMarginBorderPadding) 982 ? availableLogicalHeight(IncludeMarginBorderPadding)
957 : availableLogicalWidth(); 983 : availableLogicalWidth();
958 } 984 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 } 1029 }
1004 virtual bool scrollsOverflowX() const { 1030 virtual bool scrollsOverflowX() const {
1005 return hasOverflowClip() && (style()->overflowX() == OverflowScroll || 1031 return hasOverflowClip() && (style()->overflowX() == OverflowScroll ||
1006 hasAutoHorizontalScrollbar()); 1032 hasAutoHorizontalScrollbar());
1007 } 1033 }
1008 virtual bool scrollsOverflowY() const { 1034 virtual bool scrollsOverflowY() const {
1009 return hasOverflowClip() && (style()->overflowY() == OverflowScroll || 1035 return hasOverflowClip() && (style()->overflowY() == OverflowScroll ||
1010 hasAutoVerticalScrollbar()); 1036 hasAutoVerticalScrollbar());
1011 } 1037 }
1012 1038
1013 // Elements such as the <input> field override this to specify that they are s crollable 1039 // Elements such as the <input> field override this to specify that they are
1014 // outside the context of the CSS overflow style 1040 // scrollable outside the context of the CSS overflow style
1015 virtual bool isIntrinsicallyScrollable( 1041 virtual bool isIntrinsicallyScrollable(
1016 ScrollbarOrientation orientation) const { 1042 ScrollbarOrientation orientation) const {
1017 return false; 1043 return false;
1018 } 1044 }
1019 1045
1020 bool hasUnsplittableScrollingOverflow() const; 1046 bool hasUnsplittableScrollingOverflow() const;
1021 1047
1022 // Page / column breakability inside block-level objects. 1048 // Page / column breakability inside block-level objects.
1023 enum PaginationBreakability { 1049 enum PaginationBreakability {
1024 AllowAnyBreaks, // No restrictions on breaking. May examine children to fin d possible break points. 1050 AllowAnyBreaks, // No restrictions on breaking. May examine children to
1025 ForbidBreaks, // Forbid breaks inside this object. Content cannot be spli t nicely into smaller pieces. 1051 // find possible break points.
1026 AvoidBreaks // Preferably avoid breaks. If not possible, examine childr en to find possible break points. 1052 ForbidBreaks, // Forbid breaks inside this object. Content cannot be split
1053 // nicely into smaller pieces.
1054 AvoidBreaks // Preferably avoid breaks. If not possible, examine children
1055 // to find possible break points.
1027 }; 1056 };
1028 PaginationBreakability getPaginationBreakability() const; 1057 PaginationBreakability getPaginationBreakability() const;
1029 1058
1030 LayoutRect localCaretRect( 1059 LayoutRect localCaretRect(
1031 InlineBox*, 1060 InlineBox*,
1032 int caretOffset, 1061 int caretOffset,
1033 LayoutUnit* extraWidthToEndOfLine = nullptr) override; 1062 LayoutUnit* extraWidthToEndOfLine = nullptr) override;
1034 1063
1035 virtual LayoutRect overflowClipRect( 1064 virtual LayoutRect overflowClipRect(
1036 const LayoutPoint& location, 1065 const LayoutPoint& location,
1037 OverlayScrollbarClipBehavior = IgnoreOverlayScrollbarSize) const; 1066 OverlayScrollbarClipBehavior = IgnoreOverlayScrollbarSize) const;
1038 LayoutRect clipRect(const LayoutPoint& location) const; 1067 LayoutRect clipRect(const LayoutPoint& location) const;
1039 virtual bool hasControlClip() const { return false; } 1068 virtual bool hasControlClip() const { return false; }
1040 virtual LayoutRect controlClipRect(const LayoutPoint&) const { 1069 virtual LayoutRect controlClipRect(const LayoutPoint&) const {
1041 return LayoutRect(); 1070 return LayoutRect();
1042 } 1071 }
1043 1072
1044 // Returns the combination of overflow clip, contain: paint clip and CSS clip for this object, in local space. 1073 // Returns the combination of overflow clip, contain: paint clip and CSS clip
1074 // for this object, in local space.
1045 LayoutRect clippingRect() const; 1075 LayoutRect clippingRect() const;
1046 1076
1047 virtual void paintBoxDecorationBackground(const PaintInfo&, 1077 virtual void paintBoxDecorationBackground(const PaintInfo&,
1048 const LayoutPoint&) const; 1078 const LayoutPoint&) const;
1049 virtual void paintMask(const PaintInfo&, const LayoutPoint&) const; 1079 virtual void paintMask(const PaintInfo&, const LayoutPoint&) const;
1050 void imageChanged(WrappedImagePtr, const IntRect* = nullptr) override; 1080 void imageChanged(WrappedImagePtr, const IntRect* = nullptr) override;
1051 ResourcePriority computeResourcePriority() const final; 1081 ResourcePriority computeResourcePriority() const final;
1052 1082
1053 void logicalExtentAfterUpdatingLogicalWidth(const LayoutUnit& logicalTop, 1083 void logicalExtentAfterUpdatingLogicalWidth(const LayoutUnit& logicalTop,
1054 LogicalExtentComputedValues&); 1084 LogicalExtentComputedValues&);
1055 1085
1056 PositionWithAffinity positionForPoint(const LayoutPoint&) override; 1086 PositionWithAffinity positionForPoint(const LayoutPoint&) override;
1057 1087
1058 void removeFloatingOrPositionedChildFromBlockLists(); 1088 void removeFloatingOrPositionedChildFromBlockLists();
1059 1089
1060 PaintLayer* enclosingFloatPaintingLayer() const; 1090 PaintLayer* enclosingFloatPaintingLayer() const;
1061 1091
1062 virtual int firstLineBoxBaseline() const { return -1; } 1092 virtual int firstLineBoxBaseline() const { return -1; }
1063 virtual int inlineBlockBaseline(LineDirectionMode) const { 1093 virtual int inlineBlockBaseline(LineDirectionMode) const {
1064 return -1; 1094 return -1;
1065 } // Returns -1 if we should skip this box when computing the baseline of an inline-block. 1095 } // Returns -1 if we should skip this box when computing the baseline of an
1096 // inline-block.
1066 1097
1067 virtual Node* nodeForHitTest() const { return node(); } 1098 virtual Node* nodeForHitTest() const { return node(); }
1068 1099
1069 bool shrinkToAvoidFloats() const; 1100 bool shrinkToAvoidFloats() const;
1070 virtual bool avoidsFloats() const; 1101 virtual bool avoidsFloats() const;
1071 1102
1072 void markChildForPaginationRelayoutIfNeeded(LayoutBox& child, 1103 void markChildForPaginationRelayoutIfNeeded(LayoutBox& child,
1073 SubtreeLayoutScope&); 1104 SubtreeLayoutScope&);
1074 1105
1075 bool isWritingModeRoot() const { 1106 bool isWritingModeRoot() const {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 bool firstLine, 1138 bool firstLine,
1108 LineDirectionMode, 1139 LineDirectionMode,
1109 LinePositionMode = PositionOnContainingLine) const override; 1140 LinePositionMode = PositionOnContainingLine) const override;
1110 1141
1111 LayoutUnit offsetLeft(const Element*) const override; 1142 LayoutUnit offsetLeft(const Element*) const override;
1112 LayoutUnit offsetTop(const Element*) const override; 1143 LayoutUnit offsetTop(const Element*) const override;
1113 1144
1114 LayoutPoint flipForWritingModeForChild(const LayoutBox* child, 1145 LayoutPoint flipForWritingModeForChild(const LayoutBox* child,
1115 const LayoutPoint&) const; 1146 const LayoutPoint&) const;
1116 LayoutUnit flipForWritingMode(LayoutUnit position) const WARN_UNUSED_RETURN { 1147 LayoutUnit flipForWritingMode(LayoutUnit position) const WARN_UNUSED_RETURN {
1117 // The offset is in the block direction (y for horizontal writing modes, x f or vertical writing modes). 1148 // The offset is in the block direction (y for horizontal writing modes, x
1149 // for vertical writing modes).
1118 if (!UNLIKELY(hasFlippedBlocksWritingMode())) 1150 if (!UNLIKELY(hasFlippedBlocksWritingMode()))
1119 return position; 1151 return position;
1120 return logicalHeight() - position; 1152 return logicalHeight() - position;
1121 } 1153 }
1122 LayoutPoint flipForWritingMode(const LayoutPoint& position) const 1154 LayoutPoint flipForWritingMode(const LayoutPoint& position) const
1123 WARN_UNUSED_RETURN { 1155 WARN_UNUSED_RETURN {
1124 if (!UNLIKELY(hasFlippedBlocksWritingMode())) 1156 if (!UNLIKELY(hasFlippedBlocksWritingMode()))
1125 return position; 1157 return position;
1126 return isHorizontalWritingMode() 1158 return isHorizontalWritingMode()
1127 ? LayoutPoint(position.x(), m_frameRect.height() - position.y()) 1159 ? LayoutPoint(position.x(), m_frameRect.height() - position.y())
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1174 bool hasVisualOverflow() const { 1206 bool hasVisualOverflow() const {
1175 return m_overflow && !borderBoxRect().contains(visualOverflowRect()); 1207 return m_overflow && !borderBoxRect().contains(visualOverflowRect());
1176 } 1208 }
1177 1209
1178 virtual bool needsPreferredWidthsRecalculation() const; 1210 virtual bool needsPreferredWidthsRecalculation() const;
1179 1211
1180 // See README.md for an explanation of scroll origin. 1212 // See README.md for an explanation of scroll origin.
1181 virtual IntSize originAdjustmentForScrollbars() const; 1213 virtual IntSize originAdjustmentForScrollbars() const;
1182 IntSize scrolledContentOffset() const; 1214 IntSize scrolledContentOffset() const;
1183 1215
1184 // Maps a rect in scrolling contents space to box space and apply overflow cli p if needed. 1216 // Maps a rect in scrolling contents space to box space and apply overflow
1185 // Returns true if no clipping applied or the rect actually intersects the cli pping region. 1217 // clip if needed. Returns true if no clipping applied or the rect actually
1186 // If edgeInclusive is true, then this method may return true even 1218 // intersects the clipping region. If edgeInclusive is true, then this method
1187 // if the resulting rect has zero area. 1219 // may return true even if the resulting rect has zero area.
1188 bool mapScrollingContentsRectToBoxSpace( 1220 bool mapScrollingContentsRectToBoxSpace(
1189 LayoutRect&, 1221 LayoutRect&,
1190 ApplyOverflowClipFlag, 1222 ApplyOverflowClipFlag,
1191 VisualRectFlags = DefaultVisualRectFlags) const; 1223 VisualRectFlags = DefaultVisualRectFlags) const;
1192 1224
1193 virtual bool hasRelativeLogicalWidth() const; 1225 virtual bool hasRelativeLogicalWidth() const;
1194 virtual bool hasRelativeLogicalHeight() const; 1226 virtual bool hasRelativeLogicalHeight() const;
1195 1227
1196 bool hasHorizontalLayoutOverflow() const { 1228 bool hasHorizontalLayoutOverflow() const {
1197 if (!m_overflow) 1229 if (!m_overflow)
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1282 void willBeRemovedFromTree() override; 1314 void willBeRemovedFromTree() override;
1283 1315
1284 void styleWillChange(StyleDifference, const ComputedStyle& newStyle) override; 1316 void styleWillChange(StyleDifference, const ComputedStyle& newStyle) override;
1285 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override; 1317 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override;
1286 void updateFromStyle() override; 1318 void updateFromStyle() override;
1287 1319
1288 virtual ItemPosition selfAlignmentNormalBehavior() const { 1320 virtual ItemPosition selfAlignmentNormalBehavior() const {
1289 return ItemPositionStretch; 1321 return ItemPositionStretch;
1290 } 1322 }
1291 1323
1292 // Returns false if it could not cheaply compute the extent (e.g. fixed backgr ound), in which case the returned rect may be incorrect. 1324 // Returns false if it could not cheaply compute the extent (e.g. fixed
1293 // FIXME: make this a const method once the LayoutBox reference in BoxPainter is const. 1325 // background), in which case the returned rect may be incorrect.
1326 // FIXME: make this a const method once the LayoutBox reference in BoxPainter
1327 // is const.
1294 bool getBackgroundPaintedExtent(LayoutRect&) const; 1328 bool getBackgroundPaintedExtent(LayoutRect&) const;
1295 virtual bool foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect, 1329 virtual bool foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect,
1296 unsigned maxDepthToTest) const; 1330 unsigned maxDepthToTest) const;
1297 bool computeBackgroundIsKnownToBeObscured() const override; 1331 bool computeBackgroundIsKnownToBeObscured() const override;
1298 1332
1299 virtual void computePositionedLogicalWidth( 1333 virtual void computePositionedLogicalWidth(
1300 LogicalExtentComputedValues&) const; 1334 LogicalExtentComputedValues&) const;
1301 1335
1302 LayoutUnit computeIntrinsicLogicalWidthUsing( 1336 LayoutUnit computeIntrinsicLogicalWidthUsing(
1303 const Length& logicalWidthLength, 1337 const Length& logicalWidthLength,
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1416 const Length& logicalBottom, 1450 const Length& logicalBottom,
1417 const Length& marginLogicalTop, 1451 const Length& marginLogicalTop,
1418 const Length& marginLogicalBottom, 1452 const Length& marginLogicalBottom,
1419 LogicalExtentComputedValues&) const; 1453 LogicalExtentComputedValues&) const;
1420 1454
1421 LayoutUnit fillAvailableMeasure(LayoutUnit availableLogicalWidth) const; 1455 LayoutUnit fillAvailableMeasure(LayoutUnit availableLogicalWidth) const;
1422 LayoutUnit fillAvailableMeasure(LayoutUnit availableLogicalWidth, 1456 LayoutUnit fillAvailableMeasure(LayoutUnit availableLogicalWidth,
1423 LayoutUnit& marginStart, 1457 LayoutUnit& marginStart,
1424 LayoutUnit& marginEnd) const; 1458 LayoutUnit& marginEnd) const;
1425 1459
1426 // Calculates the intrinsic(https://drafts.csswg.org/css-sizing-3/#intrinsic) logical widths for this layout box. 1460 // Calculates the intrinsic(https://drafts.csswg.org/css-sizing-3/#intrinsic)
1461 // logical widths for this layout box.
1427 // 1462 //
1428 // intrinsicWidth is defined as: 1463 // intrinsicWidth is defined as:
1429 // intrinsic size of content (without our border and padding) + scrollbarW idth. 1464 // intrinsic size of content (without our border and padding) +
1465 // scrollbarWidth.
1430 // 1466 //
1431 // preferredWidth is defined as: 1467 // preferredWidth is defined as:
1432 // fixedWidth OR (intrinsicWidth plus border and padding). 1468 // fixedWidth OR (intrinsicWidth plus border and padding).
1433 // Note: fixedWidth includes border and padding and scrollbarWidth. 1469 // Note: fixedWidth includes border and padding and scrollbarWidth.
1434 virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, 1470 virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth,
1435 LayoutUnit& maxLogicalWidth) const; 1471 LayoutUnit& maxLogicalWidth) const;
1436 1472
1437 // This function calculates the preferred widths for an object. 1473 // This function calculates the preferred widths for an object.
1438 // 1474 //
1439 // This function is only expected to be called if 1475 // This function is only expected to be called if
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1560 } 1596 }
1561 1597
1562 inline LayoutBox* LayoutBox::nextSiblingMultiColumnBox() const { 1598 inline LayoutBox* LayoutBox::nextSiblingMultiColumnBox() const {
1563 ASSERT(isLayoutMultiColumnSpannerPlaceholder() || isLayoutMultiColumnSet()); 1599 ASSERT(isLayoutMultiColumnSpannerPlaceholder() || isLayoutMultiColumnSet());
1564 return nextSiblingBox(); 1600 return nextSiblingBox();
1565 } 1601 }
1566 1602
1567 inline void LayoutBox::setInlineBoxWrapper(InlineBox* boxWrapper) { 1603 inline void LayoutBox::setInlineBoxWrapper(InlineBox* boxWrapper) {
1568 if (boxWrapper) { 1604 if (boxWrapper) {
1569 ASSERT(!m_inlineBoxWrapper); 1605 ASSERT(!m_inlineBoxWrapper);
1570 // m_inlineBoxWrapper should already be nullptr. Deleting it is a safeguard against security issues. 1606 // m_inlineBoxWrapper should already be nullptr. Deleting it is a safeguard
1571 // Otherwise, there will two line box wrappers keeping the reference to this layoutObject, and 1607 // against security issues. Otherwise, there will two line box wrappers
1572 // only one will be notified when the layoutObject is getting destroyed. The second line box wrapper 1608 // keeping the reference to this layoutObject, and only one will be notified
1609 // when the layoutObject is getting destroyed. The second line box wrapper
1573 // will keep a stale reference. 1610 // will keep a stale reference.
1574 if (UNLIKELY(m_inlineBoxWrapper != nullptr)) 1611 if (UNLIKELY(m_inlineBoxWrapper != nullptr))
1575 deleteLineBoxWrapper(); 1612 deleteLineBoxWrapper();
1576 } 1613 }
1577 1614
1578 m_inlineBoxWrapper = boxWrapper; 1615 m_inlineBoxWrapper = boxWrapper;
1579 } 1616 }
1580 1617
1581 inline bool LayoutBox::isForcedFragmentainerBreakValue(EBreak breakValue) { 1618 inline bool LayoutBox::isForcedFragmentainerBreakValue(EBreak breakValue) {
1582 return breakValue == BreakColumn || breakValue == BreakLeft || 1619 return breakValue == BreakColumn || breakValue == BreakLeft ||
1583 breakValue == BreakPage || breakValue == BreakRecto || 1620 breakValue == BreakPage || breakValue == BreakRecto ||
1584 breakValue == BreakRight || breakValue == BreakVerso; 1621 breakValue == BreakRight || breakValue == BreakVerso;
1585 } 1622 }
1586 1623
1587 } // namespace blink 1624 } // namespace blink
1588 1625
1589 #endif // LayoutBox_h 1626 #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