| 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 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 // view. The available height is taken from the frame. | 683 // view. The available height is taken from the frame. |
| 684 if (cb->isLayoutView()) | 684 if (cb->isLayoutView()) |
| 685 return nullptr; | 685 return nullptr; |
| 686 | 686 |
| 687 if (isOutOfFlowPositionedWithImplicitHeight(cb)) | 687 if (isOutOfFlowPositionedWithImplicitHeight(cb)) |
| 688 return nullptr; | 688 return nullptr; |
| 689 | 689 |
| 690 return cb; | 690 return cb; |
| 691 } | 691 } |
| 692 | 692 |
| 693 bool LayoutBoxModelObject::hasAutoHeightOrContainingBlockWithAutoHeight( | 693 bool LayoutBoxModelObject::hasAutoHeightOrContainingBlockWithAutoHeight() |
| 694 bool checkingContainingBlock) const { | 694 const { |
| 695 // TODO(rego): Check if we can somehow reuse LayoutBlock:: | 695 // TODO(rego): Check if we can somehow reuse LayoutBlock:: |
| 696 // availableLogicalHeightForPercentageComputation() (see crbug.com/635655). | 696 // availableLogicalHeightForPercentageComputation() (see crbug.com/635655). |
| 697 const LayoutBox* thisBox = isBox() ? toLayoutBox(this) : nullptr; | 697 const LayoutBox* thisBox = isBox() ? toLayoutBox(this) : nullptr; |
| 698 Length logicalHeightLength = style()->logicalHeight(); | 698 Length logicalHeightLength = style()->logicalHeight(); |
| 699 LayoutBlock* cb = containingBlockForAutoHeightDetection(logicalHeightLength); | 699 LayoutBlock* cb = containingBlockForAutoHeightDetection(logicalHeightLength); |
| 700 if (logicalHeightLength.isPercentOrCalc() && cb && isBox()) | 700 if (logicalHeightLength.isPercentOrCalc() && cb && isBox()) |
| 701 cb->addPercentHeightDescendant(const_cast<LayoutBox*>(toLayoutBox(this))); | 701 cb->addPercentHeightDescendant(const_cast<LayoutBox*>(toLayoutBox(this))); |
| 702 if (thisBox && thisBox->isFlexItem()) { | 702 if (thisBox && thisBox->isFlexItem()) { |
| 703 LayoutFlexibleBox& flexBox = toLayoutFlexibleBox(*parent()); | 703 LayoutFlexibleBox& flexBox = toLayoutFlexibleBox(*parent()); |
| 704 if (flexBox.childLogicalHeightForPercentageResolution(*thisBox) != | 704 if (flexBox.childLogicalHeightForPercentageResolution(*thisBox) != |
| 705 LayoutUnit(-1)) | 705 LayoutUnit(-1)) |
| 706 return false; | 706 return false; |
| 707 } | 707 } |
| 708 if (thisBox && thisBox->isGridItem()) { | 708 if (thisBox && thisBox->isGridItem() && |
| 709 if (checkingContainingBlock && thisBox->hasOverrideLogicalContentHeight()) | 709 thisBox->hasOverrideContainingBlockLogicalHeight()) |
| 710 return false; | 710 return false; |
| 711 if (!checkingContainingBlock && | |
| 712 thisBox->hasOverrideContainingBlockLogicalHeight()) | |
| 713 return false; | |
| 714 } | |
| 715 if (logicalHeightLength.isAuto() && | 711 if (logicalHeightLength.isAuto() && |
| 716 !isOutOfFlowPositionedWithImplicitHeight(this)) | 712 !isOutOfFlowPositionedWithImplicitHeight(this)) |
| 717 return true; | 713 return true; |
| 718 | 714 |
| 719 if (document().inQuirksMode()) | 715 if (document().inQuirksMode()) |
| 720 return false; | 716 return false; |
| 721 | 717 |
| 722 // If the height of the containing block computes to 'auto', then it hasn't | |
| 723 // been 'specified explicitly'. | |
| 724 if (cb) | 718 if (cb) |
| 725 return cb->hasAutoHeightOrContainingBlockWithAutoHeight(true); | 719 return !cb->hasDefiniteLogicalHeight(); |
| 720 |
| 726 return false; | 721 return false; |
| 727 } | 722 } |
| 728 | 723 |
| 729 bool LayoutBoxModelObject::hasAutoHeightOrContainingBlockWithAutoHeight() | |
| 730 const { | |
| 731 return hasAutoHeightOrContainingBlockWithAutoHeight(false); | |
| 732 } | |
| 733 | |
| 734 LayoutSize LayoutBoxModelObject::relativePositionOffset() const { | 724 LayoutSize LayoutBoxModelObject::relativePositionOffset() const { |
| 735 LayoutSize offset = accumulateInFlowPositionOffsets(); | 725 LayoutSize offset = accumulateInFlowPositionOffsets(); |
| 736 | 726 |
| 737 LayoutBlock* containingBlock = this->containingBlock(); | 727 LayoutBlock* containingBlock = this->containingBlock(); |
| 738 | 728 |
| 739 // Objects that shrink to avoid floats normally use available line width when | 729 // Objects that shrink to avoid floats normally use available line width when |
| 740 // computing containing block width. However in the case of relative | 730 // computing containing block width. However in the case of relative |
| 741 // positioning using percentages, we can't do this. The offset should always | 731 // positioning using percentages, we can't do this. The offset should always |
| 742 // be resolved using the available width of the containing block. Therefore we | 732 // be resolved using the available width of the containing block. Therefore we |
| 743 // don't use containingBlockLogicalWidthForContent() here, but instead | 733 // don't use containingBlockLogicalWidthForContent() here, but instead |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1386 if (rootElementStyle->hasBackground()) | 1376 if (rootElementStyle->hasBackground()) |
| 1387 return false; | 1377 return false; |
| 1388 | 1378 |
| 1389 if (node() != document().firstBodyElement()) | 1379 if (node() != document().firstBodyElement()) |
| 1390 return false; | 1380 return false; |
| 1391 | 1381 |
| 1392 return true; | 1382 return true; |
| 1393 } | 1383 } |
| 1394 | 1384 |
| 1395 } // namespace blink | 1385 } // namespace blink |
| OLD | NEW |