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

Side by Side Diff: third_party/WebKit/WebCore/css/CSSMutableStyleDeclaration.cpp

Issue 20076: WebKit merge 40500:40539 [WebKit side] (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 10 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 74
75 CSSMutableStyleDeclaration::CSSMutableStyleDeclaration(CSSRule* parent, const CS SProperty* const * properties, int numProperties) 75 CSSMutableStyleDeclaration::CSSMutableStyleDeclaration(CSSRule* parent, const CS SProperty* const * properties, int numProperties)
76 : CSSStyleDeclaration(parent) 76 : CSSStyleDeclaration(parent)
77 , m_node(0) 77 , m_node(0)
78 , m_variableDependentValueCount(0) 78 , m_variableDependentValueCount(0)
79 , m_strictParsing(!parent || parent->useStrictParsing()) 79 , m_strictParsing(!parent || parent->useStrictParsing())
80 #ifndef NDEBUG 80 #ifndef NDEBUG
81 , m_iteratorCount(0) 81 , m_iteratorCount(0)
82 #endif 82 #endif
83 { 83 {
84 m_properties.reserveCapacity(numProperties); 84 m_properties.reserveInitialCapacity(numProperties);
85 for (int i = 0; i < numProperties; ++i) { 85 for (int i = 0; i < numProperties; ++i) {
86 ASSERT(properties[i]); 86 ASSERT(properties[i]);
87 m_properties.append(*properties[i]); 87 m_properties.append(*properties[i]);
88 if (properties[i]->value()->isVariableDependentValue()) 88 if (properties[i]->value()->isVariableDependentValue())
89 m_variableDependentValueCount++; 89 m_variableDependentValueCount++;
90 } 90 }
91 // FIXME: This allows duplicate properties. 91 // FIXME: This allows duplicate properties.
92 } 92 }
93 93
94 CSSMutableStyleDeclaration& CSSMutableStyleDeclaration::operator=(const CSSMutab leStyleDeclaration& other) 94 CSSMutableStyleDeclaration& CSSMutableStyleDeclaration::operator=(const CSSMutab leStyleDeclaration& other)
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 695
696 if (m_properties.isEmpty()) 696 if (m_properties.isEmpty())
697 return; 697 return;
698 698
699 // FIXME: This is always used with static sets and in that case constructing the hash repeatedly is pretty pointless. 699 // FIXME: This is always used with static sets and in that case constructing the hash repeatedly is pretty pointless.
700 HashSet<int> toRemove; 700 HashSet<int> toRemove;
701 for (unsigned i = 0; i < length; ++i) 701 for (unsigned i = 0; i < length; ++i)
702 toRemove.add(set[i]); 702 toRemove.add(set[i]);
703 703
704 Vector<CSSProperty> newProperties; 704 Vector<CSSProperty> newProperties;
705 newProperties.reserveCapacity(m_properties.size()); 705 newProperties.reserveInitialCapacity(m_properties.size());
706 706
707 unsigned size = m_properties.size(); 707 unsigned size = m_properties.size();
708 for (unsigned n = 0; n < size; ++n) { 708 for (unsigned n = 0; n < size; ++n) {
709 const CSSProperty& property = m_properties[n]; 709 const CSSProperty& property = m_properties[n];
710 // Not quite sure if the isImportant test is needed but it matches the e xisting behavior. 710 // Not quite sure if the isImportant test is needed but it matches the e xisting behavior.
711 if (!property.isImportant()) { 711 if (!property.isImportant()) {
712 if (toRemove.contains(property.id())) 712 if (toRemove.contains(property.id()))
713 continue; 713 continue;
714 } 714 }
715 newProperties.append(property); 715 newProperties.append(property);
(...skipping 28 matching lines...) Expand all
744 CSSProperty* CSSMutableStyleDeclaration::findPropertyWithId(int propertyID) 744 CSSProperty* CSSMutableStyleDeclaration::findPropertyWithId(int propertyID)
745 { 745 {
746 for (int n = m_properties.size() - 1 ; n >= 0; --n) { 746 for (int n = m_properties.size() - 1 ; n >= 0; --n) {
747 if (propertyID == m_properties[n].m_id) 747 if (propertyID == m_properties[n].m_id)
748 return &m_properties[n]; 748 return &m_properties[n];
749 } 749 }
750 return 0; 750 return 0;
751 } 751 }
752 752
753 } // namespace WebCore 753 } // namespace WebCore
OLDNEW
« no previous file with comments | « third_party/WebKit/WebCore/bridge/qt/qt_runtime.cpp ('k') | third_party/WebKit/WebCore/css/CSSPrimitiveValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698