CSSSelectorList::CSSSelectorList(const CSSSelectorList& other) { unsigned otherLength = other.length(); m_selectorArray = reinterpret_cast<CSSSelector*>(fastMalloc(sizeof(CSSSelector) * otherLength)); for (unsigned i = 0; i < otherLength; ++i) new (&m_selectorArray[i]) CSSSelector(other.m_selectorArray[i]); }
CSSSelectorList::CSSSelectorList(const CSSSelectorList& o) { unsigned length = o.length(); if (length == 1) { // Destructor expects a single selector to be allocated by new, multiple with fastMalloc. m_selectorArray = new CSSSelector(o.m_selectorArray[0]); return; } m_selectorArray = reinterpret_cast<CSSSelector*>(fastMalloc(sizeof(CSSSelector) * length)); for (unsigned i = 0; i < length; ++i) new (&m_selectorArray[i]) CSSSelector(o.m_selectorArray[i]); }