| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/layout/DepthOrderedLayoutObjectList.h" | 5 #include "core/layout/DepthOrderedLayoutObjectList.h" |
| 6 | 6 |
| 7 #include "core/frame/FrameView.h" | 7 #include "core/frame/FrameView.h" |
| 8 #include "core/layout/LayoutObject.h" | 8 #include "core/layout/LayoutObject.h" |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 int DepthOrderedLayoutObjectList::size() const { | 31 int DepthOrderedLayoutObjectList::size() const { |
| 32 return m_data->m_objects.size(); | 32 return m_data->m_objects.size(); |
| 33 } | 33 } |
| 34 | 34 |
| 35 bool DepthOrderedLayoutObjectList::isEmpty() const { | 35 bool DepthOrderedLayoutObjectList::isEmpty() const { |
| 36 return m_data->m_objects.isEmpty(); | 36 return m_data->m_objects.isEmpty(); |
| 37 } | 37 } |
| 38 | 38 |
| 39 void DepthOrderedLayoutObjectList::add(LayoutObject& object) { | 39 void DepthOrderedLayoutObjectList::add(LayoutObject& object) { |
| 40 ASSERT(!object.frameView()->isInPerformLayout()); | 40 DCHECK(!object.frameView()->isInPerformLayout()); |
| 41 m_data->m_objects.insert(&object); | 41 m_data->m_objects.insert(&object); |
| 42 m_data->m_orderedObjects.clear(); | 42 m_data->m_orderedObjects.clear(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 void DepthOrderedLayoutObjectList::remove(LayoutObject& object) { | 45 void DepthOrderedLayoutObjectList::remove(LayoutObject& object) { |
| 46 auto it = m_data->m_objects.find(&object); | 46 auto it = m_data->m_objects.find(&object); |
| 47 if (it == m_data->m_objects.end()) | 47 if (it == m_data->m_objects.end()) |
| 48 return; | 48 return; |
| 49 ASSERT(!object.frameView()->isInPerformLayout()); | 49 DCHECK(!object.frameView()->isInPerformLayout()); |
| 50 m_data->m_objects.erase(it); | 50 m_data->m_objects.erase(it); |
| 51 m_data->m_orderedObjects.clear(); | 51 m_data->m_orderedObjects.clear(); |
| 52 } | 52 } |
| 53 | 53 |
| 54 void DepthOrderedLayoutObjectList::clear() { | 54 void DepthOrderedLayoutObjectList::clear() { |
| 55 m_data->m_objects.clear(); | 55 m_data->m_objects.clear(); |
| 56 m_data->m_orderedObjects.clear(); | 56 m_data->m_orderedObjects.clear(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 unsigned DepthOrderedLayoutObjectList::LayoutObjectWithDepth::determineDepth( | 59 unsigned DepthOrderedLayoutObjectList::LayoutObjectWithDepth::determineDepth( |
| (...skipping 13 matching lines...) Expand all Loading... |
| 73 DepthOrderedLayoutObjectList::ordered() { | 73 DepthOrderedLayoutObjectList::ordered() { |
| 74 if (m_data->m_objects.isEmpty() || !m_data->m_orderedObjects.isEmpty()) | 74 if (m_data->m_objects.isEmpty() || !m_data->m_orderedObjects.isEmpty()) |
| 75 return m_data->m_orderedObjects; | 75 return m_data->m_orderedObjects; |
| 76 | 76 |
| 77 copyToVector(m_data->m_objects, m_data->m_orderedObjects); | 77 copyToVector(m_data->m_objects, m_data->m_orderedObjects); |
| 78 std::sort(m_data->m_orderedObjects.begin(), m_data->m_orderedObjects.end()); | 78 std::sort(m_data->m_orderedObjects.begin(), m_data->m_orderedObjects.end()); |
| 79 return m_data->m_orderedObjects; | 79 return m_data->m_orderedObjects; |
| 80 } | 80 } |
| 81 | 81 |
| 82 } // namespace blink | 82 } // namespace blink |
| OLD | NEW |