[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 07:38:10 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 57c7376088fb76c663244f6571f1063fabc2a472
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Apr 23 17:24:21 2003 +0000
Reviewed by Ken.
- fixed 3237301 -- REGRESSION: text fields with size greater than maxlength are sized according to maxlength
* kwq/KWQLineEdit.mm: (QLineEdit::sizeForCharacterWidth): Override the maximum length
for this operation.
- fixed 3236961 -- setting innerHTML with input elements doesn't set up value properly
To fix this, I rolled in the changes from the trunk of KHTML development that get rid of
the init() function and do the work in either attach() or insertedIntoDocument() instead.
* khtml/html/html_baseimpl.h: Removed init overrides, added insertedIntoDocument override.
* khtml/html/html_baseimpl.cpp:
(HTMLBodyElementImpl::insertedIntoDocument): Moved HTMLBodyElementImpl::init code here.
(HTMLFrameElementImpl::attach): Moved HTMLFrameElementImpl::init code here.
(HTMLFrameSetElementImpl::attach): Moved HTMLFrameSetElementImpl::init code here.
* khtml/html/html_formimpl.h: Added m_inited flag, removed init overrides, removed unused
m_encCharset field.
* khtml/html/html_formimpl.cpp:
(HTMLFormElementImpl::formData): Removed code that set m_encCharset.
(HTMLFormElementImpl::setEnctype): Removed code that set m_encCharset.
(HTMLInputElementImpl::HTMLInputElementImpl): Initialize m_inited to false.
(HTMLInputElementImpl::attach): Moved HTMLInputElementImpl::init code here, guarded by
m_inited.
(HTMLSelectElementImpl::attach): Moved HTMLSelectElementImpl::init code here.
(HTMLTextAreaElementImpl::attach): Moved HTMLTextAreaElementImpl::init code here.
* khtml/xml/dom_nodeimpl.h: Removed init.
* khtml/xml/dom_nodeimpl.cpp: Removed init.
* khtml/html/htmlparser.cpp: (KHTMLParser::insertNode): Removed calls to init.
* khtml/xml/xml_tokenizer.cpp:
(XMLHandler::startElement): Removed call to init.
(XMLHandler::startCDATA): Removed call to init.
(XMLHandler::exitText): Removed call to init.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@4160 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 2950f5a..097f128 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,43 @@
+2003-04-23 Darin Adler <darin at apple.com>
+
+ Reviewed by Ken.
+
+ - fixed 3237301 -- REGRESSION: text fields with size greater than maxlength are sized according to maxlength
+
+ * kwq/KWQLineEdit.mm: (QLineEdit::sizeForCharacterWidth): Override the maximum length
+ for this operation.
+
+ - fixed 3236961 -- setting innerHTML with input elements doesn't set up value properly
+
+ To fix this, I rolled in the changes from the trunk of KHTML development that get rid of
+ the init() function and do the work in either attach() or insertedIntoDocument() instead.
+
+ * khtml/html/html_baseimpl.h: Removed init overrides, added insertedIntoDocument override.
+ * khtml/html/html_baseimpl.cpp:
+ (HTMLBodyElementImpl::insertedIntoDocument): Moved HTMLBodyElementImpl::init code here.
+ (HTMLFrameElementImpl::attach): Moved HTMLFrameElementImpl::init code here.
+ (HTMLFrameSetElementImpl::attach): Moved HTMLFrameSetElementImpl::init code here.
+
+ * khtml/html/html_formimpl.h: Added m_inited flag, removed init overrides, removed unused
+ m_encCharset field.
+ * khtml/html/html_formimpl.cpp:
+ (HTMLFormElementImpl::formData): Removed code that set m_encCharset.
+ (HTMLFormElementImpl::setEnctype): Removed code that set m_encCharset.
+ (HTMLInputElementImpl::HTMLInputElementImpl): Initialize m_inited to false.
+ (HTMLInputElementImpl::attach): Moved HTMLInputElementImpl::init code here, guarded by
+ m_inited.
+ (HTMLSelectElementImpl::attach): Moved HTMLSelectElementImpl::init code here.
+ (HTMLTextAreaElementImpl::attach): Moved HTMLTextAreaElementImpl::init code here.
+
+ * khtml/xml/dom_nodeimpl.h: Removed init.
+ * khtml/xml/dom_nodeimpl.cpp: Removed init.
+
+ * khtml/html/htmlparser.cpp: (KHTMLParser::insertNode): Removed calls to init.
+ * khtml/xml/xml_tokenizer.cpp:
+ (XMLHandler::startElement): Removed call to init.
+ (XMLHandler::startCDATA): Removed call to init.
+ (XMLHandler::exitText): Removed call to init.
+
2003-04-22 Darin Adler <darin at apple.com>
Reviewed by Maciej.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 2950f5a..097f128 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,43 @@
+2003-04-23 Darin Adler <darin at apple.com>
+
+ Reviewed by Ken.
+
+ - fixed 3237301 -- REGRESSION: text fields with size greater than maxlength are sized according to maxlength
+
+ * kwq/KWQLineEdit.mm: (QLineEdit::sizeForCharacterWidth): Override the maximum length
+ for this operation.
+
+ - fixed 3236961 -- setting innerHTML with input elements doesn't set up value properly
+
+ To fix this, I rolled in the changes from the trunk of KHTML development that get rid of
+ the init() function and do the work in either attach() or insertedIntoDocument() instead.
+
+ * khtml/html/html_baseimpl.h: Removed init overrides, added insertedIntoDocument override.
+ * khtml/html/html_baseimpl.cpp:
+ (HTMLBodyElementImpl::insertedIntoDocument): Moved HTMLBodyElementImpl::init code here.
+ (HTMLFrameElementImpl::attach): Moved HTMLFrameElementImpl::init code here.
+ (HTMLFrameSetElementImpl::attach): Moved HTMLFrameSetElementImpl::init code here.
+
+ * khtml/html/html_formimpl.h: Added m_inited flag, removed init overrides, removed unused
+ m_encCharset field.
+ * khtml/html/html_formimpl.cpp:
+ (HTMLFormElementImpl::formData): Removed code that set m_encCharset.
+ (HTMLFormElementImpl::setEnctype): Removed code that set m_encCharset.
+ (HTMLInputElementImpl::HTMLInputElementImpl): Initialize m_inited to false.
+ (HTMLInputElementImpl::attach): Moved HTMLInputElementImpl::init code here, guarded by
+ m_inited.
+ (HTMLSelectElementImpl::attach): Moved HTMLSelectElementImpl::init code here.
+ (HTMLTextAreaElementImpl::attach): Moved HTMLTextAreaElementImpl::init code here.
+
+ * khtml/xml/dom_nodeimpl.h: Removed init.
+ * khtml/xml/dom_nodeimpl.cpp: Removed init.
+
+ * khtml/html/htmlparser.cpp: (KHTMLParser::insertNode): Removed calls to init.
+ * khtml/xml/xml_tokenizer.cpp:
+ (XMLHandler::startElement): Removed call to init.
+ (XMLHandler::startCDATA): Removed call to init.
+ (XMLHandler::exitText): Removed call to init.
+
2003-04-22 Darin Adler <darin at apple.com>
Reviewed by Maciej.
diff --git a/WebCore/khtml/html/html_baseimpl.cpp b/WebCore/khtml/html/html_baseimpl.cpp
index 1fbebe6..f4aaaff 100644
--- a/WebCore/khtml/html/html_baseimpl.cpp
+++ b/WebCore/khtml/html/html_baseimpl.cpp
@@ -157,9 +157,9 @@ void HTMLBodyElementImpl::parseAttribute(AttributeImpl *attr)
}
}
-void HTMLBodyElementImpl::init()
+void HTMLBodyElementImpl::insertedIntoDocument()
{
- HTMLElementImpl::init();
+ HTMLElementImpl::insertedIntoDocument();
KHTMLView* w = getDocument()->view();
if(w->marginWidth() != -1) {
@@ -357,10 +357,19 @@ void HTMLFrameElementImpl::parseAttribute(AttributeImpl *attr)
}
}
-void HTMLFrameElementImpl::init()
+bool HTMLFrameElementImpl::rendererIsNeeded(RenderStyle *style)
{
- HTMLElementImpl::init();
+ // Ignore display: none.
+ return isURLAllowed(url);
+}
+RenderObject *HTMLFrameElementImpl::createRenderer(RenderArena *arena, RenderStyle *style)
+{
+ return new (arena) RenderFrame(this);
+}
+
+void HTMLFrameElementImpl::attach()
+{
// we should first look up via id, then via name.
// this shortterm hack fixes the ugly case. ### rewrite needed for next release
name = getAttribute(ATTR_NAME);
@@ -380,21 +389,7 @@ void HTMLFrameElementImpl::init()
}
node = static_cast<HTMLElementImpl*>(node->parentNode());
}
-}
-bool HTMLFrameElementImpl::rendererIsNeeded(RenderStyle *style)
-{
- // Ignore display: none.
- return isURLAllowed(url);
-}
-
-RenderObject *HTMLFrameElementImpl::createRenderer(RenderArena *arena, RenderStyle *style)
-{
- return new (arena) RenderFrame(this);
-}
-
-void HTMLFrameElementImpl::attach()
-{
createRendererIfNeeded();
NodeBaseImpl::attach();
@@ -551,10 +546,19 @@ void HTMLFrameSetElementImpl::parseAttribute(AttributeImpl *attr)
}
}
-void HTMLFrameSetElementImpl::init()
+bool HTMLFrameSetElementImpl::rendererIsNeeded(RenderStyle *style)
{
- HTMLElementImpl::init();
+ // Ignore display: none but do pay attention if a stylesheet has caused us to delay our loading.
+ return style->isStyleAvailable();
+}
+RenderObject *HTMLFrameSetElementImpl::createRenderer(RenderArena *arena, RenderStyle *style)
+{
+ return new (arena) RenderFrameSet(this);
+}
+
+void HTMLFrameSetElementImpl::attach()
+{
// inherit default settings from parent frameset
HTMLElementImpl* node = static_cast<HTMLElementImpl*>(parentNode());
while(node)
@@ -568,21 +572,7 @@ void HTMLFrameSetElementImpl::init()
}
node = static_cast<HTMLElementImpl*>(node->parentNode());
}
-}
-bool HTMLFrameSetElementImpl::rendererIsNeeded(RenderStyle *style)
-{
- // Ignore display: none but do pay attention if a stylesheet has caused us to delay our loading.
- return style->isStyleAvailable();
-}
-
-RenderObject *HTMLFrameSetElementImpl::createRenderer(RenderArena *arena, RenderStyle *style)
-{
- return new (arena) RenderFrameSet(this);
-}
-
-void HTMLFrameSetElementImpl::attach()
-{
createRendererIfNeeded();
NodeBaseImpl::attach();
}
diff --git a/WebCore/khtml/html/html_baseimpl.h b/WebCore/khtml/html/html_baseimpl.h
index dfb684f..fcdb349 100644
--- a/WebCore/khtml/html/html_baseimpl.h
+++ b/WebCore/khtml/html/html_baseimpl.h
@@ -57,7 +57,7 @@ public:
virtual Id id() const;
virtual void parseAttribute(AttributeImpl *);
- virtual void init();
+ virtual void insertedIntoDocument();
virtual void attach();
virtual khtml::RenderObject *createRenderer(RenderArena *, khtml::RenderStyle *);
@@ -84,7 +84,6 @@ public:
virtual Id id() const;
virtual void parseAttribute(AttributeImpl *);
- virtual void init();
virtual void attach();
virtual void detach();
virtual bool rendererIsNeeded(khtml::RenderStyle *);
@@ -135,7 +134,6 @@ public:
virtual Id id() const;
virtual void parseAttribute(AttributeImpl *);
- virtual void init();
virtual void attach();
virtual bool rendererIsNeeded(khtml::RenderStyle *);
virtual khtml::RenderObject *createRenderer(RenderArena *, khtml::RenderStyle *);
diff --git a/WebCore/khtml/html/html_formimpl.cpp b/WebCore/khtml/html/html_formimpl.cpp
index ea17c0a..7b4fa0f 100644
--- a/WebCore/khtml/html/html_formimpl.cpp
+++ b/WebCore/khtml/html/html_formimpl.cpp
@@ -314,18 +314,6 @@ QByteArray HTMLFormElementImpl::formData(bool& ok)
if(!codec)
codec = QTextCodec::codecForLocale();
-#if APPLE_CHANGES
- QString encCharset = codec->name();
- QChar encChars[encCharset.length()];
- for(unsigned int i=0; i < encCharset.length(); i++)
- encChars[i] = encCharset[i].latin1() == ' ' ? QChar('-') : encCharset[i].lower();
- QString m_encCharset(encChars, encCharset.length());
-#else /* APPLE_CHANGES not defined */
- m_encCharset = codec->name();
- for(unsigned int i=0; i < m_encCharset.length(); i++)
- m_encCharset[i] = m_encCharset[i].latin1() == ' ' ? QChar('-') : m_encCharset[i].lower();
-#endif /* APPLE_CHANGES not defined */
-
QStringList fileUploads;
for (QPtrListIterator<HTMLGenericFormElementImpl> it(formElements); it.current(); ++it) {
@@ -452,7 +440,6 @@ void HTMLFormElementImpl::setEnctype( const DOMString& type )
m_enctype = "application/x-www-form-urlencoded";
m_multipart = false;
}
- m_encCharset = QString::null;
}
void HTMLFormElementImpl::setBoundary( const DOMString& bound )
@@ -1085,6 +1072,7 @@ HTMLInputElementImpl::HTMLInputElementImpl(DocumentPtr *doc, HTMLFormElementImpl
m_haveType = false;
m_activeSubmit = false;
m_autocomplete = true;
+ m_inited = false;
xPos = 0;
yPos = 0;
@@ -1174,7 +1162,7 @@ QString HTMLInputElementImpl::state( )
switch (m_type) {
case CHECKBOX:
case RADIO:
- return state + QString::fromLatin1(m_checked ? "on" : "off");
+ return state + (m_checked ? "on" : "off");
default:
return state + value().string()+'.'; // Make sure the string is not empty!
}
@@ -1190,7 +1178,7 @@ void HTMLInputElementImpl::restoreState(QStringList &states)
switch (m_type) {
case CHECKBOX:
case RADIO:
- setChecked((state == QString::fromLatin1("on")));
+ setChecked((state == "on"));
break;
default:
setValue(DOMString(state.left(state.length()-1)));
@@ -1291,44 +1279,6 @@ void HTMLInputElementImpl::parseAttribute(AttributeImpl *attr)
}
}
-void HTMLInputElementImpl::init()
-{
- HTMLGenericFormElementImpl::init();
-
- // make sure we don't inherit a color to the form elements
- // by adding a non-CSS color property. this his higher
- // priority than inherited color, but lesser priority than
- // any color specified by CSS for the elements.
- switch( m_type ) {
- case TEXT:
- case PASSWORD:
- case ISINDEX:
- case FILE:
- addCSSProperty(CSS_PROP_COLOR, "text");
- break;
- case SUBMIT:
- case RESET:
- case BUTTON:
- case CHECKBOX:
- case RADIO:
- addCSSProperty(CSS_PROP_COLOR, "buttontext" );
- case HIDDEN:
- case IMAGE:
- break;
- };
- if (m_type != FILE) m_value = getAttribute(ATTR_VALUE);
- if ((uint) m_type <= ISINDEX && !m_value.isEmpty()) {
- QString value = m_value.string();
- // remove newline stuff..
- QString nvalue;
- for (unsigned int i = 0; i < value.length(); ++i)
- if (value[i] >= ' ')
- nvalue += value[i];
- m_value = nvalue;
- }
- m_checked = (getAttribute(ATTR_CHECKED) != 0);
-}
-
bool HTMLInputElementImpl::rendererIsNeeded(RenderStyle *style)
{
switch(m_type)
@@ -1371,16 +1321,57 @@ RenderObject *HTMLInputElementImpl::createRenderer(RenderArena *arena, RenderSty
void HTMLInputElementImpl::attach()
{
- // We had to wait until the attach call to do this, because we don't yet know
- // our type in parseAttribute. This also has to be done *before* we do
- // styleForElement, or the width info will not get used. This fixes
- // spinner.com on the PLT -dwh.
- if (m_type == IMAGE && parentNode()->renderer()) {
- DOMString width = getAttribute( ATTR_WIDTH );
- if (!width.isEmpty())
- addCSSLength(CSS_PROP_WIDTH, width);
+ if (!m_inited) {
+ setType(getAttribute(ATTR_TYPE));
+
+ if (m_type != FILE) m_value = getAttribute(ATTR_VALUE);
+ if ((uint) m_type <= ISINDEX && !m_value.isEmpty()) {
+ QString value = m_value.string();
+ // remove newline stuff..
+ QString nvalue;
+ for (unsigned int i = 0; i < value.length(); ++i)
+ if (value[i] >= ' ')
+ nvalue += value[i];
+ m_value = nvalue;
+ }
+
+ removeCheckedRadioButtonFromDocument();
+ m_checked = (getAttribute(ATTR_CHECKED) != 0);
+ addCheckedRadioButtonToDocument();
+
+ m_inited = true;
}
-
+
+ // make sure we don't inherit a color to the form elements
+ // by adding a non-CSS color property. this his higher
+ // priority than inherited color, but lesser priority than
+ // any color specified by CSS for the elements.
+ switch( m_type ) {
+ case TEXT:
+ case PASSWORD:
+#if !APPLE_CHANGES
+ addCSSProperty(CSS_PROP_FONT_FAMILY, CSS_VAL_MONOSPACE);
+#endif
+ /* nobreak */
+ case ISINDEX:
+ case FILE:
+ addCSSProperty(CSS_PROP_COLOR, "text");
+ break;
+ case SUBMIT:
+ case RESET:
+ case BUTTON:
+ case CHECKBOX:
+ case RADIO:
+ addCSSProperty(CSS_PROP_COLOR, "buttontext");
+ // FIXME: There was no break here in the original KHTML. Was that intentional?
+ break;
+ case HIDDEN:
+ case IMAGE:
+ if (!getAttribute(ATTR_WIDTH).isEmpty())
+ addCSSLength(CSS_PROP_WIDTH, getAttribute(ATTR_WIDTH));
+ break;
+ }
+
createRendererIfNeeded();
HTMLGenericFormElementImpl::attach();
@@ -2030,13 +2021,6 @@ void HTMLSelectElementImpl::parseAttribute(AttributeImpl *attr)
}
}
-void HTMLSelectElementImpl::init()
-{
- HTMLGenericFormElementImpl::init();
-
- addCSSProperty(CSS_PROP_COLOR, "text");
-}
-
RenderObject *HTMLSelectElementImpl::createRenderer(RenderArena *arena, RenderStyle *style)
{
return new (arena) RenderSelect(this);
@@ -2044,6 +2028,8 @@ RenderObject *HTMLSelectElementImpl::createRenderer(RenderArena *arena, RenderSt
void HTMLSelectElementImpl::attach()
{
+ addCSSProperty(CSS_PROP_COLOR, "text");
+
createRendererIfNeeded();
HTMLGenericFormElementImpl::attach();
}
@@ -2532,13 +2518,6 @@ void HTMLTextAreaElementImpl::parseAttribute(AttributeImpl *attr)
}
}
-void HTMLTextAreaElementImpl::init()
-{
- HTMLGenericFormElementImpl::init();
-
- addCSSProperty(CSS_PROP_COLOR, "text");
-}
-
RenderObject *HTMLTextAreaElementImpl::createRenderer(RenderArena *arena, RenderStyle *style)
{
return new (arena) RenderTextArea(this);
@@ -2546,6 +2525,8 @@ RenderObject *HTMLTextAreaElementImpl::createRenderer(RenderArena *arena, Render
void HTMLTextAreaElementImpl::attach()
{
+ addCSSProperty(CSS_PROP_COLOR, "text");
+
createRendererIfNeeded();
HTMLGenericFormElementImpl::attach();
}
diff --git a/WebCore/khtml/html/html_formimpl.h b/WebCore/khtml/html/html_formimpl.h
index 557303a..14fcfdf 100644
--- a/WebCore/khtml/html/html_formimpl.h
+++ b/WebCore/khtml/html/html_formimpl.h
@@ -106,7 +106,6 @@ public:
DOMString m_enctype;
DOMString m_boundary;
DOMString m_acceptcharset;
- QString m_encCharset;
bool m_post : 1;
bool m_multipart : 1;
bool m_autocomplete : 1;
@@ -185,6 +184,8 @@ protected:
DOMStringImpl* m_name;
HTMLFormElementImpl *m_form;
bool m_disabled, m_readOnly;
+
+ bool m_inited : 1;
};
// -------------------------------------------------------------------------
@@ -293,7 +294,6 @@ public:
virtual void parseAttribute(AttributeImpl *attr);
virtual void setName(const DOMString& name);
- virtual void init();
virtual void attach();
virtual bool rendererIsNeeded(khtml::RenderStyle *);
virtual khtml::RenderObject *createRenderer(RenderArena *, khtml::RenderStyle *);
@@ -419,7 +419,6 @@ public:
virtual void parseAttribute(AttributeImpl *attr);
- virtual void init();
virtual void attach();
virtual khtml::RenderObject *createRenderer(RenderArena *, khtml::RenderStyle *);
virtual bool encoding(const QTextCodec*, khtml::encodingList&, bool);
@@ -561,7 +560,6 @@ public:
void select ( );
virtual void parseAttribute(AttributeImpl *attr);
- virtual void init();
virtual void attach();
virtual khtml::RenderObject *createRenderer(RenderArena *, khtml::RenderStyle *);
virtual bool encoding(const QTextCodec*, khtml::encodingList&, bool);
diff --git a/WebCore/khtml/html/htmlparser.cpp b/WebCore/khtml/html/htmlparser.cpp
index fa03082..7ee0635 100644
--- a/WebCore/khtml/html/htmlparser.cpp
+++ b/WebCore/khtml/html/htmlparser.cpp
@@ -332,26 +332,14 @@ bool KHTMLParser::insertNode(NodeImpl *n, bool flat)
else
current = newNode;
#if SPEED_DEBUG < 2
- if(!n->attached() && HTMLWidget ) {
- // ### get rid of init. it has no reason for existance.
- // those that do not support multiple attach() have to block it
- // (it only happens upon display: change on those elments, and those
- // are so special it won't be supported anyway. (think of <select> changed
- // into a <input> element. not possible.
- n->init();
- //
- if (!n->attached())
- n->attach();
- }
+ if(!n->attached() && HTMLWidget)
+ n->attach();
#endif
}
else {
#if SPEED_DEBUG < 2
- if(!n->attached() && HTMLWidget) {
- n->init();
- if (!n->attached())
- n->attach();
- }
+ if(!n->attached() && HTMLWidget)
+ n->attach();
if (n->maintainsState()) {
document->document()->registerMaintainsState(n);
QStringList &states = document->document()->restoreState();
@@ -401,13 +389,10 @@ bool KHTMLParser::insertNode(NodeImpl *n, bool flat)
if( head ) {
if ( head->addChild(n) ) {
#if SPEED_DEBUG < 2
- if(!n->attached() && HTMLWidget) {
- n->init();
- if (!n->attached())
+ if(!n->attached() && HTMLWidget)
n->attach();
- }
#endif
- return true;
+ return true;
} else {
return false;
}
@@ -442,11 +427,8 @@ bool KHTMLParser::insertNode(NodeImpl *n, bool flat)
pushBlock(id, tagPriority[id]);
current = newNode;
#if SPEED_DEBUG < 2
- if(!n->attached() && HTMLWidget) {
- n->init();
- if (!n->attached())
- n->attach();
- }
+ if(!n->attached() && HTMLWidget)
+ n->attach();
#endif
} else {
#ifdef PARSER_DEBUG
@@ -493,11 +475,8 @@ bool KHTMLParser::insertNode(NodeImpl *n, bool flat)
if ( strcasecmp( type, "hidden" ) == 0 && form) {
form->addChild(n);
#if SPEED_DEBUG < 2
- if(!n->attached() && HTMLWidget) {
- n->init();
- if (!n->attached())
- n->attach();
- }
+ if(!n->attached() && HTMLWidget)
+ n->attach();
#endif
return true;
}
@@ -528,11 +507,8 @@ bool KHTMLParser::insertNode(NodeImpl *n, bool flat)
{
map->addChild(n);
#if SPEED_DEBUG < 2
- if(!n->attached() && HTMLWidget) {
- n->init();
- if (!n->attached())
- n->attach();
- }
+ if(!n->attached() && HTMLWidget)
+ n->attach();
#endif
handled = true;
}
diff --git a/WebCore/khtml/xml/dom_nodeimpl.cpp b/WebCore/khtml/xml/dom_nodeimpl.cpp
index a39d277..3caa0f2 100644
--- a/WebCore/khtml/xml/dom_nodeimpl.cpp
+++ b/WebCore/khtml/xml/dom_nodeimpl.cpp
@@ -920,10 +920,6 @@ void NodeImpl::dump(QTextStream *stream, QString ind) const
}
#endif
-void NodeImpl::init()
-{
-}
-
void NodeImpl::closeRenderer()
{
// It's important that we close the renderer, even if it hasn't been
diff --git a/WebCore/khtml/xml/dom_nodeimpl.h b/WebCore/khtml/xml/dom_nodeimpl.h
index 15c2580..f2a75ff 100644
--- a/WebCore/khtml/xml/dom_nodeimpl.h
+++ b/WebCore/khtml/xml/dom_nodeimpl.h
@@ -283,16 +283,6 @@ public:
virtual void dump(QTextStream *stream, QString ind = "") const;
#endif
- /**
- * Performs any necessary initialization of the element based on attributes that have been set during parsing. This
- * method is called after the parser has finished parsing the element and inserted it into the tree, but before it
- * is attached to the rendering tree.
- *
- * This method will eventually be removed once all of the initialization that currently only works during parsing is
- * fixed to work with dynamic changes.
- */
- virtual void init();
-
// -----------------------------------------------------------------------------
// Integration with rendering tree
diff --git a/WebCore/khtml/xml/xml_tokenizer.cpp b/WebCore/khtml/xml/xml_tokenizer.cpp
index f1129be..fb7ecd7 100644
--- a/WebCore/khtml/xml/xml_tokenizer.cpp
+++ b/WebCore/khtml/xml/xml_tokenizer.cpp
@@ -94,11 +94,8 @@ bool XMLHandler::startElement( const QString& namespaceURI, const QString& /*loc
return false;
}
if (m_currentNode->addChild(newElement)) {
- if (m_view && !newElement->attached()) {
- newElement->init();
- if (!newElement->attached())
- newElement->attach();
- }
+ if (m_view && !newElement->attached())
+ newElement->attach();
m_currentNode = newElement;
return true;
}
@@ -134,11 +131,8 @@ bool XMLHandler::startCDATA()
NodeImpl *newNode = m_doc->document()->createCDATASection("");
if (m_currentNode->addChild(newNode)) {
- if (m_view && !newNode->attached()) {
- newNode->init();
- if (!newNode->attached())
- newNode->attach();
- }
+ if (m_view && !newNode->attached())
+ newNode->attach();
m_currentNode = newNode;
return true;
}
@@ -237,11 +231,8 @@ bool XMLHandler::enterText()
void XMLHandler::exitText()
{
- if (m_view && m_currentNode && !m_currentNode->attached()) {
- m_currentNode->init();
- if (!m_currentNode->attached())
- m_currentNode->attach();
- }
+ if (m_view && m_currentNode && !m_currentNode->attached())
+ m_currentNode->attach();
NodeImpl* par = m_currentNode->parentNode();
if (par != 0)
diff --git a/WebCore/kwq/KWQLineEdit.mm b/WebCore/kwq/KWQLineEdit.mm
index 1a62cda..1475579 100644
--- a/WebCore/kwq/KWQLineEdit.mm
+++ b/WebCore/kwq/KWQLineEdit.mm
@@ -125,19 +125,27 @@ void QLineEdit::setEdited(bool flag)
QSize QLineEdit::sizeForCharacterWidth(int numCharacters) const
{
+ // Figure out how big a text field needs to be for a given number of characters
+ // by installing a string with that number of characters (using "0" as the nominal
+ // character) and then asking the field's cell what the size should be.
+
+ KWQTextField *textField = (KWQTextField *)getView();
+
ASSERT(numCharacters > 0);
-
+
NSMutableString *nominalWidthString = [NSMutableString stringWithCapacity:numCharacters];
for (int i = 0; i < numCharacters; ++i) {
[nominalWidthString appendString:@"0"];
}
-
- KWQTextField *textField = (KWQTextField *)getView();
+
NSString *value = [textField stringValue];
+ int maximumLength = [textField maximumLength];
+ [textField setMaximumLength:numCharacters];
[textField setStringValue:nominalWidthString];
NSSize size = [[textField cell] cellSize];
+ [textField setMaximumLength:maximumLength];
[textField setStringValue:value];
-
+
return QSize(size);
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list