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 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 } | 418 } |
419 return offset; | 419 return offset; |
420 } | 420 } |
421 | 421 |
422 LayoutBlock* LayoutBoxModelObject::containingBlockForAutoHeightDetection(Length
logicalHeight) const | 422 LayoutBlock* LayoutBoxModelObject::containingBlockForAutoHeightDetection(Length
logicalHeight) const |
423 { | 423 { |
424 // For percentage heights: The percentage is calculated with respect to the
height of the generated box's | 424 // For percentage heights: The percentage is calculated with respect to the
height of the generated box's |
425 // containing block. If the height of the containing block is not specified
explicitly (i.e., it depends | 425 // containing block. If the height of the containing block is not specified
explicitly (i.e., it depends |
426 // on content height), and this element is not absolutely positioned, the va
lue computes to 'auto'. | 426 // on content height), and this element is not absolutely positioned, the va
lue computes to 'auto'. |
427 if (!logicalHeight.hasPercent() || isOutOfFlowPositioned()) | 427 if (!logicalHeight.hasPercent() || isOutOfFlowPositioned()) |
428 return 0; | 428 return nullptr; |
429 | 429 |
430 // Anonymous block boxes are ignored when resolving percentage values that w
ould refer to it: | 430 // Anonymous block boxes are ignored when resolving percentage values that w
ould refer to it: |
431 // the closest non-anonymous ancestor box is used instead. | 431 // the closest non-anonymous ancestor box is used instead. |
432 LayoutBlock* cb = containingBlock(); | 432 LayoutBlock* cb = containingBlock(); |
433 while (cb->isAnonymous()) | 433 while (cb->isAnonymous()) |
434 cb = cb->containingBlock(); | 434 cb = cb->containingBlock(); |
435 | 435 |
436 // Matching LayoutBox::percentageLogicalHeightIsResolvableFromBlock() by | 436 // Matching LayoutBox::percentageLogicalHeightIsResolvableFromBlock() by |
437 // ignoring table cell's attribute value, where it says that table cells vio
late | 437 // ignoring table cell's attribute value, where it says that table cells vio
late |
438 // what the CSS spec says to do with heights. Basically we | 438 // what the CSS spec says to do with heights. Basically we |
439 // don't care if the cell specified a height or not. | 439 // don't care if the cell specified a height or not. |
440 if (cb->isTableCell()) | 440 if (cb->isTableCell()) |
441 return 0; | 441 return nullptr; |
442 | 442 |
443 // Match LayoutBox::availableLogicalHeightUsing by special casing | 443 // Match LayoutBox::availableLogicalHeightUsing by special casing |
444 // the layout view. The available height is taken from the frame. | 444 // the layout view. The available height is taken from the frame. |
445 if (cb->isLayoutView()) | 445 if (cb->isLayoutView()) |
446 return 0; | 446 return nullptr; |
447 | 447 |
448 if (cb->isOutOfFlowPositioned() && !cb->style()->logicalTop().isAuto() && !c
b->style()->logicalBottom().isAuto()) | 448 if (cb->isOutOfFlowPositioned() && !cb->style()->logicalTop().isAuto() && !c
b->style()->logicalBottom().isAuto()) |
449 return 0; | 449 return nullptr; |
450 | 450 |
451 return cb; | 451 return cb; |
452 } | 452 } |
453 | 453 |
454 bool LayoutBoxModelObject::hasAutoHeightOrContainingBlockWithAutoHeight() const | 454 bool LayoutBoxModelObject::hasAutoHeightOrContainingBlockWithAutoHeight() const |
455 { | 455 { |
456 Length logicalHeightLength = style()->logicalHeight(); | 456 Length logicalHeightLength = style()->logicalHeight(); |
457 if (logicalHeightLength.isAuto()) | 457 if (logicalHeightLength.isAuto()) |
458 return true; | 458 return true; |
459 | 459 |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 | 730 |
731 | 731 |
732 | 732 |
733 LayoutUnit LayoutBoxModelObject::containingBlockLogicalWidthForContent() const | 733 LayoutUnit LayoutBoxModelObject::containingBlockLogicalWidthForContent() const |
734 { | 734 { |
735 return containingBlock()->availableLogicalWidth(); | 735 return containingBlock()->availableLogicalWidth(); |
736 } | 736 } |
737 | 737 |
738 LayoutBoxModelObject* LayoutBoxModelObject::continuation() const | 738 LayoutBoxModelObject* LayoutBoxModelObject::continuation() const |
739 { | 739 { |
740 if (!continuationMap) | 740 return (!continuationMap) ? nullptr : continuationMap->get(this); |
741 return 0; | |
742 return continuationMap->get(this); | |
743 } | 741 } |
744 | 742 |
745 void LayoutBoxModelObject::setContinuation(LayoutBoxModelObject* continuation) | 743 void LayoutBoxModelObject::setContinuation(LayoutBoxModelObject* continuation) |
746 { | 744 { |
747 if (continuation) { | 745 if (continuation) { |
748 if (!continuationMap) | 746 if (!continuationMap) |
749 continuationMap = new ContinuationMap; | 747 continuationMap = new ContinuationMap; |
750 continuationMap->set(this, continuation); | 748 continuationMap->set(this, continuation); |
751 } else { | 749 } else { |
752 if (continuationMap) | 750 if (continuationMap) |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 } | 862 } |
865 } | 863 } |
866 | 864 |
867 const LayoutObject* LayoutBoxModelObject::pushMappingToContainer(const LayoutBox
ModelObject* ancestorToStopAt, LayoutGeometryMap& geometryMap) const | 865 const LayoutObject* LayoutBoxModelObject::pushMappingToContainer(const LayoutBox
ModelObject* ancestorToStopAt, LayoutGeometryMap& geometryMap) const |
868 { | 866 { |
869 ASSERT(ancestorToStopAt != this); | 867 ASSERT(ancestorToStopAt != this); |
870 | 868 |
871 bool ancestorSkipped; | 869 bool ancestorSkipped; |
872 LayoutObject* container = this->container(ancestorToStopAt, &ancestorSkipped
); | 870 LayoutObject* container = this->container(ancestorToStopAt, &ancestorSkipped
); |
873 if (!container) | 871 if (!container) |
874 return 0; | 872 return nullptr; |
875 | 873 |
876 bool isInline = isLayoutInline(); | 874 bool isInline = isLayoutInline(); |
877 bool isFixedPos = !isInline && style()->position() == FixedPosition; | 875 bool isFixedPos = !isInline && style()->position() == FixedPosition; |
878 bool hasTransform = !isInline && hasLayer() && layer()->transform(); | 876 bool hasTransform = !isInline && hasLayer() && layer()->transform(); |
879 | 877 |
880 LayoutSize adjustmentForSkippedAncestor; | 878 LayoutSize adjustmentForSkippedAncestor; |
881 if (ancestorSkipped) { | 879 if (ancestorSkipped) { |
882 // There can't be a transform between paintInvalidationContainer and anc
estorToStopAt, because transforms create containers, so it should be safe | 880 // There can't be a transform between paintInvalidationContainer and anc
estorToStopAt, because transforms create containers, so it should be safe |
883 // to just subtract the delta between the ancestor and ancestorToStopAt. | 881 // to just subtract the delta between the ancestor and ancestorToStopAt. |
884 adjustmentForSkippedAncestor = -ancestorToStopAt->offsetFromAncestorCont
ainer(container); | 882 adjustmentForSkippedAncestor = -ancestorToStopAt->offsetFromAncestorCont
ainer(container); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 } | 916 } |
919 } | 917 } |
920 | 918 |
921 void LayoutBoxModelObject::moveChildrenTo(LayoutBoxModelObject* toBoxModelObject
, LayoutObject* startChild, LayoutObject* endChild, LayoutObject* beforeChild, b
ool fullRemoveInsert) | 919 void LayoutBoxModelObject::moveChildrenTo(LayoutBoxModelObject* toBoxModelObject
, LayoutObject* startChild, LayoutObject* endChild, LayoutObject* beforeChild, b
ool fullRemoveInsert) |
922 { | 920 { |
923 // This condition is rarely hit since this function is usually called on | 921 // This condition is rarely hit since this function is usually called on |
924 // anonymous blocks which can no longer carry positioned objects (see r12076
1) | 922 // anonymous blocks which can no longer carry positioned objects (see r12076
1) |
925 // or when fullRemoveInsert is false. | 923 // or when fullRemoveInsert is false. |
926 if (fullRemoveInsert && isLayoutBlock()) { | 924 if (fullRemoveInsert && isLayoutBlock()) { |
927 LayoutBlock* block = toLayoutBlock(this); | 925 LayoutBlock* block = toLayoutBlock(this); |
928 block->removePositionedObjects(0); | 926 block->removePositionedObjects(nullptr); |
929 if (block->isLayoutBlockFlow()) | 927 if (block->isLayoutBlockFlow()) |
930 toLayoutBlockFlow(block)->removeFloatingObjects(); | 928 toLayoutBlockFlow(block)->removeFloatingObjects(); |
931 } | 929 } |
932 | 930 |
933 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); | 931 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); |
934 for (LayoutObject* child = startChild; child && child != endChild; ) { | 932 for (LayoutObject* child = startChild; child && child != endChild; ) { |
935 // Save our next sibling as moveChildTo will clear it. | 933 // Save our next sibling as moveChildTo will clear it. |
936 LayoutObject* nextSibling = child->nextSibling(); | 934 LayoutObject* nextSibling = child->nextSibling(); |
937 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); | 935 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); |
938 child = nextSibling; | 936 child = nextSibling; |
939 } | 937 } |
940 } | 938 } |
941 | 939 |
942 } // namespace blink | 940 } // namespace blink |
OLD | NEW |