[WTF] Add makeUnique<T>, which ensures T is fast-allocated, makeUnique / makeUniqueWi...
[WebKit-https.git] / Source / WebCore / layout / LayoutState.cpp
index bd9d4ca..1f3faba 100644 (file)
@@ -91,7 +91,7 @@ void LayoutState::layoutFormattingContextSubtree(const Box& layoutRoot)
 Display::Box& LayoutState::displayBoxForLayoutBox(const Box& layoutBox) const
 {
     return *m_layoutToDisplayBox.ensure(&layoutBox, [&layoutBox] {
-        return std::make_unique<Display::Box>(layoutBox.style());
+        return makeUnique<Display::Box>(layoutBox.style());
     }).iterator->value;
 }
 
@@ -140,13 +140,13 @@ FormattingState& LayoutState::createFormattingStateForFormattingRootIfNeeded(con
             // should not interfere with the content inside.
             // <div style="float: left"></div><div style="overflow: hidden"> <- is a non-intrusive float, because overflow: hidden triggers new block formatting context.</div>
             if (formattingRoot.establishesBlockFormattingContext())
-                return std::make_unique<InlineFormattingState>(FloatingState::create(*this, formattingRoot), *this);
+                return makeUnique<InlineFormattingState>(FloatingState::create(*this, formattingRoot), *this);
 
             // Otherwise, the formatting context inherits the floats from the parent formatting context.
             // Find the formatting state in which this formatting root lives, not the one it creates and use its floating state.
             auto& parentFormattingState = createFormattingStateForFormattingRootIfNeeded(formattingRoot.formattingContextRoot()); 
             auto& parentFloatingState = parentFormattingState.floatingState();
-            return std::make_unique<InlineFormattingState>(parentFloatingState, *this);
+            return makeUnique<InlineFormattingState>(parentFloatingState, *this);
         }).iterator->value;
     }
 
@@ -154,7 +154,7 @@ FormattingState& LayoutState::createFormattingStateForFormattingRootIfNeeded(con
         return *m_formattingStates.ensure(&formattingRoot, [&] {
 
             // Block formatting context always establishes a new floating state.
-            return std::make_unique<BlockFormattingState>(FloatingState::create(*this, formattingRoot), *this);
+            return makeUnique<BlockFormattingState>(FloatingState::create(*this, formattingRoot), *this);
         }).iterator->value;
     }
 
@@ -162,7 +162,7 @@ FormattingState& LayoutState::createFormattingStateForFormattingRootIfNeeded(con
         return *m_formattingStates.ensure(&formattingRoot, [&] {
 
             // Table formatting context always establishes a new floating state -and it stays empty.
-            return std::make_unique<TableFormattingState>(FloatingState::create(*this, formattingRoot), *this);
+            return makeUnique<TableFormattingState>(FloatingState::create(*this, formattingRoot), *this);
         }).iterator->value;
     }
 
@@ -174,18 +174,18 @@ std::unique_ptr<FormattingContext> LayoutState::createFormattingContext(const Bo
     ASSERT(formattingContextRoot.establishesFormattingContext());
     if (formattingContextRoot.establishesInlineFormattingContext()) {
         auto& inlineFormattingState = downcast<InlineFormattingState>(createFormattingStateForFormattingRootIfNeeded(formattingContextRoot));
-        return std::make_unique<InlineFormattingContext>(formattingContextRoot, inlineFormattingState);
+        return makeUnique<InlineFormattingContext>(formattingContextRoot, inlineFormattingState);
     }
 
     if (formattingContextRoot.establishesBlockFormattingContext()) {
         ASSERT(formattingContextRoot.establishesBlockFormattingContextOnly());
         auto& blockFormattingState = downcast<BlockFormattingState>(createFormattingStateForFormattingRootIfNeeded(formattingContextRoot));
-        return std::make_unique<BlockFormattingContext>(formattingContextRoot, blockFormattingState);
+        return makeUnique<BlockFormattingContext>(formattingContextRoot, blockFormattingState);
     }
 
     if (formattingContextRoot.establishesTableFormattingContext()) {
         auto& tableFormattingState = downcast<TableFormattingState>(createFormattingStateForFormattingRootIfNeeded(formattingContextRoot));
-        return std::make_unique<TableFormattingContext>(formattingContextRoot, tableFormattingState);
+        return makeUnique<TableFormattingContext>(formattingContextRoot, tableFormattingState);
     }
 
     CRASH();