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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBlock.cpp

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 * (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
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"
58 #include "wtf/StdLibExtras.h" 57 #include "wtf/StdLibExtras.h"
59 #include <memory>
60 58
61 namespace blink { 59 namespace blink {
62 60
63 struct SameSizeAsLayoutBlock : public LayoutBox { 61 struct SameSizeAsLayoutBlock : public LayoutBox {
64 LayoutObjectChildList children; 62 LayoutObjectChildList children;
65 uint32_t bitfields; 63 uint32_t bitfields;
66 }; 64 };
67 65
68 static_assert(sizeof(LayoutBlock) == sizeof(SameSizeAsLayoutBlock), "LayoutBlock should stay small"); 66 static_assert(sizeof(LayoutBlock) == sizeof(SameSizeAsLayoutBlock), "LayoutBlock should stay small");
69 67
(...skipping 28 matching lines...) Expand all
98 , m_hasPositionedObjects(false) 96 , m_hasPositionedObjects(false)
99 , m_hasPercentHeightDescendants(false) 97 , m_hasPercentHeightDescendants(false)
100 { 98 {
101 // LayoutBlockFlow calls setChildrenInline(true). 99 // LayoutBlockFlow calls setChildrenInline(true).
102 // By default, subclasses do not have inline children. 100 // By default, subclasses do not have inline children.
103 } 101 }
104 102
105 void LayoutBlock::removeFromGlobalMaps() 103 void LayoutBlock::removeFromGlobalMaps()
106 { 104 {
107 if (hasPositionedObjects()) { 105 if (hasPositionedObjects()) {
108 std::unique_ptr<TrackedLayoutBoxListHashSet> descendants = gPositionedDe scendantsMap->take(this); 106 OwnPtr<TrackedLayoutBoxListHashSet> descendants = gPositionedDescendants Map->take(this);
109 ASSERT(!descendants->isEmpty()); 107 ASSERT(!descendants->isEmpty());
110 for (LayoutBox* descendant : *descendants) { 108 for (LayoutBox* descendant : *descendants) {
111 ASSERT(gPositionedContainerMap->get(descendant) == this); 109 ASSERT(gPositionedContainerMap->get(descendant) == this);
112 gPositionedContainerMap->remove(descendant); 110 gPositionedContainerMap->remove(descendant);
113 } 111 }
114 } 112 }
115 if (hasPercentHeightDescendants()) { 113 if (hasPercentHeightDescendants()) {
116 std::unique_ptr<TrackedLayoutBoxListHashSet> descendants = gPercentHeigh tDescendantsMap->take(this); 114 OwnPtr<TrackedLayoutBoxListHashSet> descendants = gPercentHeightDescenda ntsMap->take(this);
117 ASSERT(!descendants->isEmpty()); 115 ASSERT(!descendants->isEmpty());
118 for (LayoutBox* descendant : *descendants) { 116 for (LayoutBox* descendant : *descendants) {
119 ASSERT(descendant->percentHeightContainer() == this); 117 ASSERT(descendant->percentHeightContainer() == this);
120 descendant->setPercentHeightContainer(nullptr); 118 descendant->setPercentHeightContainer(nullptr);
121 } 119 }
122 } 120 }
123 } 121 }
124 122
125 LayoutBlock::~LayoutBlock() 123 LayoutBlock::~LayoutBlock()
126 { 124 {
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 } else { 867 } else {
870 gPositionedContainerMap = new TrackedContainerMap; 868 gPositionedContainerMap = new TrackedContainerMap;
871 } 869 }
872 gPositionedContainerMap->set(o, this); 870 gPositionedContainerMap->set(o, this);
873 871
874 if (!gPositionedDescendantsMap) 872 if (!gPositionedDescendantsMap)
875 gPositionedDescendantsMap = new TrackedDescendantsMap; 873 gPositionedDescendantsMap = new TrackedDescendantsMap;
876 TrackedLayoutBoxListHashSet* descendantSet = gPositionedDescendantsMap->get( this); 874 TrackedLayoutBoxListHashSet* descendantSet = gPositionedDescendantsMap->get( this);
877 if (!descendantSet) { 875 if (!descendantSet) {
878 descendantSet = new TrackedLayoutBoxListHashSet; 876 descendantSet = new TrackedLayoutBoxListHashSet;
879 gPositionedDescendantsMap->set(this, wrapUnique(descendantSet)); 877 gPositionedDescendantsMap->set(this, adoptPtr(descendantSet));
880 } 878 }
881 descendantSet->add(o); 879 descendantSet->add(o);
882 880
883 m_hasPositionedObjects = true; 881 m_hasPositionedObjects = true;
884 } 882 }
885 883
886 void LayoutBlock::removePositionedObject(LayoutBox* o) 884 void LayoutBlock::removePositionedObject(LayoutBox* o)
887 { 885 {
888 if (!gPositionedContainerMap) 886 if (!gPositionedContainerMap)
889 return; 887 return;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 } 955 }
958 descendant->removeFromPercentHeightContainer(); 956 descendant->removeFromPercentHeightContainer();
959 } 957 }
960 descendant->setPercentHeightContainer(this); 958 descendant->setPercentHeightContainer(this);
961 959
962 if (!gPercentHeightDescendantsMap) 960 if (!gPercentHeightDescendantsMap)
963 gPercentHeightDescendantsMap = new TrackedDescendantsMap; 961 gPercentHeightDescendantsMap = new TrackedDescendantsMap;
964 TrackedLayoutBoxListHashSet* descendantSet = gPercentHeightDescendantsMap->g et(this); 962 TrackedLayoutBoxListHashSet* descendantSet = gPercentHeightDescendantsMap->g et(this);
965 if (!descendantSet) { 963 if (!descendantSet) {
966 descendantSet = new TrackedLayoutBoxListHashSet; 964 descendantSet = new TrackedLayoutBoxListHashSet;
967 gPercentHeightDescendantsMap->set(this, wrapUnique(descendantSet)); 965 gPercentHeightDescendantsMap->set(this, adoptPtr(descendantSet));
968 } 966 }
969 descendantSet->add(descendant); 967 descendantSet->add(descendant);
970 968
971 m_hasPercentHeightDescendants = true; 969 m_hasPercentHeightDescendants = true;
972 } 970 }
973 971
974 void LayoutBlock::removePercentHeightDescendant(LayoutBox* descendant) 972 void LayoutBlock::removePercentHeightDescendant(LayoutBox* descendant)
975 { 973 {
976 if (TrackedLayoutBoxListHashSet* descendants = percentHeightDescendants()) { 974 if (TrackedLayoutBoxListHashSet* descendants = percentHeightDescendants()) {
977 descendants->remove(descendant); 975 descendants->remove(descendant);
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after
1843 for (TrackedLayoutBoxListHashSet::const_iterator it = positionedDescenda ntSet->begin(); it != end; ++it) { 1841 for (TrackedLayoutBoxListHashSet::const_iterator it = positionedDescenda ntSet->begin(); it != end; ++it) {
1844 LayoutBox* currBox = *it; 1842 LayoutBox* currBox = *it;
1845 ASSERT(!currBox->needsLayout()); 1843 ASSERT(!currBox->needsLayout());
1846 } 1844 }
1847 } 1845 }
1848 } 1846 }
1849 1847
1850 #endif 1848 #endif
1851 1849
1852 } // namespace blink 1850 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlock.h ('k') | third_party/WebKit/Source/core/layout/LayoutBlockFlow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698