[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
darin
darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:40:51 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 311c3bd883232351b0c475c485d00281f2d31b3f
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu May 20 15:09:33 2004 +0000
Reviewed by Ken.
- fixed <rdar://problem/3661918>: "repro nil-deref in RenderImage::paint (www.codepoetry.net)"
* khtml/rendering/render_image.cpp: (RenderImage::paint): Check renderer pointer to see if it's
nil before dereferencing it.
- fixed <rdar://problem/3658455>: "readFromData:options:documentAttributes: crashes when passed page without a body (in WebKit mode)"
* kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::bodyBackgroundColor): Check renderer pointer to see if it's
nil before dereferencing it.
- fixed <rdar://problem/2948112>: "implement addRule for JavaScript for style sheets"
* khtml/dom/css_stylesheet.h: Added addRule.
* khtml/dom/css_stylesheet.cpp: (CSSStyleSheet::addRule): Added.
* khtml/css/css_stylesheetimpl.h: Added addRule.
* khtml/css/css_stylesheetimpl.cpp: (CSSStyleSheetImpl::addRule): Added an implementation
based on the Microsoft documentation. An index of -1 means "at the end of the list".
* khtml/dom/dom_string.h: Changed the string-append operator to be a non-member function
so it works even if the left side has to undergo type conversion.
* khtml/dom/dom_string.cpp: (DOM::operator+): Changed implementation to match above.
Also changed to not use anything private or protected so it doesn't have to be a friend.
* khtml/ecma/kjs_css.h: Added addRule to the list of functions for CSS style sheets.
* khtml/ecma/kjs_css.cpp: (DOMCSSStyleSheetProtoFunc::tryCall): Add support for addRule,
based on the Microsoft documentation; always returns -1. Also removed unused string conversions.
* khtml/ecma/kjs_css.lut.h: Regenerated.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6647 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 75b49a8..a84a338 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,35 @@
+2004-05-20 Darin Adler <darin at apple.com>
+
+ Reviewed by Ken.
+
+ - fixed <rdar://problem/3661918>: "repro nil-deref in RenderImage::paint (www.codepoetry.net)"
+
+ * khtml/rendering/render_image.cpp: (RenderImage::paint): Check renderer pointer to see if it's
+ nil before dereferencing it.
+
+ - fixed <rdar://problem/3658455>: "readFromData:options:documentAttributes: crashes when passed page without a body (in WebKit mode)"
+
+ * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::bodyBackgroundColor): Check renderer pointer to see if it's
+ nil before dereferencing it.
+
+ - fixed <rdar://problem/2948112>: "implement addRule for JavaScript for style sheets"
+
+ * khtml/dom/css_stylesheet.h: Added addRule.
+ * khtml/dom/css_stylesheet.cpp: (CSSStyleSheet::addRule): Added.
+ * khtml/css/css_stylesheetimpl.h: Added addRule.
+ * khtml/css/css_stylesheetimpl.cpp: (CSSStyleSheetImpl::addRule): Added an implementation
+ based on the Microsoft documentation. An index of -1 means "at the end of the list".
+
+ * khtml/dom/dom_string.h: Changed the string-append operator to be a non-member function
+ so it works even if the left side has to undergo type conversion.
+ * khtml/dom/dom_string.cpp: (DOM::operator+): Changed implementation to match above.
+ Also changed to not use anything private or protected so it doesn't have to be a friend.
+
+ * khtml/ecma/kjs_css.h: Added addRule to the list of functions for CSS style sheets.
+ * khtml/ecma/kjs_css.cpp: (DOMCSSStyleSheetProtoFunc::tryCall): Add support for addRule,
+ based on the Microsoft documentation; always returns -1. Also removed unused string conversions.
+ * khtml/ecma/kjs_css.lut.h: Regenerated.
+
2004-05-19 David Hyatt <hyatt at apple.com>
Implement support for notification posting to accessibility clients for layouts and loads.
diff --git a/WebCore/khtml/css/css_stylesheetimpl.cpp b/WebCore/khtml/css/css_stylesheetimpl.cpp
index 86e68ff..1f68357 100644
--- a/WebCore/khtml/css/css_stylesheetimpl.cpp
+++ b/WebCore/khtml/css/css_stylesheetimpl.cpp
@@ -2,6 +2,7 @@
* This file is part of the DOM implementation for KDE.
*
* (C) 1999-2003 Lars Knoll (knoll at kde.org)
+ * Copyright (C) 2004 Apple Computer, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -186,6 +187,13 @@ unsigned long CSSStyleSheetImpl::insertRule( const DOMString &rule, unsigned lon
return index;
}
+unsigned long CSSStyleSheetImpl::addRule( const DOMString &selector, const DOMString &style, long index, int &exceptioncode )
+{
+ if (index == -1)
+ index = m_lstChildren->count();
+ return insertRule(selector + " { " + style + " }", index, exceptioncode);
+}
+
CSSRuleList CSSStyleSheetImpl::cssRules()
{
return this;
diff --git a/WebCore/khtml/css/css_stylesheetimpl.h b/WebCore/khtml/css/css_stylesheetimpl.h
index e2d7b1c..b98f1f3 100644
--- a/WebCore/khtml/css/css_stylesheetimpl.h
+++ b/WebCore/khtml/css/css_stylesheetimpl.h
@@ -2,6 +2,7 @@
* This file is part of the DOM implementation for KDE.
*
* (C) 1999-2003 Lars Knoll (knoll at kde.org)
+ * Copyright (C) 2004 Apple Computer, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -99,6 +100,7 @@ public:
CSSRuleList cssRules();
unsigned long insertRule ( const DOM::DOMString &rule, unsigned long index, int &exceptioncode );
void deleteRule ( unsigned long index, int &exceptioncode );
+ unsigned long addRule ( const DOMString &selector, const DOMString &style, long index, int &exceptioncode );
void addNamespace(CSSParser* p, const DOM::DOMString& prefix, const DOM::DOMString& uri);
void determineNamespace(Q_UINT32& id, const DOM::DOMString& prefix);
diff --git a/WebCore/khtml/dom/css_stylesheet.cpp b/WebCore/khtml/dom/css_stylesheet.cpp
index 2f07daa..d06bb9b 100644
--- a/WebCore/khtml/dom/css_stylesheet.cpp
+++ b/WebCore/khtml/dom/css_stylesheet.cpp
@@ -2,7 +2,7 @@
* This file is part of the DOM implementation for KDE.
*
* (C) 1999 Lars Knoll (knoll at kde.org)
- * Copyright (C) 2003 Apple Computer, Inc.
+ * Copyright (C) 2004 Apple Computer, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -205,6 +205,18 @@ void CSSStyleSheet::deleteRule( unsigned long index )
throw DOMException( exceptioncode );
}
+void CSSStyleSheet::addRule( const DOMString &selector, const DOMString &style, long index )
+{
+ if (!impl)
+ return;
+ int exceptioncode = 0;
+ static_cast<CSSStyleSheetImpl *>(impl)->addRule( selector, style, index, exceptioncode );
+ if ( exceptioncode >= CSSException::_EXCEPTION_OFFSET )
+ throw CSSException( exceptioncode - CSSException::_EXCEPTION_OFFSET );
+ if ( exceptioncode )
+ throw DOMException( exceptioncode );
+}
+
StyleSheetList::StyleSheetList()
diff --git a/WebCore/khtml/dom/css_stylesheet.h b/WebCore/khtml/dom/css_stylesheet.h
index e64f8a5..ca40450 100644
--- a/WebCore/khtml/dom/css_stylesheet.h
+++ b/WebCore/khtml/dom/css_stylesheet.h
@@ -2,6 +2,7 @@
* This file is part of the DOM implementation for KDE.
*
* (C) 1999 Lars Knoll (knoll at kde.org)
+ * Copyright (C) 2004 Apple Computer, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -295,6 +296,9 @@ public:
*
*/
void deleteRule ( unsigned long index );
+
+ /* Microsoft extension. */
+ void addRule ( const DOMString &selector, const DOMString &style, long index );
};
diff --git a/WebCore/khtml/dom/dom_string.cpp b/WebCore/khtml/dom/dom_string.cpp
index cc11612..ea804b4 100644
--- a/WebCore/khtml/dom/dom_string.cpp
+++ b/WebCore/khtml/dom/dom_string.cpp
@@ -2,7 +2,7 @@
* This file is part of the DOM implementation for KDE.
*
* (C) 1999 Lars Knoll (knoll at kde.org)
- * Copyright (C) 2003 Apple Computer, Inc.
+ * Copyright (C) 2004 Apple Computer, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -24,7 +24,7 @@
#include "xml/dom_stringimpl.h"
-using namespace DOM;
+namespace DOM {
DOMString::DOMString(const QChar *str, uint len)
@@ -112,17 +112,15 @@ DOMString &DOMString::operator += (const DOMString &str)
return *this;
}
-DOMString DOMString::operator + (const DOMString &str)
+DOMString operator + (const DOMString &a, const DOMString &b)
{
- if(!impl) return str.copy();
- if(str.impl)
- {
- DOMString s = copy();
- s += str;
- return s;
- }
-
- return copy();
+ if (a.isEmpty())
+ return b.copy();
+ if (b.isEmpty())
+ return a.copy();
+ DOMString c = a.copy();
+ c += b;
+ return c;
}
void DOMString::insert(DOMString str, uint pos)
@@ -317,3 +315,6 @@ bool DOM::operator==( const DOMString &a, const char *b )
}
return *b == 0;
}
+
+
+}
diff --git a/WebCore/khtml/dom/dom_string.h b/WebCore/khtml/dom/dom_string.h
index fe68d5a..88e9855 100644
--- a/WebCore/khtml/dom/dom_string.h
+++ b/WebCore/khtml/dom/dom_string.h
@@ -2,6 +2,7 @@
* This file is part of the DOM implementation for KDE.
*
* (C) 1999 Lars Knoll (knoll at kde.org)
+ * Copyright (C) 2004 Apple Computer, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -68,10 +69,6 @@ public:
* append str to this string
*/
DOMString &operator += (const DOMString &str);
- /**
- * add two DOMString's
- */
- DOMString operator + (const DOMString &str);
void insert(DOMString str, uint pos);
@@ -127,6 +124,7 @@ protected:
DOMStringImpl *impl;
};
+DOMString operator + (const DOMString &a, const DOMString &b);
bool operator==( const DOMString &a, const QString &b );
bool operator==( const DOMString &a, const char *b );
inline bool operator==( const QString &b, const DOMString &a ) { return a == b; }
diff --git a/WebCore/khtml/ecma/kjs_css.cpp b/WebCore/khtml/ecma/kjs_css.cpp
index c765ffe..320b183 100644
--- a/WebCore/khtml/ecma/kjs_css.cpp
+++ b/WebCore/khtml/ecma/kjs_css.cpp
@@ -3,7 +3,7 @@
* This file is part of the KDE libraries
* Copyright (C) 2000 Harri Porten (porten at kde.org)
* Copyright (C) 2001 Peter Kelly (pmk at post.com)
- * Copyright (C) 2003 Apple Computer, Inc.
+ * Copyright (C) 2004 Apple Computer, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -481,15 +481,17 @@ Value KJS::DOMMediaListProtoFunc::tryCall(ExecState *exec, Object &thisObj, cons
const ClassInfo DOMCSSStyleSheet::info = { "CSSStyleSheet", 0, &DOMCSSStyleSheetTable, 0 };
/*
- at begin DOMCSSStyleSheetTable 2
+ at begin DOMCSSStyleSheetTable 5
ownerRule DOMCSSStyleSheet::OwnerRule DontDelete|ReadOnly
cssRules DOMCSSStyleSheet::CssRules DontDelete|ReadOnly
# MSIE extension
rules DOMCSSStyleSheet::Rules DontDelete|ReadOnly
@end
- at begin DOMCSSStyleSheetProtoTable 2
+ at begin DOMCSSStyleSheetProtoTable 6
insertRule DOMCSSStyleSheet::InsertRule DontDelete|Function 2
deleteRule DOMCSSStyleSheet::DeleteRule DontDelete|Function 1
+# MSIE extension
+ addRule DOMCSSStyleSheet::AddRule DontDelete|Function 2
@end
*/
DEFINE_PROTOTYPE("DOMCSSStyleSheet",DOMCSSStyleSheetProto)
@@ -522,20 +524,21 @@ Value DOMCSSStyleSheetProtoFunc::tryCall(ExecState *exec, Object &thisObj, const
}
DOM::CSSStyleSheet styleSheet = static_cast<DOMCSSStyleSheet *>(thisObj.imp())->toCSSStyleSheet();
Value result;
- UString str = args[0].toString(exec);
- DOM::DOMString s = str.string();
-
switch (id) {
case DOMCSSStyleSheet::InsertRule:
- result = Number(styleSheet.insertRule(args[0].toString(exec).string(),(long unsigned int)args[1].toInt32(exec)));
+ return Number(styleSheet.insertRule(args[0].toString(exec).string(),(long unsigned int)args[1].toInt32(exec)));
break;
case DOMCSSStyleSheet::DeleteRule:
styleSheet.deleteRule(args[0].toInt32(exec));
- break;
- default:
- result = Undefined();
+ return Undefined();
+ case DOMCSSStyleSheet::AddRule: {
+ long index = args.size() >= 3 ? args[2].toInt32(exec) : -1;
+ styleSheet.addRule(args[0].toString(exec).string(), args[1].toString(exec).string(), index);
+ // As per Microsoft documentation, always return -1.
+ return Number(-1);
+ }
}
- return result;
+ return Undefined();
}
// -------------------------------------------------------------------------
diff --git a/WebCore/khtml/ecma/kjs_css.h b/WebCore/khtml/ecma/kjs_css.h
index 09898a3..4136d2c 100644
--- a/WebCore/khtml/ecma/kjs_css.h
+++ b/WebCore/khtml/ecma/kjs_css.h
@@ -3,7 +3,7 @@
* This file is part of the KDE libraries
* Copyright (C) 2000 Harri Porten (porten at kde.org)
* Copyright (C) 2001 Peter Kelly (pmk at post.com)
- * Copyright (C) 2003 Apple Computer, Inc.
+ * Copyright (C) 2004 Apple Computer, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -119,7 +119,7 @@ namespace KJS {
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
enum { OwnerRule, CssRules, Rules,
- InsertRule, DeleteRule };
+ InsertRule, DeleteRule, AddRule };
DOM::CSSStyleSheet toCSSStyleSheet() const { return static_cast<DOM::CSSStyleSheet>(styleSheet); }
};
diff --git a/WebCore/khtml/ecma/kjs_css.lut.h b/WebCore/khtml/ecma/kjs_css.lut.h
index d86e669..6743ed0 100644
--- a/WebCore/khtml/ecma/kjs_css.lut.h
+++ b/WebCore/khtml/ecma/kjs_css.lut.h
@@ -89,12 +89,13 @@ const struct HashTable DOMMediaListProtoTable = { 2, 4, DOMMediaListProtoTableEn
namespace KJS {
const struct HashEntry DOMCSSStyleSheetTableEntries[] = {
+ { "rules", DOMCSSStyleSheet::Rules, DontDelete|ReadOnly, 0, 0 },
+ { 0, 0, 0, 0, 0 },
{ "cssRules", DOMCSSStyleSheet::CssRules, DontDelete|ReadOnly, 0, 0 },
- { "ownerRule", DOMCSSStyleSheet::OwnerRule, DontDelete|ReadOnly, 0, &DOMCSSStyleSheetTableEntries[2] },
- { "rules", DOMCSSStyleSheet::Rules, DontDelete|ReadOnly, 0, 0 }
+ { "ownerRule", DOMCSSStyleSheet::OwnerRule, DontDelete|ReadOnly, 0, 0 },
};
-const struct HashTable DOMCSSStyleSheetTable = { 2, 3, DOMCSSStyleSheetTableEntries, 2 };
+const struct HashTable DOMCSSStyleSheetTable = { 2, 5, DOMCSSStyleSheetTableEntries, 5 };
} // namespace
@@ -102,11 +103,15 @@ namespace KJS {
const struct HashEntry DOMCSSStyleSheetProtoTableEntries[] = {
{ 0, 0, 0, 0, 0 },
- { "insertRule", DOMCSSStyleSheet::InsertRule, DontDelete|Function, 2, &DOMCSSStyleSheetProtoTableEntries[2] },
- { "deleteRule", DOMCSSStyleSheet::DeleteRule, DontDelete|Function, 1, 0 }
+ { "insertRule", DOMCSSStyleSheet::InsertRule, DontDelete|Function, 2, 0 },
+ { 0, 0, 0, 0, 0 },
+ { "deleteRule", DOMCSSStyleSheet::DeleteRule, DontDelete|Function, 1, &DOMCSSStyleSheetProtoTableEntries[6] },
+ { 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0 },
+ { "addRule", DOMCSSStyleSheet::AddRule, DontDelete|Function, 2, 0 }
};
-const struct HashTable DOMCSSStyleSheetProtoTable = { 2, 3, DOMCSSStyleSheetProtoTableEntries, 2 };
+const struct HashTable DOMCSSStyleSheetProtoTable = { 2, 7, DOMCSSStyleSheetProtoTableEntries, 6 };
} // namespace
diff --git a/WebCore/khtml/rendering/render_image.cpp b/WebCore/khtml/rendering/render_image.cpp
index 1a2c995..f87614b 100644
--- a/WebCore/khtml/rendering/render_image.cpp
+++ b/WebCore/khtml/rendering/render_image.cpp
@@ -463,7 +463,7 @@ void RenderImage::paint(PaintInfo& i, int _tx, int _ty)
// p->drawPixmap( offs.x(), y, pix, rect.x(), rect.y(), rect.width(), rect.height() );
- HTMLImageElementImpl* i = element()->id() == ID_IMG ? static_cast<HTMLImageElementImpl*>(element()) : 0;
+ HTMLImageElementImpl* i = (element() && element()->id() == ID_IMG) ? static_cast<HTMLImageElementImpl*>(element()) : 0;
if (i && !i->compositeOperator().isNull()){
p->drawPixmap (offs, pix, rect, i->compositeOperator());
}
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index 49f512c..8235c6f 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -2826,16 +2826,13 @@ QChar KWQKHTMLPart::backslashAsCurrencySymbol() const
return codec->backslashAsCurrencySymbol();
}
-NSColor *KWQKHTMLPart::bodyBackgroundColor(void) const
+NSColor *KWQKHTMLPart::bodyBackgroundColor() const
{
- HTMLDocumentImpl *doc = docImpl();
-
- if (doc){
- HTMLElementImpl *body = doc->body();
- QColor bgColor = body->renderer()->style()->backgroundColor();
-
- if (bgColor.isValid())
+ if (docImpl() && docImpl()->body() && docImpl()->body()->renderer()) {
+ QColor bgColor = docImpl()->body()->renderer()->style()->backgroundColor();
+ if (bgColor.isValid()) {
return bgColor.getNSColor();
+ }
}
return nil;
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list