Index: third_party/WebKit/Source/core/layout/LayoutBlock.h |
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlock.h b/third_party/WebKit/Source/core/layout/LayoutBlock.h |
index dbfe957fab3dc189f4fca56c4b4cd51438ab5f18..f40b4db8a2696bcb1fd2f6f4102c37dc5388879f 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutBlock.h |
+++ b/third_party/WebKit/Source/core/layout/LayoutBlock.h |
@@ -44,7 +44,7 @@ class WordMeasurement; |
typedef WTF::ListHashSet<LayoutBox*, 16> TrackedLayoutBoxListHashSet; |
typedef WTF::HashMap<const LayoutBlock*, OwnPtr<TrackedLayoutBoxListHashSet>> TrackedDescendantsMap; |
-typedef WTF::HashMap<const LayoutBox*, OwnPtr<HashSet<LayoutBlock*>>> TrackedContainerMap; |
+typedef WTF::HashMap<const LayoutBox*, LayoutBlock*> TrackedContainerMap; |
typedef Vector<WordMeasurement, 64> WordMeasurements; |
enum ContainingBlockState { NewContainingBlock, SameContainingBlock }; |
@@ -159,25 +159,22 @@ public: |
static void removePositionedObject(LayoutBox*); |
void removePositionedObjects(LayoutBlock*, ContainingBlockState = SameContainingBlock); |
- TrackedLayoutBoxListHashSet* positionedObjects() const; |
+ TrackedLayoutBoxListHashSet* positionedObjects() const { return hasPositionedObjects() ? positionedObjectsInternal() : nullptr; } |
bool hasPositionedObjects() const |
{ |
- TrackedLayoutBoxListHashSet* objects = positionedObjects(); |
- return objects && !objects->isEmpty(); |
+ ASSERT(static_cast<bool>(m_hasPositionedObjects) == (positionedObjectsInternal() && !positionedObjectsInternal()->isEmpty())); |
+ return m_hasPositionedObjects; |
} |
void addPercentHeightDescendant(LayoutBox*); |
- static void removePercentHeightDescendant(LayoutBox*); |
- static bool hasPercentHeightContainerMap(); |
- static bool hasPercentHeightDescendant(LayoutBox*); |
- static void clearPercentHeightDescendantsFrom(LayoutBox*); |
- static void removePercentHeightDescendantIfNeeded(LayoutBox*); |
+ void removePercentHeightDescendant(LayoutBox*); |
+ bool hasPercentHeightDescendant(LayoutBox* o) const { return hasPercentHeightDescendants() && percentHeightDescendants()->contains(o); } |
esprehn
2016/01/20 00:01:49
this checks the bit twice, you want to call the In
Xianzhu
2016/01/20 02:33:26
Done.
|
- TrackedLayoutBoxListHashSet* percentHeightDescendants() const; |
+ TrackedLayoutBoxListHashSet* percentHeightDescendants() const { return hasPercentHeightDescendants() ? percentHeightDescendantsInternal() : nullptr; } |
bool hasPercentHeightDescendants() const |
{ |
- TrackedLayoutBoxListHashSet* descendants = percentHeightDescendants(); |
- return descendants && !descendants->isEmpty(); |
+ ASSERT(static_cast<bool>(m_hasPercentHeightDescendants) == (percentHeightDescendantsInternal() && !percentHeightDescendantsInternal()->isEmpty())); |
esprehn
2016/01/20 00:01:48
I would do this as:
(!m_hasPercentHeightDescendan
Xianzhu
2016/01/20 02:33:26
This will miss check of another side: when m_hasPe
|
+ return m_hasPercentHeightDescendants; |
} |
void notifyScrollbarThicknessChanged() { m_widthAvailableToChildrenChanged = true; } |
@@ -399,8 +396,9 @@ private: |
bool isSelfCollapsingBlock() const override; |
- void insertIntoTrackedLayoutBoxMaps(LayoutBox* descendant, TrackedDescendantsMap*&, TrackedContainerMap*&); |
- static void removeFromTrackedLayoutBoxMaps(LayoutBox* descendant, TrackedDescendantsMap*&, TrackedContainerMap*&); |
+ void insertIntoTrackedDescendantsMap(LayoutBox*, TrackedDescendantsMap*&); |
+ TrackedLayoutBoxListHashSet* positionedObjectsInternal() const; |
+ TrackedLayoutBoxListHashSet* percentHeightDescendantsInternal() const; |
Node* nodeForHitTest() const; |
@@ -496,6 +494,9 @@ protected: |
mutable unsigned m_descendantsWithFloatsMarkedForLayout : 1; |
mutable unsigned m_needsRecalcLogicalWidthAfterLayoutChildren : 1; |
+ unsigned m_hasPositionedObjects : 1; |
+ unsigned m_hasPercentHeightDescendants : 1; |
+ |
// LayoutRubyBase objects need to be able to split and merge, moving their children around |
// (calling moveChildTo, moveAllChildrenTo, and makeChildrenNonInline). |
friend class LayoutRubyBase; |