[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:43:06 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 53103852ad025ef37263d97e1441c3806cb508ed
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri May 23 22:22:29 2003 +0000

    	Fix for 3248176, failed assertion on blizzard's world of warcraft
    	page.  They dynamically changed the position of an element from
    	absolute to relative, and this element was inside an inline.
    	The setStyle() code has to be smart enough to split the inline
    	flow when the element is no longer absolute positioned.
    
    	This patch makes a splitFlow occur like it should and it also
    	cleans up anonymous block creation with a new helper function
    	on RenderObject, createAnonymousBlock.
    
            Reviewed by darin
    
            * khtml/rendering/render_block.cpp:
            * khtml/rendering/render_inline.cpp:
            (RenderInline::splitFlow):
            * khtml/rendering/render_object.cpp:
            (RenderObject::createAnonymousBlock):
            (RenderObject::handleDynamicFloatPositionChange):
            (RenderObject::setStyle):
            * khtml/rendering/render_object.h:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@4421 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index d24161b..e73fd1d 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,5 +1,28 @@
 2003-05-22  David Hyatt  <hyatt at apple.com>
 
+	Fix for 3248176, failed assertion on blizzard's world of warcraft
+	page.  They dynamically changed the position of an element from
+	absolute to relative, and this element was inside an inline.
+	The setStyle() code has to be smart enough to split the inline
+	flow when the element is no longer absolute positioned.
+
+	This patch makes a splitFlow occur like it should and it also
+	cleans up anonymous block creation with a new helper function
+	on RenderObject, createAnonymousBlock.
+	
+        Reviewed by darin
+
+        * khtml/rendering/render_block.cpp:
+        * khtml/rendering/render_inline.cpp:
+        (RenderInline::splitFlow):
+        * khtml/rendering/render_object.cpp:
+        (RenderObject::createAnonymousBlock):
+        (RenderObject::handleDynamicFloatPositionChange):
+        (RenderObject::setStyle):
+        * khtml/rendering/render_object.h:
+
+2003-05-22  David Hyatt  <hyatt at apple.com>
+
 	Fix for 3259947.  Can't add clippings on iht.com.  The fix is
 	to make sure all DOM properties that relate to attributes return ""
 	and not "null" when the attribute isn't present or when the 
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index d24161b..e73fd1d 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,5 +1,28 @@
 2003-05-22  David Hyatt  <hyatt at apple.com>
 
+	Fix for 3248176, failed assertion on blizzard's world of warcraft
+	page.  They dynamically changed the position of an element from
+	absolute to relative, and this element was inside an inline.
+	The setStyle() code has to be smart enough to split the inline
+	flow when the element is no longer absolute positioned.
+
+	This patch makes a splitFlow occur like it should and it also
+	cleans up anonymous block creation with a new helper function
+	on RenderObject, createAnonymousBlock.
+	
+        Reviewed by darin
+
+        * khtml/rendering/render_block.cpp:
+        * khtml/rendering/render_inline.cpp:
+        (RenderInline::splitFlow):
+        * khtml/rendering/render_object.cpp:
+        (RenderObject::createAnonymousBlock):
+        (RenderObject::handleDynamicFloatPositionChange):
+        (RenderObject::setStyle):
+        * khtml/rendering/render_object.h:
+
+2003-05-22  David Hyatt  <hyatt at apple.com>
+
 	Fix for 3259947.  Can't add clippings on iht.com.  The fix is
 	to make sure all DOM properties that relate to attributes return ""
 	and not "null" when the attribute isn't present or when the 
diff --git a/WebCore/khtml/rendering/render_block.cpp b/WebCore/khtml/rendering/render_block.cpp
index ee74a57..1e67edb 100644
--- a/WebCore/khtml/rendering/render_block.cpp
+++ b/WebCore/khtml/rendering/render_block.cpp
@@ -210,18 +210,10 @@ void RenderBlock::addChildToFlow(RenderObject* newChild, RenderObject* beforeChi
             }
 
             // no suitable existing anonymous box - create a new one
-            RenderStyle *newStyle = new RenderStyle();
-            newStyle->inheritFrom(style());
-            newStyle->setDisplay(BLOCK);
-
-            RenderBlock *newBox = new (renderArena()) RenderBlock(0 /* anonymous box */);
-            newBox->setStyle(newStyle);
-            newBox->setIsAnonymousBox(true);
-
+            RenderBlock* newBox = createAnonymousBlock();
             RenderBox::addChild(newBox,beforeChild);
             newBox->addChild(newChild);
             newBox->setPos(newBox->xPos(), -500000);
-
             newChild->setNeedsLayoutAndMinMaxRecalc();
             return;
         }
@@ -303,14 +295,7 @@ void RenderBlock::makeChildrenNonInline(RenderObject *insertionPoint)
 
         child = inlineRunEnd->nextSibling();
 
-        RenderStyle *newStyle = new RenderStyle();
-        newStyle->inheritFrom(style());
-        newStyle->setDisplay(BLOCK);
-
-        RenderBlock *box = new (renderArena()) RenderBlock(0 /* anonymous box */);
-        box->setStyle(newStyle);
-        box->setIsAnonymousBox(true);
-
+        RenderBlock* box = createAnonymousBlock();
         insertChildNode(box, inlineRunStart);
         RenderObject* o = inlineRunStart;
         while(o != inlineRunEnd)
diff --git a/WebCore/khtml/rendering/render_inline.cpp b/WebCore/khtml/rendering/render_inline.cpp
index a80b8b3..1dbdb3f 100644
--- a/WebCore/khtml/rendering/render_inline.cpp
+++ b/WebCore/khtml/rendering/render_inline.cpp
@@ -172,8 +172,7 @@ void RenderInline::splitInlines(RenderBlock* fromBlock, RenderBlock* toBlock,
 void RenderInline::splitFlow(RenderObject* beforeChild, RenderBlock* newBlockBox,
                              RenderObject* newChild, RenderFlow* oldCont)
 {
-    RenderBlock *pre = 0;
-    RenderStyle* newStyle = 0;
+    RenderBlock* pre = 0;
     RenderBlock* block = containingBlock();
     bool madeNewBeforeBlock = false;
     if (block->isAnonymousBox()) {
@@ -183,24 +182,12 @@ void RenderInline::splitFlow(RenderObject* beforeChild, RenderBlock* newBlockBox
     }
     else {
         // No anonymous block available for use.  Make one.
-        newStyle = new RenderStyle();
-        newStyle->inheritFrom(block->style());
-        newStyle->setDisplay(BLOCK);
-        pre = new (renderArena()) RenderBlock(0 /* anonymous box */);
-        pre->setStyle(newStyle);
-        pre->setIsAnonymousBox(true);
-        pre->setChildrenInline(true);
+        pre = block->createAnonymousBlock();
         madeNewBeforeBlock = true;
     }
 
-    newStyle = new RenderStyle();
-    newStyle->inheritFrom(block->style());
-    newStyle->setDisplay(BLOCK);
-    RenderBlock *post = new (renderArena()) RenderBlock(0 /* anonymous box */);
-    post->setStyle(newStyle);
-    post->setIsAnonymousBox(true);
-    post->setChildrenInline(true);
-
+    RenderBlock* post = block->createAnonymousBlock();
+    
     RenderObject* boxFirst = madeNewBeforeBlock ? block->firstChild() : pre->nextSibling();
     if (madeNewBeforeBlock)
         block->insertChildNode(pre, boxFirst);
diff --git a/WebCore/khtml/rendering/render_object.cpp b/WebCore/khtml/rendering/render_object.cpp
index 0dfb43b..3bb803a 100644
--- a/WebCore/khtml/rendering/render_object.cpp
+++ b/WebCore/khtml/rendering/render_object.cpp
@@ -910,6 +910,51 @@ void RenderObject::selectionStartEnd(int& spos, int& epos)
         parent()->selectionStartEnd(spos, epos);
 }
 
+RenderBlock* RenderObject::createAnonymousBlock()
+{
+    RenderStyle *newStyle = new RenderStyle();
+    newStyle->inheritFrom(m_style);
+    newStyle->setDisplay(BLOCK);
+
+    RenderBlock *newBox = new (renderArena()) RenderBlock(0 /* anonymous box */);
+    newBox->setStyle(newStyle);
+    newBox->setIsAnonymousBox(true);
+    return newBox;
+}
+
+void RenderObject::handleDynamicFloatPositionChange()
+{
+    // We have gone from not affecting the inline status of the parent flow to suddenly
+    // having an impact.  See if there is a mismatch between the parent flow's
+    // childrenInline() state and our state.
+    setInline(m_style->display() == INLINE || // m_style->display() == INLINE_BLOCK ||
+              m_style->display() == INLINE_TABLE);
+    if (isInline() != parent()->childrenInline()) {
+        if (!isInline()) {
+            if (parent()->isRenderInline()) {
+                // We have to split the parent flow.
+                RenderInline* parentInline = static_cast<RenderInline*>(parent());
+                RenderBlock* newBox = parentInline->createAnonymousBlock();
+                
+                RenderFlow* oldContinuation = parent()->continuation();
+                parentInline->setContinuation(newBox);
+
+                RenderObject* beforeChild = nextSibling();
+                parent()->removeChildNode(this);
+                parentInline->splitFlow(beforeChild, newBox, this, oldContinuation);
+            }
+            else if (parent()->isRenderBlock())
+                static_cast<RenderBlock*>(parent())->makeChildrenNonInline();
+        }
+        else {
+            // An anonymous block must be made to wrap this inline.
+            RenderBlock* box = createAnonymousBlock();
+            parent()->insertChildNode(box, this);
+            box->appendChildNode(parent()->removeChildNode(this));
+        }
+    }
+}
+
 void RenderObject::setStyle(RenderStyle *style)
 {
     if (m_style == style)
@@ -931,9 +976,9 @@ void RenderObject::setStyle(RenderStyle *style)
         // from the positioned objects list.
         removeFromObjectLists();
 
-    bool affectsParentBlock = (m_style && isFloatingOrPositioned() &&
+    bool affectsParentBlock = m_style && isFloatingOrPositioned() &&
         (!style->isFloating() && style->position() != ABSOLUTE && style->position() != FIXED)
-        && parent() && parent()->isBlockFlow());
+        && parent() && (parent()->isBlockFlow() || parent()->isInlineFlow());
     
     //qDebug("new style, diff=%d", d);
     // reset style flags
@@ -971,30 +1016,9 @@ void RenderObject::setStyle(RenderStyle *style)
                                      m_style->hasBorder() || nb );
     m_hasFirstLine = (style->getPseudoStyle(RenderStyle::FIRST_LINE) != 0);
 
-    if (affectsParentBlock) {
-        // We have gone from not affecting the inline status of the parent block to suddenly
-        // having an impact.  See if there is a mismatch between the parent block's
-        // childrenInline() state and our state.
-        setInline(style->display() == INLINE || // style->display() == INLINE_BLOCK ||
-                  style->display() == INLINE_TABLE);
-        if (isInline() != parent()->childrenInline()) {
-            if (!isInline())
-                static_cast<RenderBlock*>(parent())->makeChildrenNonInline();
-            else {
-                // An anonymous block must be made to wrap this inline.
-                RenderStyle *newStyle = new RenderStyle();
-                newStyle->inheritFrom(m_style);
-                newStyle->setDisplay(BLOCK);
-
-                RenderBlock *box = new (renderArena()) RenderBlock(0 /* anonymous box */);
-                box->setStyle(newStyle);
-                box->setIsAnonymousBox(true);
-                parent()->insertChildNode(box, this);
-                box->appendChildNode(parent()->removeChildNode(this));
-            }
-        }
-    }
-        
+    if (affectsParentBlock)
+        handleDynamicFloatPositionChange();
+            
     if ( d >= RenderStyle::Position && m_parent ) {
         //qDebug("triggering relayout");
         setNeedsLayoutAndMinMaxRecalc();
diff --git a/WebCore/khtml/rendering/render_object.h b/WebCore/khtml/rendering/render_object.h
index b499fd8..055acee 100644
--- a/WebCore/khtml/rendering/render_object.h
+++ b/WebCore/khtml/rendering/render_object.h
@@ -129,6 +129,15 @@ public:
     virtual int getBaselineOfFirstLineBox() { return -1; } // Tables and blocks implement this.
     virtual InlineFlowBox* getFirstLineBox() { return 0; } // Tables and blocks implement this.
 
+    // Called when an object that was floating or positioned becomes a normal flow object
+    // again.  We have to make sure the render tree updates as needed to accommodate the new
+    // normal flow object.
+    void handleDynamicFloatPositionChange();
+
+    // This function is a convenience helper for creating an anonymous block that inherits its
+    // style from this RenderObject.
+    RenderBlock* createAnonymousBlock();
+    
     // Whether or not a positioned element requires normal flow x/y to be computed
     // to determine its position.
     bool hasStaticX() const;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list