[webkit-changes] cvs commit: WebCore/khtml/ecma kjs_dom.cpp
kjs_dom.h
Maciej
mjs at opensource.apple.com
Tue Nov 29 01:07:59 PST 2005
mjs 05/11/29 01:07:58
Modified: . ChangeLog
. ChangeLog
khtml/ecma kjs_dom.cpp kjs_dom.h
Added: fast/dom/Document document-charset-expected.txt
document-charset.html
Log:
LayoutTests:
Reviewed by Darin. Commited by Maciej.
- test case for http://bugzilla.opendarwin.org/show_bug.cgi?id=5715
(document.charset, document.defaultCharset, and document.characterSet are not supported)
* fast/dom/Document/document-charset-expected.txt: Added.
* fast/dom/Document/document-charset.html: Added.
WebCore:
Reviewed by Darin. Commited by Maciej.
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5715
(document.charset, document.defaultCharset, and document.characterSet are not supported)
* khtml/ecma/kjs_dom.cpp:
(KJS::DOMDocument::getValueProperty):
(KJS::DOMDocument::putValueProperty):
* khtml/ecma/kjs_dom.h:
(KJS::DOMDocument::):
Revision Changes Path
1.108 +10 -0 LayoutTests/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/LayoutTests/ChangeLog,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -r1.107 -r1.108
--- ChangeLog 29 Nov 2005 01:35:18 -0000 1.107
+++ ChangeLog 29 Nov 2005 09:07:52 -0000 1.108
@@ -1,3 +1,13 @@
+2005-11-28 Alexey Proskuryakov <ap at nypop.com>
+
+ Reviewed by Darin. Commited by Maciej.
+
+ - test case for http://bugzilla.opendarwin.org/show_bug.cgi?id=5715
+ (document.charset, document.defaultCharset, and document.characterSet are not supported)
+
+ * fast/dom/Document/document-charset-expected.txt: Added.
+ * fast/dom/Document/document-charset.html: Added.
+
2005-11-28 Justin Garcia <justin.garcia at apple.com>
Fixed/added layout tests for:
1.1 LayoutTests/fast/dom/Document/document-charset-expected.txt
Index: document-charset-expected.txt
===================================================================
Initial
 document.charset: KOI8-R
 document.defaultCharset: defined
 document.characterSet: KOI8-R
 document.inputEncoding: KOI8-R
 document.actualEncoding: KOI8-R
Setting charset to UTF-8...
 document.charset: UTF-8
 document.defaultCharset: defined
 document.characterSet: UTF-8
 document.inputEncoding: UTF-8
 document.actualEncoding: UTF-8
Setting characterSet to KOI8-R (expected to fail, matching Firefox)...
 document.charset: UTF-8
 document.defaultCharset: defined
 document.characterSet: UTF-8
 document.inputEncoding: UTF-8
 document.actualEncoding: UTF-8
1.1 LayoutTests/fast/dom/Document/document-charset.html
Index: document-charset.html
===================================================================
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=koi8-r">
</head>
<body>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
document.write("<p>Initial</p>");
document.write("<p> document.charset: " + document.charset + "</p>"); // MSIE
document.write("<p> document.defaultCharset: " + (document.defaultCharset ? "defined" : "undefined") + "</p>"); // MSIE
document.write("<p> document.characterSet: " + document.characterSet + "</p>"); // Firefox
document.write("<p> document.inputEncoding: " + document.inputEncoding + "</p>"); // DOM3
document.write("<p> document.actualEncoding: " + document.actualEncoding + "</p>"); // Firefox, old DOM3 draft
document.write("<p>Setting charset to UTF-8...</p>");
try {
document.charset = "utf-8";
document.write("<p> document.charset: " + document.charset + "</p>");
document.write("<p> document.defaultCharset: " + (document.defaultCharset ? "defined" : "undefined") + "</p>");
document.write("<p> document.characterSet: " + document.characterSet + "</p>");
document.write("<p> document.inputEncoding: " + document.inputEncoding + "</p>");
document.write("<p> document.actualEncoding: " + document.actualEncoding + "</p>");
} catch (ex) {
document.write("<p>Failure</p>");
}
// throws an exception in Firefox, but JavaScriptCore seems to silently ignore assignment to read-only properties
document.write("<p>Setting characterSet to KOI8-R (expected to fail, matching Firefox)...</p>");
try {
document.characterSet = "KOI8-R";
document.write("<p> document.charset: " + document.charset + "</p>");
document.write("<p> document.defaultCharset: " + (document.defaultCharset ? "defined" : "undefined") + "</p>");
document.write("<p> document.characterSet: " + document.characterSet + "</p>");
document.write("<p> document.inputEncoding: " + document.inputEncoding + "</p>");
document.write("<p> document.actualEncoding: " + document.actualEncoding + "</p>");
} catch (ex) {
document.write("<p>Failure (expected)</p>");
}
</script>
</body>
<html>
1.418 +13 -0 WebCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebCore/ChangeLog,v
retrieving revision 1.417
retrieving revision 1.418
diff -u -r1.417 -r1.418
--- ChangeLog 29 Nov 2005 02:11:35 -0000 1.417
+++ ChangeLog 29 Nov 2005 09:07:53 -0000 1.418
@@ -1,3 +1,16 @@
+2005-11-28 Alexey Proskuryakov <ap at nypop.com>
+
+ Reviewed by Darin. Commited by Maciej.
+
+ - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5715
+ (document.charset, document.defaultCharset, and document.characterSet are not supported)
+
+ * khtml/ecma/kjs_dom.cpp:
+ (KJS::DOMDocument::getValueProperty):
+ (KJS::DOMDocument::putValueProperty):
+ * khtml/ecma/kjs_dom.h:
+ (KJS::DOMDocument::):
+
2005-11-28 Eric Seidel <eseidel at apple.com>
* ChangeLog: added bug numbers for last two commits.
1.113 +21 -2 WebCore/khtml/ecma/kjs_dom.cpp
Index: kjs_dom.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/kjs_dom.cpp,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -r1.112 -r1.113
--- kjs_dom.cpp 27 Nov 2005 02:06:58 -0000 1.112
+++ kjs_dom.cpp 29 Nov 2005 09:07:57 -0000 1.113
@@ -920,6 +920,11 @@
doctype DOMDocument::DocType DontDelete|ReadOnly
implementation DOMDocument::Implementation DontDelete|ReadOnly
documentElement DOMDocument::DocumentElement DontDelete|ReadOnly
+ charset DOMDocument::Charset DontDelete
+ defaultCharset DOMDocument::DefaultCharset DontDelete|ReadOnly
+ characterSet DOMDocument::CharacterSet DontDelete|ReadOnly
+ actualEncoding DOMDocument::ActualEncoding DontDelete|ReadOnly
+ inputEncoding DOMDocument::InputEncoding DontDelete|ReadOnly
styleSheets DOMDocument::StyleSheets DontDelete|ReadOnly
preferredStylesheetSet DOMDocument::PreferredStylesheetSet DontDelete|ReadOnly
selectedStylesheetSet DOMDocument::SelectedStylesheetSet DontDelete
@@ -960,6 +965,18 @@
return getDOMDOMImplementation(exec, doc.implementation());
case DocumentElement:
return getDOMNode(exec,doc.documentElement());
+ case Charset:
+ case CharacterSet:
+ case ActualEncoding:
+ case InputEncoding:
+ khtml::Decoder* decoder = doc.decoder();
+ if (decoder)
+ return String(doc.decoder()->encoding());
+ return Null();
+ case DefaultCharset:
+ if (KHTMLPart* part = doc.part())
+ return String(part->settings()->encoding());
+ return Undefined();
case StyleSheets:
//kdDebug() << "DOMDocument::StyleSheets, returning " << doc.styleSheets().length() << " stylesheets" << endl;
return getDOMStyleSheetList(exec, doc.styleSheets(), &doc);
@@ -996,10 +1013,12 @@
{
DocumentImpl &doc = *static_cast<DocumentImpl *>(impl());
switch (token) {
- case SelectedStylesheetSet: {
+ case SelectedStylesheetSet:
doc.setSelectedStylesheetSet(value->toString(exec).domString());
break;
- }
+ case Charset:
+ doc.decoder()->setEncoding(value->toString(exec).cstring().c_str(), khtml::Decoder::UserChosenEncoding);
+ break;
}
}
1.60 +2 -1 WebCore/khtml/ecma/kjs_dom.h
Index: kjs_dom.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/kjs_dom.h,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -r1.59 -r1.60
--- kjs_dom.h 23 Nov 2005 09:46:54 -0000 1.59
+++ kjs_dom.h 29 Nov 2005 09:07:57 -0000 1.60
@@ -122,7 +122,8 @@
void putValueProperty(ExecState *exec, int token, ValueImp *value, int attr);
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
- enum { DocType, Implementation, DocumentElement,
+ enum { DocType, Implementation, DocumentElement,
+ Charset, DefaultCharset, CharacterSet, ActualEncoding, InputEncoding,
// Functions
AdoptNode,
CreateElement, CreateDocumentFragment, CreateTextNode, CreateComment,
More information about the webkit-changes
mailing list