Commit 1dbdf723 authored by mjs's avatar mjs

Reviewed by Darin.

	- fixed 3125283 - HOMEPAGE: in onload of an IMG, the width and height are equal to zero

	There were two problems here. First, the calls to get image width
	and height didn't force a layout in all the cases where it was
	required. Second, layout wouldn't lay out images at all until
	parsing was done, due to a hack to block inline layout until that
	point. I'm not sure if this will have other bad consquences, but
	nearly every page I tried, including Hebrew and Japanese pages as
	well as every page on the base PLT laid out properly.

        * khtml/html/html_imageimpl.cpp:
        (HTMLImageElementImpl::width): Force a layout if not laid out.
        (HTMLImageElementImpl::height): Likewise.
        * khtml/html/htmlparser.cpp:
	(KHTMLParser::insertNode): Remove setBlockBidi hack - this was
	preventing images from getting laid out until the document was
	totally done parsing.
        * khtml/rendering/render_flow.cpp:
        (RenderFlow::RenderFlow): More setBLockBidi removal.
        (RenderFlow::layout): Likewise.
        (RenderFlow::close): Likewise.
        (RenderFlow::addChildToFlow): Likewise.
        (RenderFlow::printTree): Likewise.
        * khtml/rendering/render_flow.h:
        * khtml/rendering/render_object.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3097 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b0169e56
2002-12-16 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
- fixed 3125283 - HOMEPAGE: in onload of an IMG, the width and height are equal to zero
There were two problems here. First, the calls to get image width
and height didn't force a layout in all the cases where it was
required. Second, layout wouldn't lay out images at all until
parsing was done, due to a hack to block inline layout until that
point. I'm not sure if this will have other bad consquences, but
nearly every page I tried, including Hebrew and Japanese pages as
well as every page on the base PLT laid out properly.
* khtml/html/html_imageimpl.cpp:
(HTMLImageElementImpl::width): Force a layout if not laid out.
(HTMLImageElementImpl::height): Likewise.
* khtml/html/htmlparser.cpp:
(KHTMLParser::insertNode): Remove setBlockBidi hack - this was
preventing images from getting laid out until the document was
totally done parsing.
* khtml/rendering/render_flow.cpp:
(RenderFlow::RenderFlow): More setBLockBidi removal.
(RenderFlow::layout): Likewise.
(RenderFlow::close): Likewise.
(RenderFlow::addChildToFlow): Likewise.
(RenderFlow::printTree): Likewise.
* khtml/rendering/render_flow.h:
* khtml/rendering/render_object.h:
2002-12-16 David Hyatt <hyatt@apple.com> 2002-12-16 David Hyatt <hyatt@apple.com>
When a clear occurs (thus causing a block to move underneath When a clear occurs (thus causing a block to move underneath
......
2002-12-16 Maciej Stachowiak <mjs@apple.com>
Reviewed by Darin.
- fixed 3125283 - HOMEPAGE: in onload of an IMG, the width and height are equal to zero
There were two problems here. First, the calls to get image width
and height didn't force a layout in all the cases where it was
required. Second, layout wouldn't lay out images at all until
parsing was done, due to a hack to block inline layout until that
point. I'm not sure if this will have other bad consquences, but
nearly every page I tried, including Hebrew and Japanese pages as
well as every page on the base PLT laid out properly.
* khtml/html/html_imageimpl.cpp:
(HTMLImageElementImpl::width): Force a layout if not laid out.
(HTMLImageElementImpl::height): Likewise.
* khtml/html/htmlparser.cpp:
(KHTMLParser::insertNode): Remove setBlockBidi hack - this was
preventing images from getting laid out until the document was
totally done parsing.
* khtml/rendering/render_flow.cpp:
(RenderFlow::RenderFlow): More setBLockBidi removal.
(RenderFlow::layout): Likewise.
(RenderFlow::close): Likewise.
(RenderFlow::addChildToFlow): Likewise.
(RenderFlow::printTree): Likewise.
* khtml/rendering/render_flow.h:
* khtml/rendering/render_object.h:
2002-12-16 David Hyatt <hyatt@apple.com> 2002-12-16 David Hyatt <hyatt@apple.com>
When a clear occurs (thus causing a block to move underneath When a clear occurs (thus causing a block to move underneath
......
...@@ -233,7 +233,7 @@ long HTMLImageElementImpl::width() const ...@@ -233,7 +233,7 @@ long HTMLImageElementImpl::width() const
if (!m_render) return getAttribute(ATTR_WIDTH).toInt(); if (!m_render) return getAttribute(ATTR_WIDTH).toInt();
// ### make a unified call for this // ### make a unified call for this
if (changed()) { if (changed() || !m_render->layouted()) {
getDocument()->updateRendering(); getDocument()->updateRendering();
if (getDocument()->view()) if (getDocument()->view())
getDocument()->view()->layout(); getDocument()->view()->layout();
...@@ -247,7 +247,7 @@ long HTMLImageElementImpl::height() const ...@@ -247,7 +247,7 @@ long HTMLImageElementImpl::height() const
if (!m_render) return getAttribute(ATTR_HEIGHT).toInt(); if (!m_render) return getAttribute(ATTR_HEIGHT).toInt();
// ### make a unified call for this // ### make a unified call for this
if (changed()) { if (changed() || !m_render->layouted()) {
getDocument()->updateRendering(); getDocument()->updateRendering();
if (getDocument()->view()) if (getDocument()->view())
getDocument()->view()->layout(); getDocument()->view()->layout();
......
...@@ -332,8 +332,6 @@ bool KHTMLParser::insertNode(NodeImpl *n, bool flat) ...@@ -332,8 +332,6 @@ bool KHTMLParser::insertNode(NodeImpl *n, bool flat)
// //
if (!n->attached()) if (!n->attached())
n->attach(); n->attach();
if (n->renderer())
n->renderer()->setBlockBidi();
} }
#endif #endif
} }
......
...@@ -50,7 +50,6 @@ RenderFlow::RenderFlow(DOM::NodeImpl* node) ...@@ -50,7 +50,6 @@ RenderFlow::RenderFlow(DOM::NodeImpl* node)
m_childrenInline = true; m_childrenInline = true;
m_pre = false; m_pre = false;
firstLine = false; firstLine = false;
m_blockBidi = false;
m_clearStatus = CNONE; m_clearStatus = CNONE;
specialObjects = 0; specialObjects = 0;
...@@ -313,9 +312,7 @@ void RenderFlow::layout() ...@@ -313,9 +312,7 @@ void RenderFlow::layout()
// kdDebug( 6040 ) << "childrenInline()=" << childrenInline() << endl; // kdDebug( 6040 ) << "childrenInline()=" << childrenInline() << endl;
if(childrenInline()) { if(childrenInline()) {
// ### make bidi resumeable so that we can get rid of this ugly hack layoutInlineChildren( relayoutChildren );
if (!m_blockBidi)
layoutInlineChildren( relayoutChildren );
} }
else else
layoutBlockChildren( relayoutChildren ); layoutBlockChildren( relayoutChildren );
...@@ -1723,9 +1720,6 @@ void RenderFlow::calcMinMaxWidth() ...@@ -1723,9 +1720,6 @@ void RenderFlow::calcMinMaxWidth()
void RenderFlow::close() void RenderFlow::close()
{ {
// ### get rid of me
m_blockBidi = false;
if(lastChild() && lastChild()->isAnonymousBox()) { if(lastChild() && lastChild()->isAnonymousBox()) {
lastChild()->close(); lastChild()->close();
} }
...@@ -1980,12 +1974,6 @@ void RenderFlow::addChildToFlow(RenderObject* newChild, RenderObject* beforeChil ...@@ -1980,12 +1974,6 @@ void RenderFlow::addChildToFlow(RenderObject* newChild, RenderObject* beforeChil
bool madeBoxesNonInline = FALSE; bool madeBoxesNonInline = FALSE;
if ( newChild->isPositioned() ) {
m_blockBidi = false;
}
if (m_blockBidi)
newChild->setBlockBidi();
RenderStyle* pseudoStyle=0; RenderStyle* pseudoStyle=0;
if (!isInline() && (!firstChild() || firstChild() == beforeChild) && newChild->isText()) if (!isInline() && (!firstChild() || firstChild() == beforeChild) && newChild->isText())
{ {
...@@ -2298,8 +2286,6 @@ void RenderFlow::printTree(int indent) const ...@@ -2298,8 +2286,6 @@ void RenderFlow::printTree(int indent) const
{ {
RenderBox::printTree(indent); RenderBox::printTree(indent);
// KHTMLAssert(!m_blockBidi);
if(specialObjects) if(specialObjects)
{ {
QPtrListIterator<SpecialObject> it(*specialObjects); QPtrListIterator<SpecialObject> it(*specialObjects);
......
...@@ -72,7 +72,6 @@ public: ...@@ -72,7 +72,6 @@ public:
virtual void setChildrenInline(bool b) { m_childrenInline = b; } virtual void setChildrenInline(bool b) { m_childrenInline = b; }
virtual bool isRendered() const { return true; } virtual bool isRendered() const { return true; }
virtual void setBlockBidi() { m_blockBidi = true; }
virtual RenderFlow* continuation() const { return m_continuation; } virtual RenderFlow* continuation() const { return m_continuation; }
void setContinuation(RenderFlow* c) { m_continuation = c; } void setContinuation(RenderFlow* c) { m_continuation = c; }
...@@ -235,7 +234,6 @@ private: ...@@ -235,7 +234,6 @@ private:
bool m_childrenInline : 1; bool m_childrenInline : 1;
bool m_pre : 1; bool m_pre : 1;
bool firstLine : 1; // used in inline layouting bool firstLine : 1; // used in inline layouting
bool m_blockBidi : 1;
EClear m_clearStatus : 2; // used during layuting of paragraphs EClear m_clearStatus : 2; // used during layuting of paragraphs
short m_maxTopPosMargin; short m_maxTopPosMargin;
......
...@@ -212,10 +212,6 @@ public: ...@@ -212,10 +212,6 @@ public:
void setOverhangingContents(bool p=true); void setOverhangingContents(bool p=true);
void setLayouted(bool b=true); void setLayouted(bool b=true);
// hack to block inline layouts during parsing
// evil, evil. I didn't do it. <tm>
virtual void setBlockBidi() {}
void setMinMaxKnown(bool b=true) { void setMinMaxKnown(bool b=true) {
m_minMaxKnown = b; m_minMaxKnown = b;
......
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