OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) |
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
7 * Copyright (C) 2010 Google Inc. All rights reserved. | 7 * Copyright (C) 2010 Google Inc. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 // the layout view. The available height is taken from the frame. | 548 // the layout view. The available height is taken from the frame. |
549 if (cb->isLayoutView()) | 549 if (cb->isLayoutView()) |
550 return nullptr; | 550 return nullptr; |
551 | 551 |
552 if (cb->isOutOfFlowPositioned() && !cb->style()->logicalTop().isAuto() && !c
b->style()->logicalBottom().isAuto()) | 552 if (cb->isOutOfFlowPositioned() && !cb->style()->logicalTop().isAuto() && !c
b->style()->logicalBottom().isAuto()) |
553 return nullptr; | 553 return nullptr; |
554 | 554 |
555 return cb; | 555 return cb; |
556 } | 556 } |
557 | 557 |
558 bool LayoutBoxModelObject::hasAutoHeightOrContainingBlockWithAutoHeight() const | 558 bool LayoutBoxModelObject::hasAutoHeightOrContainingBlockWithAutoHeight(bool che
ckingContainingBlock) const |
559 { | 559 { |
560 const LayoutBox* thisBox = isBox() ? toLayoutBox(this) : nullptr; | 560 const LayoutBox* thisBox = isBox() ? toLayoutBox(this) : nullptr; |
561 Length logicalHeightLength = style()->logicalHeight(); | 561 Length logicalHeightLength = style()->logicalHeight(); |
562 LayoutBlock* cb = containingBlockForAutoHeightDetection(logicalHeightLength)
; | 562 LayoutBlock* cb = containingBlockForAutoHeightDetection(logicalHeightLength)
; |
563 if (logicalHeightLength.hasPercent() && cb && isBox()) | 563 if (logicalHeightLength.hasPercent() && cb && isBox()) |
564 cb->addPercentHeightDescendant(const_cast<LayoutBox*>(toLayoutBox(this))
); | 564 cb->addPercentHeightDescendant(const_cast<LayoutBox*>(toLayoutBox(this))
); |
565 if (thisBox && thisBox->isFlexItem()) { | 565 if (thisBox && thisBox->isFlexItem()) { |
566 LayoutFlexibleBox& flexBox = toLayoutFlexibleBox(*parent()); | 566 LayoutFlexibleBox& flexBox = toLayoutFlexibleBox(*parent()); |
567 if (flexBox.childLogicalHeightForPercentageResolution(*thisBox) != Layou
tUnit(-1)) | 567 if (flexBox.childLogicalHeightForPercentageResolution(*thisBox) != Layou
tUnit(-1)) |
568 return false; | 568 return false; |
569 } | 569 } |
| 570 if (thisBox && thisBox->isGridItem()) { |
| 571 if (checkingContainingBlock && thisBox->hasOverrideLogicalContentHeight(
)) |
| 572 return false; |
| 573 if (!checkingContainingBlock && thisBox->hasOverrideContainingBlockLogic
alHeight()) |
| 574 return false; |
| 575 } |
570 if (logicalHeightLength.isAuto()) | 576 if (logicalHeightLength.isAuto()) |
571 return true; | 577 return true; |
572 | 578 |
573 if (document().inQuirksMode()) | 579 if (document().inQuirksMode()) |
574 return false; | 580 return false; |
575 | 581 |
576 // If the height of the containing block computes to 'auto', then it hasn't
been 'specified explicitly'. | 582 // If the height of the containing block computes to 'auto', then it hasn't
been 'specified explicitly'. |
577 if (cb) | 583 if (cb) |
578 return cb->hasAutoHeightOrContainingBlockWithAutoHeight(); | 584 return cb->hasAutoHeightOrContainingBlockWithAutoHeight(true); |
579 return false; | 585 return false; |
580 } | 586 } |
581 | 587 |
| 588 bool LayoutBoxModelObject::hasAutoHeightOrContainingBlockWithAutoHeight() const |
| 589 { |
| 590 return hasAutoHeightOrContainingBlockWithAutoHeight(false); |
| 591 } |
| 592 |
582 LayoutSize LayoutBoxModelObject::relativePositionOffset() const | 593 LayoutSize LayoutBoxModelObject::relativePositionOffset() const |
583 { | 594 { |
584 LayoutSize offset = accumulateInFlowPositionOffsets(); | 595 LayoutSize offset = accumulateInFlowPositionOffsets(); |
585 | 596 |
586 LayoutBlock* containingBlock = this->containingBlock(); | 597 LayoutBlock* containingBlock = this->containingBlock(); |
587 | 598 |
588 // Objects that shrink to avoid floats normally use available line width whe
n computing containing block width. However | 599 // Objects that shrink to avoid floats normally use available line width whe
n computing containing block width. However |
589 // in the case of relative positioning using percentages, we can't do this.
The offset should always be resolved using the | 600 // in the case of relative positioning using percentages, we can't do this.
The offset should always be resolved using the |
590 // available width of the containing block. Therefore we don't use containi
ngBlockLogicalWidthForContent() here, but instead explicitly | 601 // available width of the containing block. Therefore we don't use containi
ngBlockLogicalWidthForContent() here, but instead explicitly |
591 // call availableWidth on our containing block. | 602 // call availableWidth on our containing block. |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1115 if (rootElementStyle->hasBackground()) | 1126 if (rootElementStyle->hasBackground()) |
1116 return false; | 1127 return false; |
1117 | 1128 |
1118 if (node() != document().firstBodyElement()) | 1129 if (node() != document().firstBodyElement()) |
1119 return false; | 1130 return false; |
1120 | 1131 |
1121 return true; | 1132 return true; |
1122 } | 1133 } |
1123 | 1134 |
1124 } // namespace blink | 1135 } // namespace blink |
OLD | NEW |