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) 2007 David Smith (catfish.man@gmail.com) | 4 * (C) 2007 David Smith (catfish.man@gmail.com) |
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. |
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 #include "core/layout/LayoutView.h" | 47 #include "core/layout/LayoutView.h" |
48 #include "core/layout/TextAutosizer.h" | 48 #include "core/layout/TextAutosizer.h" |
49 #include "core/layout/api/LineLayoutBox.h" | 49 #include "core/layout/api/LineLayoutBox.h" |
50 #include "core/layout/api/LineLayoutItem.h" | 50 #include "core/layout/api/LineLayoutItem.h" |
51 #include "core/layout/line/InlineTextBox.h" | 51 #include "core/layout/line/InlineTextBox.h" |
52 #include "core/page/Page.h" | 52 #include "core/page/Page.h" |
53 #include "core/paint/BlockPainter.h" | 53 #include "core/paint/BlockPainter.h" |
54 #include "core/paint/PaintLayer.h" | 54 #include "core/paint/PaintLayer.h" |
55 #include "core/style/ComputedStyle.h" | 55 #include "core/style/ComputedStyle.h" |
56 #include "platform/RuntimeEnabledFeatures.h" | 56 #include "platform/RuntimeEnabledFeatures.h" |
| 57 #include "wtf/PtrUtil.h" |
57 #include "wtf/StdLibExtras.h" | 58 #include "wtf/StdLibExtras.h" |
| 59 #include <memory> |
58 | 60 |
59 namespace blink { | 61 namespace blink { |
60 | 62 |
61 struct SameSizeAsLayoutBlock : public LayoutBox { | 63 struct SameSizeAsLayoutBlock : public LayoutBox { |
62 LayoutObjectChildList children; | 64 LayoutObjectChildList children; |
63 uint32_t bitfields; | 65 uint32_t bitfields; |
64 }; | 66 }; |
65 | 67 |
66 static_assert(sizeof(LayoutBlock) == sizeof(SameSizeAsLayoutBlock), "LayoutBlock
should stay small"); | 68 static_assert(sizeof(LayoutBlock) == sizeof(SameSizeAsLayoutBlock), "LayoutBlock
should stay small"); |
67 | 69 |
(...skipping 28 matching lines...) Expand all Loading... |
96 , m_hasPositionedObjects(false) | 98 , m_hasPositionedObjects(false) |
97 , m_hasPercentHeightDescendants(false) | 99 , m_hasPercentHeightDescendants(false) |
98 { | 100 { |
99 // LayoutBlockFlow calls setChildrenInline(true). | 101 // LayoutBlockFlow calls setChildrenInline(true). |
100 // By default, subclasses do not have inline children. | 102 // By default, subclasses do not have inline children. |
101 } | 103 } |
102 | 104 |
103 void LayoutBlock::removeFromGlobalMaps() | 105 void LayoutBlock::removeFromGlobalMaps() |
104 { | 106 { |
105 if (hasPositionedObjects()) { | 107 if (hasPositionedObjects()) { |
106 OwnPtr<TrackedLayoutBoxListHashSet> descendants = gPositionedDescendants
Map->take(this); | 108 std::unique_ptr<TrackedLayoutBoxListHashSet> descendants = gPositionedDe
scendantsMap->take(this); |
107 ASSERT(!descendants->isEmpty()); | 109 ASSERT(!descendants->isEmpty()); |
108 for (LayoutBox* descendant : *descendants) { | 110 for (LayoutBox* descendant : *descendants) { |
109 ASSERT(gPositionedContainerMap->get(descendant) == this); | 111 ASSERT(gPositionedContainerMap->get(descendant) == this); |
110 gPositionedContainerMap->remove(descendant); | 112 gPositionedContainerMap->remove(descendant); |
111 } | 113 } |
112 } | 114 } |
113 if (hasPercentHeightDescendants()) { | 115 if (hasPercentHeightDescendants()) { |
114 OwnPtr<TrackedLayoutBoxListHashSet> descendants = gPercentHeightDescenda
ntsMap->take(this); | 116 std::unique_ptr<TrackedLayoutBoxListHashSet> descendants = gPercentHeigh
tDescendantsMap->take(this); |
115 ASSERT(!descendants->isEmpty()); | 117 ASSERT(!descendants->isEmpty()); |
116 for (LayoutBox* descendant : *descendants) { | 118 for (LayoutBox* descendant : *descendants) { |
117 ASSERT(descendant->percentHeightContainer() == this); | 119 ASSERT(descendant->percentHeightContainer() == this); |
118 descendant->setPercentHeightContainer(nullptr); | 120 descendant->setPercentHeightContainer(nullptr); |
119 } | 121 } |
120 } | 122 } |
121 } | 123 } |
122 | 124 |
123 LayoutBlock::~LayoutBlock() | 125 LayoutBlock::~LayoutBlock() |
124 { | 126 { |
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 } else { | 869 } else { |
868 gPositionedContainerMap = new TrackedContainerMap; | 870 gPositionedContainerMap = new TrackedContainerMap; |
869 } | 871 } |
870 gPositionedContainerMap->set(o, this); | 872 gPositionedContainerMap->set(o, this); |
871 | 873 |
872 if (!gPositionedDescendantsMap) | 874 if (!gPositionedDescendantsMap) |
873 gPositionedDescendantsMap = new TrackedDescendantsMap; | 875 gPositionedDescendantsMap = new TrackedDescendantsMap; |
874 TrackedLayoutBoxListHashSet* descendantSet = gPositionedDescendantsMap->get(
this); | 876 TrackedLayoutBoxListHashSet* descendantSet = gPositionedDescendantsMap->get(
this); |
875 if (!descendantSet) { | 877 if (!descendantSet) { |
876 descendantSet = new TrackedLayoutBoxListHashSet; | 878 descendantSet = new TrackedLayoutBoxListHashSet; |
877 gPositionedDescendantsMap->set(this, adoptPtr(descendantSet)); | 879 gPositionedDescendantsMap->set(this, wrapUnique(descendantSet)); |
878 } | 880 } |
879 descendantSet->add(o); | 881 descendantSet->add(o); |
880 | 882 |
881 m_hasPositionedObjects = true; | 883 m_hasPositionedObjects = true; |
882 } | 884 } |
883 | 885 |
884 void LayoutBlock::removePositionedObject(LayoutBox* o) | 886 void LayoutBlock::removePositionedObject(LayoutBox* o) |
885 { | 887 { |
886 if (!gPositionedContainerMap) | 888 if (!gPositionedContainerMap) |
887 return; | 889 return; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
955 } | 957 } |
956 descendant->removeFromPercentHeightContainer(); | 958 descendant->removeFromPercentHeightContainer(); |
957 } | 959 } |
958 descendant->setPercentHeightContainer(this); | 960 descendant->setPercentHeightContainer(this); |
959 | 961 |
960 if (!gPercentHeightDescendantsMap) | 962 if (!gPercentHeightDescendantsMap) |
961 gPercentHeightDescendantsMap = new TrackedDescendantsMap; | 963 gPercentHeightDescendantsMap = new TrackedDescendantsMap; |
962 TrackedLayoutBoxListHashSet* descendantSet = gPercentHeightDescendantsMap->g
et(this); | 964 TrackedLayoutBoxListHashSet* descendantSet = gPercentHeightDescendantsMap->g
et(this); |
963 if (!descendantSet) { | 965 if (!descendantSet) { |
964 descendantSet = new TrackedLayoutBoxListHashSet; | 966 descendantSet = new TrackedLayoutBoxListHashSet; |
965 gPercentHeightDescendantsMap->set(this, adoptPtr(descendantSet)); | 967 gPercentHeightDescendantsMap->set(this, wrapUnique(descendantSet)); |
966 } | 968 } |
967 descendantSet->add(descendant); | 969 descendantSet->add(descendant); |
968 | 970 |
969 m_hasPercentHeightDescendants = true; | 971 m_hasPercentHeightDescendants = true; |
970 } | 972 } |
971 | 973 |
972 void LayoutBlock::removePercentHeightDescendant(LayoutBox* descendant) | 974 void LayoutBlock::removePercentHeightDescendant(LayoutBox* descendant) |
973 { | 975 { |
974 if (TrackedLayoutBoxListHashSet* descendants = percentHeightDescendants()) { | 976 if (TrackedLayoutBoxListHashSet* descendants = percentHeightDescendants()) { |
975 descendants->remove(descendant); | 977 descendants->remove(descendant); |
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1841 for (TrackedLayoutBoxListHashSet::const_iterator it = positionedDescenda
ntSet->begin(); it != end; ++it) { | 1843 for (TrackedLayoutBoxListHashSet::const_iterator it = positionedDescenda
ntSet->begin(); it != end; ++it) { |
1842 LayoutBox* currBox = *it; | 1844 LayoutBox* currBox = *it; |
1843 ASSERT(!currBox->needsLayout()); | 1845 ASSERT(!currBox->needsLayout()); |
1844 } | 1846 } |
1845 } | 1847 } |
1846 } | 1848 } |
1847 | 1849 |
1848 #endif | 1850 #endif |
1849 | 1851 |
1850 } // namespace blink | 1852 } // namespace blink |
OLD | NEW |