[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

hyatt hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:07:55 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit d18db816a7ee825ab79764b23b35ca1ac6d67cec
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Nov 25 06:17:14 2002 +0000

    	This landing adds support for blocks inside inlines.  It
    	gets rid of the old broken way KHTML used to handle this
    	and implements a brand new mechanism.
    
    	With this change, I have decreased the tag priority of <font>
    	and <a> to match other inlines (<i>, <span>, etc.), and I
    	now allow all the inlines to contain blocks for relaxed parsing.
    
    	Now if you open an <i> or a <b> and just leave it open across
    	blocks, this will work.
    
    	I also fixed a bad DHTML bug caused by the WebCoreBridge
    	forceLayout method.  The basic pattern is that someone does
    	a tiny repaint of just a sliver of the window, then someone
    	schedules a layout (which means they want a full repaint), but
    	then drawRect comes along and calls forceLayout which unschedules
    	the layout, thus preventing the full repaint from occurring.
    
    	Any basic DHTML that used append/remove child was broken because
    	of this pattern.  For now I have just removed the unscheduleLayout
    	call at the end of forceLayout.
    
            * khtml/html/dtd.cpp:
            (DOM::checkChild):
            * khtml/html/htmlparser.cpp:
            (KHTMLParser::popInlineBlocks):
            * khtml/rendering/render_container.cpp:
            (RenderContainer::removeChild):
            (RenderContainer::removeLeftoverAnonymousBoxes):
            * khtml/rendering/render_flow.cpp:
            (RenderFlow::setStyle):
            (RenderFlow::layoutBlockChildren):
            (RenderFlow::continuationBefore):
            (cloneInline):
            (RenderFlow::splitInlines):
            (RenderFlow::splitFlow):
            (RenderFlow::addChildWithContinuation):
            (RenderFlow::addChild):
            (RenderFlow::addChildToFlow):
            * khtml/rendering/render_flow.h:
            * khtml/rendering/render_object.cpp:
            (RenderObject::mouseInside):
            * khtml/rendering/render_object.h:
            * kwq/KWQKHTMLPart.mm:
            (KWQKHTMLPart::forceLayout):
            * kwq/WebCoreBridge.mm:
            (-[WebCoreBridge copyRenderNode:copier:]):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2854 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index aa0d619..531dd2e 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,53 @@
+2002-11-24  David Hyatt  <hyatt at apple.com>
+
+	This landing adds support for blocks inside inlines.  It
+	gets rid of the old broken way KHTML used to handle this
+	and implements a brand new mechanism.
+
+	With this change, I have decreased the tag priority of <font>
+	and <a> to match other inlines (<i>, <span>, etc.), and I
+	now allow all the inlines to contain blocks for relaxed parsing.
+
+	Now if you open an <i> or a <b> and just leave it open across
+	blocks, this will work.
+
+	I also fixed a bad DHTML bug caused by the WebCoreBridge 
+	forceLayout method.  The basic pattern is that someone does
+	a tiny repaint of just a sliver of the window, then someone
+	schedules a layout (which means they want a full repaint), but
+	then drawRect comes along and calls forceLayout which unschedules
+	the layout, thus preventing the full repaint from occurring.
+
+	Any basic DHTML that used append/remove child was broken because
+	of this pattern.  For now I have just removed the unscheduleLayout
+	call at the end of forceLayout.
+	
+        * khtml/html/dtd.cpp:
+        (DOM::checkChild):
+        * khtml/html/htmlparser.cpp:
+        (KHTMLParser::popInlineBlocks):
+        * khtml/rendering/render_container.cpp:
+        (RenderContainer::removeChild):
+        (RenderContainer::removeLeftoverAnonymousBoxes):
+        * khtml/rendering/render_flow.cpp:
+        (RenderFlow::setStyle):
+        (RenderFlow::layoutBlockChildren):
+        (RenderFlow::continuationBefore):
+        (cloneInline):
+        (RenderFlow::splitInlines):
+        (RenderFlow::splitFlow):
+        (RenderFlow::addChildWithContinuation):
+        (RenderFlow::addChild):
+        (RenderFlow::addChildToFlow):
+        * khtml/rendering/render_flow.h:
+        * khtml/rendering/render_object.cpp:
+        (RenderObject::mouseInside):
+        * khtml/rendering/render_object.h:
+        * kwq/KWQKHTMLPart.mm:
+        (KWQKHTMLPart::forceLayout):
+        * kwq/WebCoreBridge.mm:
+        (-[WebCoreBridge copyRenderNode:copier:]):
+
 2002-11-24  Chris Blumenberg  <cblu at apple.com>
 
 	Added element keys for the image ALT and link TITLE attributes. This will eventually be used to fix other bugs. Also made WebKit and WebCore use the same element keys to simplify the conversion of the element dictionary.
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index aa0d619..531dd2e 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,53 @@
+2002-11-24  David Hyatt  <hyatt at apple.com>
+
+	This landing adds support for blocks inside inlines.  It
+	gets rid of the old broken way KHTML used to handle this
+	and implements a brand new mechanism.
+
+	With this change, I have decreased the tag priority of <font>
+	and <a> to match other inlines (<i>, <span>, etc.), and I
+	now allow all the inlines to contain blocks for relaxed parsing.
+
+	Now if you open an <i> or a <b> and just leave it open across
+	blocks, this will work.
+
+	I also fixed a bad DHTML bug caused by the WebCoreBridge 
+	forceLayout method.  The basic pattern is that someone does
+	a tiny repaint of just a sliver of the window, then someone
+	schedules a layout (which means they want a full repaint), but
+	then drawRect comes along and calls forceLayout which unschedules
+	the layout, thus preventing the full repaint from occurring.
+
+	Any basic DHTML that used append/remove child was broken because
+	of this pattern.  For now I have just removed the unscheduleLayout
+	call at the end of forceLayout.
+	
+        * khtml/html/dtd.cpp:
+        (DOM::checkChild):
+        * khtml/html/htmlparser.cpp:
+        (KHTMLParser::popInlineBlocks):
+        * khtml/rendering/render_container.cpp:
+        (RenderContainer::removeChild):
+        (RenderContainer::removeLeftoverAnonymousBoxes):
+        * khtml/rendering/render_flow.cpp:
+        (RenderFlow::setStyle):
+        (RenderFlow::layoutBlockChildren):
+        (RenderFlow::continuationBefore):
+        (cloneInline):
+        (RenderFlow::splitInlines):
+        (RenderFlow::splitFlow):
+        (RenderFlow::addChildWithContinuation):
+        (RenderFlow::addChild):
+        (RenderFlow::addChildToFlow):
+        * khtml/rendering/render_flow.h:
+        * khtml/rendering/render_object.cpp:
+        (RenderObject::mouseInside):
+        * khtml/rendering/render_object.h:
+        * kwq/KWQKHTMLPart.mm:
+        (KWQKHTMLPart::forceLayout):
+        * kwq/WebCoreBridge.mm:
+        (-[WebCoreBridge copyRenderNode:copier:]):
+
 2002-11-24  Chris Blumenberg  <cblu at apple.com>
 
 	Added element keys for the image ALT and link TITLE attributes. This will eventually be used to fix other bugs. Also made WebKit and WebCore use the same element keys to simplify the conversion of the element dictionary.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index aa0d619..531dd2e 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,53 @@
+2002-11-24  David Hyatt  <hyatt at apple.com>
+
+	This landing adds support for blocks inside inlines.  It
+	gets rid of the old broken way KHTML used to handle this
+	and implements a brand new mechanism.
+
+	With this change, I have decreased the tag priority of <font>
+	and <a> to match other inlines (<i>, <span>, etc.), and I
+	now allow all the inlines to contain blocks for relaxed parsing.
+
+	Now if you open an <i> or a <b> and just leave it open across
+	blocks, this will work.
+
+	I also fixed a bad DHTML bug caused by the WebCoreBridge 
+	forceLayout method.  The basic pattern is that someone does
+	a tiny repaint of just a sliver of the window, then someone
+	schedules a layout (which means they want a full repaint), but
+	then drawRect comes along and calls forceLayout which unschedules
+	the layout, thus preventing the full repaint from occurring.
+
+	Any basic DHTML that used append/remove child was broken because
+	of this pattern.  For now I have just removed the unscheduleLayout
+	call at the end of forceLayout.
+	
+        * khtml/html/dtd.cpp:
+        (DOM::checkChild):
+        * khtml/html/htmlparser.cpp:
+        (KHTMLParser::popInlineBlocks):
+        * khtml/rendering/render_container.cpp:
+        (RenderContainer::removeChild):
+        (RenderContainer::removeLeftoverAnonymousBoxes):
+        * khtml/rendering/render_flow.cpp:
+        (RenderFlow::setStyle):
+        (RenderFlow::layoutBlockChildren):
+        (RenderFlow::continuationBefore):
+        (cloneInline):
+        (RenderFlow::splitInlines):
+        (RenderFlow::splitFlow):
+        (RenderFlow::addChildWithContinuation):
+        (RenderFlow::addChild):
+        (RenderFlow::addChildToFlow):
+        * khtml/rendering/render_flow.h:
+        * khtml/rendering/render_object.cpp:
+        (RenderObject::mouseInside):
+        * khtml/rendering/render_object.h:
+        * kwq/KWQKHTMLPart.mm:
+        (KWQKHTMLPart::forceLayout):
+        * kwq/WebCoreBridge.mm:
+        (-[WebCoreBridge copyRenderNode:copier:]):
+
 2002-11-24  Chris Blumenberg  <cblu at apple.com>
 
 	Added element keys for the image ALT and link TITLE attributes. This will eventually be used to fix other bugs. Also made WebKit and WebCore use the same element keys to simplify the conversion of the element dictionary.
diff --git a/WebCore/khtml/html/dtd.cpp b/WebCore/khtml/html/dtd.cpp
index 6478870..51367f2 100644
--- a/WebCore/khtml/html/dtd.cpp
+++ b/WebCore/khtml/html/dtd.cpp
@@ -45,7 +45,7 @@ using namespace DOM;
 // 10 html
 const unsigned short DOM::tagPriority[] = {
     0, // 0
-    5, // ID_A == 1
+    1, // ID_A == 1
     1, // ID_ABBR
     1, // ID_ACRONYM
     3, // ID_ADDRESS
@@ -76,7 +76,7 @@ const unsigned short DOM::tagPriority[] = {
     1, // ID_EM
     0, // ID_EMBED
     3, // ID_FIELDSET
-    5, // ID_FONT
+    1, // ID_FONT
     3, // ID_FORM
     0, // ID_FRAME
    10,// ID_FRAMESET
@@ -593,8 +593,9 @@ bool DOM::checkChild(ushort tagID, ushort childID)
     case ID_BDO:
     case ID_Q:
     case ID_LEGEND:
-        // _0 *
-        return check_array(childID, tag_list_0);
+    case ID_FONT:
+    case ID_A:
+        return check_array(childID, tag_list_1);
     case ID_P:
     case ID_H1:
     case ID_H2:
@@ -602,7 +603,7 @@ bool DOM::checkChild(ushort tagID, ushort childID)
     case ID_H4:
     case ID_H5:
     case ID_H6:
-        if (childID == ID_TABLE) return true;
+        if (childID == ID_TABLE || (tagID != ID_P && childID == ID_CENTER)) return true;
         return check_array(childID, tag_list_0);
     case ID_BASEFONT:
     case ID_BR:
@@ -630,9 +631,6 @@ bool DOM::checkChild(ushort tagID, ushort childID)
         // ADDRESS: ( _0 | P ) *
         if( check_array(childID, tag_list_0) ) return true;
         return (childID == ID_P);
-    case ID_FONT:
-        // special handling for FONT: (_0 | 3)
-        return check_array(childID, tag_list_3) || check_array(childID, tag_list_0);
     case ID__KONQBLOCK:
         if ( childID == ID__KONQBLOCK ) return false;
         // Fall through!
@@ -655,13 +653,6 @@ bool DOM::checkChild(ushort tagID, ushort childID)
     case ID_MARQUEE:
         // DIV: _1 *
         return check_array(childID, tag_list_1);
-    case ID_A:
-        // A: _0 * - A
-        if( check_array(childID, tag_list_0) ) return true;
-        if ( childID == ID_TABLE ) return false; // no table in anchor
-        if( check_array(childID, tag_list_3) ) return true;
-        if( childID == ID_ADDRESS ) return true;
-        return false;
     case ID_MAP:
         // MAP: ( _3 + | AREA + )
         if( check_array(childID, tag_list_3) ) return true;
diff --git a/WebCore/khtml/html/htmlparser.cpp b/WebCore/khtml/html/htmlparser.cpp
index 8b655c4..13c8a02 100644
--- a/WebCore/khtml/html/htmlparser.cpp
+++ b/WebCore/khtml/html/htmlparser.cpp
@@ -1278,7 +1278,7 @@ void KHTMLParser::popOneBlock()
 
 void KHTMLParser::popInlineBlocks()
 {
-    while(current->isInline() && current->id() != ID_FONT)
+    while(current->isInline())
         popOneBlock();
 }
 
diff --git a/WebCore/khtml/rendering/render_container.cpp b/WebCore/khtml/rendering/render_container.cpp
index f2099e2..9492113 100644
--- a/WebCore/khtml/rendering/render_container.cpp
+++ b/WebCore/khtml/rendering/render_container.cpp
@@ -191,6 +191,9 @@ RenderObject* RenderContainer::removeChildNode(RenderObject* oldChild)
 
 void RenderContainer::removeChild(RenderObject *oldChild)
 {
+    if (oldChild->continuation())
+        oldChild->continuation()->parent()->removeChild(oldChild->continuation());
+    
     removeChildNode(oldChild);
     setLayouted(false);
 }
@@ -316,7 +319,7 @@ void RenderContainer::removeLeftoverAnonymousBoxes()
     while( child ) {
 	RenderObject *next = child->nextSibling();
 	
-	if ( child->isFlow() && child->isAnonymousBox() && !child->childrenInline() ) {
+	if ( child->isFlow() && child->isAnonymousBox() && !child->continuation() && !child->childrenInline() ) {
 	    RenderObject *firstAnChild = child->firstChild();
 	    RenderObject *lastAnChild = child->lastChild();
 	    if ( firstAnChild ) {
diff --git a/WebCore/khtml/rendering/render_flow.cpp b/WebCore/khtml/rendering/render_flow.cpp
index 497b846..c45c92a 100644
--- a/WebCore/khtml/rendering/render_flow.cpp
+++ b/WebCore/khtml/rendering/render_flow.cpp
@@ -100,6 +100,18 @@ void RenderFlow::setStyle(RenderStyle *_style)
         }
         child = child->nextSibling();
     }
+    
+    // Ensure that all of the split inlines pick up the new style.
+    RenderFlow* currCont = continuation();
+    while (currCont) {
+        if (currCont->isInline()) {
+            RenderFlow* nextCont = currCont->continuation();
+            currCont->setContinuation(0);
+            currCont->setStyle(style());
+            currCont->setContinuation(nextCont);
+        }
+        currCont = currCont->continuation();
+    }
 }
 
 RenderFlow::~RenderFlow()
@@ -450,7 +462,7 @@ void RenderFlow::layoutBlockChildren( bool relayoutChildren )
     bool topChildQuirk = false;
     bool bottomChildQuirk = false;
     
-    bool strictMode = (element()->getDocument()->parseMode() == DocumentImpl::Strict);
+    bool strictMode = isAnonymousBox() ? true : (element()->getDocument()->parseMode() == DocumentImpl::Strict);
      
     //kdDebug() << "RenderFlow::layoutBlockChildren " << prevMargin << endl;
 
@@ -735,7 +747,7 @@ void RenderFlow::layoutBlockChildren( bool relayoutChildren )
             m_bottomMarginQuirk = false;
     }
     
-    if (element()->id() == ID__KONQBLOCK)
+    if (element() && element()->id() == ID__KONQBLOCK)
         // Deal with the case where <forms> get wrapped in a KONQBLOCK.
         // We want that form's bottom margin to actually disappear.
         // Don't let any children affect a KONQBLOCK's margins.
@@ -1720,6 +1732,191 @@ int RenderFlow::offsetTop() const
     return y;
 }
 
+RenderFlow* RenderFlow::continuationBefore(RenderObject* beforeChild)
+{
+    if (beforeChild && beforeChild->parent() == this)
+        return this;
+       
+    RenderFlow* curr = continuation();
+    RenderFlow* nextToLast = this;
+    RenderFlow* last = this;
+    while (curr) {
+        if (beforeChild && beforeChild->parent() == curr) {
+            if (curr->firstChild() == beforeChild)
+                return last;
+            return curr;
+        }
+        
+        nextToLast = last;
+        last = curr;
+        curr = curr->continuation();
+    }
+    
+    if (!beforeChild && !last->firstChild())
+        return nextToLast;
+    return last;
+}
+
+static RenderFlow* cloneInline(RenderFlow* src)
+{
+    RenderFlow *o = new (src->renderArena()) RenderFlow(src->element());
+    o->setStyle(src->style());
+    return o;
+}
+
+void RenderFlow::splitInlines(RenderFlow* fromBlock, RenderFlow* toBlock,
+                              RenderFlow* middleBlock,
+                              RenderObject* beforeChild, RenderFlow* oldCont)
+{
+    // Create a clone of this inline.
+    RenderFlow* clone = cloneInline(this);
+    clone->setContinuation(oldCont);
+    
+    // Now take all of the children from beforeChild to the end and remove
+    // then from |this| and place them in the clone.
+    RenderObject* o = beforeChild;
+    while (o) {
+        RenderObject* tmp = o;
+        o = tmp->nextSibling();
+        clone->appendChildNode(removeChildNode(tmp));
+        tmp->setLayouted(false);
+        tmp->setMinMaxKnown(false);
+    }
+    
+    // Hook |clone| up as the continuation of the middle block.
+    middleBlock->setContinuation(clone);
+    
+    // We have been reparented and are now under the fromBlock.  We need
+    // to walk up our inline parent chain until we hit the containing block.
+    // Once we hit the containing block we're done.
+    RenderFlow* curr = static_cast<RenderFlow*>(parent());
+    RenderFlow* currChild = this;
+    while (curr && curr != fromBlock) {
+        // Create a new clone.
+        RenderFlow* cloneChild = clone;
+        clone = cloneInline(curr);
+        
+        // Insert our child clone as the first child.
+        clone->appendChildNode(cloneChild);
+        
+        // Hook the clone up as a continuation of |curr|.
+        RenderFlow* oldCont = curr->continuation();
+        curr->setContinuation(clone);
+        clone->setContinuation(oldCont);
+        
+        // Now we need to take all of the children starting from the first child
+        // *after* currChild and append them all to the clone.
+        o = currChild->nextSibling();
+        while (o) {
+            RenderObject* tmp = o;
+            o = tmp->nextSibling();
+            clone->appendChildNode(curr->removeChildNode(tmp));
+            tmp->setLayouted(false);
+            tmp->setMinMaxKnown(false);
+        }
+        
+        // Keep walking up the chain.
+        currChild = curr;
+        curr = static_cast<RenderFlow*>(curr->parent());
+    }
+  
+    // Now we are at the block level. We need to put the clone into the toBlock.
+    toBlock->appendChildNode(clone);
+    
+    // Now take all the children after currChild and remove them from the fromBlock
+    // and put them in the toBlock.
+    o = currChild->nextSibling();
+    while (o) {
+        RenderObject* tmp = o;
+        o = tmp->nextSibling();
+        toBlock->appendChildNode(fromBlock->removeChildNode(tmp));
+    }
+}
+
+void RenderFlow::splitFlow(RenderObject* beforeChild, RenderFlow* newBlockBox, RenderFlow* oldCont)
+{
+    RenderObject* block = containingBlock();
+    RenderFlow* pre = 0;
+    RenderFlow* post = 0;
+    
+    RenderStyle* newStyle = new RenderStyle();
+    newStyle->inheritFrom(block->style());
+    newStyle->setDisplay(BLOCK);
+    pre = new (renderArena()) RenderFlow(0 /* anonymous box */);
+    pre->setStyle(newStyle);
+    pre->setIsAnonymousBox(true);
+    pre->setChildrenInline(true);
+    
+    newStyle = new RenderStyle();
+    newStyle->inheritFrom(block->style());
+    newStyle->setDisplay(BLOCK);
+    post = new (renderArena()) RenderFlow(0 /* anonymous box */);
+    post->setStyle(newStyle);
+    post->setIsAnonymousBox(true);
+    post->setChildrenInline(true);
+    
+    RenderObject* boxFirst = block->firstChild();
+    block->insertChildNode(pre, boxFirst);
+    block->insertChildNode(newBlockBox, boxFirst);
+    block->insertChildNode(post, boxFirst);
+    block->setChildrenInline(false);
+    
+    RenderObject* o = boxFirst;
+    while (o) 
+    {
+        RenderObject* no = o;
+        o = no->nextSibling();
+        pre->appendChildNode(block->removeChildNode(no));
+        no->setLayouted(false);
+        no->setMinMaxKnown(false);
+    }
+    
+    splitInlines(pre, post, newBlockBox, beforeChild, oldCont);
+    
+    // XXXdwh is any of this even necessary? I don't think it is.
+    pre->close();
+    pre->setPos(0, -500000);
+    pre->setLayouted(false);
+    newBlockBox->close();
+    newBlockBox->setPos(0, -500000);
+    newBlockBox->setLayouted(false);
+    post->close();
+    post->setPos(0, -500000);
+    post->setLayouted(false);
+    
+    block->setLayouted(false);
+    block->setMinMaxKnown(false);
+}
+
+void RenderFlow::addChildWithContinuation(RenderObject* newChild, RenderObject* beforeChild)
+{
+    RenderFlow* flow = continuationBefore(beforeChild);
+    RenderFlow* beforeChildParent = beforeChild ? static_cast<RenderFlow*>(beforeChild->parent()) : 
+                                    (flow->continuation() ? flow->continuation() : flow);
+    
+    if (newChild->isSpecial())
+        return beforeChildParent->addChildToFlow(newChild, beforeChild);
+    
+    // A continuation always consists of two potential candidates: an inline or an anonymous
+    // block box holding block children.
+    bool childInline = newChild->isInline();
+    bool bcpInline = beforeChildParent->isInline();
+    bool flowInline = flow->isInline();
+    
+    if (flow == beforeChildParent)
+        return flow->addChildToFlow(newChild, beforeChild);
+    else {
+        // The goal here is to match up if we can, so that we can coalesce and create the
+        // minimal # of continuations needed for the inline.
+        if (childInline == bcpInline)
+            return beforeChildParent->addChildToFlow(newChild, beforeChild);
+        else if (flowInline == childInline)
+            return flow->addChildToFlow(newChild, 0); // Just treat like an append.
+        else 
+            return beforeChildParent->addChildToFlow(newChild, beforeChild);
+    }
+}
+
 void RenderFlow::addChild(RenderObject *newChild, RenderObject *beforeChild)
 {
 #ifdef DEBUG_LAYOUT
@@ -1727,6 +1924,14 @@ void RenderFlow::addChild(RenderObject *newChild, RenderObject *beforeChild)
                        ", " << (beforeChild ? beforeChild->renderName() : "0") << " )" << endl;
     kdDebug( 6040 ) << "current height = " << m_height << endl;
 #endif
+
+    if (continuation())
+        return addChildWithContinuation(newChild, beforeChild);
+    return addChildToFlow(newChild, beforeChild);
+}
+
+void RenderFlow::addChildToFlow(RenderObject* newChild, RenderObject* beforeChild)
+{
     setLayouted( false );
     
     bool madeBoxesNonInline = FALSE;
@@ -1832,7 +2037,26 @@ void RenderFlow::addChild(RenderObject *newChild, RenderObject *beforeChild)
     // inline children into anonymous block boxes
     if ( m_childrenInline && !newChild->isInline() && !newChild->isSpecial() )
     {
-        if ( m_childrenInline ) {
+        if (isInline()) {
+            // We are placing a block inside an inline. We have to perform a split of this
+            // inline into continuations.  This involves creating an anonymous block box to hold 
+            // |newChild|.  We then make that block box a continuation of this inline.  We take all of
+            // the children after |beforeChild| and put them in a clone of this object.
+            RenderStyle *newStyle = new RenderStyle();
+            newStyle->inheritFrom(style());
+            newStyle->setDisplay(BLOCK);
+
+            RenderFlow *newBox = new (renderArena()) RenderFlow(0 /* anonymous box */);
+            newBox->setStyle(newStyle);
+            newBox->setIsAnonymousBox(true);
+            newBox->addChild(newChild);
+            RenderFlow* oldContinuation = continuation();
+            setContinuation(newBox);
+            splitFlow(beforeChild, newBox, oldContinuation);
+            return;
+        }
+        else {
+            // This is a block with inline content. Wrap the inline content in anonymous blocks.
             makeChildrenNonInline(beforeChild);
             madeBoxesNonInline = true;
         }
@@ -1895,25 +2119,6 @@ void RenderFlow::addChild(RenderObject *newChild, RenderObject *beforeChild)
         }
     }
 
-    if(!newChild->isInline()) // block child
-    {
-        // XXX This is all just completely wrong and is going to have to be
-        // rewritten. -dwh
-        
-        // If we are inline ourselves and have become block, we have to make sure our parent
-        // makes the necessary adjustments so that all of its other children are moved into
-        // anonymous block boxes where necessary
-        if (style()->display() == INLINE)
-        {
-            setInline(false); // inline can't contain blocks
-            RenderObject *p = parent();
-            if (p && p->isFlow() && p->childrenInline() ) {
-                static_cast<RenderFlow*>(p)->makeChildrenNonInline();
-                madeBoxesNonInline = true;
-            }
-        }
-    }
-
     RenderBox::addChild(newChild,beforeChild);
     // ### care about aligned stuff
 
diff --git a/WebCore/khtml/rendering/render_flow.h b/WebCore/khtml/rendering/render_flow.h
index 8483b94..8b0b648 100644
--- a/WebCore/khtml/rendering/render_flow.h
+++ b/WebCore/khtml/rendering/render_flow.h
@@ -47,17 +47,33 @@ public:
 
     virtual ~RenderFlow();
 
-    virtual const char *renderName() const { return "RenderFlow"; }
-
+    virtual const char *renderName() const 
+    { 
+        if (isAnonymousBox()) 
+            return "Block (Anonymous)";
+        if (isInline())
+            return "Inline";
+        return "Block";
+    };
+    
     virtual void setStyle(RenderStyle *style);
 
     virtual bool isFlow() const { return true; }
     virtual bool childrenInline() const { return m_childrenInline; }
+    virtual void setChildrenInline(bool b) { m_childrenInline = b; }
+    
     virtual bool isRendered() const { return true; }
     virtual void setBlockBidi() { m_blockBidi = true; }
 
-    RenderFlow* continuation() { return m_continuation; }
+    virtual RenderFlow* continuation() const { return m_continuation; }
     void setContinuation(RenderFlow* c) { m_continuation = c; }
+    RenderFlow* continuationBefore(RenderObject* beforeChild);
+    
+    void splitInlines(RenderFlow* fromBlock, RenderFlow* toBlock, RenderFlow* middleBlock,
+                      RenderObject* beforeChild, RenderFlow* oldCont);
+    void splitFlow(RenderObject* beforeChild, RenderFlow* newBlockBox, RenderFlow* oldCont);
+    void addChildWithContinuation(RenderObject* newChild, RenderObject* beforeChild);
+    void addChildToFlow(RenderObject* newChild, RenderObject* beforeChild);
     
     void makeChildrenNonInline(RenderObject *box2Start = 0);
 
@@ -210,7 +226,7 @@ private:
     bool firstLine        : 1; // used in inline layouting
     bool m_blockBidi : 1;
     EClear m_clearStatus  : 2; // used during layuting of paragraphs
-    
+     
     short m_maxTopPosMargin;
     short m_maxTopNegMargin;
     short m_maxBottomPosMargin;
diff --git a/WebCore/khtml/rendering/render_object.cpp b/WebCore/khtml/rendering/render_object.cpp
index cbe9417..1ffe785 100644
--- a/WebCore/khtml/rendering/render_object.cpp
+++ b/WebCore/khtml/rendering/render_object.cpp
@@ -969,6 +969,13 @@ FindSelectionResult RenderObject::checkSelectionPoint( int _x, int _y, int _tx,
     return SelectionPointAfter;
 }
 
+bool RenderObject::mouseInside() const
+{ 
+    if (!m_mouseInside && continuation()) 
+        return continuation()->mouseInside();
+    return m_mouseInside; 
+}
+
 bool RenderObject::nodeAtPoint(NodeInfo& info, int _x, int _y, int _tx, int _ty)
 {
     int tx = _tx + xPos();
diff --git a/WebCore/khtml/rendering/render_object.h b/WebCore/khtml/rendering/render_object.h
index 49377cc..f413e76 100644
--- a/WebCore/khtml/rendering/render_object.h
+++ b/WebCore/khtml/rendering/render_object.h
@@ -153,9 +153,11 @@ public:
     
     // some helper functions...
     virtual bool childrenInline() const { return false; }
+    virtual void setChildrenInline(bool b) { };
     virtual bool isRendered() const { return false; }
     virtual bool isFlow() const { return false; }
-
+    virtual RenderFlow* continuation() const { return 0; }
+    
     virtual bool isListItem() const { return false; }
     virtual bool isListMarker() const { return false; }
     virtual bool isRoot() const { return false; }
@@ -181,7 +183,7 @@ public:
     bool isRelPositioned() const { return m_relPositioned; } // relative positioning
     bool isText() const  { return m_isText; }
     bool isInline() const { return m_inline; }  // inline object
-    bool mouseInside() const { return m_mouseInside; }
+    bool mouseInside() const;
     bool isReplaced() const { return m_replaced; } // a "replaced" element (see CSS)
     bool shouldPaintBackgroundOrBorder() const { return m_paintBackground; }
     bool layouted() const   { return m_layouted; }
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index b360e00..3d55743 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -488,7 +488,12 @@ void KWQKHTMLPart::forceLayout()
     KHTMLView *v = d->m_view;
     if (v) {
         v->layout();
-        v->unscheduleRelayout();
+        // We cannot unschedule a pending relayout, since the force can be called with
+        // a tiny rectangle from a drawRect update.  By unscheduling we in effect
+        // "validate" and stop the necessary full repaint from occurring.  Basically any basic
+        // append/remove DHTML is broken by this call.  For now, I have removed the optimization
+        // until we have a better invalidation stategy. -dwh
+        //v->unscheduleRelayout();
     }
 }
 
diff --git a/WebCore/kwq/WebCoreBridge.mm b/WebCore/kwq/WebCoreBridge.mm
index b04d76e..0c3f818 100644
--- a/WebCore/kwq/WebCoreBridge.mm
+++ b/WebCore/kwq/WebCoreBridge.mm
@@ -301,7 +301,7 @@ NSString *WebCoreElementStringKey = 		@"WebElementString";
     for (RenderObject *child = node->firstChild(); child; child = child->nextSibling()) {
         [children addObject:[self copyRenderNode:child copier:copier]];
     }
-    
+          
     NSString *name = [[NSString alloc] initWithUTF8String:node->renderName()];
     
     RenderPart *nodeRenderPart = dynamic_cast<RenderPart *>(node);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list