[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:50:59 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit ba92aa21452ba379e21a9bb891295d3f99bfd0b0
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Aug 11 23:41:02 2003 +0000

    	Fix for 3349142, blocks inside inlines with generated content cause the generated
    	content to get all screwed up, especially if you try to print.  This patch fixes
    	generated content to be continuation-aware (and vice versa), so that the content
    	behaves correctly when inlines get split.
    
            Reviewed by darin
    
            * khtml/rendering/render_block.cpp:
            * khtml/rendering/render_container.cpp:
            (RenderContainer::updatePseudoChild):
            * khtml/rendering/render_container.h:
            * khtml/rendering/render_flow.cpp:
            (RenderFlow::addChild):
            * khtml/rendering/render_inline.cpp:
            (RenderInline::isInlineContinuation):
            (RenderInline::addChildToFlow):
            (RenderInline::cloneInline):
            (RenderInline::splitInlines):
            * khtml/rendering/render_inline.h:
            * khtml/rendering/render_object.cpp:
            (RenderObject::continuation):
            (RenderObject::isInlineContinuation):
            * khtml/rendering/render_object.h:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@4804 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index c830560..f866cd5 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,29 @@
+2003-08-11  David Hyatt  <hyatt at apple.com>
+
+	Fix for 3349142, blocks inside inlines with generated content cause the generated
+	content to get all screwed up, especially if you try to print.  This patch fixes
+	generated content to be continuation-aware (and vice versa), so that the content
+	behaves correctly when inlines get split.
+	
+        Reviewed by darin
+
+        * khtml/rendering/render_block.cpp:
+        * khtml/rendering/render_container.cpp:
+        (RenderContainer::updatePseudoChild):
+        * khtml/rendering/render_container.h:
+        * khtml/rendering/render_flow.cpp:
+        (RenderFlow::addChild):
+        * khtml/rendering/render_inline.cpp:
+        (RenderInline::isInlineContinuation):
+        (RenderInline::addChildToFlow):
+        (RenderInline::cloneInline):
+        (RenderInline::splitInlines):
+        * khtml/rendering/render_inline.h:
+        * khtml/rendering/render_object.cpp:
+        (RenderObject::continuation):
+        (RenderObject::isInlineContinuation):
+        * khtml/rendering/render_object.h:
+
 2003-08-11  Darin Adler  <darin at apple.com>
 
         * kwq/KWQKHTMLPart.h: Fixed some small typo-ish strangenesses.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index c830560..f866cd5 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,29 @@
+2003-08-11  David Hyatt  <hyatt at apple.com>
+
+	Fix for 3349142, blocks inside inlines with generated content cause the generated
+	content to get all screwed up, especially if you try to print.  This patch fixes
+	generated content to be continuation-aware (and vice versa), so that the content
+	behaves correctly when inlines get split.
+	
+        Reviewed by darin
+
+        * khtml/rendering/render_block.cpp:
+        * khtml/rendering/render_container.cpp:
+        (RenderContainer::updatePseudoChild):
+        * khtml/rendering/render_container.h:
+        * khtml/rendering/render_flow.cpp:
+        (RenderFlow::addChild):
+        * khtml/rendering/render_inline.cpp:
+        (RenderInline::isInlineContinuation):
+        (RenderInline::addChildToFlow):
+        (RenderInline::cloneInline):
+        (RenderInline::splitInlines):
+        * khtml/rendering/render_inline.h:
+        * khtml/rendering/render_object.cpp:
+        (RenderObject::continuation):
+        (RenderObject::isInlineContinuation):
+        * khtml/rendering/render_object.h:
+
 2003-08-11  Darin Adler  <darin at apple.com>
 
         * kwq/KWQKHTMLPart.h: Fixed some small typo-ish strangenesses.
diff --git a/WebCore/khtml/rendering/render_block.cpp b/WebCore/khtml/rendering/render_block.cpp
index 1faaeb8..6f2a819 100644
--- a/WebCore/khtml/rendering/render_block.cpp
+++ b/WebCore/khtml/rendering/render_block.cpp
@@ -96,6 +96,10 @@ void RenderBlock::setStyle(RenderStyle* _style)
 
 void RenderBlock::addChildToFlow(RenderObject* newChild, RenderObject* beforeChild)
 {
+    // Make sure we don't append things after :after-generated content if we have it.
+    if (!beforeChild && lastChild() && lastChild()->style()->styleType() == RenderStyle::AFTER)
+        beforeChild = lastChild();
+    
     setNeedsLayout(true);
 
     bool madeBoxesNonInline = FALSE;
diff --git a/WebCore/khtml/rendering/render_container.cpp b/WebCore/khtml/rendering/render_container.cpp
index e6ad8c0..009936e 100644
--- a/WebCore/khtml/rendering/render_container.cpp
+++ b/WebCore/khtml/rendering/render_container.cpp
@@ -217,6 +217,16 @@ void RenderContainer::updatePseudoChild(RenderStyle::PseudoId type, RenderObject
     // Whether or not we now want generated content.  
     bool newContentWanted = pseudo && pseudo->display() != NONE;
 
+    // For <q><p/></q>, if this object is the inline continuation of the <q>, we only want to generate
+    // :after content and not :before content.
+    if (type == RenderStyle::BEFORE && isInlineContinuation())
+        newContentWanted = false;
+
+    // Similarly, if we're the beginning of a <q>, and there's an inline continuation for our object,
+    // then we don't generate the :after content.
+    if (type == RenderStyle::AFTER && isRenderInline() && continuation())
+        newContentWanted = false;
+    
     // If we don't want generated content any longer, or if we have generated content, but it's no longer
     // identical to the new content data we want to build render objects for, then we nuke all
     // of the old generated content.
diff --git a/WebCore/khtml/rendering/render_container.h b/WebCore/khtml/rendering/render_container.h
index e4bd1a9..a2d1184 100644
--- a/WebCore/khtml/rendering/render_container.h
+++ b/WebCore/khtml/rendering/render_container.h
@@ -54,16 +54,14 @@ public:
     virtual void calcMinMaxWidth() { setMinMaxKnown( true ); }
 
     virtual void removeLeftoverAnonymousBoxes();
-    
-private:
 
+    void updatePseudoChild(RenderStyle::PseudoId type, RenderObject* child);
+
+private:
     void setFirstChild(RenderObject *first) { m_first = first; }
     void setLastChild(RenderObject *last) { m_last = last; }
 
 protected:
-
-    void updatePseudoChild(RenderStyle::PseudoId type, RenderObject* child);
-
     RenderObject *m_first;
     RenderObject *m_last;
 };
diff --git a/WebCore/khtml/rendering/render_flow.cpp b/WebCore/khtml/rendering/render_flow.cpp
index 53bc676..ce576ca 100644
--- a/WebCore/khtml/rendering/render_flow.cpp
+++ b/WebCore/khtml/rendering/render_flow.cpp
@@ -120,10 +120,6 @@ void RenderFlow::addChild(RenderObject *newChild, RenderObject *beforeChild)
     kdDebug( 6040 ) << "current height = " << m_height << endl;
 #endif
 
-    // Make sure we don't append things after :after-generated content if we have it.
-    if (!beforeChild && lastChild() && lastChild()->style()->styleType() == RenderStyle::AFTER)
-        beforeChild = lastChild();
-    
     if (continuation())
         return addChildWithContinuation(newChild, beforeChild);
     return addChildToFlow(newChild, beforeChild);
diff --git a/WebCore/khtml/rendering/render_inline.cpp b/WebCore/khtml/rendering/render_inline.cpp
index 8d1211a..c43d1dd 100644
--- a/WebCore/khtml/rendering/render_inline.cpp
+++ b/WebCore/khtml/rendering/render_inline.cpp
@@ -64,8 +64,17 @@ void RenderInline::setStyle(RenderStyle* _style)
     updatePseudoChild(RenderStyle::AFTER, lastChild());
 }
 
+bool RenderInline::isInlineContinuation() const
+{
+    return m_isContinuation;
+}
+
 void RenderInline::addChildToFlow(RenderObject* newChild, RenderObject* beforeChild)
 {
+    // Make sure we don't append things after :after-generated content if we have it.
+    if (!beforeChild && lastChild() && lastChild()->style()->styleType() == RenderStyle::AFTER)
+        beforeChild = lastChild();
+    
     setNeedsLayout(true);
     
     if (!newChild->isText() && newChild->style()->position() != STATIC)
@@ -86,6 +95,16 @@ void RenderInline::addChildToFlow(RenderObject* newChild, RenderObject* beforeCh
         newBox->setIsAnonymousBox(true);
         RenderFlow* oldContinuation = continuation();
         setContinuation(newBox);
+
+        // Someone may have put a <p> inside a <q>, causing a split.  When this happens, the :after content
+        // has to move into the inline continuation.  Call updatePseudoChild to ensure that our :after
+        // content gets properly destroyed.
+        bool isLastChild = (beforeChild == lastChild());
+        updatePseudoChild(RenderStyle::AFTER, lastChild());
+        if (isLastChild && beforeChild != lastChild())
+            beforeChild = 0; // We destroyed the last child, so now we need to update our insertion
+                             // point to be 0.  It's just a straight append now.
+        
         splitFlow(beforeChild, newBox, newChild, oldContinuation);
         return;
     }
@@ -95,9 +114,10 @@ void RenderInline::addChildToFlow(RenderObject* newChild, RenderObject* beforeCh
     newChild->setNeedsLayoutAndMinMaxRecalc();
 }
 
-static RenderInline* cloneInline(RenderFlow* src)
+RenderInline* RenderInline::cloneInline(RenderFlow* src)
 {
     RenderInline *o = new (src->renderArena()) RenderInline(src->element());
+    o->m_isContinuation = true;
     o->setStyle(src->style());
     return o;
 }
@@ -109,14 +129,14 @@ void RenderInline::splitInlines(RenderBlock* fromBlock, RenderBlock* toBlock,
     // Create a clone of this inline.
     RenderInline* 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.
+    // them from |this| and place them in the clone.
     RenderObject* o = beforeChild;
     while (o) {
         RenderObject* tmp = o;
         o = tmp->nextSibling();
-        clone->appendChildNode(removeChildNode(tmp));
+        clone->addChildToFlow(removeChildNode(tmp), 0);
         tmp->setNeedsLayoutAndMinMaxRecalc();
     }
 
@@ -134,20 +154,25 @@ void RenderInline::splitInlines(RenderBlock* fromBlock, RenderBlock* toBlock,
         clone = cloneInline(curr);
 
         // Insert our child clone as the first child.
-        clone->appendChildNode(cloneChild);
+        clone->addChildToFlow(cloneChild, 0);
 
         // Hook the clone up as a continuation of |curr|.
         RenderFlow* oldCont = curr->continuation();
         curr->setContinuation(clone);
         clone->setContinuation(oldCont);
 
+        // Someone may have indirectly caused a <q> to split.  When this happens, the :after content
+        // has to move into the inline continuation.  Call updatePseudoChild to ensure that the inline's :after
+        // content gets properly destroyed.
+        curr->updatePseudoChild(RenderStyle::AFTER, curr->lastChild());
+        
         // 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));
+            clone->addChildToFlow(curr->removeChildNode(tmp), 0);
             tmp->setNeedsLayoutAndMinMaxRecalc();
         }
 
diff --git a/WebCore/khtml/rendering/render_inline.h b/WebCore/khtml/rendering/render_inline.h
index ec2f3a1..364e5b7 100644
--- a/WebCore/khtml/rendering/render_inline.h
+++ b/WebCore/khtml/rendering/render_inline.h
@@ -40,6 +40,8 @@ public:
     virtual bool isRenderInline() const { return true; }
     virtual bool isInlineFlow() const { return true; }
     virtual bool childrenInline() const { return true; }
+
+    virtual bool isInlineContinuation() const;
     
     virtual void addChildToFlow(RenderObject* newChild, RenderObject* beforeChild);
     void splitInlines(RenderBlock* fromBlock, RenderBlock* toBlock, RenderBlock* middleBlock,
@@ -70,6 +72,12 @@ public:
     // the remaining width on a given line (and the height of a single line).
     virtual int offsetLeft() const;
     virtual int offsetTop() const;
+
+protected:
+    static RenderInline* cloneInline(RenderFlow* src);
+    
+private:
+    bool m_isContinuation : 1; // Whether or not we're a continuation of an inline.
 };
 
 }; // namespace
diff --git a/WebCore/khtml/rendering/render_object.cpp b/WebCore/khtml/rendering/render_object.cpp
index ddd1324..f97d453 100644
--- a/WebCore/khtml/rendering/render_object.cpp
+++ b/WebCore/khtml/rendering/render_object.cpp
@@ -180,6 +180,16 @@ bool RenderObject::canHaveChildren() const
     return false;
 }
 
+RenderFlow* RenderObject::continuation() const
+{
+    return 0;
+}
+
+bool RenderObject::isInlineContinuation() const
+{
+    return false;
+}
+
 void RenderObject::addChild(RenderObject* , RenderObject *)
 {
     KHTMLAssert(0);
diff --git a/WebCore/khtml/rendering/render_object.h b/WebCore/khtml/rendering/render_object.h
index cfa09e8..8d6dcab 100644
--- a/WebCore/khtml/rendering/render_object.h
+++ b/WebCore/khtml/rendering/render_object.h
@@ -195,7 +195,9 @@ public:
     virtual bool isInlineBlockOrInlineTable() const { return false; }
     virtual bool childrenInline() const { return false; }
     virtual void setChildrenInline(bool b) { };
-    virtual RenderFlow* continuation() const { return 0; }
+
+    virtual RenderFlow* continuation() const;
+    virtual bool isInlineContinuation() const;
     
     virtual bool isListItem() const { return false; }
     virtual bool isListMarker() const { return false; }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list