[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:47:08 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit d0f2fdadb0a7b1763c56b44b00b4933c9bde7f94
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sun Jul 13 00:10:21 2003 +0000

    	Fix for 3187101, before/after content not dynamic.  This patch
    	compares the ContentData of the old style and the new style and
    	if they are different, it blows away and recreates the render
    	objects for the generated content.  Otherwise it will dynamically
    	update the styles of the generated content render objects (which
    	should fix the printer/screen bug for rjw).
    
    	Note that createObject had an extra call to setStyle, which was
    	causing most objects to set the same style context on themselves
    	twice.  This was exposed as I was fixing the above problem.
    
            Reviewed by darin
    
            * ChangeLog:
            * khtml/rendering/render_container.cpp:
            (RenderContainer::updatePseudoChild):
            * khtml/rendering/render_object.cpp:
            (RenderObject::createObject):
            * khtml/rendering/render_style.cpp:
            (RenderStyle::contentDataEquivalent):
            * khtml/rendering/render_style.h:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@4632 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 06b9ab2..d8edf0b 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,5 +1,29 @@
 2003-07-11  Dave Hyatt  <hyatt at apple.com>
 
+	Fix for 3187101, before/after content not dynamic.  This patch
+	compares the ContentData of the old style and the new style and
+	if they are different, it blows away and recreates the render
+	objects for the generated content.  Otherwise it will dynamically
+	update the styles of the generated content render objects (which
+	should fix the printer/screen bug for rjw).
+
+	Note that createObject had an extra call to setStyle, which was
+	causing most objects to set the same style context on themselves
+	twice.  This was exposed as I was fixing the above problem.
+	
+        Reviewed by darin
+
+        * ChangeLog:
+        * khtml/rendering/render_container.cpp:
+        (RenderContainer::updatePseudoChild):
+        * khtml/rendering/render_object.cpp:
+        (RenderObject::createObject):
+        * khtml/rendering/render_style.cpp:
+        (RenderStyle::contentDataEquivalent):
+        * khtml/rendering/render_style.h:
+
+2003-07-11  Dave Hyatt  <hyatt at apple.com>
+
 	Fix pseudostyles to inherit from the element's style that they are
 	specified for.  This is incorrect both for ::first-line and
 	::first-letter, but it is at least right for ::before and ::after.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 06b9ab2..d8edf0b 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,5 +1,29 @@
 2003-07-11  Dave Hyatt  <hyatt at apple.com>
 
+	Fix for 3187101, before/after content not dynamic.  This patch
+	compares the ContentData of the old style and the new style and
+	if they are different, it blows away and recreates the render
+	objects for the generated content.  Otherwise it will dynamically
+	update the styles of the generated content render objects (which
+	should fix the printer/screen bug for rjw).
+
+	Note that createObject had an extra call to setStyle, which was
+	causing most objects to set the same style context on themselves
+	twice.  This was exposed as I was fixing the above problem.
+	
+        Reviewed by darin
+
+        * ChangeLog:
+        * khtml/rendering/render_container.cpp:
+        (RenderContainer::updatePseudoChild):
+        * khtml/rendering/render_object.cpp:
+        (RenderObject::createObject):
+        * khtml/rendering/render_style.cpp:
+        (RenderStyle::contentDataEquivalent):
+        * khtml/rendering/render_style.h:
+
+2003-07-11  Dave Hyatt  <hyatt at apple.com>
+
 	Fix pseudostyles to inherit from the element's style that they are
 	specified for.  This is incorrect both for ::first-line and
 	::first-letter, but it is at least right for ::before and ::after.
diff --git a/WebCore/khtml/rendering/render_container.cpp b/WebCore/khtml/rendering/render_container.cpp
index a1a0d5e..e6ad8c0 100644
--- a/WebCore/khtml/rendering/render_container.cpp
+++ b/WebCore/khtml/rendering/render_container.cpp
@@ -205,32 +205,49 @@ void RenderContainer::removeChild(RenderObject *oldChild)
 
 void RenderContainer::updatePseudoChild(RenderStyle::PseudoId type, RenderObject* child)
 {
+    // In CSS2, before/after pseudo-content cannot nest.  Check this first.
+    if (style()->styleType() == RenderStyle::BEFORE || style()->styleType() == RenderStyle::AFTER)
+        return;
+    
     RenderStyle* pseudo = style()->getPseudoStyle(type);
-    if (!pseudo || pseudo->display() == NONE) {
-        if (child && child->style()->styleType() == type)
-            // The child needs to be removed.
+
+    // Whether or not we currently have generated content attached.
+    bool oldContentPresent = child && (child->style()->styleType() == type);
+
+    // Whether or not we now want generated content.  
+    bool newContentWanted = pseudo && pseudo->display() != NONE;
+
+    // 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.
+    if (!newContentWanted ||
+        (oldContentPresent && !child->style()->contentDataEquivalent(pseudo))) {
+        // Nuke the children. 
+        while (child && child->style()->styleType() == type) {
+            // The children need to be removed.
             removeChild(child);
-        return; // If we have no pseudo-style or if the pseudo's display type is NONE, then we
-                // have no generated content.
+            child = (type == RenderStyle::BEFORE) ? child->nextSibling() : child->previousSibling();
+        }
+
+        oldContentPresent = child && (child->style()->styleType() == type);
     }
 
-    // FIXME: need to detect when :before/:after content has changed, in addition
-    // to detecting addition/removal.
-    if (child && child->style()->styleType() == type)
-        return; // Generated content is already added.  No need to add more.
+    // If we have no pseudo-style or if the pseudo's display type is NONE, then we
+    // have no generated content and can now return.
+    if (!newContentWanted)
+        return;
     
-    RenderObject* insertBefore = (type == RenderStyle::BEFORE) ? child : 0;
-        
     // From the CSS2 specification:
     // User agents must ignore the following properties with :before and :after
     // pseudo-elements: 'position', 'float', list properties, and table properties.
     // Basically we need to ensure that no RenderLayer gets made for generated
     // content.
+    pseudo->setOpacity(1.0f);
     pseudo->setPosition(STATIC);
     pseudo->setFloating(FNONE);
     pseudo->setOverflow(OVISIBLE); // FIXME: Glazman's blog does this. Wacky.
-                                    // This property might need to be allowed if the
-                                    // generated content is a block.
+                                   // This property might need to be allowed if the
+                                   // generated content is a block.
 
     if (isInlineFlow() && pseudo->display() != INLINE)
         // According to the CSS2 spec (the end of section 12.1), the only allowed
@@ -238,7 +255,26 @@ void RenderContainer::updatePseudoChild(RenderStyle::PseudoId type, RenderObject
         // determined that the pseudo is not display NONE, any display other than
         // inline should be mutated to INLINE.
         pseudo->setDisplay(INLINE);
-
+    
+    if (oldContentPresent) {
+        while (child && child->style()->styleType() == type) {
+            // We have generated content present still.  We want to walk this content and update our
+            // style information with the new pseudo style.
+            child->setStyle(pseudo);
+
+            // Note that if we ever support additional types of generated content (which should be way off
+            // in the future), this code will need to be patched.
+            if (child->firstChild()) // Generated text content has a first child whose style also needs to be set.
+                child->firstChild()->setStyle(pseudo);
+
+            // Advance to the next child.
+            child = (type == RenderStyle::BEFORE) ? child->nextSibling() : child->previousSibling();
+        }
+        return; // We've updated the generated content. That's all we needed to do.
+    }
+    
+    RenderObject* insertBefore = (type == RenderStyle::BEFORE) ? child : 0;
+        
     // Now walk our list of generated content and create render objects for every type
     // we encounter.
     for (ContentData* contentData = pseudo->contentData();
diff --git a/WebCore/khtml/rendering/render_object.cpp b/WebCore/khtml/rendering/render_object.cpp
index 17aa90b..0e1e903 100644
--- a/WebCore/khtml/rendering/render_object.cpp
+++ b/WebCore/khtml/rendering/render_object.cpp
@@ -122,7 +122,6 @@ RenderObject *RenderObject::createObject(DOM::NodeImpl* node,  RenderStyle* styl
         o = new (arena) RenderFlexibleBox(node);
         break;
     }
-    if(o) o->setStyle(style);
     return o;
 }
 
diff --git a/WebCore/khtml/rendering/render_style.cpp b/WebCore/khtml/rendering/render_style.cpp
index 479e452..3857b6a 100644
--- a/WebCore/khtml/rendering/render_style.cpp
+++ b/WebCore/khtml/rendering/render_style.cpp
@@ -31,6 +31,7 @@
 using namespace khtml;
 
 using DOM::DOMStringImpl;
+using DOM::DOMString;
 
 StyleSurroundData::StyleSurroundData()
     : margin( Fixed ), padding( Variable )
@@ -498,6 +499,32 @@ void RenderStyle::setClip( Length top, Length right, Length bottom, Length left
     data->clip.left = left;
 }
 
+bool RenderStyle::contentDataEquivalent(RenderStyle* otherStyle)
+{
+    ContentData* c1 = content;
+    ContentData* c2 = otherStyle->content;
+
+    while (c1 && c2) {
+        if (c1->_contentType != c2->_contentType)
+            return false;
+        if (c1->_contentType == CONTENT_TEXT) {
+            DOMString c1Str(c1->_content.text);
+            DOMString c2Str(c2->_content.text);
+            if (c1Str != c2Str)
+                return false;
+        }
+        else if (c1->_contentType == CONTENT_OBJECT) {
+            if (c1->_content.object != c2->_content.object)
+                return false;
+        }
+
+        c1 = c1->_nextContent;
+        c2 = c2->_nextContent;
+    }
+
+    return !c1 && !c2;
+}
+
 void RenderStyle::setContent(CachedObject* o, bool add)
 {
     if (!o)
diff --git a/WebCore/khtml/rendering/render_style.h b/WebCore/khtml/rendering/render_style.h
index d5f11b0..ec2294d 100644
--- a/WebCore/khtml/rendering/render_style.h
+++ b/WebCore/khtml/rendering/render_style.h
@@ -1002,6 +1002,7 @@ public:
     }
 
     ContentData* contentData() { return content; }
+    bool contentDataEquivalent(RenderStyle* otherStyle);
     void setContent(DOM::DOMStringImpl* s, bool add = false);
     void setContent(CachedObject* o, bool add = false);
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list