+2005-12-01 Maciej Stachowiak <mjs@apple.com>
+
+ Rubber stamped by Eric.
+
+ - renamed SharedPtr to RefPtr via script
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/function.cpp:
+ (KJS::GlobalFuncImp::callAsFunction):
+ * kjs/function.h:
+ * kjs/function_object.cpp:
+ (FunctionObjectImp::construct):
+ * kjs/internal.cpp:
+ (KJS::Parser::parse):
+ (KJS::InterpreterImp::checkSyntax):
+ (KJS::InterpreterImp::evaluate):
+ * kjs/internal.h:
+ * kjs/nodes.h:
+ * kjs/nodes2string.cpp:
+ (KJS::SourceStream::operator<<):
+ * kjs/protect.h:
+ * kxmlcore/RefPtr.h: Added.
+ (KXMLCore::RefPtr::RefPtr):
+ (KXMLCore::RefPtr::~RefPtr):
+ (KXMLCore::RefPtr::isNull):
+ (KXMLCore::RefPtr::notNull):
+ (KXMLCore::RefPtr::reset):
+ (KXMLCore::RefPtr::get):
+ (KXMLCore::RefPtr::operator*):
+ (KXMLCore::RefPtr::operator->):
+ (KXMLCore::RefPtr::operator!):
+ (KXMLCore::RefPtr::operator UnspecifiedBoolType):
+ (KXMLCore::::operator):
+ (KXMLCore::operator==):
+ (KXMLCore::operator!=):
+ (KXMLCore::static_pointer_cast):
+ (KXMLCore::const_pointer_cast):
+ * kxmlcore/SharedPtr.h: Removed.
+
2005-11-30 Maciej Stachowiak <mjs@apple.com>
Reviewed by Dave Hyatt.
/* End PBXAggregateTarget section */
/* Begin PBXBuildFile section */
- 65162EEB08E6A1FE007556CD /* SharedPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 65162EEA08E6A1FE007556CD /* SharedPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
652C107F08DA7B1E0020887D /* protected_reference.h in Headers */ = {isa = PBXBuildFile; fileRef = 652C107E08DA7B1E0020887D /* protected_reference.h */; };
6541BD7208E80A17002CBEE7 /* TCPageMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 6541BD6E08E80A17002CBEE7 /* TCPageMap.h */; };
6541BD7308E80A17002CBEE7 /* TCSpinLock.h in Headers */ = {isa = PBXBuildFile; fileRef = 6541BD6F08E80A17002CBEE7 /* TCSpinLock.h */; };
6557E8F808EA5D4D0049CDFC /* HashMapPtrSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = 6557E8F708EA5D4D0049CDFC /* HashMapPtrSpec.h */; settings = {ATTRIBUTES = (Private, ); }; };
65621E6D089E859700760F35 /* property_slot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65621E6B089E859700760F35 /* property_slot.cpp */; };
65621E6E089E859700760F35 /* property_slot.h in Headers */ = {isa = PBXBuildFile; fileRef = 65621E6C089E859700760F35 /* property_slot.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 65C647B4093EF8D60022C380 /* RefPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 65C647B3093EF8D60022C380 /* RefPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
65D7D19C08F10B5B0015ABD8 /* FastMallocInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 65D7D19B08F10B5B0015ABD8 /* FastMallocInternal.h */; };
65DFC93008EA173A00F7300B /* HashFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = 65DFC92A08EA173A00F7300B /* HashFunctions.h */; settings = {ATTRIBUTES = (Private, ); }; };
65DFC93108EA173A00F7300B /* HashMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 65DFC92B08EA173A00F7300B /* HashMap.h */; settings = {ATTRIBUTES = (Private, ); }; };
51F0EC9705C88DC700E6DF1B /* objc_utility.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; name = objc_utility.mm; path = bindings/objc/objc_utility.mm; sourceTree = "<group>"; };
650B68D80639033F009D42DE /* protected_values.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = protected_values.cpp; sourceTree = "<group>"; };
650B68D90639033F009D42DE /* protected_values.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = protected_values.h; sourceTree = "<group>"; };
- 65162EEA08E6A1FE007556CD /* SharedPtr.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SharedPtr.h; sourceTree = "<group>"; };
651F6412039D5B5F0078395C /* dtoa.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = dtoa.cpp; sourceTree = "<group>"; };
651F6413039D5B5F0078395C /* dtoa.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = dtoa.h; sourceTree = "<group>"; };
652C107E08DA7B1E0020887D /* protected_reference.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = protected_reference.h; sourceTree = "<group>"; };
65621E6B089E859700760F35 /* property_slot.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = property_slot.cpp; sourceTree = "<group>"; };
65621E6C089E859700760F35 /* property_slot.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = property_slot.h; sourceTree = "<group>"; };
65C02FBB0637462A003E7EE6 /* protect.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = protect.h; sourceTree = "<group>"; };
+ 65C647B3093EF8D60022C380 /* RefPtr.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RefPtr.h; sourceTree = "<group>"; };
65D7D19B08F10B5B0015ABD8 /* FastMallocInternal.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FastMallocInternal.h; sourceTree = "<group>"; };
65DFC92A08EA173A00F7300B /* HashFunctions.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HashFunctions.h; sourceTree = "<group>"; };
65DFC92B08EA173A00F7300B /* HashMap.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HashMap.h; sourceTree = "<group>"; };
65162EF108E6A21C007556CD /* kxmlcore */ = {
isa = PBXGroup;
children = (
+ 65C647B3093EF8D60022C380 /* RefPtr.h */,
65D7D19B08F10B5B0015ABD8 /* FastMallocInternal.h */,
6557E8F708EA5D4D0049CDFC /* HashMapPtrSpec.h */,
65DFC92A08EA173A00F7300B /* HashFunctions.h */,
6541BD6F08E80A17002CBEE7 /* TCSpinLock.h */,
6541BD7008E80A17002CBEE7 /* TCSystemAlloc.cpp */,
6541BD7108E80A17002CBEE7 /* TCSystemAlloc.h */,
- 65162EEA08E6A1FE007556CD /* SharedPtr.h */,
65E217B708E7EECC0023E5F6 /* Assertions.h */,
65E217B808E7EECC0023E5F6 /* Assertions.mm */,
65E217B908E7EECC0023E5F6 /* FastMalloc.cpp */,
93E26C1308B1523D00F85226 /* ucptable.c in Headers */,
93E26CCF08B2921900F85226 /* softlinking.h in Headers */,
652C107F08DA7B1E0020887D /* protected_reference.h in Headers */,
- 65162EEB08E6A1FE007556CD /* SharedPtr.h in Headers */,
65E217BD08E7EECC0023E5F6 /* Assertions.h in Headers */,
65E217C008E7EECC0023E5F6 /* FastMalloc.h in Headers */,
6541BD7208E80A17002CBEE7 /* TCPageMap.h in Headers */,
6557E8F808EA5D4D0049CDFC /* HashMapPtrSpec.h in Headers */,
65D7D19C08F10B5B0015ABD8 /* FastMallocInternal.h in Headers */,
65EA4C9C092AF9E20093D800 /* JSLock.h in Headers */,
+ 65C647B4093EF8D60022C380 /* RefPtr.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
int sid;
int errLine;
UString errMsg;
- SharedPtr<ProgramNode> progNode(Parser::parse(UString(), 0, s.data(),s.size(),&sid,&errLine,&errMsg));
+ RefPtr<ProgramNode> progNode(Parser::parse(UString(), 0, s.data(),s.size(),&sid,&errLine,&errMsg));
Debugger *dbg = exec->dynamicInterpreter()->imp()->debugger();
if (dbg) {
virtual Completion execute(ExecState *exec);
CodeType codeType() const { return FunctionCode; }
- SharedPtr<FunctionBodyNode> body;
+ RefPtr<FunctionBodyNode> body;
virtual const ClassInfo *classInfo() const { return &info; }
static const ClassInfo info;
int sid;
int errLine;
UString errMsg;
- SharedPtr<ProgramNode> progNode = Parser::parse(sourceURL, lineNumber, body.data(),body.size(),&sid,&errLine,&errMsg);
+ RefPtr<ProgramNode> progNode = Parser::parse(sourceURL, lineNumber, body.data(),body.size(),&sid,&errLine,&errMsg);
// notify debugger that source has been parsed
Debugger *dbg = exec->dynamicInterpreter()->imp()->debugger();
// ------------------------------ Parser ---------------------------------------
-static SharedPtr<ProgramNode> *progNode;
+static RefPtr<ProgramNode> *progNode;
int Parser::sid = 0;
const int initialCapacity = 64;
newNodesCapacity = 0;
}
-SharedPtr<ProgramNode> Parser::parse(const UString &sourceURL, int startingLineNumber,
+RefPtr<ProgramNode> Parser::parse(const UString &sourceURL, int startingLineNumber,
const UChar *code, unsigned int length, int *sourceId,
int *errLine, UString *errMsg)
{
if (errMsg)
*errMsg = 0;
if (!progNode)
- progNode = new SharedPtr<ProgramNode>;
+ progNode = new RefPtr<ProgramNode>;
Lexer::curr()->setCode(sourceURL, startingLineNumber, code, length);
*progNode = 0;
int parseError = kjsyyparse();
bool lexError = Lexer::curr()->sawError();
Lexer::curr()->doneParsing();
- SharedPtr<ProgramNode> prog = *progNode;
+ RefPtr<ProgramNode> prog = *progNode;
*progNode = 0;
clearNewNodes();
*errLine = eline;
if (errMsg)
*errMsg = "Parse error";
- return SharedPtr<ProgramNode>();
+ return RefPtr<ProgramNode>();
}
return prog;
JSLock lock;
// Parser::parse() returns 0 in a syntax error occurs, so we just check for that
- SharedPtr<ProgramNode> progNode = Parser::parse(UString(), 0, code.data(),code.size(),0,0,0);
+ RefPtr<ProgramNode> progNode = Parser::parse(UString(), 0, code.data(),code.size(),0,0,0);
return progNode;
}
int sid;
int errLine;
UString errMsg;
- SharedPtr<ProgramNode> progNode = Parser::parse(sourceURL, startingLineNumber, code.data(),code.size(),&sid,&errLine,&errMsg);
+ RefPtr<ProgramNode> progNode = Parser::parse(sourceURL, startingLineNumber, code.data(),code.size(),&sid,&errLine,&errMsg);
// notify debugger that source has been parsed
if (dbg) {
#include "types.h"
#include "interpreter.h"
#include "scope_chain.h"
-#include <kxmlcore/SharedPtr.h>
+#include <kxmlcore/RefPtr.h>
#define I18N_NOOP(s) s
*/
class Parser {
public:
- static SharedPtr<ProgramNode> parse(const UString &sourceURL, int startingLineNumber,
+ static RefPtr<ProgramNode> parse(const UString &sourceURL, int startingLineNumber,
const UChar *code, unsigned int length, int *sourceId = 0,
int *errLine = 0, UString *errMsg = 0);
static void accept(ProgramNode *prog);
#ifndef _NODES_H_
#define _NODES_H_
-#include <kxmlcore/SharedPtr.h>
+#include <kxmlcore/RefPtr.h>
#include "internal.h"
virtual void streamTo(SourceStream &s) const;
virtual bool isGroupNode() const { return true; }
private:
- SharedPtr<Node> group;
+ RefPtr<Node> group;
};
class ElementNode : public Node {
virtual void streamTo(SourceStream &s) const;
private:
friend class ArrayNode;
- SharedPtr<ElementNode> list;
+ RefPtr<ElementNode> list;
int elision;
- SharedPtr<Node> node;
+ RefPtr<Node> node;
};
class ArrayNode : public Node {
ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<ElementNode> element;
+ RefPtr<ElementNode> element;
int elision;
bool opt;
};
virtual void streamTo(SourceStream &s) const;
private:
friend class ObjectLiteralNode;
- SharedPtr<PropertyNode> name;
- SharedPtr<Node> assign;
- SharedPtr<PropertyValueNode> list;
+ RefPtr<PropertyNode> name;
+ RefPtr<Node> assign;
+ RefPtr<PropertyValueNode> list;
};
class ObjectLiteralNode : public Node {
ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<PropertyValueNode> list;
+ RefPtr<PropertyValueNode> list;
};
class PropertyNode : public Node {
Node *subscript() { return expr2.get(); }
private:
- SharedPtr<Node> expr1;
- SharedPtr<Node> expr2;
+ RefPtr<Node> expr1;
+ RefPtr<Node> expr2;
};
class DotAccessorNode : public Node {
const Identifier& identifier() const { return ident; }
private:
- SharedPtr<Node> expr;
+ RefPtr<Node> expr;
Identifier ident;
};
virtual void streamTo(SourceStream &s) const;
private:
friend class ArgumentsNode;
- SharedPtr<ArgumentListNode> list;
- SharedPtr<Node> expr;
+ RefPtr<ArgumentListNode> list;
+ RefPtr<Node> expr;
};
class ArgumentsNode : public Node {
List evaluateList(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<ArgumentListNode> list;
+ RefPtr<ArgumentListNode> list;
};
class NewExprNode : public Node {
ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<Node> expr;
- SharedPtr<ArgumentsNode> args;
+ RefPtr<Node> expr;
+ RefPtr<ArgumentsNode> args;
};
class FunctionCallValueNode : public Node {
ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<Node> expr;
- SharedPtr<ArgumentsNode> args;
+ RefPtr<Node> expr;
+ RefPtr<ArgumentsNode> args;
};
class FunctionCallResolveNode : public Node {
virtual void streamTo(SourceStream &s) const;
private:
Identifier ident;
- SharedPtr<ArgumentsNode> args;
+ RefPtr<ArgumentsNode> args;
};
class FunctionCallBracketNode : public Node {
ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
protected:
- SharedPtr<Node> base;
- SharedPtr<Node> subscript;
- SharedPtr<ArgumentsNode> args;
+ RefPtr<Node> base;
+ RefPtr<Node> subscript;
+ RefPtr<ArgumentsNode> args;
};
class FunctionCallParenBracketNode : public FunctionCallBracketNode {
ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
protected:
- SharedPtr<Node> base;
+ RefPtr<Node> base;
Identifier ident;
- SharedPtr<ArgumentsNode> args;
+ RefPtr<ArgumentsNode> args;
};
class FunctionCallParenDotNode : public FunctionCallDotNode {
ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<Node> m_base;
- SharedPtr<Node> m_subscript;
+ RefPtr<Node> m_base;
+ RefPtr<Node> m_subscript;
Operator m_oper;
};
ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<Node> m_base;
+ RefPtr<Node> m_base;
Identifier m_ident;
Operator m_oper;
};
ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<Node> m_base;
- SharedPtr<Node> m_subscript;
+ RefPtr<Node> m_base;
+ RefPtr<Node> m_subscript;
};
class DeleteDotNode : public Node {
ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<Node> m_base;
+ RefPtr<Node> m_base;
Identifier m_ident;
};
ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<Node> m_expr;
+ RefPtr<Node> m_expr;
};
class VoidNode : public Node {
ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<Node> expr;
+ RefPtr<Node> expr;
};
class TypeOfResolveNode : public Node {
ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<Node> m_expr;
+ RefPtr<Node> m_expr;
};
class PrefixResolveNode : public Node {
ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<Node> m_base;
- SharedPtr<Node> m_subscript;
+ RefPtr<Node> m_base;
+ RefPtr<Node> m_subscript;
Operator m_oper;
};
ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<Node> m_base;
+ RefPtr<Node> m_base;
Identifier m_ident;
Operator m_oper;
};
ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<Node> expr;
+ RefPtr<Node> expr;
};
class NegateNode : public Node {
ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<Node> expr;
+ RefPtr<Node> expr;
};
class BitwiseNotNode : public Node {
ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<Node> expr;
+ RefPtr<Node> expr;
};
class LogicalNotNode : public Node {
ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<Node> expr;
+ RefPtr<Node> expr;
};
class MultNode : public Node {
ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<Node> term1;
- SharedPtr<Node> term2;
+ RefPtr<Node> term1;
+ RefPtr<Node> term2;
char oper;
};
ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<Node> term1;
- SharedPtr<Node> term2;
+ RefPtr<Node> term1;
+ RefPtr<Node> term2;
char oper;
};
ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<Node> term1;
- SharedPtr<Node> term2;
+ RefPtr<Node> term1;
+ RefPtr<Node> term2;
Operator oper;
};
ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<Node> expr1;
- SharedPtr<Node> expr2;
+ RefPtr<Node> expr1;
+ RefPtr<Node> expr2;
Operator oper;
};
ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<Node> expr1;
- SharedPtr<Node> expr2;
+ RefPtr<Node> expr1;
+ RefPtr<Node> expr2;
Operator oper;
};
ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<Node> expr1;
- SharedPtr<Node> expr2;
+ RefPtr<Node> expr1;
+ RefPtr<Node> expr2;
Operator oper;
};
ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<Node> expr1;
- SharedPtr<Node> expr2;
+ RefPtr<Node> expr1;
+ RefPtr<Node> expr2;
Operator oper;
};
ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<Node> logical;
- SharedPtr<Node> expr1;
- SharedPtr<Node> expr2;
+ RefPtr<Node> logical;
+ RefPtr<Node> expr1;
+ RefPtr<Node> expr2;
};
class AssignResolveNode : public Node {
protected:
Identifier m_ident;
Operator m_oper;
- SharedPtr<Node> m_right;
+ RefPtr<Node> m_right;
};
class AssignBracketNode : public Node {
ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
protected:
- SharedPtr<Node> m_base;
- SharedPtr<Node> m_subscript;
+ RefPtr<Node> m_base;
+ RefPtr<Node> m_subscript;
Operator m_oper;
- SharedPtr<Node> m_right;
+ RefPtr<Node> m_right;
};
class AssignDotNode : public Node {
ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
protected:
- SharedPtr<Node> m_base;
+ RefPtr<Node> m_base;
Identifier m_ident;
Operator m_oper;
- SharedPtr<Node> m_right;
+ RefPtr<Node> m_right;
};
class CommaNode : public Node {
ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<Node> expr1;
- SharedPtr<Node> expr2;
+ RefPtr<Node> expr1;
+ RefPtr<Node> expr2;
};
class StatListNode : public StatementNode {
virtual void streamTo(SourceStream &s) const;
private:
friend class CaseClauseNode;
- SharedPtr<StatementNode> statement;
- SharedPtr<StatListNode> list;
+ RefPtr<StatementNode> statement;
+ RefPtr<StatListNode> list;
};
class AssignExprNode : public Node {
ValueImp *evaluate(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<Node> expr;
+ RefPtr<Node> expr;
};
class VarDeclNode : public Node {
private:
Type varType;
Identifier ident;
- SharedPtr<AssignExprNode> init;
+ RefPtr<AssignExprNode> init;
};
class VarDeclListNode : public Node {
private:
friend class ForNode;
friend class VarStatementNode;
- SharedPtr<VarDeclListNode> list;
- SharedPtr<VarDeclNode> var;
+ RefPtr<VarDeclListNode> list;
+ RefPtr<VarDeclNode> var;
};
class VarStatementNode : public StatementNode {
virtual void processVarDecls(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<VarDeclListNode> list;
+ RefPtr<VarDeclListNode> list;
};
class BlockNode : public StatementNode {
virtual void processVarDecls(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
protected:
- SharedPtr<SourceElementsNode> source;
+ RefPtr<SourceElementsNode> source;
};
class EmptyStatementNode : public StatementNode {
virtual Completion execute(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<Node> expr;
+ RefPtr<Node> expr;
};
class IfNode : public StatementNode {
virtual void processVarDecls(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<Node> expr;
- SharedPtr<StatementNode> statement1;
- SharedPtr<StatementNode> statement2;
+ RefPtr<Node> expr;
+ RefPtr<StatementNode> statement1;
+ RefPtr<StatementNode> statement2;
};
class DoWhileNode : public StatementNode {
virtual void processVarDecls(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<StatementNode> statement;
- SharedPtr<Node> expr;
+ RefPtr<StatementNode> statement;
+ RefPtr<Node> expr;
};
class WhileNode : public StatementNode {
virtual void processVarDecls(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<Node> expr;
- SharedPtr<StatementNode> statement;
+ RefPtr<Node> expr;
+ RefPtr<StatementNode> statement;
};
class ForNode : public StatementNode {
virtual void processVarDecls(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<Node> expr1;
- SharedPtr<Node> expr2;
- SharedPtr<Node> expr3;
- SharedPtr<StatementNode> statement;
+ RefPtr<Node> expr1;
+ RefPtr<Node> expr2;
+ RefPtr<Node> expr3;
+ RefPtr<StatementNode> statement;
};
class ForInNode : public StatementNode {
virtual void streamTo(SourceStream &s) const;
private:
Identifier ident;
- SharedPtr<AssignExprNode> init;
- SharedPtr<Node> lexpr;
- SharedPtr<Node> expr;
- SharedPtr<VarDeclNode> varDecl;
- SharedPtr<StatementNode> statement;
+ RefPtr<AssignExprNode> init;
+ RefPtr<Node> lexpr;
+ RefPtr<Node> expr;
+ RefPtr<VarDeclNode> varDecl;
+ RefPtr<StatementNode> statement;
};
class ContinueNode : public StatementNode {
virtual Completion execute(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<Node> value;
+ RefPtr<Node> value;
};
class WithNode : public StatementNode {
virtual void processVarDecls(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<Node> expr;
- SharedPtr<StatementNode> statement;
+ RefPtr<Node> expr;
+ RefPtr<StatementNode> statement;
};
class CaseClauseNode : public Node {
virtual void processVarDecls(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<Node> expr;
- SharedPtr<StatListNode> list;
+ RefPtr<Node> expr;
+ RefPtr<StatListNode> list;
};
class ClauseListNode : public Node {
virtual void streamTo(SourceStream &s) const;
private:
friend class CaseBlockNode;
- SharedPtr<CaseClauseNode> cl;
- SharedPtr<ClauseListNode> nx;
+ RefPtr<CaseClauseNode> cl;
+ RefPtr<ClauseListNode> nx;
};
class CaseBlockNode : public Node {
virtual void processVarDecls(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<ClauseListNode> list1;
- SharedPtr<CaseClauseNode> def;
- SharedPtr<ClauseListNode> list2;
+ RefPtr<ClauseListNode> list1;
+ RefPtr<CaseClauseNode> def;
+ RefPtr<ClauseListNode> list2;
};
class SwitchNode : public StatementNode {
virtual void processVarDecls(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<Node> expr;
- SharedPtr<CaseBlockNode> block;
+ RefPtr<Node> expr;
+ RefPtr<CaseBlockNode> block;
};
class LabelNode : public StatementNode {
virtual void streamTo(SourceStream &s) const;
private:
Identifier label;
- SharedPtr<StatementNode> statement;
+ RefPtr<StatementNode> statement;
};
class ThrowNode : public StatementNode {
virtual Completion execute(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<Node> expr;
+ RefPtr<Node> expr;
};
class TryNode : public StatementNode {
virtual void processVarDecls(ExecState *exec);
virtual void streamTo(SourceStream &s) const;
private:
- SharedPtr<StatementNode> tryBlock;
+ RefPtr<StatementNode> tryBlock;
Identifier exceptionIdent;
- SharedPtr<StatementNode> catchBlock;
- SharedPtr<StatementNode> finallyBlock;
+ RefPtr<StatementNode> catchBlock;
+ RefPtr<StatementNode> finallyBlock;
};
class ParameterNode : public Node {
friend class FuncDeclNode;
friend class FuncExprNode;
Identifier id;
- SharedPtr<ParameterNode> next;
+ RefPtr<ParameterNode> next;
};
// inherited by ProgramNode
virtual void streamTo(SourceStream &) const;
private:
Identifier ident;
- SharedPtr<ParameterNode> param;
- SharedPtr<FunctionBodyNode> body;
+ RefPtr<ParameterNode> param;
+ RefPtr<FunctionBodyNode> body;
};
class FuncDeclNode : public StatementNode {
virtual void streamTo(SourceStream &) const;
private:
Identifier ident;
- SharedPtr<ParameterNode> param;
- SharedPtr<FunctionBodyNode> body;
+ RefPtr<ParameterNode> param;
+ RefPtr<FunctionBodyNode> body;
};
// A linked list of source element nodes
virtual void streamTo(SourceStream &s) const;
private:
friend class BlockNode;
- SharedPtr<StatementNode> element; // 'this' element
- SharedPtr<SourceElementsNode> elements; // pointer to next
+ RefPtr<StatementNode> element; // 'this' element
+ RefPtr<SourceElementsNode> elements; // pointer to next
};
class ProgramNode : public FunctionBodyNode {
SourceStream& operator<<(char);
SourceStream& operator<<(Format f);
SourceStream& operator<<(const Node *);
- template <typename T> SourceStream& operator<<(SharedPtr<T> n) { return this->operator<<(n.get()); }
+ template <typename T> SourceStream& operator<<(RefPtr<T> n) { return this->operator<<(n.get()); }
private:
UString str; /* TODO: buffer */
UString ind;
if (val) gcUnprotect(val);
}
- // FIXME: Share more code with SharedPtr template? The only difference is the ref/deref operation.
+ // FIXME: Share more code with RefPtr template? The only difference is the ref/deref operation.
template <class T> class ProtectedPtr {
public:
ProtectedPtr() : m_ptr(NULL) { }
namespace KXMLCore {
// FIXME: Change template name to RefPtr?
- template <class T> class SharedPtr
+ template <class T> class RefPtr
{
public:
- SharedPtr() : m_ptr(NULL) {}
- SharedPtr(T *ptr) : m_ptr(ptr) { if (ptr) ptr->ref(); }
- SharedPtr(const SharedPtr &o) : m_ptr(o.m_ptr) { if (T *ptr = m_ptr) ptr->ref(); }
- ~SharedPtr() { if (T *ptr = m_ptr) ptr->deref(); }
+ RefPtr() : m_ptr(NULL) {}
+ RefPtr(T *ptr) : m_ptr(ptr) { if (ptr) ptr->ref(); }
+ RefPtr(const RefPtr &o) : m_ptr(o.m_ptr) { if (T *ptr = m_ptr) ptr->ref(); }
+ ~RefPtr() { if (T *ptr = m_ptr) ptr->deref(); }
- template <class U> SharedPtr(const SharedPtr<U> &o) : m_ptr(o.get()) { if (T *ptr = m_ptr) ptr->ref(); }
+ template <class U> RefPtr(const RefPtr<U> &o) : m_ptr(o.get()) { if (T *ptr = m_ptr) ptr->ref(); }
// FIXME: Deprecate in favor of operators below, then remove?
bool isNull() const { return m_ptr == NULL; }
// this type conversion operator allows implicit conversion to
// bool but not to other integer types
- typedef T * (SharedPtr::*UnspecifiedBoolType)() const;
+ typedef T * (RefPtr::*UnspecifiedBoolType)() const;
operator UnspecifiedBoolType() const
{
- return m_ptr ? &SharedPtr::get : 0;
+ return m_ptr ? &RefPtr::get : 0;
}
- SharedPtr &operator=(const SharedPtr &);
- SharedPtr &operator=(T *);
+ RefPtr &operator=(const RefPtr &);
+ RefPtr &operator=(T *);
private:
T *m_ptr;
};
- template <class T> SharedPtr<T> &SharedPtr<T>::operator=(const SharedPtr<T> &o)
+ template <class T> RefPtr<T> &RefPtr<T>::operator=(const RefPtr<T> &o)
{
T *optr = o.m_ptr;
if (optr)
return *this;
}
- template <class T> inline SharedPtr<T> &SharedPtr<T>::operator=(T *optr)
+ template <class T> inline RefPtr<T> &RefPtr<T>::operator=(T *optr)
{
if (optr)
optr->ref();
return *this;
}
- template <class T> inline bool operator==(const SharedPtr<T> &a, const SharedPtr<T> &b)
+ template <class T> inline bool operator==(const RefPtr<T> &a, const RefPtr<T> &b)
{
return a.get() == b.get();
}
- template <class T> inline bool operator==(const SharedPtr<T> &a, const T *b)
+ template <class T> inline bool operator==(const RefPtr<T> &a, const T *b)
{
return a.get() == b;
}
- template <class T> inline bool operator==(const T *a, const SharedPtr<T> &b)
+ template <class T> inline bool operator==(const T *a, const RefPtr<T> &b)
{
return a == b.get();
}
- template <class T> inline bool operator!=(const SharedPtr<T> &a, const SharedPtr<T> &b)
+ template <class T> inline bool operator!=(const RefPtr<T> &a, const RefPtr<T> &b)
{
return a.get() != b.get();
}
- template <class T> inline bool operator!=(const SharedPtr<T> &a, const T *b)
+ template <class T> inline bool operator!=(const RefPtr<T> &a, const T *b)
{
return a.get() != b;
}
- template <class T> inline bool operator!=(const T *a, const SharedPtr<T> &b)
+ template <class T> inline bool operator!=(const T *a, const RefPtr<T> &b)
{
return a != b.get();
}
- template <class T, class U> inline SharedPtr<T> static_pointer_cast(const SharedPtr<U> &p)
+ template <class T, class U> inline RefPtr<T> static_pointer_cast(const RefPtr<U> &p)
{
- return SharedPtr<T>(static_cast<T *>(p.get()));
+ return RefPtr<T>(static_cast<T *>(p.get()));
}
- template <class T, class U> inline SharedPtr<T> const_pointer_cast(const SharedPtr<U> &p)
+ template <class T, class U> inline RefPtr<T> const_pointer_cast(const RefPtr<U> &p)
{
- return SharedPtr<T>(const_cast<T *>(p.get()));
+ return RefPtr<T>(const_cast<T *>(p.get()));
}
} // namespace KXMLCore
-using KXMLCore::SharedPtr;
+using KXMLCore::RefPtr;
using KXMLCore::static_pointer_cast;
using KXMLCore::const_pointer_cast;
+2005-12-01 Maciej Stachowiak <mjs@apple.com>
+
+ Rubber stamped by Eric.
+
+ - renamed SharedPtr to RefPtr via script
+
+ * ForwardingHeaders/kxmlcore/RefPtr.h: Added.
+ * ForwardingHeaders/kxmlcore/SharedPtr.h: Removed.
+ * khtml/css/css_computedstyle.h:
+ * khtml/ecma/XSLTProcessor.cpp:
+ (KJS::XSLTProcessorProtoFunc::callAsFunction):
+ * khtml/ecma/XSLTProcessor.h:
+ * khtml/ecma/domparser.h:
+ * khtml/ecma/kjs_css.h:
+ * khtml/ecma/kjs_dom.cpp:
+ (KJS::DOMNamedNodesCollection::DOMNamedNodesCollection):
+ (KJS::DOMNamedNodesCollection::getOwnPropertySlot):
+ * khtml/ecma/kjs_dom.h:
+ * khtml/ecma/kjs_events.h:
+ * khtml/ecma/kjs_html.cpp:
+ (KJS::HTMLDocument::namedItemGetter):
+ (KJS::KJS::HTMLCollection::getNamedItems):
+ (KJS::OptionConstructorImp::construct):
+ * khtml/ecma/kjs_html.h:
+ * khtml/ecma/kjs_range.h:
+ * khtml/ecma/kjs_traversal.h:
+ * khtml/ecma/kjs_views.h:
+ * khtml/ecma/kjs_window.cpp:
+ (KJS::Window::namedItemGetter):
+ * khtml/ecma/xmlhttprequest.h:
+ * khtml/editing/SelectionController.cpp:
+ (khtml::SelectionController::toRange):
+ * khtml/editing/SelectionController.h:
+ * khtml/editing/apply_style_command.cpp:
+ (khtml::StyleChange::init):
+ (khtml::StyleChange::currentlyHasStyle):
+ (khtml::ApplyStyleCommand::doApply):
+ (khtml::ApplyStyleCommand::applyRelativeFontStyleChange):
+ (khtml::ApplyStyleCommand::removeCSSStyle):
+ (khtml::hasTextDecorationProperty):
+ (khtml::ApplyStyleCommand::extractTextDecorationStyle):
+ (khtml::ApplyStyleCommand::extractAndNegateTextDecorationStyle):
+ (khtml::ApplyStyleCommand::pushDownTextDecorationStyleAroundNode):
+ (khtml::ApplyStyleCommand::removeInlineStyle):
+ (khtml::ApplyStyleCommand::addInlineStyleIfNeeded):
+ (khtml::ApplyStyleCommand::computedFontSize):
+ * khtml/editing/apply_style_command.h:
+ * khtml/editing/edit_command.cpp:
+ (khtml::EditCommandPtr::EditCommandPtr):
+ (khtml::EditCommandPtr::operator=):
+ * khtml/editing/edit_command.h:
+ * khtml/editing/markup.cpp:
+ (khtml::startMarkup):
+ * khtml/editing/visible_position.cpp:
+ (khtml::makeRange):
+ * khtml/editing/visible_position.h:
+ * khtml/editing/visible_range.h:
+ * khtml/editing/visible_text.cpp:
+ (khtml::TextIterator::range):
+ (khtml::SimplifiedBackwardsTextIterator::range):
+ (khtml::CharacterIterator::range):
+ (khtml::TextIterator::rangeFromLocationAndLength):
+ (khtml::findPlainText):
+ * khtml/editing/visible_text.h:
+ (khtml::WordAwareIterator::range):
+ * khtml/editing/visible_units.cpp:
+ (khtml::previousBoundary):
+ (khtml::nextBoundary):
+ * khtml/html/html_elementimpl.cpp:
+ (HTMLElementImpl::children):
+ * khtml/html/html_elementimpl.h:
+ * khtml/html/html_formimpl.cpp:
+ (DOM::HTMLFormElementImpl::elements):
+ (DOM::HTMLSelectElementImpl::add):
+ (DOM::HTMLSelectElementImpl::optionsHTMLCollection):
+ * khtml/html/html_formimpl.h:
+ * khtml/html/html_imageimpl.cpp:
+ (DOM::HTMLMapElementImpl::areas):
+ * khtml/html/html_imageimpl.h:
+ * khtml/html/html_miscimpl.cpp:
+ (DOM::HTMLCollectionImpl::namedItems):
+ * khtml/html/html_miscimpl.h:
+ * khtml/html/html_tableimpl.cpp:
+ (DOM::HTMLTableElementImpl::rows):
+ (DOM::HTMLTableElementImpl::tBodies):
+ (DOM::HTMLTableSectionElementImpl::insertRow):
+ (DOM::HTMLTableSectionElementImpl::deleteRow):
+ (DOM::HTMLTableSectionElementImpl::rows):
+ (DOM::HTMLTableRowElementImpl::insertCell):
+ (DOM::HTMLTableRowElementImpl::deleteCell):
+ (DOM::HTMLTableRowElementImpl::cells):
+ * khtml/html/html_tableimpl.h:
+ * khtml/html/htmlparser.cpp:
+ (HTMLParser::parseToken):
+ (HTMLParser::insertNode):
+ * khtml/khtml_events.h:
+ * khtml/khtml_part.cpp:
+ (KHTMLPart::selectionHasStyle):
+ (KHTMLPart::selectionStartHasStyle):
+ (KHTMLPart::selectionComputedStyle):
+ (KHTMLPart::applyEditingStyleToBodyElement):
+ (KHTMLPart::removeEditingStyleFromBodyElement):
+ * khtml/khtmlpart_p.h:
+ * khtml/khtmlview.cpp:
+ (KHTMLView::viewportMousePressEvent):
+ (KHTMLView::viewportMouseDoubleClickEvent):
+ (KHTMLView::viewportMouseReleaseEvent):
+ (KHTMLView::dispatchMouseEvent):
+ * khtml/misc/shared.h:
+ * khtml/rendering/bidi.cpp:
+ * khtml/rendering/render_block.cpp:
+ (khtml::RenderBlock::updateFirstLetter):
+ * khtml/rendering/render_line.h:
+ * khtml/rendering/render_text.cpp:
+ (RenderText::setStyle):
+ (RenderText::originalString):
+ (RenderTextFragment::originalString):
+ * khtml/rendering/render_text.h:
+ * khtml/xml/dom2_eventsimpl.h:
+ * khtml/xml/dom2_rangeimpl.cpp:
+ (DOM::rangeOfContents):
+ * khtml/xml/dom2_rangeimpl.h:
+ * khtml/xml/dom_docimpl.cpp:
+ (DocumentImpl::adoptNode):
+ (DocumentImpl::setFocusNode):
+ (DocumentImpl::addMarker):
+ (DocumentImpl::removeMarkers):
+ (DocumentImpl::applyXSLTransform):
+ (DocumentImpl::images):
+ (DocumentImpl::applets):
+ (DocumentImpl::embeds):
+ (DocumentImpl::objects):
+ (DocumentImpl::links):
+ (DocumentImpl::forms):
+ (DocumentImpl::anchors):
+ (DocumentImpl::all):
+ (DocumentImpl::windowNamedItems):
+ (DocumentImpl::documentNamedItems):
+ (DocumentImpl::getElementsByName):
+ * khtml/xml/dom_docimpl.h:
+ (DOM::DocumentImpl::transformSourceDocument):
+ * khtml/xml/dom_elementimpl.cpp:
+ (ElementImpl::setAttributeNode):
+ (ElementImpl::removeAttributeNode):
+ (NamedAttrMapImpl::removeNamedItemNS):
+ (NamedAttrMapImpl::setNamedItem):
+ (NamedAttrMapImpl::removeNamedItem):
+ * khtml/xml/dom_elementimpl.h:
+ (DOM::ElementImpl::setAttributeNodeNS):
+ * khtml/xml/dom_nodeimpl.cpp:
+ (DOM::NodeImpl::childNodes):
+ (DOM::NodeImpl::dispatchWindowEvent):
+ (DOM::NodeImpl::dispatchMouseEvent):
+ (DOM::NodeImpl::getElementsByTagNameNS):
+ (DOM::ContainerNodeImpl::insertBefore):
+ (DOM::ContainerNodeImpl::replaceChild):
+ (DOM::ContainerNodeImpl::appendChild):
+ (DOM::ContainerNodeImpl::addChild):
+ * khtml/xml/dom_nodeimpl.h:
+ (DOM::NodeImpl::getElementsByTagName):
+ (DOM::NamedNodeMapImpl::removeNamedItem):
+ (DOM::NamedNodeMapImpl::setNamedItemNS):
+ * khtml/xml/dom_xmlimpl.h:
+ * khtml/xsl/xslt_processorimpl.cpp:
+ (DOM::XSLTProcessorImpl::createDocumentFromSource):
+ (DOM::createFragmentFromSource):
+ (DOM::xsltStylesheetPointer):
+ (DOM::xmlDocPtrFromNode):
+ (DOM::XSLTProcessorImpl::transformToString):
+ (DOM::XSLTProcessorImpl::transformToDocument):
+ (DOM::XSLTProcessorImpl::transformToFragment):
+ (DOM::XSLTProcessorImpl::getParameter):
+ * khtml/xsl/xslt_processorimpl.h:
+ * kwq/KWQClipboard.h:
+ * kwq/KWQKHTMLPart.h:
+ * kwq/KWQKHTMLPart.mm:
+ (KWQKHTMLPart::findString):
+ (KWQKHTMLPart::advanceToNextMisspelling):
+ (KWQKHTMLPart::fontForSelection):
+ (KWQKHTMLPart::markMisspellings):
+ (KWQKHTMLPart::shouldClose):
+ * kwq/WebCoreBridge.mm:
+ (-[WebCoreBridge convertToNSRange:DOM::]):
+
2005-11-30 Maciej Stachowiak <mjs@apple.com>
Reviewed by Dave Hyatt.
--- /dev/null
+#import <JavaScriptCore/RefPtr.h>
+++ /dev/null
-#import <JavaScriptCore/SharedPtr.h>
virtual DOMString removeProperty(int propertyID, int &exceptionCode);
virtual void setProperty(int propertyId, const DOMString &value, bool important, int &exceptionCode);
- SharedPtr<NodeImpl> m_node;
+ RefPtr<NodeImpl> m_node;
};
}
ValueImp *nodeVal = args[0];
if (nodeVal->isObject(&DOMNode::info)) {
DOMNode *node = static_cast<DOMNode *>(nodeVal);
- SharedPtr<DocumentImpl> resultDocument = processor.transformToDocument(node->impl());
+ RefPtr<DocumentImpl> resultDocument = processor.transformToDocument(node->impl());
if (resultDocument)
return getDOMDocumentNode(exec, resultDocument.get());
return jsUndefined();
#ifndef XSLTProcessor_H
#define XSLTProcessor_H
-#include <kxmlcore/SharedPtr.h>
+#include <kxmlcore/RefPtr.h>
#include "kjs_binding.h"
namespace DOM {
DOM::XSLTProcessorImpl *impl() const { return m_impl.get(); }
private:
- SharedPtr<DOM::XSLTProcessorImpl> m_impl;
+ RefPtr<DOM::XSLTProcessorImpl> m_impl;
};
class XSLTProcessorConstructorImp : public ObjectImp {
virtual bool implementsConstruct() const;
virtual ObjectImp *construct(ExecState *exec, const List &args);
private:
- SharedPtr<DOM::DocumentImpl> doc;
+ RefPtr<DOM::DocumentImpl> doc;
};
class DOMParser : public DOMObject {
static ValueImp *indexGetter(ExecState *, const Identifier&, const PropertySlot&);
static ValueImp *cssPropertyGetter(ExecState *, const Identifier&, const PropertySlot&);
- SharedPtr<DOM::CSSStyleDeclarationImpl> m_impl;
+ RefPtr<DOM::CSSStyleDeclarationImpl> m_impl;
};
ValueImp *getDOMCSSStyleDeclaration(ExecState *exec, DOM::CSSStyleDeclarationImpl *d);
// Constructor for derived classes; doesn't set up a prototype.
DOMStyleSheet(DOM::StyleSheetImpl *ss) : m_impl(ss) { }
private:
- SharedPtr<DOM::StyleSheetImpl> m_impl;
+ RefPtr<DOM::StyleSheetImpl> m_impl;
};
ValueImp *getDOMStyleSheet(ExecState *exec, DOM::StyleSheetImpl *ss);
static ValueImp *indexGetter(ExecState *, const Identifier&, const PropertySlot&);
static ValueImp *nameGetter(ExecState *, const Identifier&, const PropertySlot&);
- SharedPtr<DOM::StyleSheetListImpl> m_impl;
- SharedPtr<DOM::DocumentImpl> m_doc;
+ RefPtr<DOM::StyleSheetListImpl> m_impl;
+ RefPtr<DOM::DocumentImpl> m_doc;
};
// The document is only used for get-stylesheet-by-name (make optional if necessary)
DOM::MediaListImpl *impl() const { return m_impl.get(); }
private:
static ValueImp *indexGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
- SharedPtr<DOM::MediaListImpl> m_impl;
+ RefPtr<DOM::MediaListImpl> m_impl;
};
ValueImp *getDOMMediaList(ExecState *exec, DOM::MediaListImpl *ml);
private:
static ValueImp *indexGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
- SharedPtr<DOM::CSSRuleListImpl> m_impl;
+ RefPtr<DOM::CSSRuleListImpl> m_impl;
};
ValueImp *getDOMCSSRuleList(ExecState *exec, DOM::CSSRuleListImpl *rl);
Import_Href, Import_Media, Import_StyleSheet, Charset_Encoding };
DOM::CSSRuleImpl *impl() const { return m_impl.get(); }
private:
- SharedPtr<DOM::CSSRuleImpl> m_impl;
+ RefPtr<DOM::CSSRuleImpl> m_impl;
};
ValueImp *getDOMCSSRule(ExecState *exec, DOM::CSSRuleImpl *r);
// Constructor for derived classes; doesn't set up a prototype.
DOMCSSValue(DOM::CSSValueImpl *v) : m_impl(v) { }
private:
- SharedPtr<DOM::CSSValueImpl> m_impl;
+ RefPtr<DOM::CSSValueImpl> m_impl;
};
ValueImp *getDOMCSSValue(ExecState *exec, DOM::CSSValueImpl *v);
static const ClassInfo info;
enum { Top, Right, Bottom, Left };
private:
- SharedPtr<DOM::RectImpl> m_rect;
+ RefPtr<DOM::RectImpl> m_rect;
};
ValueImp *getDOMRect(ExecState *exec, DOM::RectImpl *r);
static const ClassInfo info;
enum { identifier, listStyle, separator };
protected:
- SharedPtr<DOM::CounterImpl> m_counter;
+ RefPtr<DOM::CounterImpl> m_counter;
};
ValueImp *getDOMCounter(ExecState *exec, DOM::CounterImpl *c);
// 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 *, const QValueList< SharedPtr<NodeImpl> >& nodes )
+DOMNamedNodesCollection::DOMNamedNodesCollection(ExecState *, const QValueList< RefPtr<NodeImpl> >& nodes )
: m_nodes(nodes)
{
}
// For IE compatibility, we need to be able to look up elements in a
// document.formName.name result by id as well as be index.
- QValueListConstIterator< SharedPtr<NodeImpl> > end = m_nodes.end();
+ QValueListConstIterator< RefPtr<NodeImpl> > end = m_nodes.end();
int i = 0;
- for (QValueListConstIterator< SharedPtr<NodeImpl> > it = m_nodes.begin(); it != end; ++it, ++i) {
+ for (QValueListConstIterator< RefPtr<NodeImpl> > it = m_nodes.begin(); it != end; ++it, ++i) {
NodeImpl *node = (*it).get();
if (node->hasAttributes() &&
node->attributes()->id() == propertyName.domString()) {
protected:
// Constructor for inherited classes; doesn't set up a prototype.
DOMNode(DOM::NodeImpl *n);
- SharedPtr<DOM::NodeImpl> m_impl;
+ RefPtr<DOM::NodeImpl> m_impl;
};
DOM::NodeImpl *toNode(ValueImp *); // returns 0 if passed-in value is not a DOMNode object
static ValueImp *indexGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
static ValueImp *nameGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
- SharedPtr<DOM::NodeListImpl> m_impl;
+ RefPtr<DOM::NodeListImpl> m_impl;
};
class DOMDocument : public DOMNode {
enum { HasFeature, CreateDocumentType, CreateDocument, CreateCSSStyleSheet, CreateHTMLDocument };
DOM::DOMImplementationImpl *impl() const { return m_impl.get(); }
private:
- SharedPtr<DOM::DOMImplementationImpl> m_impl;
+ RefPtr<DOM::DOMImplementationImpl> m_impl;
};
class DOMDocumentType : public DOMNode {
static ValueImp *indexGetter(ExecState* exec, const Identifier&, const PropertySlot& slot);
static ValueImp *nameGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
- SharedPtr<DOM::NamedNodeMapImpl> m_impl;
+ RefPtr<DOM::NamedNodeMapImpl> m_impl;
};
class DOMProcessingInstruction : public DOMNode {
// when multiple nodes have the same name.
class DOMNamedNodesCollection : public DOMObject {
public:
- DOMNamedNodesCollection(ExecState *exec, const QValueList< SharedPtr<DOM::NodeImpl> >& nodes );
+ DOMNamedNodesCollection(ExecState *exec, const QValueList< RefPtr<DOM::NodeImpl> >& nodes );
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
private:
static ValueImp *lengthGetter(ExecState* exec, const Identifier&, const PropertySlot& slot);
static ValueImp *indexGetter(ExecState* exec, const Identifier&, const PropertySlot& slot);
- QValueList< SharedPtr<DOM::NodeImpl> > m_nodes;
+ QValueList< RefPtr<DOM::NodeImpl> > m_nodes;
};
class DOMCharacterData : public DOMNode {
SrcElement, ReturnValue, CancelBubble, ClipboardData, DataTransfer };
DOM::EventImpl *impl() const { return m_impl.get(); }
protected:
- SharedPtr<DOM::EventImpl> m_impl;
+ RefPtr<DOM::EventImpl> m_impl;
mutable Clipboard *clipboard;
};
HTMLDocumentImpl &doc = *static_cast<HTMLDocumentImpl *>(thisObj->impl());
DOMString name = propertyName.domString();
- SharedPtr<DOM::HTMLCollectionImpl> collection = doc.documentNamedItems(name);
+ RefPtr<DOM::HTMLCollectionImpl> collection = doc.documentNamedItems(name);
if (collection->length() == 1) {
NodeImpl *node = collection->firstItem();
#endif
DOM::DOMString pstr = propertyName.domString();
- QValueList< SharedPtr<NodeImpl> > namedItems = m_impl->namedItems(pstr);
+ QValueList< RefPtr<NodeImpl> > namedItems = m_impl->namedItems(pstr);
if (namedItems.isEmpty()) {
#ifdef KJS_VERBOSE
ObjectImp *OptionConstructorImp::construct(ExecState *exec, const List &args)
{
int exception = 0;
- SharedPtr<ElementImpl> el(m_doc->createElement("option", exception));
+ RefPtr<ElementImpl> el(m_doc->createElement("option", exception));
HTMLOptionElementImpl *opt = 0;
if (el.notNull()) {
opt = static_cast<HTMLOptionElementImpl *>(el.get());
static const ClassInfo info;
DOM::HTMLCollectionImpl *impl() const { return m_impl.get(); }
protected:
- SharedPtr<DOM::HTMLCollectionImpl> m_impl;
+ RefPtr<DOM::HTMLCollectionImpl> m_impl;
private:
static ValueImp *lengthGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
static ValueImp *indexGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
private:
static ValueImp *selectedIndexGetter(ExecState *exec, const Identifier&, const PropertySlot& slot);
- SharedPtr<DOM::HTMLSelectElementImpl> m_element;
+ RefPtr<DOM::HTMLSelectElementImpl> m_element;
};
////////////////////// Option Object ////////////////////////
virtual bool implementsConstruct() const;
virtual ObjectImp *construct(ExecState *exec, const List &args);
private:
- SharedPtr<DOM::DocumentImpl> m_doc;
+ RefPtr<DOM::DocumentImpl> m_doc;
};
////////////////////// Image Object ////////////////////////
virtual bool implementsConstruct() const;
virtual ObjectImp *construct(ExecState *exec, const List &args);
private:
- SharedPtr<DOM::DocumentImpl> m_doc;
+ RefPtr<DOM::DocumentImpl> m_doc;
};
class Image : public DOMObject, public khtml::CachedObjectClient {
void setShadow(ExecState *exec);
- SharedPtr<DOM::HTMLElementImpl> _element;
+ RefPtr<DOM::HTMLElementImpl> _element;
bool _needsFlushRasterCache;
QPtrList<List> stateStack;
Detach, CreateContextualFragment };
DOM::RangeImpl *impl() const { return m_impl.get(); }
private:
- SharedPtr<DOM::RangeImpl> m_impl;
+ RefPtr<DOM::RangeImpl> m_impl;
};
// Constructor object Range
NextNode, PreviousNode, Detach };
DOM::NodeIteratorImpl *impl() const { return m_impl.get(); }
private:
- SharedPtr<DOM::NodeIteratorImpl> m_impl;
+ RefPtr<DOM::NodeIteratorImpl> m_impl;
};
// Constructor object NodeFilter
DOM::NodeFilterImpl *impl() const { return m_impl.get(); }
enum { AcceptNode };
private:
- SharedPtr<DOM::NodeFilterImpl> m_impl;
+ RefPtr<DOM::NodeFilterImpl> m_impl;
};
class DOMTreeWalker : public DOMObject {
PreviousNode, NextNode };
DOM::TreeWalkerImpl *impl() const { return m_impl.get(); }
private:
- SharedPtr<DOM::TreeWalkerImpl> m_impl;
+ RefPtr<DOM::TreeWalkerImpl> m_impl;
};
ValueImp *getDOMNodeIterator(ExecState *exec, DOM::NodeIteratorImpl *ni);
DOM::AbstractViewImpl *impl() const { return m_impl.get(); }
enum { Document, GetComputedStyle };
private:
- SharedPtr<DOM::AbstractViewImpl> m_impl;
+ RefPtr<DOM::AbstractViewImpl> m_impl;
};
ValueImp *getDOMAbstractView(ExecState *exec, DOM::AbstractViewImpl *av);
assert(thisObj->isSafeScript(exec) && doc && doc->isHTMLDocument());
DOMString name = propertyName.domString();
- SharedPtr<DOM::HTMLCollectionImpl> collection = doc->windowNamedItems(name);
+ RefPtr<DOM::HTMLCollectionImpl> collection = doc->windowNamedItems(name);
if (collection->length() == 1)
return getDOMNode(exec, collection->firstItem());
else
virtual bool implementsConstruct() const;
virtual ObjectImp *construct(ExecState *exec, const List &args);
private:
- SharedPtr<DOM::DocumentImpl> doc;
+ RefPtr<DOM::DocumentImpl> doc;
};
class XMLHttpRequest : public DOMObject {
KIO::TransferJob * job;
XMLHttpRequestState state;
- SharedPtr<JSUnprotectedEventListener> onReadyStateChangeListener;
- SharedPtr<JSUnprotectedEventListener> onLoadListener;
+ RefPtr<JSUnprotectedEventListener> onReadyStateChangeListener;
+ RefPtr<JSUnprotectedEventListener> onLoadListener;
khtml::Decoder *decoder;
QString encoding;
QString response;
mutable bool createdDocument;
mutable bool typeIsXML;
- mutable SharedPtr<DOM::DocumentImpl> responseXML;
+ mutable RefPtr<DOM::DocumentImpl> responseXML;
bool aborted;
};
m_needsLayout = flag;
}
-SharedPtr<RangeImpl> SelectionController::toRange() const
+RefPtr<RangeImpl> SelectionController::toRange() const
{
if (isNone())
- return SharedPtr<RangeImpl>();
+ return RefPtr<RangeImpl>();
// Make sure we have an updated layout since this function is called
// in the course of running edit commands which modify the DOM.
}
int exceptionCode = 0;
- SharedPtr<RangeImpl> result(new RangeImpl(s.node()->getDocument()));
+ RefPtr<RangeImpl> result(new RangeImpl(s.node()->getDocument()));
result->setStart(s.node(), s.offset(), exceptionCode);
if (exceptionCode) {
ERROR("Exception setting Range start from SelectionController: %d", exceptionCode);
- return SharedPtr<RangeImpl>();
+ return RefPtr<RangeImpl>();
}
result->setEnd(e.node(), e.offset(), exceptionCode);
if (exceptionCode) {
ERROR("Exception setting Range end from SelectionController: %d", exceptionCode);
- return SharedPtr<RangeImpl>();
+ return RefPtr<RangeImpl>();
}
return result;
}
bool isRange() const { return state() == RANGE; }
bool isCaretOrRange() const { return state() != NONE; }
- SharedPtr<DOM::RangeImpl> toRange() const;
+ RefPtr<DOM::RangeImpl> toRange() const;
void debugPosition() const;
void debugRenderer(khtml::RenderObject *r, bool selected) const;
void StyleChange::init(CSSStyleDeclarationImpl *style, const Position &position)
{
style->ref();
- SharedPtr<CSSMutableStyleDeclarationImpl> mutableStyle = style->makeMutable();
+ RefPtr<CSSMutableStyleDeclarationImpl> mutableStyle = style->makeMutable();
style->deref();
QString styleText("");
bool StyleChange::currentlyHasStyle(const Position &pos, const CSSProperty *property)
{
ASSERT(pos.isNotNull());
- SharedPtr<CSSComputedStyleDeclarationImpl> style = pos.computedStyle();
- SharedPtr<CSSValueImpl> value = style->getPropertyCSSValue(property->id(), DoNotUpdateLayout);
+ RefPtr<CSSComputedStyleDeclarationImpl> style = pos.computedStyle();
+ RefPtr<CSSValueImpl> value = style->getPropertyCSSValue(property->id(), DoNotUpdateLayout);
if (!value)
return false;
return strcasecmp(value->cssText(), property->value()->cssText()) == 0;
switch (m_propertyLevel) {
case PropertyDefault: {
// apply the block-centric properties of the style
- SharedPtr<CSSMutableStyleDeclarationImpl> blockStyle = m_style->copyBlockProperties();
+ RefPtr<CSSMutableStyleDeclarationImpl> blockStyle = m_style->copyBlockProperties();
applyBlockStyle(blockStyle.get());
// apply any remaining styles to the inline elements
// NOTE: hopefully, this string comparison is the same as checking for a non-null diff
if (blockStyle->length() < m_style->length()) {
- SharedPtr<CSSMutableStyleDeclarationImpl> inlineStyle = m_style->copy();
+ RefPtr<CSSMutableStyleDeclarationImpl> inlineStyle = m_style->copy();
applyRelativeFontStyleChange(inlineStyle.get());
blockStyle->diff(inlineStyle.get());
applyInlineStyle(inlineStyle.get());
void ApplyStyleCommand::applyRelativeFontStyleChange(CSSMutableStyleDeclarationImpl *style)
{
- SharedPtr<CSSValueImpl> value = style->getPropertyCSSValue(CSS_PROP_FONT_SIZE);
+ RefPtr<CSSValueImpl> value = style->getPropertyCSSValue(CSS_PROP_FONT_SIZE);
if (value) {
// Explicit font size overrides any delta.
style->removeProperty(CSS_PROP__KHTML_FONT_SIZE_DELTA);
CSSMutableStyleDeclarationImpl *inlineStyleDecl = elem->getInlineStyleDecl();
float currentFontSize = computedFontSize(node);
float desiredFontSize = kMax(MinimumFontSize, startingFontSizes[node] + adjustment);
- SharedPtr<CSSValueImpl> value = inlineStyleDecl->getPropertyCSSValue(CSS_PROP_FONT_SIZE);
+ RefPtr<CSSValueImpl> value = inlineStyleDecl->getPropertyCSSValue(CSS_PROP_FONT_SIZE);
if (value) {
inlineStyleDecl->removeProperty(CSS_PROP_FONT_SIZE, true);
currentFontSize = computedFontSize(node);
QValueListConstIterator<CSSProperty> end;
for (QValueListConstIterator<CSSProperty> it = style->valuesIterator(); it != end; ++it) {
int propertyID = (*it).id();
- SharedPtr<CSSValueImpl> value = decl->getPropertyCSSValue(propertyID);
+ RefPtr<CSSValueImpl> value = decl->getPropertyCSSValue(propertyID);
if (value && (propertyID != CSS_PROP_WHITE_SPACE || !isTabSpanNode(elem)))
removeCSSProperty(decl, propertyID);
}
ElementImpl *element = static_cast<ElementImpl *>(node);
CSSComputedStyleDeclarationImpl style(element);
- SharedPtr<CSSValueImpl> value = style.getPropertyCSSValue(CSS_PROP_TEXT_DECORATION, DoNotUpdateLayout);
+ RefPtr<CSSValueImpl> value = style.getPropertyCSSValue(CSS_PROP_TEXT_DECORATION, DoNotUpdateLayout);
return value && strcasecmp(value->cssText(), "none") != 0;
}
return 0;
HTMLElementImpl *element = static_cast<HTMLElementImpl *>(node);
- SharedPtr<CSSMutableStyleDeclarationImpl> style = element->inlineStyleDecl();
+ RefPtr<CSSMutableStyleDeclarationImpl> style = element->inlineStyleDecl();
if (!style)
return 0;
int properties[1] = { CSS_PROP_TEXT_DECORATION };
CSSMutableStyleDeclarationImpl *textDecorationStyle = style->copyPropertiesInSet(properties, 1);
- SharedPtr<CSSValueImpl> property = style->getPropertyCSSValue(CSS_PROP_TEXT_DECORATION);
+ RefPtr<CSSValueImpl> property = style->getPropertyCSSValue(CSS_PROP_TEXT_DECORATION);
if (property && strcasecmp(property->cssText(), "none") != 0)
removeCSSProperty(style.get(), CSS_PROP_TEXT_DECORATION);
return 0;
HTMLElementImpl *element = static_cast<HTMLElementImpl *>(node);
- SharedPtr<CSSComputedStyleDeclarationImpl> computedStyle = new CSSComputedStyleDeclarationImpl(element);
+ RefPtr<CSSComputedStyleDeclarationImpl> computedStyle = new CSSComputedStyleDeclarationImpl(element);
ASSERT(computedStyle);
int properties[1] = { CSS_PROP_TEXT_DECORATION };
CSSMutableStyleDeclarationImpl *textDecorationStyle = computedStyle->copyPropertiesInSet(properties, 1);
- SharedPtr<CSSValueImpl> property = computedStyle->getPropertyCSSValue(CSS_PROP_TEXT_DECORATION);
+ RefPtr<CSSValueImpl> property = computedStyle->getPropertyCSSValue(CSS_PROP_TEXT_DECORATION);
if (property && strcasecmp(property->cssText(), "none") != 0) {
- SharedPtr<CSSMutableStyleDeclarationImpl> newStyle = textDecorationStyle->copy();
+ RefPtr<CSSMutableStyleDeclarationImpl> newStyle = textDecorationStyle->copy();
newStyle->setProperty(CSS_PROP_TEXT_DECORATION, "none");
applyTextDecorationStyle(node, newStyle.get());
}
nextCurrent = NULL;
- SharedPtr<CSSMutableStyleDeclarationImpl> decoration = force ? extractAndNegateTextDecorationStyle(current) : extractTextDecorationStyle(current);
+ RefPtr<CSSMutableStyleDeclarationImpl> decoration = force ? extractAndNegateTextDecorationStyle(current) : extractTextDecorationStyle(current);
for (NodeImpl *child = current->firstChild(); child; child = nextChild) {
nextChild = child->nextSibling();
ASSERT(end.node()->inDocument());
ASSERT(RangeImpl::compareBoundaryPoints(start, end) < 0);
- SharedPtr<CSSValueImpl> textDecorationSpecialProperty = style->getPropertyCSSValue(CSS_PROP__KHTML_TEXT_DECORATIONS_IN_EFFECT);
+ RefPtr<CSSValueImpl> textDecorationSpecialProperty = style->getPropertyCSSValue(CSS_PROP__KHTML_TEXT_DECORATIONS_IN_EFFECT);
if (textDecorationSpecialProperty) {
pushDownTextDecorationStyleAtBoundaries(start.downstream(), end.upstream());
}
if (styleChange.cssStyle().length() > 0) {
- SharedPtr<ElementImpl> styleElement = createStyleSpanElement(document());
+ RefPtr<ElementImpl> styleElement = createStyleSpanElement(document());
styleElement->setAttribute(styleAttr, styleChange.cssStyle());
insertNodeBefore(styleElement.get(), startNode);
surroundNodeRangeWithElement(startNode, endNode, styleElement.get());
return 0;
Position pos(const_cast<NodeImpl *>(node), 0);
- SharedPtr<CSSComputedStyleDeclarationImpl> computedStyle = pos.computedStyle();
+ RefPtr<CSSComputedStyleDeclarationImpl> computedStyle = pos.computedStyle();
if (!computedStyle)
return 0;
- SharedPtr<CSSPrimitiveValueImpl> value = static_cast<CSSPrimitiveValueImpl *>(computedStyle->getPropertyCSSValue(CSS_PROP_FONT_SIZE));
+ RefPtr<CSSPrimitiveValueImpl> value = static_cast<CSSPrimitiveValueImpl *>(computedStyle->getPropertyCSSValue(CSS_PROP_FONT_SIZE));
if (!value)
return 0;
float computedFontSize(const DOM::NodeImpl *);
void joinChildTextNodes(DOM::NodeImpl *, const DOM::Position &start, const DOM::Position &end);
- SharedPtr<DOM::CSSMutableStyleDeclarationImpl> m_style;
+ RefPtr<DOM::CSSMutableStyleDeclarationImpl> m_style;
EditAction m_editingAction;
EPropertyLevel m_propertyLevel;
};
{
}
-EditCommandPtr::EditCommandPtr(EditCommand *impl) : SharedPtr<EditCommand>(impl)
+EditCommandPtr::EditCommandPtr(EditCommand *impl) : RefPtr<EditCommand>(impl)
{
}
-EditCommandPtr::EditCommandPtr(const EditCommandPtr &o) : SharedPtr<EditCommand>(o)
+EditCommandPtr::EditCommandPtr(const EditCommandPtr &o) : RefPtr<EditCommand>(o)
{
}
EditCommandPtr &EditCommandPtr::operator=(const EditCommandPtr &c)
{
- static_cast<SharedPtr<EditCommand> &>(*this) = c;
+ static_cast<RefPtr<EditCommand> &>(*this) = c;
return *this;
}
EditCommand *m_parent;
};
-class EditCommandPtr : public SharedPtr<EditCommand>
+class EditCommandPtr : public RefPtr<EditCommand>
{
public:
EditCommandPtr();
if (defaultStyle) {
NodeImpl *element = node->parentNode();
if (element) {
- SharedPtr<CSSComputedStyleDeclarationImpl> computedStyle = Position(element, 0).computedStyle();
- SharedPtr<CSSMutableStyleDeclarationImpl> style = computedStyle->copyInheritableProperties();
+ RefPtr<CSSComputedStyleDeclarationImpl> computedStyle = Position(element, 0).computedStyle();
+ RefPtr<CSSMutableStyleDeclarationImpl> style = computedStyle->copyInheritableProperties();
defaultStyle->diff(style.get());
if (style->length() > 0) {
// FIXME: Handle case where style->cssText() has illegal characters in it, like "
const ElementImpl *el = static_cast<const ElementImpl *>(node);
DOMString additionalStyle;
if (defaultStyle && el->isHTMLElement()) {
- SharedPtr<CSSComputedStyleDeclarationImpl> computedStyle = Position(const_cast<ElementImpl *>(el), 0).computedStyle();
- SharedPtr<CSSMutableStyleDeclarationImpl> style = computedStyle->copyInheritableProperties();
+ RefPtr<CSSComputedStyleDeclarationImpl> computedStyle = Position(const_cast<ElementImpl *>(el), 0).computedStyle();
+ RefPtr<CSSMutableStyleDeclarationImpl> style = computedStyle->copyInheritableProperties();
defaultStyle->diff(style.get());
if (style->length() > 0) {
CSSMutableStyleDeclarationImpl *inlineStyleDecl = static_cast<const HTMLElementImpl *>(el)->inlineStyleDecl();
}
#endif
-SharedPtr<RangeImpl> makeRange(const VisiblePosition &start, const VisiblePosition &end)
+RefPtr<RangeImpl> makeRange(const VisiblePosition &start, const VisiblePosition &end)
{
Position s = start.position();
Position e = end.position();
- return SharedPtr<RangeImpl>(new RangeImpl(s.node()->getDocument(), s.node(), s.offset(), e.node(), e.offset()));
+ return RefPtr<RangeImpl>(new RangeImpl(s.node()->getDocument(), s.node(), s.offset(), e.node(), e.offset()));
}
VisiblePosition startVisiblePosition(const RangeImpl *r, EAffinity affinity)
return !(a == b);
}
-SharedPtr<DOM::RangeImpl> makeRange(const VisiblePosition &start, const VisiblePosition &end);
+RefPtr<DOM::RangeImpl> makeRange(const VisiblePosition &start, const VisiblePosition &end);
bool setStart(DOM::RangeImpl *, const VisiblePosition &start);
bool setEnd(DOM::RangeImpl *, const VisiblePosition &start);
VisiblePosition startVisiblePosition(const DOM::RangeImpl *, EAffinity);
VisiblePosition start() const { return m_start; }
VisiblePosition end() const { return m_end; }
- SharedPtr<RangeImpl> range() const;
+ RefPtr<RangeImpl> range() const;
void clear() { m_start.clear(); m_end.clear(); }
m_lastCharacter = c;
}
-SharedPtr<RangeImpl> TextIterator::range() const
+RefPtr<RangeImpl> TextIterator::range() const
{
// use the current run information, if we have it
if (m_positionNode) {
m_positionEndOffset += index;
m_positionOffsetBaseNode = 0;
}
- return SharedPtr<RangeImpl>(new RangeImpl(m_positionNode->getDocument(),
+ return RefPtr<RangeImpl>(new RangeImpl(m_positionNode->getDocument(),
m_positionNode, m_positionStartOffset, m_positionNode, m_positionEndOffset));
}
// otherwise, return the end of the overall range we were given
if (m_endContainer)
- return SharedPtr<RangeImpl>(new RangeImpl(m_endContainer->getDocument(),
+ return RefPtr<RangeImpl>(new RangeImpl(m_endContainer->getDocument(),
m_endContainer, m_endOffset, m_endContainer, m_endOffset));
- return SharedPtr<RangeImpl>();
+ return RefPtr<RangeImpl>();
}
SimplifiedBackwardsTextIterator::SimplifiedBackwardsTextIterator() : m_positionNode(0)
}
}
-SharedPtr<RangeImpl> SimplifiedBackwardsTextIterator::range() const
+RefPtr<RangeImpl> SimplifiedBackwardsTextIterator::range() const
{
if (m_positionNode) {
- return SharedPtr<RangeImpl>(new RangeImpl(m_positionNode->getDocument(), m_positionNode, m_positionStartOffset, m_positionNode, m_positionEndOffset));
+ return RefPtr<RangeImpl>(new RangeImpl(m_positionNode->getDocument(), m_positionNode, m_positionStartOffset, m_positionNode, m_positionEndOffset));
} else {
- return SharedPtr<RangeImpl>(new RangeImpl(m_startNode->getDocument(), m_startNode, m_startOffset, m_startNode, m_startOffset));
+ return RefPtr<RangeImpl>(new RangeImpl(m_startNode->getDocument(), m_startNode, m_startOffset, m_startNode, m_startOffset));
}
}
}
}
-SharedPtr<RangeImpl> CharacterIterator::range() const
+RefPtr<RangeImpl> CharacterIterator::range() const
{
- SharedPtr<RangeImpl> r = m_textIterator.range();
+ RefPtr<RangeImpl> r = m_textIterator.range();
if (!m_textIterator.atEnd()) {
if (m_textIterator.length() <= 1) {
assert(m_runOffset == 0);
for (TextIterator it(rangeOfContents(doc).get()); !it.atEnd(); it.advance()) {
int len = it.length();
if (rangeLocation >= docTextPosition && rangeLocation <= docTextPosition + len) {
- SharedPtr<RangeImpl> textRunRange = it.range();
+ RefPtr<RangeImpl> textRunRange = it.range();
int exception = 0;
if (textRunRange->startContainer(exception)->isTextNode()) {
int offset = rangeLocation - docTextPosition;
}
}
if (rangeEnd >= docTextPosition && rangeEnd <= docTextPosition + len) {
- SharedPtr<RangeImpl> textRunRange = it.range();
+ RefPtr<RangeImpl> textRunRange = it.range();
int exception = 0;
if (textRunRange->startContainer(exception)->isTextNode()) {
int offset = rangeEnd - docTextPosition;
return result;
}
-SharedPtr<RangeImpl> findPlainText(const RangeImpl *r, const QString &s, bool forward, bool caseSensitive)
+RefPtr<RangeImpl> findPlainText(const RangeImpl *r, const QString &s, bool forward, bool caseSensitive)
{
// FIXME: Can we do Boyer-Moore or equivalent instead for speed?
int exception = 0;
RangeImpl *result = r->cloneRange(exception);
result->collapse(forward, exception);
- return SharedPtr<RangeImpl>(result);
+ return RefPtr<RangeImpl>(result);
}
CircularSearchBuffer buffer(s, caseSensitive);
it.advance(buffer.length() - 1);
result->setEnd(it.range()->endContainer(exception), it.range()->endOffset(exception), exception);
}
- return SharedPtr<RangeImpl>(result);
+ return RefPtr<RangeImpl>(result);
}
}
}
QString plainText(const DOM::RangeImpl *);
-SharedPtr<DOM::RangeImpl> findPlainText(const DOM::RangeImpl *, const QString &, bool forward, bool caseSensitive);
+RefPtr<DOM::RangeImpl> findPlainText(const DOM::RangeImpl *, const QString &, bool forward, bool caseSensitive);
// Iterates through the DOM range, returning all the text, and 0-length boundaries
// at points where replaced elements break up the text flow. The text comes back in
int length() const { return m_textLength; }
const QChar *characters() const { return m_textCharacters; }
- SharedPtr<DOM::RangeImpl> range() const;
+ RefPtr<DOM::RangeImpl> range() const;
static int TextIterator::rangeLength(const DOM::RangeImpl *r);
static DOM::RangeImpl *TextIterator::rangeFromLocationAndLength(DOM::DocumentImpl *doc, int rangeLocation, int rangeLength);
int length() const { return m_textLength; }
const QChar *characters() const { return m_textCharacters; }
- SharedPtr<DOM::RangeImpl> range() const;
+ RefPtr<DOM::RangeImpl> range() const;
private:
void exitNode();
QString string(int numChars);
int characterOffset() const { return m_offset; }
- SharedPtr<DOM::RangeImpl> range() const;
+ RefPtr<DOM::RangeImpl> range() const;
private:
int m_offset;
const QChar *characters() const;
// Range of the text we're currently returning
- SharedPtr<DOM::RangeImpl> range() const { return m_range; }
+ RefPtr<DOM::RangeImpl> range() const { return m_range; }
private:
// text from the previous chunk from the textIterator
// Did we have to look ahead in the textIterator to confirm the current chunk?
bool m_didLookAhead;
- SharedPtr<DOM::RangeImpl> m_range;
+ RefPtr<DOM::RangeImpl> m_range;
TextIterator m_textIterator;
};
boundary = boundary->parentNode();
}
- SharedPtr<RangeImpl> searchRange(d->createRange());
+ RefPtr<RangeImpl> searchRange(d->createRange());
int exception = 0;
searchRange->setStartBefore(boundary, exception);
Position end(pos.equivalentRangeCompliantPosition());
}
if (it.atEnd() && next == 0) {
- SharedPtr<RangeImpl> range(it.range());
+ RefPtr<RangeImpl> range(it.range());
pos = Position(range->startContainer(exception), range->startOffset(exception));
}
else if (!it.atEnd() && it.length() == 0) {
chars[1] = ' ';
string.prepend(chars, 2);
unsigned pastImage = searchFunction(string.unicode(), string.length());
- SharedPtr<RangeImpl> range(it.range());
+ RefPtr<RangeImpl> range(it.range());
if (pastImage == 0)
pos = Position(range->startContainer(exception), range->startOffset(exception));
else
boundary = boundary->parentNode();
}
- SharedPtr<RangeImpl> searchRange(d->createRange());
+ RefPtr<RangeImpl> searchRange(d->createRange());
Position start(pos.equivalentRangeCompliantPosition());
int exception = 0;
searchRange->setStart(start.node(), start.offset(), exception);
}
if (it.atEnd() && next == string.length()) {
- SharedPtr<RangeImpl> range(it.range());
+ RefPtr<RangeImpl> range(it.range());
int exception = 0;
pos = Position(range->startContainer(exception), range->startOffset(exception));
}
chars[1] = 'X';
string.append(chars, 2);
unsigned pastImage = searchFunction(string.unicode(), string.length());
- SharedPtr<RangeImpl> range(it.range());
+ RefPtr<RangeImpl> range(it.range());
int exception = 0;
if (next != pastImage)
pos = Position(range->endContainer(exception), range->endOffset(exception));
setAttribute(classAttr, value);
}
-SharedPtr<HTMLCollectionImpl> HTMLElementImpl::children()
+RefPtr<HTMLCollectionImpl> HTMLElementImpl::children()
{
- return SharedPtr<HTMLCollectionImpl>(new HTMLCollectionImpl(this, HTMLCollectionImpl::NODE_CHILDREN));
+ return RefPtr<HTMLCollectionImpl>(new HTMLCollectionImpl(this, HTMLCollectionImpl::NODE_CHILDREN));
}
// DOM Section 1.1.1
virtual NodeImpl* cloneNode(bool deep);
- SharedPtr<HTMLCollectionImpl> children();
+ RefPtr<HTMLCollectionImpl> children();
DOMString id() const;
void setId(const DOMString &value);
removeFromVector(imgElements, e);
}
-SharedPtr<HTMLCollectionImpl> HTMLFormElementImpl::elements()
+RefPtr<HTMLCollectionImpl> HTMLFormElementImpl::elements()
{
- return SharedPtr<HTMLCollectionImpl>(new HTMLFormCollectionImpl(this));
+ return RefPtr<HTMLCollectionImpl>(new HTMLFormCollectionImpl(this));
}
DOMString HTMLFormElementImpl::name() const
void HTMLSelectElementImpl::add( HTMLElementImpl *element, HTMLElementImpl *before, int &exceptioncode )
{
- SharedPtr<HTMLElementImpl> protectNewChild(element); // make sure the element is ref'd and deref'd so we don't leak it
+ RefPtr<HTMLElementImpl> protectNewChild(element); // make sure the element is ref'd and deref'd so we don't leak it
if (!element || !(element->hasLocalName(optionTag) || element->hasLocalName(hrTag)))
return;
}
// FIXME: Delete once the above function is working well enough to use for real.
-SharedPtr<HTMLCollectionImpl> HTMLSelectElementImpl::optionsHTMLCollection()
+RefPtr<HTMLCollectionImpl> HTMLSelectElementImpl::optionsHTMLCollection()
{
- return SharedPtr<HTMLCollectionImpl>(new HTMLCollectionImpl(this, HTMLCollectionImpl::SELECT_OPTIONS));
+ return RefPtr<HTMLCollectionImpl>(new HTMLCollectionImpl(this, HTMLCollectionImpl::SELECT_OPTIONS));
}
void HTMLSelectElementImpl::recalcListItems()
virtual void insertedIntoDocument();
virtual void removedFromDocument();
- SharedPtr<HTMLCollectionImpl> elements();
+ RefPtr<HTMLCollectionImpl> elements();
int length() const;
DOMString enctype() const { return m_enctype; }
void setValue(const DOMString &);
HTMLOptionsCollectionImpl *options();
- SharedPtr<HTMLCollectionImpl> optionsHTMLCollection(); // FIXME: Remove this and migrate to options().
+ RefPtr<HTMLCollectionImpl> optionsHTMLCollection(); // FIXME: Remove this and migrate to options().
virtual bool maintainsState() { return true; }
virtual QString state();
HTMLElementImpl::parseMappedAttribute(attr);
}
-SharedPtr<HTMLCollectionImpl> HTMLMapElementImpl::areas()
+RefPtr<HTMLCollectionImpl> HTMLMapElementImpl::areas()
{
- return SharedPtr<HTMLCollectionImpl>(new HTMLCollectionImpl(this, HTMLCollectionImpl::MAP_AREAS));
+ return RefPtr<HTMLCollectionImpl>(new HTMLCollectionImpl(this, HTMLCollectionImpl::MAP_AREAS));
}
DOMString HTMLMapElementImpl::name() const
bool mapMouseEvent(int x_, int y_, int width_, int height_,
khtml::RenderObject::NodeInfo& info);
- SharedPtr<HTMLCollectionImpl> areas();
+ RefPtr<HTMLCollectionImpl> areas();
DOMString name() const;
void setName( const DOMString & );
info->hasNameCache = true;
}
-QValueList< SharedPtr<NodeImpl> > HTMLCollectionImpl::namedItems(const DOMString &name) const
+QValueList< RefPtr<NodeImpl> > HTMLCollectionImpl::namedItems(const DOMString &name) const
{
- QValueList< SharedPtr<NodeImpl> > result;
+ QValueList< RefPtr<NodeImpl> > result;
if (name.isEmpty())
return result;
QPtrVector<NodeImpl> *nameResults = info->nameCache.find(name.qstring());
for (unsigned i = 0; idResults && i < idResults->count(); ++i) {
- result.append(SharedPtr<NodeImpl>(idResults->at(i)));
+ result.append(RefPtr<NodeImpl>(idResults->at(i)));
}
for (unsigned i = 0; nameResults && i < nameResults->count(); ++i) {
- result.append(SharedPtr<NodeImpl>(nameResults->at(i)));
+ result.append(RefPtr<NodeImpl>(nameResults->at(i)));
}
return result;
// In case of multiple items named the same way
virtual NodeImpl *nextNamedItem(const DOMString &name) const;
- QValueList< SharedPtr<NodeImpl> > namedItems(const DOMString &name) const;
+ QValueList< RefPtr<NodeImpl> > namedItems(const DOMString &name) const;
NodeImpl *base() { return m_base.get(); }
virtual unsigned calcLength() const;
virtual void resetCollectionInfo() const;
// the base node, the collection refers to
- SharedPtr<NodeImpl> m_base;
+ RefPtr<NodeImpl> m_base;
// The collection list the following elements
int type;
mutable CollectionInfo *info;
return attr->name() == backgroundAttr;
}
-SharedPtr<HTMLCollectionImpl> HTMLTableElementImpl::rows()
+RefPtr<HTMLCollectionImpl> HTMLTableElementImpl::rows()
{
- return SharedPtr<HTMLCollectionImpl>(new HTMLCollectionImpl(this, HTMLCollectionImpl::TABLE_ROWS));
+ return RefPtr<HTMLCollectionImpl>(new HTMLCollectionImpl(this, HTMLCollectionImpl::TABLE_ROWS));
}
-SharedPtr<HTMLCollectionImpl> HTMLTableElementImpl::tBodies()
+RefPtr<HTMLCollectionImpl> HTMLTableElementImpl::tBodies()
{
- return SharedPtr<HTMLCollectionImpl>(new HTMLCollectionImpl(this, HTMLCollectionImpl::TABLE_TBODIES));
+ return RefPtr<HTMLCollectionImpl>(new HTMLCollectionImpl(this, HTMLCollectionImpl::TABLE_TBODIES));
}
DOMString HTMLTableElementImpl::align() const
HTMLElementImpl *HTMLTableSectionElementImpl::insertRow( int index, int& exceptioncode )
{
HTMLTableRowElementImpl *r = 0L;
- SharedPtr<NodeListImpl> children = childNodes();
+ RefPtr<NodeListImpl> children = childNodes();
int numRows = children.notNull() ? (int)children->length() : 0;
//kdDebug(6030) << k_funcinfo << "index=" << index << " numRows=" << numRows << endl;
if ( index < -1 || index > numRows ) {
void HTMLTableSectionElementImpl::deleteRow( int index, int &exceptioncode )
{
- SharedPtr<NodeListImpl> children = childNodes();
+ RefPtr<NodeListImpl> children = childNodes();
int numRows = children.notNull() ? (int)children->length() : 0;
if ( index == -1 ) index = numRows - 1;
if( index >= 0 && index < numRows ) {
setAttribute(valignAttr, value);
}
-SharedPtr<HTMLCollectionImpl> HTMLTableSectionElementImpl::rows()
+RefPtr<HTMLCollectionImpl> HTMLTableSectionElementImpl::rows()
{
- return SharedPtr<HTMLCollectionImpl>(new HTMLCollectionImpl(this, HTMLCollectionImpl::TABLE_ROWS));
+ return RefPtr<HTMLCollectionImpl>(new HTMLCollectionImpl(this, HTMLCollectionImpl::TABLE_ROWS));
}
// -------------------------------------------------------------------------
HTMLElementImpl *HTMLTableRowElementImpl::insertCell( int index, int &exceptioncode )
{
HTMLTableCellElementImpl *c = 0L;
- SharedPtr<NodeListImpl> children = childNodes();
+ RefPtr<NodeListImpl> children = childNodes();
int numCells = children.notNull() ? children->length() : 0;
if ( index < -1 || index > numCells )
exceptioncode = DOMException::INDEX_SIZE_ERR; // per the DOM
void HTMLTableRowElementImpl::deleteCell( int index, int &exceptioncode )
{
- SharedPtr<NodeListImpl> children = childNodes();
+ RefPtr<NodeListImpl> children = childNodes();
int numCells = children.notNull() ? children->length() : 0;
if ( index == -1 ) index = numCells-1;
if( index >= 0 && index < numCells ) {
exceptioncode = DOMException::INDEX_SIZE_ERR;
}
-SharedPtr<HTMLCollectionImpl> HTMLTableRowElementImpl::cells()
+RefPtr<HTMLCollectionImpl> HTMLTableRowElementImpl::cells()
{
- return SharedPtr<HTMLCollectionImpl>(new HTMLCollectionImpl(this, HTMLCollectionImpl::TR_CELLS));
+ return RefPtr<HTMLCollectionImpl>(new HTMLCollectionImpl(this, HTMLCollectionImpl::TR_CELLS));
}
void HTMLTableRowElementImpl::setCells(HTMLCollectionImpl *, int &exception)
HTMLElementImpl *insertRow ( int index, int &exceptioncode );
void deleteRow ( int index, int &exceptioncode );
- SharedPtr<HTMLCollectionImpl> rows();
- SharedPtr<HTMLCollectionImpl> tBodies();
+ RefPtr<HTMLCollectionImpl> rows();
+ RefPtr<HTMLCollectionImpl> tBodies();
DOMString align() const;
void setAlign( const DOMString & );
DOMString vAlign() const;
void setVAlign( const DOMString & );
- SharedPtr<HTMLCollectionImpl> rows();
+ RefPtr<HTMLCollectionImpl> rows();
};
// -------------------------------------------------------------------------
void setSectionRowIndex( int );
- SharedPtr<HTMLCollectionImpl> cells();
+ RefPtr<HTMLCollectionImpl> cells();
void setCells(HTMLCollectionImpl *, int &exception);
DOMString align() const;
AtomicString tagName;
int level;
bool strayTableContent;
- SharedPtr<NodeImpl> node;
+ RefPtr<NodeImpl> node;
HTMLStackElem* next;
};
if (!n)
return;
- SharedPtr<NodeImpl> protectNode(n);
+ RefPtr<NodeImpl> protectNode(n);
// set attributes
if (n->isHTMLElement()) {
bool HTMLParser::insertNode(NodeImpl *n, bool flat)
{
- SharedPtr<NodeImpl> protectNode(n);
+ RefPtr<NodeImpl> protectNode(n);
const AtomicString& localName = n->localName();
int tagPriority = n->isHTMLElement() ? static_cast<HTMLElementImpl*>(n)->tagPriority() : 0;
int m_nodeAbsX, m_nodeAbsY;
DOM::DOMString m_url;
DOM::DOMString m_target;
- SharedPtr<DOM::NodeImpl> m_innerNode;
+ RefPtr<DOM::NodeImpl> m_innerNode;
class MouseEventPrivate;
MouseEventPrivate *d;
};
TriState state = falseTriState;
CSSMutableStyleDeclarationImpl *mutableStyle = style->makeMutable();
- SharedPtr<CSSStyleDeclarationImpl> protectQueryStyle(mutableStyle);
+ RefPtr<CSSStyleDeclarationImpl> protectQueryStyle(mutableStyle);
if (!d->m_selection.isRange()) {
NodeImpl *nodeToRemove;
CSSMutableStyleDeclarationImpl *mutableStyle = style->makeMutable();
- SharedPtr<CSSStyleDeclarationImpl> protectSelectionStyle(selectionStyle);
- SharedPtr<CSSStyleDeclarationImpl> protectQueryStyle(mutableStyle);
+ RefPtr<CSSStyleDeclarationImpl> protectSelectionStyle(selectionStyle);
+ RefPtr<CSSStyleDeclarationImpl> protectQueryStyle(mutableStyle);
bool match = true;
QValueListConstIterator<CSSProperty> end;
if (d->m_selection.isNone())
return 0;
- SharedPtr<RangeImpl> range(d->m_selection.toRange());
+ RefPtr<RangeImpl> range(d->m_selection.toRange());
Position pos = range->editingStartPosition();
ElementImpl *elem = pos.element();
if (!d->m_doc)
return;
- SharedPtr<NodeListImpl> list = d->m_doc->getElementsByTagName("body");
+ RefPtr<NodeListImpl> list = d->m_doc->getElementsByTagName("body");
unsigned len = list->length();
for (unsigned i = 0; i < len; i++) {
applyEditingStyleToElement(static_cast<ElementImpl *>(list->item(i)));
if (!d->m_doc)
return;
- SharedPtr<NodeListImpl> list = d->m_doc->getElementsByTagName("body");
+ RefPtr<NodeListImpl> list = d->m_doc->getElementsByTagName("body");
unsigned len = list->length();
for (unsigned i = 0; i < len; i++) {
removeEditingStyleFromElement(static_cast<ElementImpl *>(list->item(i)));
long m_cacheId;
#endif
QString scheduledScript;
- SharedPtr<DOM::NodeImpl> scheduledScriptNode;
+ RefPtr<DOM::NodeImpl> scheduledScriptNode;
KJSProxy *m_jscript;
KLibrary *m_kjs_lib;
SubmitForm *m_submitForm;
bool m_bMousePressed;
- SharedPtr<DOM::NodeImpl> m_mousePressNode; //node under the mouse when the mouse was pressed (set in the mouse handler)
+ RefPtr<DOM::NodeImpl> m_mousePressNode; //node under the mouse when the mouse was pressed (set in the mouse handler)
khtml::ETextGranularity m_selectionGranularity;
bool m_beganSelectingText;
// after all layout has been completed.
QPtrList<RenderObject::RepaintInfo>* repaintRects;
- SharedPtr<NodeImpl> dragTarget;
+ RefPtr<NodeImpl> dragTarget;
};
#ifndef QT_NO_TOOLTIP
{
if(!m_part->xmlDocImpl()) return;
- SharedPtr<KHTMLView> protector(this);
+ RefPtr<KHTMLView> protector(this);
int xm, ym;
viewportToContents(_mouse->x(), _mouse->y(), xm, ym);
{
if(!m_part->xmlDocImpl()) return;
- SharedPtr<KHTMLView> protector(this);
+ RefPtr<KHTMLView> protector(this);
int xm, ym;
viewportToContents(_mouse->x(), _mouse->y(), xm, ym);
{
if ( !m_part->xmlDocImpl() ) return;
- SharedPtr<KHTMLView> protector(this);
+ RefPtr<KHTMLView> protector(this);
int xm, ym;
viewportToContents(_mouse->x(), _mouse->y(), xm, ym);
// it again. calculating is expensive! (Dirk)
// Also, there's no guarantee that the old under node is even around any more,
// so we could be sending a mouseout to a node that never got a mouseover.
- SharedPtr<NodeImpl> oldUnder;
+ RefPtr<NodeImpl> oldUnder;
if (d->prevMouseX >= 0 && d->prevMouseY >= 0) {
NodeImpl::MouseEvent mev( _mouse->stateAfter(), static_cast<NodeImpl::MouseEventType>(mouseEventType));
m_part->xmlDocImpl()->prepareMouseEvent( true, d->prevMouseX, d->prevMouseY, &mev );
#ifndef SHARED_H
#define SHARED_H
-#include <kxmlcore/SharedPtr.h>
+#include <kxmlcore/RefPtr.h>
namespace khtml {
BidiIterator eor;
BidiIterator last;
BidiIterator current;
- SharedPtr<BidiContext> context;
+ RefPtr<BidiContext> context;
BidiStatus status;
QChar::Direction dir;
bool adjustEmbedding;
// The original string is going to be either a generated content string or a DOM node's
// string. We want the original string before it got transformed in case first-letter has
// no text-transform or a different text-transform applied to it.
- SharedPtr<DOMStringImpl> oldText = textObj->originalString();
+ RefPtr<DOMStringImpl> oldText = textObj->originalString();
KHTMLAssert(oldText);
if (oldText.notNull() && oldText->l > 0) {
uint m_lineBreakPos;
BidiStatus m_lineBreakBidiStatus;
- SharedPtr<BidiContext> m_lineBreakContext;
+ RefPtr<BidiContext> m_lineBreakContext;
// The height of the block at the end of this line. This is where the next line starts.
int m_blockHeight;
RenderObject::setStyle( _style );
if (needToTransformText) {
- SharedPtr<DOMStringImpl> textToTransform = originalString();
+ RefPtr<DOMStringImpl> textToTransform = originalString();
if (textToTransform.notNull())
setText(textToTransform.get(), true);
}
return false;
}
-SharedPtr<DOMStringImpl> RenderText::originalString() const
+RefPtr<DOMStringImpl> RenderText::originalString() const
{
- return element() ? SharedPtr<DOMStringImpl>(element()->string()) : SharedPtr<DOMStringImpl>();
+ return element() ? RefPtr<DOMStringImpl>(element()->string()) : RefPtr<DOMStringImpl>();
}
void RenderText::absoluteRects(QValueList<QRect>& rects, int _tx, int _ty)
return true;
}
-SharedPtr<DOMStringImpl> RenderTextFragment::originalString() const
+RefPtr<DOMStringImpl> RenderTextFragment::originalString() const
{
DOM::DOMStringImpl* result = 0;
if (element())
result = contentString();
if (result && (start() > 0 || start() < result->l))
result = result->substring(start(), end());
- return SharedPtr<DOMStringImpl>(result);
+ return RefPtr<DOMStringImpl>(result);
}
virtual ~RenderText();
virtual bool isTextFragment() const;
- virtual SharedPtr<DOM::DOMStringImpl> originalString() const;
+ virtual RefPtr<DOM::DOMStringImpl> originalString() const;
virtual const char *renderName() const { return "RenderText"; }
uint end() const { return m_end; }
DOM::DOMStringImpl* contentString() const { return m_generatedContentStr; }
- virtual SharedPtr<DOM::DOMStringImpl> originalString() const;
+ virtual RefPtr<DOM::DOMStringImpl> originalString() const;
private:
uint m_start;
NodeImpl *m_currentTarget; // ref > 0 maintained externally
unsigned short m_eventPhase;
- SharedPtr<NodeImpl> m_target;
+ RefPtr<NodeImpl> m_target;
DOMTimeStamp m_createTime;
};
virtual int which() const;
private:
- SharedPtr<AbstractViewImpl> m_view;
+ RefPtr<AbstractViewImpl> m_view;
int m_detail;
};
virtual int which() const;
private:
unsigned short m_button;
- SharedPtr<NodeImpl> m_relatedTarget;
- SharedPtr<ClipboardImpl> m_clipboard;
+ RefPtr<NodeImpl> m_relatedTarget;
+ RefPtr<ClipboardImpl> m_clipboard;
};
private:
QKeyEvent *m_keyEvent;
- SharedPtr<DOMStringImpl> m_keyIdentifier;
+ RefPtr<DOMStringImpl> m_keyIdentifier;
unsigned m_keyLocation;
bool m_altGraphKey : 1;
};
unsigned short attrChangeArg);
virtual bool isMutationEvent() const;
private:
- SharedPtr<NodeImpl> m_relatedNode;
- SharedPtr<DOMStringImpl> m_prevValue;
- SharedPtr<DOMStringImpl> m_newValue;
- SharedPtr<DOMStringImpl> m_attrName;
+ RefPtr<NodeImpl> m_relatedNode;
+ RefPtr<DOMStringImpl> m_prevValue;
+ RefPtr<DOMStringImpl> m_newValue;
+ RefPtr<DOMStringImpl> m_attrName;
unsigned short m_attrChange;
};
ClipboardImpl *clipboard() const { return m_clipboard.get(); }
virtual bool isClipboardEvent() const;
private:
- SharedPtr<ClipboardImpl> m_clipboard;
+ RefPtr<ClipboardImpl> m_clipboard;
};
// extension: mouse wheel event
private:
AtomicString m_eventType;
- SharedPtr<EventListener> m_listener;
+ RefPtr<EventListener> m_listener;
bool m_useCapture;
};
DOMString result() const { return m_result.get(); }
private:
- SharedPtr<DOMStringImpl> m_result;
+ RefPtr<DOMStringImpl> m_result;
};
} // namespace
&& a.endOffset(exception) == b.endOffset(exception);
}
-SharedPtr<RangeImpl> rangeOfContents(NodeImpl *node)
+RefPtr<RangeImpl> rangeOfContents(NodeImpl *node)
{
RangeImpl *range = new RangeImpl(node->getDocument());
int exception = 0;
range->selectNodeContents(node, exception);
- return SharedPtr<RangeImpl>(range);
+ return RefPtr<RangeImpl>(range);
}
}
#endif
protected:
- // FIXME - this could be a full-on SharedPtr in principle...
+ // FIXME - this could be a full-on RefPtr in principle...
DocPtr<DocumentImpl> m_ownerDocument;
NodeImpl *m_startContainer;
unsigned m_startOffset;
bool containedByReadOnly() const;
};
-SharedPtr<RangeImpl> rangeOfContents(NodeImpl *node);
+RefPtr<RangeImpl> rangeOfContents(NodeImpl *node);
bool operator==(const RangeImpl &, const RangeImpl &);
inline bool operator!=(const RangeImpl &a, const RangeImpl &b) { return !(a == b); }
if (!source)
return 0;
- SharedPtr<NodeImpl> protect(source);
+ RefPtr<NodeImpl> protect(source);
switch (source->nodeType()) {
case Node::ENTITY_NODE:
return false;
bool focusChangeBlocked = false;
- SharedPtr<NodeImpl> oldFocusNode = m_focusNode;
+ RefPtr<NodeImpl> oldFocusNode = m_focusNode;
m_focusNode = 0;
clearSelectionIfNeeded(newFocusNode);
{
// Use a TextIterator to visit the potentially multiple nodes the range covers.
for (TextIterator markedText(range); !markedText.atEnd(); markedText.advance()) {
- SharedPtr<RangeImpl> textPiece = markedText.range();
+ RefPtr<RangeImpl> textPiece = markedText.range();
int exception = 0;
DocumentMarker marker = {type, textPiece->startOffset(exception), textPiece->endOffset(exception)};
addMarker(textPiece->startContainer(exception), marker);
{
// Use a TextIterator to visit the potentially multiple nodes the range covers.
for (TextIterator markedText(range); !markedText.atEnd(); markedText.advance()) {
- SharedPtr<RangeImpl> textPiece = markedText.range();
+ RefPtr<RangeImpl> textPiece = markedText.range();
int exception = 0;
unsigned startOffset = textPiece->startOffset(exception);
unsigned length = textPiece->endOffset(exception) - startOffset + 1;
void DocumentImpl::applyXSLTransform(ProcessingInstructionImpl* pi)
{
- SharedPtr<XSLTProcessorImpl> processor = new XSLTProcessorImpl;
+ RefPtr<XSLTProcessorImpl> processor = new XSLTProcessorImpl;
processor->setXSLStylesheet(static_cast<XSLStyleSheetImpl*>(pi->sheet()));
QString resultMIMEType;
}
}
-SharedPtr<HTMLCollectionImpl> DocumentImpl::images()
+RefPtr<HTMLCollectionImpl> DocumentImpl::images()
{
- return SharedPtr<HTMLCollectionImpl>(new HTMLCollectionImpl(this, HTMLCollectionImpl::DOC_IMAGES));
+ return RefPtr<HTMLCollectionImpl>(new HTMLCollectionImpl(this, HTMLCollectionImpl::DOC_IMAGES));
}
-SharedPtr<HTMLCollectionImpl> DocumentImpl::applets()
+RefPtr<HTMLCollectionImpl> DocumentImpl::applets()
{
- return SharedPtr<HTMLCollectionImpl>(new HTMLCollectionImpl(this, HTMLCollectionImpl::DOC_APPLETS));
+ return RefPtr<HTMLCollectionImpl>(new HTMLCollectionImpl(this, HTMLCollectionImpl::DOC_APPLETS));
}
-SharedPtr<HTMLCollectionImpl> DocumentImpl::embeds()
+RefPtr<HTMLCollectionImpl> DocumentImpl::embeds()
{
- return SharedPtr<HTMLCollectionImpl>(new HTMLCollectionImpl(this, HTMLCollectionImpl::DOC_EMBEDS));
+ return RefPtr<HTMLCollectionImpl>(new HTMLCollectionImpl(this, HTMLCollectionImpl::DOC_EMBEDS));
}
-SharedPtr<HTMLCollectionImpl> DocumentImpl::objects()
+RefPtr<HTMLCollectionImpl> DocumentImpl::objects()
{
- return SharedPtr<HTMLCollectionImpl>(new HTMLCollectionImpl(this, HTMLCollectionImpl::DOC_OBJECTS));
+ return RefPtr<HTMLCollectionImpl>(new HTMLCollectionImpl(this, HTMLCollectionImpl::DOC_OBJECTS));
}
-SharedPtr<HTMLCollectionImpl> DocumentImpl::links()
+RefPtr<HTMLCollectionImpl> DocumentImpl::links()
{
- return SharedPtr<HTMLCollectionImpl>(new HTMLCollectionImpl(this, HTMLCollectionImpl::DOC_LINKS));
+ return RefPtr<HTMLCollectionImpl>(new HTMLCollectionImpl(this, HTMLCollectionImpl::DOC_LINKS));
}
-SharedPtr<HTMLCollectionImpl> DocumentImpl::forms()
+RefPtr<HTMLCollectionImpl> DocumentImpl::forms()
{
- return SharedPtr<HTMLCollectionImpl>(new HTMLCollectionImpl(this, HTMLCollectionImpl::DOC_FORMS));
+ return RefPtr<HTMLCollectionImpl>(new HTMLCollectionImpl(this, HTMLCollectionImpl::DOC_FORMS));
}
-SharedPtr<HTMLCollectionImpl> DocumentImpl::anchors()
+RefPtr<HTMLCollectionImpl> DocumentImpl::anchors()
{
- return SharedPtr<HTMLCollectionImpl>(new HTMLCollectionImpl(this, HTMLCollectionImpl::DOC_ANCHORS));
+ return RefPtr<HTMLCollectionImpl>(new HTMLCollectionImpl(this, HTMLCollectionImpl::DOC_ANCHORS));
}
-SharedPtr<HTMLCollectionImpl> DocumentImpl::all()
+RefPtr<HTMLCollectionImpl> DocumentImpl::all()
{
- return SharedPtr<HTMLCollectionImpl>(new HTMLCollectionImpl(this, HTMLCollectionImpl::DOC_ALL));
+ return RefPtr<HTMLCollectionImpl>(new HTMLCollectionImpl(this, HTMLCollectionImpl::DOC_ALL));
}
-SharedPtr<HTMLCollectionImpl> DocumentImpl::windowNamedItems(DOMString &name)
+RefPtr<HTMLCollectionImpl> DocumentImpl::windowNamedItems(DOMString &name)
{
- return SharedPtr<HTMLCollectionImpl>(new HTMLNameCollectionImpl(this, HTMLCollectionImpl::WINDOW_NAMED_ITEMS, name));
+ return RefPtr<HTMLCollectionImpl>(new HTMLNameCollectionImpl(this, HTMLCollectionImpl::WINDOW_NAMED_ITEMS, name));
}
-SharedPtr<HTMLCollectionImpl> DocumentImpl::documentNamedItems(DOMString &name)
+RefPtr<HTMLCollectionImpl> DocumentImpl::documentNamedItems(DOMString &name)
{
- return SharedPtr<HTMLCollectionImpl>(new HTMLNameCollectionImpl(this, HTMLCollectionImpl::DOCUMENT_NAMED_ITEMS, name));
+ return RefPtr<HTMLCollectionImpl>(new HTMLNameCollectionImpl(this, HTMLCollectionImpl::DOCUMENT_NAMED_ITEMS, name));
}
-SharedPtr<NameNodeListImpl> DocumentImpl::getElementsByName(const DOMString &elementName)
+RefPtr<NameNodeListImpl> DocumentImpl::getElementsByName(const DOMString &elementName)
{
- return SharedPtr<NameNodeListImpl>(new NameNodeListImpl(this, elementName));
+ return RefPtr<NameNodeListImpl>(new NameNodeListImpl(this, elementName));
}
// ----------------------------------------------------------------------------
NodeImpl *adoptNode(NodeImpl *source, int &exceptioncode);
- SharedPtr<NameNodeListImpl> getElementsByName(const DOMString &elementName);
+ RefPtr<NameNodeListImpl> getElementsByName(const DOMString &elementName);
// Actually part of HTMLDocument, but used for giving XML documents a window title as well
DOMString title() const { return m_title; }
void setTitle(DOMString, NodeImpl *titleElement = 0);
void removeTitle(NodeImpl *titleElement);
- SharedPtr<HTMLCollectionImpl> images();
- SharedPtr<HTMLCollectionImpl> embeds();
- SharedPtr<HTMLCollectionImpl> applets();
- SharedPtr<HTMLCollectionImpl> links();
- SharedPtr<HTMLCollectionImpl> forms();
- SharedPtr<HTMLCollectionImpl> anchors();
- SharedPtr<HTMLCollectionImpl> all();
- SharedPtr<HTMLCollectionImpl> objects();
- SharedPtr<HTMLCollectionImpl> windowNamedItems(DOMString &name);
- SharedPtr<HTMLCollectionImpl> documentNamedItems(DOMString &name);
+ RefPtr<HTMLCollectionImpl> images();
+ RefPtr<HTMLCollectionImpl> embeds();
+ RefPtr<HTMLCollectionImpl> applets();
+ RefPtr<HTMLCollectionImpl> links();
+ RefPtr<HTMLCollectionImpl> forms();
+ RefPtr<HTMLCollectionImpl> anchors();
+ RefPtr<HTMLCollectionImpl> all();
+ RefPtr<HTMLCollectionImpl> objects();
+ RefPtr<HTMLCollectionImpl> windowNamedItems(DOMString &name);
+ RefPtr<HTMLCollectionImpl> documentNamedItems(DOMString &name);
// DOM methods overridden from parent classes
void applyXSLTransform(ProcessingInstructionImpl* pi);
void setTransformSource(void* doc) { m_transformSource = doc; }
const void* transformSource() { return m_transformSource; }
- SharedPtr<DocumentImpl> transformSourceDocument() { return m_transformSourceDocument; }
+ RefPtr<DocumentImpl> transformSourceDocument() { return m_transformSourceDocument; }
void setTransformSourceDocument(DocumentImpl *doc) { m_transformSourceDocument = doc; }
#endif
QString m_baseURL;
QString m_baseTarget;
- SharedPtr<DocumentTypeImpl> m_docType;
+ RefPtr<DocumentTypeImpl> m_docType;
DOMImplementationImpl *m_implementation;
StyleSheetImpl *m_sheet;
QColor m_textColor;
- SharedPtr<NodeImpl> m_focusNode;
- SharedPtr<NodeImpl> m_hoverNode;
- SharedPtr<NodeImpl> m_activeNode;
+ RefPtr<NodeImpl> m_focusNode;
+ RefPtr<NodeImpl> m_hoverNode;
+ RefPtr<NodeImpl> m_activeNode;
unsigned int m_domtree_version;
DOMString m_title;
bool m_titleSetExplicitly;
- SharedPtr<NodeImpl> m_titleElement;
+ RefPtr<NodeImpl> m_titleElement;
RenderArena* m_renderArena;
#ifdef KHTML_XSLT
void *m_transformSource;
- SharedPtr<DocumentImpl> m_transformSourceDocument;
+ RefPtr<DocumentImpl> m_transformSourceDocument;
#endif
#ifndef KHTML_NO_XBL
virtual DOMString toString() const;
private:
- SharedPtr<DOMImplementationImpl> m_implementation;
- SharedPtr<NamedNodeMapImpl> m_entities;
- SharedPtr<NamedNodeMapImpl> m_notations;
+ RefPtr<DOMImplementationImpl> m_implementation;
+ RefPtr<NamedNodeMapImpl> m_entities;
+ RefPtr<NamedNodeMapImpl> m_notations;
DOMString m_name;
DOMString m_publicId;
}
#endif
-SharedPtr<AttrImpl> ElementImpl::setAttributeNode(AttrImpl *attr, int &exception)
+RefPtr<AttrImpl> ElementImpl::setAttributeNode(AttrImpl *attr, int &exception)
{
return static_pointer_cast<AttrImpl>(attributes(false)->setNamedItem(attr, exception));
}
-SharedPtr<AttrImpl> ElementImpl::removeAttributeNode(AttrImpl *attr, int &exception)
+RefPtr<AttrImpl> ElementImpl::removeAttributeNode(AttrImpl *attr, int &exception)
{
if (!attr || attr->ownerElement() != this) {
exception = DOMException::NOT_FOUND_ERR;
- return SharedPtr<AttrImpl>();
+ return RefPtr<AttrImpl>();
}
if (getDocument() != attr->getDocument()) {
exception = DOMException::WRONG_DOCUMENT_ERR;
- return SharedPtr<AttrImpl>();
+ return RefPtr<AttrImpl>();
}
NamedAttrMapImpl *attrs = attributes(true);
if (!attrs)
- return SharedPtr<AttrImpl>();
+ return RefPtr<AttrImpl>();
return static_pointer_cast<AttrImpl>(attrs->removeNamedItem(attr->m_attribute->name(), exception));
}
return getNamedItem(QualifiedName(nullAtom, ln.impl(), namespaceURI.impl()));
}
-SharedPtr<NodeImpl> NamedAttrMapImpl::removeNamedItemNS(const DOMString &namespaceURI, const DOMString &localName, int &exception)
+RefPtr<NodeImpl> NamedAttrMapImpl::removeNamedItemNS(const DOMString &namespaceURI, const DOMString &localName, int &exception)
{
DOMString ln(localName);
if (element->getDocument()->isHTMLDocument())
return a->attrImpl();
}
-SharedPtr<NodeImpl> NamedAttrMapImpl::setNamedItem ( NodeImpl* arg, int &exceptioncode )
+RefPtr<NodeImpl> NamedAttrMapImpl::setNamedItem ( NodeImpl* arg, int &exceptioncode )
{
if (!element) {
exceptioncode = DOMException::NOT_FOUND_ERR;
- return SharedPtr<NodeImpl>();
+ return RefPtr<NodeImpl>();
}
// NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
if (isReadOnly()) {
exceptioncode = DOMException::NO_MODIFICATION_ALLOWED_ERR;
- return SharedPtr<NodeImpl>();
+ return RefPtr<NodeImpl>();
}
// WRONG_DOCUMENT_ERR: Raised if arg was created from a different document than the one that created this map.
if (arg->getDocument() != element->getDocument()) {
exceptioncode = DOMException::WRONG_DOCUMENT_ERR;
- return SharedPtr<NodeImpl>();
+ return RefPtr<NodeImpl>();
}
// Not mentioned in spec: throw a HIERARCHY_REQUEST_ERROR if the user passes in a non-attribute node
if (!arg->isAttributeNode()) {
exceptioncode = DOMException::HIERARCHY_REQUEST_ERR;
- return SharedPtr<NodeImpl>();
+ return RefPtr<NodeImpl>();
}
AttrImpl *attr = static_cast<AttrImpl*>(arg);
AttributeImpl* a = attr->attrImpl();
AttributeImpl* old = getAttributeItem(a->name());
if (old == a)
- return SharedPtr<NodeImpl>(arg); // we know about it already
+ return RefPtr<NodeImpl>(arg); // we know about it already
// INUSE_ATTRIBUTE_ERR: Raised if arg is an Attr that is already an attribute of another Element object.
// The DOM user must explicitly clone Attr nodes to re-use them in other elements.
if (attr->ownerElement()) {
exceptioncode = DOMException::INUSE_ATTRIBUTE_ERR;
- return SharedPtr<NodeImpl>();
+ return RefPtr<NodeImpl>();
}
if (a->name() == idAttr)
element->updateId(old ? old->value() : nullAtom, a->value());
// ### slightly inefficient - resizes attribute array twice.
- SharedPtr<NodeImpl> r;
+ RefPtr<NodeImpl> r;
if (old) {
if (!old->attrImpl())
old->allocateImpl(element);
// The DOM2 spec doesn't say that removeAttribute[NS] throws NOT_FOUND_ERR
// if the attribute is not found, but at this level we have to throw NOT_FOUND_ERR
// because of removeNamedItem, removeNamedItemNS, and removeAttributeNode.
-SharedPtr<NodeImpl> NamedAttrMapImpl::removeNamedItem(const QualifiedName& name, int &exceptioncode)
+RefPtr<NodeImpl> NamedAttrMapImpl::removeNamedItem(const QualifiedName& name, int &exceptioncode)
{
// ### should this really be raised when the attribute to remove isn't there at all?
// NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly
if (isReadOnly()) {
exceptioncode = DOMException::NO_MODIFICATION_ALLOWED_ERR;
- return SharedPtr<NodeImpl>();
+ return RefPtr<NodeImpl>();
}
AttributeImpl* a = getAttributeItem(name);
if (!a) {
exceptioncode = DOMException::NOT_FOUND_ERR;
- return SharedPtr<NodeImpl>();
+ return RefPtr<NodeImpl>();
}
if (!a->attrImpl()) a->allocateImpl(element);
- SharedPtr<NodeImpl> r(a->attrImpl());
+ RefPtr<NodeImpl> r(a->attrImpl());
if (name == idAttr)
element->updateId(a->value(), nullAtom);
AttrImpl *getAttributeNode(const DOMString &name) { return getAttributeNodeNS(DOMString(), name); }
AttrImpl *getAttributeNodeNS(const DOMString &namespaceURI, const DOMString &localName);
- SharedPtr<AttrImpl> setAttributeNode(AttrImpl *newAttr, int &exception);
- SharedPtr<AttrImpl> setAttributeNodeNS(AttrImpl *newAttr, int &exception) { return setAttributeNode(newAttr, exception); }
- SharedPtr<AttrImpl> removeAttributeNode(AttrImpl *oldAttr, int &exception);
+ RefPtr<AttrImpl> setAttributeNode(AttrImpl *newAttr, int &exception);
+ RefPtr<AttrImpl> setAttributeNodeNS(AttrImpl *newAttr, int &exception) { return setAttributeNode(newAttr, exception); }
+ RefPtr<AttrImpl> removeAttributeNode(AttrImpl *oldAttr, int &exception);
virtual CSSStyleDeclarationImpl *style();
// DOM methods & attributes for NamedNodeMap
virtual NodeImpl *getNamedItemNS(const DOMString &namespaceURI, const DOMString &localName) const;
- virtual SharedPtr<NodeImpl> removeNamedItemNS(const DOMString &namespaceURI, const DOMString &localName, int &exception);
+ virtual RefPtr<NodeImpl> removeNamedItemNS(const DOMString &namespaceURI, const DOMString &localName, int &exception);
virtual AttrImpl* getNamedItem(const QualifiedName& name) const;
- virtual SharedPtr<NodeImpl> removeNamedItem(const QualifiedName& name, int &exceptioncode);
- virtual SharedPtr<NodeImpl> setNamedItem(NodeImpl* arg, int &exceptioncode);
+ virtual RefPtr<NodeImpl> removeNamedItem(const QualifiedName& name, int &exceptioncode);
+ virtual RefPtr<NodeImpl> setNamedItem(NodeImpl* arg, int &exceptioncode);
virtual AttrImpl *item ( unsigned index ) const;
unsigned length() const { return len; }
// be default nodeValue is null, so setting it has no effect
}
-SharedPtr<NodeListImpl> NodeImpl::childNodes()
+RefPtr<NodeListImpl> NodeImpl::childNodes()
{
- return SharedPtr<NodeListImpl>(new ChildNodeListImpl(this));
+ return RefPtr<NodeListImpl>(new ChildNodeListImpl(this));
}
NodeImpl *NodeImpl::firstChild() const
{
assert(!eventDispatchForbidden());
int exceptioncode = 0;
- SharedPtr<EventImpl> evt = new EventImpl(eventType, canBubbleArg, cancelableArg);
- SharedPtr<DocumentImpl> doc = getDocument();
+ RefPtr<EventImpl> evt = new EventImpl(eventType, canBubbleArg, cancelableArg);
+ RefPtr<DocumentImpl> doc = getDocument();
evt->setTarget(doc.get());
bool r = dispatchGenericEvent(evt.get(), exceptioncode);
if (!evt->defaultPrevented() && doc)
// Dispatching the first event can easily result in this node being destroyed.
// Since we dispatch up to three events here, we need to make sure we're referenced
// so the pointer will be good for the two subsequent ones.
- SharedPtr<NodeImpl> protect(this);
+ RefPtr<NodeImpl> protect(this);
bool cancelable = eventType != mousemoveEvent;
// FIXME: End of obviously misplaced HTML editing functions. Try to move these out of NodeImpl.
-SharedPtr<NodeListImpl> NodeImpl::getElementsByTagNameNS(const DOMString &namespaceURI, const DOMString &localName)
+RefPtr<NodeListImpl> NodeImpl::getElementsByTagNameNS(const DOMString &namespaceURI, const DOMString &localName)
{
if (namespaceURI.isNull() || localName.isNull())
- return SharedPtr<NodeListImpl>(); // FIXME: Who cares about this additional check?
+ return RefPtr<NodeListImpl>(); // FIXME: Who cares about this additional check?
DOMString name = localName;
if (getDocument()->isHTMLDocument())
name = localName.lower();
- return SharedPtr<NodeListImpl>(new TagNodeListImpl(this, AtomicString(namespaceURI), AtomicString(name)));
+ return RefPtr<NodeListImpl>(new TagNodeListImpl(this, AtomicString(namespaceURI), AtomicString(name)));
}
bool NodeImpl::isSupported(const DOMString &feature, const DOMString &version)
if(!refChild)
return appendChild(newChild, exceptioncode);
- SharedPtr<NodeImpl> protectNewChild(newChild); // make sure the new child is ref'd and deref'd so we don't leak it
+ RefPtr<NodeImpl> protectNewChild(newChild); // make sure the new child is ref'd and deref'd so we don't leak it
// Make sure adding the new child is ok
checkAddChild(newChild, exceptioncode);
{
exceptioncode = 0;
- SharedPtr<NodeImpl> protectNewChild(newChild); // make sure the new child is ref'd and deref'd so we don't leak it
+ RefPtr<NodeImpl> protectNewChild(newChild); // make sure the new child is ref'd and deref'd so we don't leak it
if ( oldChild == newChild ) // nothing to do
return oldChild;
{
exceptioncode = 0;
- SharedPtr<NodeImpl> protectNewChild(newChild); // make sure the new child is ref'd and deref'd so we don't leak it
+ RefPtr<NodeImpl> protectNewChild(newChild); // make sure the new child is ref'd and deref'd so we don't leak it
// Make sure adding the new child is ok
checkAddChild(newChild, exceptioncode);
{
// do not add applyChanges here! This function is only used during parsing
- SharedPtr<NodeImpl> protectNewChild(newChild); // make sure the new child is ref'd and deref'd so we don't leak it
+ RefPtr<NodeImpl> protectNewChild(newChild); // make sure the new child is ref'd and deref'd so we don't leak it
// short check for consistency with DTD
if (getDocument()->isHTMLDocument() && !childAllowed(newChild))
NodeImpl *parentNode() const { return parent(); }
NodeImpl *previousSibling() const { return m_previous; }
NodeImpl *nextSibling() const { return m_next; }
- virtual SharedPtr<NodeListImpl> childNodes();
+ virtual RefPtr<NodeListImpl> childNodes();
virtual NodeImpl *firstChild() const;
virtual NodeImpl *lastChild() const;
virtual bool hasAttributes() const;
MouseEventType type;
DOMString url; // url under mouse or empty
DOMString target;
- SharedPtr<NodeImpl> innerNode;
+ RefPtr<NodeImpl> innerNode;
};
// for LINK and STYLE
void notifyNodeListsAttributeChanged();
void notifyLocalNodeListsAttributeChanged();
- SharedPtr<NodeListImpl> getElementsByTagName(const DOMString &name) { return getElementsByTagNameNS("*", name); }
- SharedPtr<NodeListImpl> getElementsByTagNameNS(const DOMString &namespaceURI, const DOMString &localName);
+ RefPtr<NodeListImpl> getElementsByTagName(const DOMString &name) { return getElementsByTagNameNS("*", name); }
+ RefPtr<NodeListImpl> getElementsByTagNameNS(const DOMString &namespaceURI, const DOMString &localName);
private: // members
DocPtr<DocumentImpl> document;
virtual ~NamedNodeMapImpl() {}
NodeImpl *getNamedItem(const DOMString &name) const { return getNamedItemNS(DOMString(), name); }
- SharedPtr<NodeImpl> removeNamedItem(const DOMString &name, int &exception) { return removeNamedItemNS(DOMString(), name, exception); }
+ RefPtr<NodeImpl> removeNamedItem(const DOMString &name, int &exception) { return removeNamedItemNS(DOMString(), name, exception); }
virtual NodeImpl *getNamedItemNS(const DOMString &namespaceURI, const DOMString &localName) const = 0;
- SharedPtr<NodeImpl> setNamedItemNS(NodeImpl *arg, int &exception) { return setNamedItem(arg, exception); }
- virtual SharedPtr<NodeImpl> removeNamedItemNS(const DOMString &namespaceURI, const DOMString &localName, int &exception) = 0;
+ RefPtr<NodeImpl> setNamedItemNS(NodeImpl *arg, int &exception) { return setNamedItem(arg, exception); }
+ virtual RefPtr<NodeImpl> removeNamedItemNS(const DOMString &namespaceURI, const DOMString &localName, int &exception) = 0;
// DOM methods & attributes for NamedNodeMap
virtual NodeImpl *getNamedItem(const QualifiedName& attrName) const = 0;
- virtual SharedPtr<NodeImpl> removeNamedItem (const QualifiedName& attrName, int &exceptioncode) = 0;
- virtual SharedPtr<NodeImpl> setNamedItem (NodeImpl* arg, int &exceptioncode) = 0;
+ virtual RefPtr<NodeImpl> removeNamedItem (const QualifiedName& attrName, int &exceptioncode) = 0;
+ virtual RefPtr<NodeImpl> setNamedItem (NodeImpl* arg, int &exceptioncode) = 0;
virtual NodeImpl *item ( unsigned index ) const = 0;
virtual unsigned length( ) const = 0;
DOMStringImpl *m_data;
DOMStringImpl *m_localHref;
khtml::CachedObject *m_cachedSheet;
- SharedPtr<StyleSheetImpl> m_sheet;
+ RefPtr<StyleSheetImpl> m_sheet;
bool m_loading;
#ifdef KHTML_XSLT
bool m_isXSL;
}
-SharedPtr<DocumentImpl> XSLTProcessorImpl::createDocumentFromSource(const QString &sourceString, const QString &sourceMIMEType, NodeImpl *sourceNode, KHTMLView *view)
+RefPtr<DocumentImpl> XSLTProcessorImpl::createDocumentFromSource(const QString &sourceString, const QString &sourceMIMEType, NodeImpl *sourceNode, KHTMLView *view)
{
- SharedPtr<DocumentImpl> ownerDocument = sourceNode->getDocument();
+ RefPtr<DocumentImpl> ownerDocument = sourceNode->getDocument();
bool sourceIsDocument = (sourceNode == ownerDocument.get());
QString documentSource = sourceString;
- SharedPtr<DocumentImpl> result;
+ RefPtr<DocumentImpl> result;
if (sourceMIMEType == "text/html")
result = ownerDocument->implementation()->createHTMLDocument(view);
else {
return result;
}
-static inline SharedPtr<DocumentFragmentImpl> createFragmentFromSource(QString sourceString, QString sourceMIMEType, NodeImpl *sourceNode, DocumentImpl *ouputDoc)
+static inline RefPtr<DocumentFragmentImpl> createFragmentFromSource(QString sourceString, QString sourceMIMEType, NodeImpl *sourceNode, DocumentImpl *ouputDoc)
{
- SharedPtr<DocumentFragmentImpl> fragment = new DocumentFragmentImpl(ouputDoc);
+ RefPtr<DocumentFragmentImpl> fragment = new DocumentFragmentImpl(ouputDoc);
if (sourceMIMEType == "text/html")
parseHTMLDocumentFragment(sourceString, fragment.get());
return fragment;
}
-static xsltStylesheetPtr xsltStylesheetPointer(SharedPtr<XSLStyleSheetImpl> &cachedStylesheet, NodeImpl *stylesheetRootNode)
+static xsltStylesheetPtr xsltStylesheetPointer(RefPtr<XSLStyleSheetImpl> &cachedStylesheet, NodeImpl *stylesheetRootNode)
{
if (!cachedStylesheet && stylesheetRootNode) {
cachedStylesheet = new XSLStyleSheetImpl(stylesheetRootNode->parent() ? stylesheetRootNode->parent() : stylesheetRootNode);
static inline xmlDocPtr xmlDocPtrFromNode(NodeImpl *sourceNode)
{
- SharedPtr<DocumentImpl> ownerDocument = sourceNode->getDocument();
+ RefPtr<DocumentImpl> ownerDocument = sourceNode->getDocument();
bool sourceIsDocument = (sourceNode == ownerDocument.get());
xmlDocPtr sourceDoc = 0;
bool XSLTProcessorImpl::transformToString(NodeImpl *sourceNode, QString &mimeType, QString &resultString)
{
- SharedPtr<DocumentImpl> ownerDocument = sourceNode->getDocument();
- SharedPtr<XSLStyleSheetImpl> cachedStylesheet = m_stylesheet;
+ RefPtr<DocumentImpl> ownerDocument = sourceNode->getDocument();
+ RefPtr<XSLStyleSheetImpl> cachedStylesheet = m_stylesheet;
setXSLTLoadCallBack(stylesheetLoadFunc, this, ownerDocument->docLoader());
xsltStylesheetPtr sheet = xsltStylesheetPointer(cachedStylesheet, m_stylesheetRootNode.get());
return true;
}
-SharedPtr<DocumentImpl> XSLTProcessorImpl::transformToDocument(NodeImpl *sourceNode)
+RefPtr<DocumentImpl> XSLTProcessorImpl::transformToDocument(NodeImpl *sourceNode)
{
QString resultMIMEType;
QString resultString;
return createDocumentFromSource(resultString, resultMIMEType, sourceNode);
}
-SharedPtr<DocumentFragmentImpl> XSLTProcessorImpl::transformToFragment(NodeImpl *sourceNode, DocumentImpl *outputDoc)
+RefPtr<DocumentFragmentImpl> XSLTProcessorImpl::transformToFragment(NodeImpl *sourceNode, DocumentImpl *outputDoc)
{
QString resultMIMEType;
QString resultString;
m_parameters.replace(DOMString(localName).qstring(), new DOMString(value));
}
-SharedPtr<DOMStringImpl> XSLTProcessorImpl::getParameter(DOMStringImpl *namespaceURI, DOMStringImpl *localName) const
+RefPtr<DOMStringImpl> XSLTProcessorImpl::getParameter(DOMStringImpl *namespaceURI, DOMStringImpl *localName) const
{
// FIXME: namespace support?
if (DOMString *value = m_parameters.find(DOMString(localName).qstring()))
void setXSLStylesheet(XSLStyleSheetImpl *styleSheet) { m_stylesheet = styleSheet; }
bool transformToString(NodeImpl *source, QString &resultMIMEType, QString &resultString);
- SharedPtr<DocumentImpl> createDocumentFromSource(const QString &source, const QString &sourceMIMEType, NodeImpl *sourceNode, KHTMLView *view = 0);
+ RefPtr<DocumentImpl> createDocumentFromSource(const QString &source, const QString &sourceMIMEType, NodeImpl *sourceNode, KHTMLView *view = 0);
// DOM methods
void importStylesheet(NodeImpl *style) { m_stylesheetRootNode = style; }
- SharedPtr<DocumentFragmentImpl> transformToFragment(NodeImpl *source, DocumentImpl *ouputDoc);
- SharedPtr<DocumentImpl> transformToDocument(NodeImpl *source);
+ RefPtr<DocumentFragmentImpl> transformToFragment(NodeImpl *source, DocumentImpl *ouputDoc);
+ RefPtr<DocumentImpl> transformToDocument(NodeImpl *source);
void setParameter(DOMStringImpl *namespaceURI, DOMStringImpl *localName, DOMStringImpl *value);
- SharedPtr<DOMStringImpl> getParameter(DOMStringImpl *namespaceURI, DOMStringImpl *localName) const;
+ RefPtr<DOMStringImpl> getParameter(DOMStringImpl *namespaceURI, DOMStringImpl *localName) const;
void removeParameter(DOMStringImpl *namespaceURI, DOMStringImpl *localName);
void clearParameters() { m_parameters.clear(); }
private:
// Convert a libxml doc ptr to a KHTML DOM Document
- SharedPtr<DocumentImpl> documentFromXMLDocPtr(xmlDocPtr resultDoc, xsltStylesheetPtr sheet, DocumentImpl *ownerDocument, bool sourceIsDocument);
+ RefPtr<DocumentImpl> documentFromXMLDocPtr(xmlDocPtr resultDoc, xsltStylesheetPtr sheet, DocumentImpl *ownerDocument, bool sourceIsDocument);
- SharedPtr<XSLStyleSheetImpl> m_stylesheet;
- SharedPtr<NodeImpl> m_stylesheetRootNode;
+ RefPtr<XSLStyleSheetImpl> m_stylesheet;
+ RefPtr<NodeImpl> m_stylesheetRootNode;
QDict<DOMString> m_parameters;
};
DOM::DOMString m_effectAllowed;
QPoint m_dragLoc;
QPixmap m_dragImage;
- SharedPtr<DOM::NodeImpl> m_dragImageElement;
+ RefPtr<DOM::NodeImpl> m_dragImageElement;
AccessPolicy m_policy;
int m_changeCount;
bool m_dragStarted;
WebScriptObject *_windowScriptObject;
NPObject *_windowScriptNPObject;
- SharedPtr<DOM::NodeImpl> _dragSrc; // element that may be a drag source, for the current mouse gesture
+ RefPtr<DOM::NodeImpl> _dragSrc; // element that may be a drag source, for the current mouse gesture
bool _dragSrcIsLink;
bool _dragSrcIsImage;
bool _dragSrcInSelection;
bool _dragSrcIsDHTML;
KWQClipboard *_dragClipboard; // used on only the source side of dragging
- mutable SharedPtr<DOM::NodeImpl> _elementToDraw;
+ mutable RefPtr<DOM::NodeImpl> _elementToDraw;
- SharedPtr<DOM::RangeImpl> m_markedTextRange;
+ RefPtr<DOM::RangeImpl> m_markedTextRange;
bool m_markedTextUsesUnderlines;
QValueList<MarkedTextUnderline> m_markedTextUnderlines;
}
// Initially search from the start (if forward) or end (if backward) of the selection, and search to edge of document.
- SharedPtr<RangeImpl> searchRange(rangeOfContents(xmlDocImpl()));
+ RefPtr<RangeImpl> searchRange(rangeOfContents(xmlDocImpl()));
if (selectionStart()) {
if (forward) {
setStart(searchRange.get(), VisiblePosition(selection().start(), selection().endAffinity()));
setEnd(searchRange.get(), VisiblePosition(selection().end(), selection().startAffinity()));
}
}
- SharedPtr<RangeImpl> resultRange(findPlainText(searchRange.get(), target, forward, caseFlag));
+ RefPtr<RangeImpl> resultRange(findPlainText(searchRange.get(), target, forward, caseFlag));
// If we re-found the (non-empty) selected range, then search again starting just past the selected range.
if (selectionStart() && *resultRange == *selection().toRange()) {
// Start at the end of the selection, search to edge of document. Starting at the selection end makes
// repeated "check spelling" commands work.
- SharedPtr<RangeImpl> searchRange(rangeOfContents(xmlDocImpl()));
+ RefPtr<RangeImpl> searchRange(rangeOfContents(xmlDocImpl()));
bool startedWithSelection = false;
if (selectionStart()) {
startedWithSelection = true;
if (misspelling.length > 0) {
// Build up result range and string. Note the misspelling may span many text nodes,
// but the CharIterator insulates us from this complexity
- SharedPtr<RangeImpl> misspellingRange(rangeOfContents(xmlDocImpl()));
+ RefPtr<RangeImpl> misspellingRange(rangeOfContents(xmlDocImpl()));
CharacterIterator chars(it.range().get());
chars.advance(misspelling.location);
misspellingRange->setStart(chars.range()->startContainer(exception), chars.range()->startOffset(exception), exception);
NSFont *font = nil;
- SharedPtr<RangeImpl> range = d->m_selection.toRange();
+ RefPtr<RangeImpl> range = d->m_selection.toRange();
NodeImpl *startNode = range->editingStartPosition().node();
if (startNode != nil) {
NodeImpl *pastEnd = range->pastEndNode();
if (![_bridge isContinuousSpellCheckingEnabled])
return;
- SharedPtr<RangeImpl> searchRange(selection.toRange());
+ RefPtr<RangeImpl> searchRange(selection.toRange());
if (searchRange.isNull() || searchRange->isDetached())
return;
else {
// Build up result range and string. Note the misspelling may span many text nodes,
// but the CharIterator insulates us from this complexity
- SharedPtr<RangeImpl> misspellingRange(rangeOfContents(xmlDocImpl()));
+ RefPtr<RangeImpl> misspellingRange(rangeOfContents(xmlDocImpl()));
CharacterIterator chars(it.range().get());
chars.advance(misspelling.location);
misspellingRange->setStart(chars.range()->startContainer(exception), chars.range()->startOffset(exception), exception);
if (![_bridge canRunBeforeUnloadConfirmPanel])
return true;
- SharedPtr<DocumentImpl> document = xmlDocImpl();
+ RefPtr<DocumentImpl> document = xmlDocImpl();
if (!document)
return true;
HTMLElementImpl* body = document->body();
if (!body)
return true;
- SharedPtr<BeforeUnloadEventImpl> event = new BeforeUnloadEventImpl;
+ RefPtr<BeforeUnloadEventImpl> event = new BeforeUnloadEventImpl;
event->setTarget(document.get());
int exception = 0;
body->dispatchGenericEvent(event.get(), exception);
return NSMakeRange(NSNotFound, 0);
}
- SharedPtr<RangeImpl> fromStartRange(_part->xmlDocImpl()->createRange());
+ RefPtr<RangeImpl> fromStartRange(_part->xmlDocImpl()->createRange());
int exception = 0;
fromStartRange->setEnd(range->startContainer(exception), range->startOffset(exception), exception);