Commit aed62356 authored by darin's avatar darin

- fixed 3100895 -- REGRESSION: Assertion on http://www.w3.org/Style/CSS/

	A few arena-related fixes.

        * khtml/rendering/bidi.h: Don't define the operator new without the arena parameter.
	That way, we get a link failure if we use it by accident, rather than an assert at runtime.
	It would be even better to get a compile-time error, but I don't know how to make that happen.
        * khtml/rendering/render_layer.h: Ditto.
        * khtml/rendering/render_object.h: Ditto.
        * khtml/rendering/render_text.h: Ditto.

        * khtml/rendering/render_container.cpp:
        (RenderContainer::addChild): Create the RenderTable with the appropriate arena.
        (RenderContainer::insertPseudoChild): Create the RenderFlow objects with the appropriate arena.

        * khtml/rendering/render_text.cpp: (RenderText::deleteSlaves): Don't try to get the arena
	when there are no slaves. This can happen after the element is nil, and in that case we will
	do a nil-dereference.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2665 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 9aa61f37
2002-11-13 Darin Adler <darin@apple.com>
- fixed 3100895 -- REGRESSION: Assertion on http://www.w3.org/Style/CSS/
A few arena-related fixes.
* khtml/rendering/bidi.h: Don't define the operator new without the arena parameter.
That way, we get a link failure if we use it by accident, rather than an assert at runtime.
It would be even better to get a compile-time error, but I don't know how to make that happen.
* khtml/rendering/render_layer.h: Ditto.
* khtml/rendering/render_object.h: Ditto.
* khtml/rendering/render_text.h: Ditto.
* khtml/rendering/render_container.cpp:
(RenderContainer::addChild): Create the RenderTable with the appropriate arena.
(RenderContainer::insertPseudoChild): Create the RenderFlow objects with the appropriate arena.
* khtml/rendering/render_text.cpp: (RenderText::deleteSlaves): Don't try to get the arena
when there are no slaves. This can happen after the element is nil, and in that case we will
do a nil-dereference.
2002-11-13 Darin Adler <darin@apple.com>
* kwq/KWQLineEdit.mm: (QLineEdit::sizeForCharacterWidth):
......
2002-11-13 Darin Adler <darin@apple.com>
- fixed 3100895 -- REGRESSION: Assertion on http://www.w3.org/Style/CSS/
A few arena-related fixes.
* khtml/rendering/bidi.h: Don't define the operator new without the arena parameter.
That way, we get a link failure if we use it by accident, rather than an assert at runtime.
It would be even better to get a compile-time error, but I don't know how to make that happen.
* khtml/rendering/render_layer.h: Ditto.
* khtml/rendering/render_object.h: Ditto.
* khtml/rendering/render_text.h: Ditto.
* khtml/rendering/render_container.cpp:
(RenderContainer::addChild): Create the RenderTable with the appropriate arena.
(RenderContainer::insertPseudoChild): Create the RenderFlow objects with the appropriate arena.
* khtml/rendering/render_text.cpp: (RenderText::deleteSlaves): Don't try to get the arena
when there are no slaves. This can happen after the element is nil, and in that case we will
do a nil-dereference.
2002-11-13 Darin Adler <darin@apple.com>
* kwq/KWQLineEdit.mm: (QLineEdit::sizeForCharacterWidth):
......
2002-11-13 Darin Adler <darin@apple.com>
- fixed 3100895 -- REGRESSION: Assertion on http://www.w3.org/Style/CSS/
A few arena-related fixes.
* khtml/rendering/bidi.h: Don't define the operator new without the arena parameter.
That way, we get a link failure if we use it by accident, rather than an assert at runtime.
It would be even better to get a compile-time error, but I don't know how to make that happen.
* khtml/rendering/render_layer.h: Ditto.
* khtml/rendering/render_object.h: Ditto.
* khtml/rendering/render_text.h: Ditto.
* khtml/rendering/render_container.cpp:
(RenderContainer::addChild): Create the RenderTable with the appropriate arena.
(RenderContainer::insertPseudoChild): Create the RenderFlow objects with the appropriate arena.
* khtml/rendering/render_text.cpp: (RenderText::deleteSlaves): Don't try to get the arena
when there are no slaves. This can happen after the element is nil, and in that case we will
do a nil-dereference.
2002-11-13 Darin Adler <darin@apple.com>
* kwq/KWQLineEdit.mm: (QLineEdit::sizeForCharacterWidth):
......
......@@ -113,7 +113,7 @@ namespace khtml {
private:
// The normal operator new is disallowed.
void* operator new(size_t sz) throw() { assert(false); return 0; };
void* operator new(size_t sz) throw();
public:
RenderFlow *par;
......
......@@ -125,7 +125,7 @@ void RenderContainer::addChild(RenderObject *newChild, RenderObject *beforeChild
table = static_cast<RenderTable *>(beforeChild);
else {
//kdDebug( 6040 ) << "creating anonymous table" << endl;
table = new RenderTable(0 /* is anonymous */);
table = new (renderArena()) RenderTable(0 /* is anonymous */);
RenderStyle *newStyle = new RenderStyle();
newStyle->inheritFrom(style());
newStyle->setDisplay(TABLE);
......@@ -209,12 +209,12 @@ void RenderContainer::insertPseudoChild(RenderStyle::PseudoId type, RenderObject
{
if (pseudo->contentType()==CONTENT_TEXT)
{
RenderObject* po = new RenderFlow(0 /* anonymous box */);
RenderObject* po = new (renderArena()) RenderFlow(0 /* anonymous box */);
po->setStyle(pseudo);
addChild(po, beforeChild);
RenderText* t = new RenderText(0 /*anonymous object */, pseudo->contentText());
RenderText* t = new (renderArena()) RenderText(0 /*anonymous object */, pseudo->contentText());
t->setStyle(pseudo);
// kdDebug() << DOM::DOMString(pseudo->contentText()).string() << endl;
......@@ -226,7 +226,7 @@ void RenderContainer::insertPseudoChild(RenderStyle::PseudoId type, RenderObject
}
else if (pseudo->contentType()==CONTENT_OBJECT)
{
RenderObject* po = new RenderImage(0);
RenderObject* po = new (renderArena()) RenderImage(0);
po->setStyle(pseudo);
addChild(po, beforeChild);
po->close();
......
......@@ -109,7 +109,7 @@ public:
private:
// The normal operator new is disallowed on all render objects.
void* operator new(size_t sz) throw() { assert(false); return 0; };
void* operator new(size_t sz) throw();
public:
// Z-Index Implementation Notes
......@@ -157,7 +157,7 @@ public:
void operator delete(void* ptr, size_t sz);
// The normal operator new is disallowed.
void* operator new(size_t sz) throw() { assert(false); return 0; };
void* operator new(size_t sz) throw();
};
// The list of layer elements is built through a recursive examination
......@@ -205,7 +205,7 @@ public:
void operator delete(void* ptr, size_t sz);
// The normal operator new is disallowed.
void* operator new(size_t sz) throw() { assert(false); return 0; };
void* operator new(size_t sz) throw();
};
private:
......
......@@ -131,7 +131,7 @@ public:
private:
// The normal operator new is disallowed on all render objects.
void* operator new(size_t sz) throw() { assert(false); return 0; };
void* operator new(size_t sz) throw();
public:
RenderArena* renderArena();
......
......@@ -350,13 +350,15 @@ void RenderText::deleteSlaves()
// We don't delete the array itself here because its
// likely to be used in the same size later again, saves
// us resize() calls
RenderArena* arena = element()->getDocument()->renderArena();
unsigned int len = m_lines.size();
for(unsigned int i=0; i < len; i++) {
TextSlave* s = m_lines.at(i);
if (s)
s->detach(arena);
m_lines.remove(i);
if (len) {
RenderArena* arena = element()->getDocument()->renderArena();
for(unsigned int i=0; i < len; i++) {
TextSlave* s = m_lines.at(i);
if (s)
s->detach(arena);
m_lines.remove(i);
}
}
KHTMLAssert(m_lines.count() == 0);
......
......@@ -68,7 +68,7 @@ public:
private:
// The normal operator new is disallowed.
void* operator new(size_t sz) throw() { assert(false); return 0; };
void* operator new(size_t sz) throw();
public:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment