Commit 02b2f195 authored by andersca's avatar andersca

Reviewed by Darin.

        Use Vector instead of DeprecatedValueList in a few places.
        
        * bindings/js/kjs_dom.cpp:
        (KJS::DOMNamedNodesCollection::DOMNamedNodesCollection):
        (KJS::DOMNamedNodesCollection::lengthGetter):
        (KJS::DOMNamedNodesCollection::getOwnPropertySlot):
        * bindings/js/kjs_dom.h:
        * bindings/js/kjs_html.cpp:
        (KJS::JSHTMLDocument::namedItemGetter):
        (KJS::JSHTMLElement::classInfo):
        (KJS::JSHTMLElement::accessors):
        (KJS::JSHTMLCollection::getNamedItems):
        * bindings/objc/DOM.mm:
        * bridge/mac/FrameMac.mm:
        (WebCore::FrameMac::dashboardRegionsDictionary):
        * css/CSSStyleDeclaration.cpp:
        (WebCore::CSSStyleDeclaration::diff):
        * html/HTMLCollection.cpp:
        (WebCore::HTMLCollection::namedItems):
        * html/HTMLCollection.h:
        * kcanvas/KCanvasFilters.cpp:
        (WebCore::KCanvasFilter::externalRepresentation):
        * kcanvas/KCanvasFilters.h:
        (WebCore::KCanvasFEColorMatrix::values):
        (WebCore::KCanvasFEColorMatrix::setValues):
        (WebCore::KCanvasFEConvolveMatrix::kernel):
        (WebCore::KCanvasFEConvolveMatrix::setKernel):
        * kcanvas/device/quartz/KCanvasFilterQuartz.mm:
        (WebCore::KCanvasFilterQuartz::getCIFilterStack):
        (WebCore::KCanvasFEColorMatrixQuartz::getCIFilter):
        * ksvg2/svg/SVGFEColorMatrixElement.cpp:
        (WebCore::SVGFEColorMatrixElement::filterEffect):
        * platform/graphics/svg/SVGResourceClipper.h:
        * platform/graphics/svg/cg/SVGResourceClipperCg.cpp:
        (WebCore::SVGResourceClipper::applyClip):
        * platform/network/FormData.h:
        * rendering/RenderPath.h:
        * rendering/SVGRenderTreeAsText.h:
        (WebCore::operator<<):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@17818 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent c98a54f5
2006-11-15 Anders Carlsson <acarlsson@apple.com>
Reviewed by Darin.
Use Vector instead of DeprecatedValueList in a few places.
* bindings/js/kjs_dom.cpp:
(KJS::DOMNamedNodesCollection::DOMNamedNodesCollection):
(KJS::DOMNamedNodesCollection::lengthGetter):
(KJS::DOMNamedNodesCollection::getOwnPropertySlot):
* bindings/js/kjs_dom.h:
* bindings/js/kjs_html.cpp:
(KJS::JSHTMLDocument::namedItemGetter):
(KJS::JSHTMLElement::classInfo):
(KJS::JSHTMLElement::accessors):
(KJS::JSHTMLCollection::getNamedItems):
* bindings/objc/DOM.mm:
* bridge/mac/FrameMac.mm:
(WebCore::FrameMac::dashboardRegionsDictionary):
* css/CSSStyleDeclaration.cpp:
(WebCore::CSSStyleDeclaration::diff):
* html/HTMLCollection.cpp:
(WebCore::HTMLCollection::namedItems):
* html/HTMLCollection.h:
* kcanvas/KCanvasFilters.cpp:
(WebCore::KCanvasFilter::externalRepresentation):
* kcanvas/KCanvasFilters.h:
(WebCore::KCanvasFEColorMatrix::values):
(WebCore::KCanvasFEColorMatrix::setValues):
(WebCore::KCanvasFEConvolveMatrix::kernel):
(WebCore::KCanvasFEConvolveMatrix::setKernel):
* kcanvas/device/quartz/KCanvasFilterQuartz.mm:
(WebCore::KCanvasFilterQuartz::getCIFilterStack):
(WebCore::KCanvasFEColorMatrixQuartz::getCIFilter):
* ksvg2/svg/SVGFEColorMatrixElement.cpp:
(WebCore::SVGFEColorMatrixElement::filterEffect):
* platform/graphics/svg/SVGResourceClipper.h:
* platform/graphics/svg/cg/SVGResourceClipperCg.cpp:
(WebCore::SVGResourceClipper::applyClip):
* platform/network/FormData.h:
* rendering/RenderPath.h:
* rendering/SVGRenderTreeAsText.h:
(WebCore::operator<<):
2006-11-16 Anders Carlsson <acarlsson@apple.com>
Reviewed by Tim.
......@@ -671,7 +715,7 @@
(WebCore::HTMLElement::isRecognizedTagName):
* ksvg2/scripts/make_names.pl:
2006-11-15 Anders Carlsson <acarlsson@apple.com>
2006-11-16 Anders Carlsson <acarlsson@apple.com>
Reviewed by Geoff.
......@@ -1106,7 +1106,7 @@ const ClassInfo DOMNamedNodesCollection::info = { "Collection", 0, 0, 0 };
// Such a collection is usually very short-lived, it only exists
// for constructs like document.forms.<name>[1],
// so it shouldn't be a problem that it's storing all the nodes (with the same name). (David)
DOMNamedNodesCollection::DOMNamedNodesCollection(ExecState* exec, const DeprecatedValueList< RefPtr<Node> >& nodes )
DOMNamedNodesCollection::DOMNamedNodesCollection(ExecState* exec, const Vector<RefPtr<Node> >& nodes)
: m_nodes(nodes)
{
setPrototype(exec->lexicalInterpreter()->builtinObjectPrototype());
......@@ -1115,7 +1115,7 @@ DOMNamedNodesCollection::DOMNamedNodesCollection(ExecState* exec, const Deprecat
JSValue* DOMNamedNodesCollection::lengthGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot)
{
DOMNamedNodesCollection *thisObj = static_cast<DOMNamedNodesCollection*>(slot.slotBase());
return jsNumber(thisObj->m_nodes.count());
return jsNumber(thisObj->m_nodes.size());
}
JSValue* DOMNamedNodesCollection::indexGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot)
......@@ -1134,7 +1134,7 @@ bool DOMNamedNodesCollection::getOwnPropertySlot(ExecState* exec, const Identifi
// array index ?
bool ok;
unsigned idx = propertyName.toUInt32(&ok);
if (ok && idx < m_nodes.count()) {
if (ok && idx < m_nodes.size()) {
slot.setCustomIndex(this, idx, indexGetter);
return true;
}
......@@ -1143,10 +1143,8 @@ bool DOMNamedNodesCollection::getOwnPropertySlot(ExecState* exec, const Identifi
// document.formName.name result by id as well as be index.
AtomicString atomicPropertyName = propertyName;
DeprecatedValueListConstIterator< RefPtr<Node> > end = m_nodes.end();
int i = 0;
for (DeprecatedValueListConstIterator< RefPtr<Node> > it = m_nodes.begin(); it != end; ++it, ++i) {
Node* node = (*it).get();
for (unsigned i = 0; i < m_nodes.size(); i++) {
Node* node = m_nodes[i].get();
if (node->hasAttributes() && node->attributes()->id() == atomicPropertyName) {
slot.setCustomIndex(this, i, indexGetter);
return true;
......
......@@ -24,8 +24,6 @@
#include "JSNode.h"
#include "NodeList.h"
#include "kjs_binding.h"
#include "DeprecatedValueList.h"
namespace WebCore {
class AtomicString;
......@@ -147,7 +145,7 @@ namespace KJS {
// when multiple nodes have the same name.
class DOMNamedNodesCollection : public DOMObject {
public:
DOMNamedNodesCollection(ExecState *exec, const WebCore::DeprecatedValueList< RefPtr<WebCore::Node> >& nodes );
DOMNamedNodesCollection(ExecState *exec, const Vector<RefPtr<WebCore::Node> >& nodes);
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
......@@ -155,7 +153,7 @@ private:
static JSValue *lengthGetter(ExecState* exec, JSObject *, const Identifier&, const PropertySlot& slot);
static JSValue *indexGetter(ExecState* exec, JSObject *, const Identifier&, const PropertySlot& slot);
WebCore::DeprecatedValueList< RefPtr<WebCore::Node> > m_nodes;
Vector<RefPtr<WebCore::Node> > m_nodes;
};
} // namespace
......
......@@ -200,12 +200,12 @@ JSValue *JSHTMLDocument::namedItemGetter(ExecState* exec, JSObject* originalObje
HTMLDocument &doc = *static_cast<HTMLDocument*>(thisObj->impl());
String name = propertyName;
RefPtr<WebCore::HTMLCollection> collection = doc.documentNamedItems(name);
RefPtr<HTMLCollection> collection = doc.documentNamedItems(name);
if (collection->length() == 1) {
WebCore::Node* node = collection->firstItem();
Node* node = collection->firstItem();
Frame *frame;
if (node->hasTagName(iframeTag) && (frame = static_cast<WebCore::HTMLIFrameElement*>(node)->contentFrame()))
if (node->hasTagName(iframeTag) && (frame = static_cast<HTMLIFrameElement*>(node)->contentFrame()))
return Window::retrieve(frame);
return toJS(exec, node);
}
......@@ -433,7 +433,7 @@ const ClassInfo JSHTMLElement::tr_info = { "HTMLTableRowElement", &JSHTMLElement
const ClassInfo* JSHTMLElement::classInfo() const
{
static HashMap<WebCore::AtomicStringImpl*, const ClassInfo*> classInfoMap;
static HashMap<AtomicStringImpl*, const ClassInfo*> classInfoMap;
if (classInfoMap.isEmpty()) {
classInfoMap.set(captionTag.localName().impl(), &caption_info);
classInfoMap.set(colTag.localName().impl(), &col_info);
......@@ -477,7 +477,7 @@ const JSHTMLElement::Accessors JSHTMLElement::marquee_accessors = { &JSHTMLEleme
const JSHTMLElement::Accessors* JSHTMLElement::accessors() const
{
static HashMap<WebCore::AtomicStringImpl*, const Accessors*> accessorMap;
static HashMap<AtomicStringImpl*, const Accessors*> accessorMap;
if (accessorMap.isEmpty()) {
accessorMap.add(captionTag.localName().impl(), &caption_accessors);
accessorMap.add(colTag.localName().impl(), &col_accessors);
......@@ -1653,12 +1653,14 @@ JSValue *JSHTMLCollection::callAsFunction(ExecState* exec, JSObject* , const Lis
JSValue *JSHTMLCollection::getNamedItems(ExecState* exec, const Identifier &propertyName) const
{
DeprecatedValueList< RefPtr<WebCore::Node> > namedItems = m_impl->namedItems(propertyName);
Vector<RefPtr<Node> > namedItems;
m_impl->namedItems(propertyName, namedItems);
if (namedItems.isEmpty())
return jsUndefined();
if (namedItems.count() == 1)
if (namedItems.size() == 1)
return toJS(exec, namedItems[0].get());
return new DOMNamedNodesCollection(exec, namedItems);
......
......@@ -34,7 +34,6 @@
#import "DOMImplementationFront.h"
#import "DOMInternal.h"
#import "DOMPrivate.h"
#import "DeprecatedValueList.h"
#import "Document.h"
#import "DocumentFragment.h"
#import "DocumentType.h"
......
......@@ -1456,7 +1456,7 @@ NSMutableDictionary *FrameMac::dashboardRegionsDictionary()
const Vector<DashboardRegionValue>& regions = doc->dashboardRegions();
size_t n = regions.size();
// Convert the DeprecatedValueList<DashboardRegionValue> into a NSDictionary of WebDashboardRegions
// Convert the Vector<DashboardRegionValue> into a NSDictionary of WebDashboardRegions
NSMutableDictionary *webRegions = [NSMutableDictionary dictionaryWithCapacity:n];
for (size_t i = 0; i < n; i++) {
const DashboardRegionValue& region = regions[i];
......
......@@ -154,7 +154,7 @@ void CSSStyleDeclaration::diff(CSSMutableStyleDeclaration *style) const
if (!style)
return;
DeprecatedValueList<int> properties;
Vector<int> properties;
DeprecatedValueListConstIterator<CSSProperty> end;
for (DeprecatedValueListConstIterator<CSSProperty> it(style->valuesIterator()); it != end; ++it) {
const CSSProperty& property = *it;
......@@ -162,9 +162,9 @@ void CSSStyleDeclaration::diff(CSSMutableStyleDeclaration *style) const
if (value && (value->cssText() == property.value()->cssText()))
properties.append(property.id());
}
for (DeprecatedValueListIterator<int> it(properties.begin()); it != properties.end(); ++it)
style->removeProperty(*it);
for (unsigned i = 0; i < properties.size(); i++)
style->removeProperty(properties[i]);
}
PassRefPtr<CSSMutableStyleDeclaration> CSSStyleDeclaration::copyPropertiesInSet(const int *set, unsigned length) const
......
......@@ -363,12 +363,12 @@ void HTMLCollection::updateNameCache() const
info->hasNameCache = true;
}
DeprecatedValueList< RefPtr<Node> > HTMLCollection::namedItems(const AtomicString &name) const
void HTMLCollection::namedItems(const AtomicString &name, Vector<RefPtr<Node> >& result) const
{
DeprecatedValueList< RefPtr<Node> > result;
ASSERT(result.isEmpty());
if (name.isEmpty())
return result;
return;
resetCollectionInfo();
updateNameCache();
......@@ -377,12 +377,10 @@ DeprecatedValueList< RefPtr<Node> > HTMLCollection::namedItems(const AtomicStrin
Vector<Node*>* nameResults = info->nameCache.get(name.impl());
for (unsigned i = 0; idResults && i < idResults->size(); ++i)
result.append(RefPtr<Node>(idResults->at(i)));
result.append(idResults->at(i));
for (unsigned i = 0; nameResults && i < nameResults->size(); ++i)
result.append(RefPtr<Node>(nameResults->at(i)));
return result;
result.append(nameResults->at(i));
}
......
......@@ -37,8 +37,6 @@ class AtomicStringImpl;
class Node;
class String;
template <typename T> class DeprecatedValueList;
class HTMLCollection : public Shared<HTMLCollection>
{
public:
......@@ -85,7 +83,7 @@ public:
// In case of multiple items named the same way
virtual Node *nextNamedItem(const String &name) const;
DeprecatedValueList< RefPtr<Node> > namedItems(const AtomicString &name) const;
void namedItems(const AtomicString &name, Vector<RefPtr<Node> >&) const;
Node *base() { return m_base.get(); }
......
......@@ -85,7 +85,7 @@ TextStream& KCanvasFilter::externalRepresentation(TextStream& ts) const
ts << " [bounding box mode=" << filterBoundingBoxMode() << "]";
if (effectBoundingBoxMode()) // default is false
ts << " [effect bounding box mode=" << effectBoundingBoxMode() << "]";
if (m_effects.count() > 0)
if (m_effects.size() > 0)
ts << " [effects=" << m_effects << "]";
return ts;
}
......
......@@ -130,7 +130,7 @@ public:
protected:
FloatRect m_filterRect;
DeprecatedValueList<KCanvasFilterEffect* > m_effects;
Vector<KCanvasFilterEffect*> m_effects;
bool m_filterBBoxMode;
bool m_effectBBoxMode;
};
......@@ -203,14 +203,14 @@ public:
KCColorMatrixType type() const { return m_type; }
void setType(KCColorMatrixType type) { m_type = type; }
DeprecatedValueList<float> values() const { return m_values; }
void setValues(const DeprecatedValueList<float> &values) { m_values = values; };
const Vector<float>& values() const { return m_values; }
void setValues(const Vector<float>& values) { m_values = values; };
TextStream& externalRepresentation(TextStream&) const;
private:
KCColorMatrixType m_type;
DeprecatedValueList<float> m_values;
Vector<float> m_values;
};
typedef enum {
......@@ -309,8 +309,8 @@ public:
FloatSize kernelSize() const { return m_kernelSize; }
void setKernelSize(FloatSize kernelSize) { m_kernelSize = kernelSize; }
DeprecatedValueList<float> kernel() const { return m_kernelMatrix; }
void setKernel(DeprecatedValueList<float> kernel) { m_kernelMatrix = kernel; }
const Vector<float>& kernel() const { return m_kernelMatrix; }
void setKernel(const Vector<float>& kernel) { m_kernelMatrix = kernel; }
float divisor() const { return m_divisor; }
void setDivisor(float divisor) { m_divisor = divisor; }
......@@ -334,7 +334,7 @@ public:
private:
FloatSize m_kernelSize;
DeprecatedValueList<float> m_kernelMatrix; // maybe should be a real matrix?
Vector<float> m_kernelMatrix; // maybe should be a real matrix?
float m_divisor;
float m_bias;
FloatSize m_targetOffset;
......
......@@ -177,13 +177,10 @@ NSArray *KCanvasFilterQuartz::getCIFilterStack(CIImage *inputImage)
{
NSMutableArray *filterEffects = [NSMutableArray array];
DeprecatedValueListIterator<KCanvasFilterEffect*> it = m_effects.begin();
DeprecatedValueListIterator<KCanvasFilterEffect*> end = m_effects.end();
setImageForName(inputImage, "SourceGraphic"); // input
for (;it != end; it++) {
CIFilter *filter = (*it)->getCIFilter(this);
for (unsigned i = 0; i < m_effects.size(); i++) {
CIFilter *filter = m_effects[i]->getCIFilter(this);
if (filter)
[filterEffects addObject:filter];
}
......@@ -315,9 +312,9 @@ CIFilter *KCanvasFEBlendQuartz::getCIFilter(KCanvasFilterQuartz* quartzFilter) c
#define deg2rad(d) ((d * (2.0 * M_PI))/360.0)
#define CMValuesCheck(expected, type) \
if (values().count() != expected) { \
NSLog(@"Error, incorrect number of values in ColorMatrix for type \"%s\", expected: %i actual: %i, ignoring filter. Values:", type, expected, values().count()); \
for (unsigned x=0; x < values().count(); x++) fprintf(stderr, " %f", values()[x]); \
if (values().size() != expected) { \
NSLog(@"Error, incorrect number of values in ColorMatrix for type \"%s\", expected: %i actual: %i, ignoring filter. Values:", type, expected, values().size()); \
for (unsigned x=0; x < values().size(); x++) fprintf(stderr, " %f", values()[x]); \
fprintf(stderr, "\n"); \
return nil; \
}
......@@ -332,7 +329,7 @@ CIFilter *KCanvasFEColorMatrixQuartz::getCIFilter(KCanvasFilterQuartz* quartzFil
CMValuesCheck(20, "matrix");
filter = [CIFilter filterWithName:@"CIColorMatrix"];
[filter setDefaults];
DeprecatedValueList<float> v = values();
const Vector<float>& v = values();
[filter setValue:[CIVector vectorWithX:v[0] Y:v[1] Z:v[2] W:v[3]] forKey:@"inputRVector"];
[filter setValue:[CIVector vectorWithX:v[5] Y:v[6] Z:v[7] W:v[8]] forKey:@"inputGVector"];
[filter setValue:[CIVector vectorWithX:v[10] Y:v[11] Z:v[12] W:v[13]] forKey:@"inputBVector"];
......
......@@ -78,7 +78,7 @@ KCanvasFEColorMatrix* SVGFEColorMatrixElement::filterEffect() const
m_filterEffect->setIn(in1());
setStandardAttributes(m_filterEffect);
DeprecatedValueList<float> _values;
Vector<float> _values;
SVGNumberList* numbers = values();
ExceptionCode ec = 0;
......
......@@ -60,7 +60,7 @@ const ClipDataList& SVGResourceClipper::clipData() const
TextStream& SVGResourceClipper::externalRepresentation(TextStream& ts) const
{
ts << "[type=CLIPPER]";
ts << " [clip data=" << clipData() << "]";
ts << " [clip data=" << clipData().clipData() << "]";
return ts;
}
......
......@@ -39,20 +39,24 @@ namespace WebCore {
bool bboxUnits : 1;
};
// FIXME: Step away from DeprecatedValueList
class ClipDataList : public DeprecatedValueList<ClipData> {
class ClipDataList {
public:
inline void addPath(const Path& pathData, WindRule windRule, bool bboxUnits)
void addPath(const Path& pathData, WindRule windRule, bool bboxUnits)
{
ClipData clipData;
clipData.path = pathData;
clipData.windRule = windRule;
clipData.bboxUnits = bboxUnits;
append(clipData);
m_clipData.append(clipData);
}
};
void clear() { m_clipData.clear(); }
const Vector<ClipData>& clipData() const { return m_clipData; }
private:
Vector<ClipData> m_clipData;
};
class SVGResourceClipper : public SVGResource {
public:
......
......@@ -41,18 +41,18 @@ void SVGResourceClipper::applyClip(const FloatRect& boundingBox) const
{
KRenderingDeviceContext* context = renderingDevice()->currentContext();
CGContextRef cgContext = static_cast<KRenderingDeviceContextQuartz*>(context)->cgContext();
if (m_clipData.count() < 1)
if (m_clipData.clipData().size() < 1)
return;
bool heterogenousClipRules = false;
WindRule clipRule = m_clipData[0].windRule;
WindRule clipRule = m_clipData.clipData()[0].windRule;
context->clearPath();
CGAffineTransform bboxTransform = CGAffineTransformMakeMapBetweenRects(CGRectMake(0,0,1,1), CGRect(boundingBox));
for (unsigned x = 0; x < m_clipData.count(); x++) {
ClipData data = m_clipData[x];
for (unsigned x = 0; x < m_clipData.clipData().size(); x++) {
ClipData data = m_clipData.clipData()[x];
if (data.windRule != clipRule)
heterogenousClipRules = true;
......@@ -67,7 +67,7 @@ void SVGResourceClipper::applyClip(const FloatRect& boundingBox) const
CGContextAddPath(cgContext, clipPath);
}
if (m_clipData.count()) {
if (m_clipData.clipData().size()) {
// FIXME!
// We don't currently allow for heterogenous clip rules.
// we would have to detect such, draw to a mask, and then clip
......
......@@ -20,7 +20,6 @@
#ifndef FormData_h
#define FormData_h
#include "DeprecatedValueList.h"
#include "PlatformString.h"
#include "Shared.h"
#include <wtf/Vector.h>
......
......@@ -27,7 +27,6 @@
#ifdef SVG_SUPPORT
#include "AffineTransform.h"
#include "DeprecatedValueList.h"
#include "FloatRect.h"
#include "RenderObject.h"
......
......@@ -25,7 +25,6 @@
#include "DeprecatedString.h"
#include "TextStream.h"
#include "DeprecatedValueList.h"
namespace WebCore {
......@@ -60,34 +59,32 @@ TextStream& operator<<(TextStream&, const FloatPoint&);
// these could be defined in separate namespace to avoid matching these generic signatures unintentionally.
template<typename Item>
TextStream& operator<<(TextStream& ts, const DeprecatedValueList<Item*>& l)
TextStream& operator<<(TextStream& ts, const Vector<Item*>& v)
{
ts << "[";
typename DeprecatedValueList<Item*>::ConstIterator it = l.begin();
typename DeprecatedValueList<Item*>::ConstIterator it_e = l.end();
while (it != it_e) {
ts << *(*it);
++it;
if (it != it_e) ts << ", ";
for (unsigned i = 0; i < v.size(); i++) {
ts << *v[i];
if (i < v.size() - 1)
ts << ", ";
}
ts << "]";
ts << "]";
return ts;
}
template<typename Item>
TextStream& operator<<(TextStream& ts, const DeprecatedValueList<Item>& l)
TextStream& operator<<(TextStream& ts, const Vector<Item>& v)
{
ts << "[";
typename DeprecatedValueList<Item>::ConstIterator it = l.begin();
typename DeprecatedValueList<Item>::ConstIterator it_e = l.end();
while (it != it_e) {
ts << *it;
++it;
if (it != it_e) ts << ", ";
for (unsigned i = 0; i < v.size(); i++) {
ts << v[i];
if (i < v.size() - 1)
ts << ", ";
}
ts << "]";
ts << "]";
return ts;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment