[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:52:32 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit b77c19c56f7e3d14b9946e00c232e8a104694f01
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Aug 20 22:03:24 2003 +0000

    	Fix for 3385211, <td>s should ignore the float property in quirks mode.  This
            patch cleans up the adjustments of <td>s and <table>s and moves the code into
            the style selector (instead of cluttering up the rendering code).
    
    	Fix for 3385476, generated content not built correctly.  All generated content
    	should be placed inside a containing object that actually gets the pseudo-style.
    
            Reviewed by rjw
    
            * ChangeLog:
            * khtml/css/cssstyleselector.cpp:
            * khtml/css/cssstyleselector.h:
            * khtml/rendering/render_container.cpp:
            (RenderContainer::updatePseudoChild):
            * khtml/rendering/render_object.cpp:
            (RenderObject::createObject):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@4850 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 8013434..60b8fed 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,22 @@
+2003-08-20  David Hyatt  <hyatt at apple.com>
+
+	Fix for 3385211, <td>s should ignore the float property in quirks mode.  This
+        patch cleans up the adjustments of <td>s and <table>s and moves the code into
+        the style selector (instead of cluttering up the rendering code).
+
+	Fix for 3385476, generated content not built correctly.  All generated content
+	should be placed inside a containing object that actually gets the pseudo-style.
+	
+        Reviewed by rjw
+
+        * ChangeLog:
+        * khtml/css/cssstyleselector.cpp:
+        * khtml/css/cssstyleselector.h:
+        * khtml/rendering/render_container.cpp:
+        (RenderContainer::updatePseudoChild):
+        * khtml/rendering/render_object.cpp:
+        (RenderObject::createObject):
+
 2003-08-20  Maciej Stachowiak  <mjs at apple.com>
 
         Reviewed by Richard.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 8013434..60b8fed 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,22 @@
+2003-08-20  David Hyatt  <hyatt at apple.com>
+
+	Fix for 3385211, <td>s should ignore the float property in quirks mode.  This
+        patch cleans up the adjustments of <td>s and <table>s and moves the code into
+        the style selector (instead of cluttering up the rendering code).
+
+	Fix for 3385476, generated content not built correctly.  All generated content
+	should be placed inside a containing object that actually gets the pseudo-style.
+	
+        Reviewed by rjw
+
+        * ChangeLog:
+        * khtml/css/cssstyleselector.cpp:
+        * khtml/css/cssstyleselector.h:
+        * khtml/rendering/render_container.cpp:
+        (RenderContainer::updatePseudoChild):
+        * khtml/rendering/render_object.cpp:
+        (RenderObject::createObject):
+
 2003-08-20  Maciej Stachowiak  <mjs at apple.com>
 
         Reviewed by Richard.
diff --git a/WebCore/khtml/css/cssstyleselector.cpp b/WebCore/khtml/css/cssstyleselector.cpp
index 1143f1e..16bedf5 100644
--- a/WebCore/khtml/css/cssstyleselector.cpp
+++ b/WebCore/khtml/css/cssstyleselector.cpp
@@ -420,6 +420,9 @@ RenderStyle *CSSStyleSelector::styleForElement(ElementImpl *e)
 	    }
         }
 
+        // Clean up our style object's display and text decorations (among other fixups).
+        adjustRenderStyle(style, e);
+        
         if ( numPseudoProps ) {
 	    fontDirty = false;
             //qDebug("%d applying %d pseudo props", e->cssTagId(), pseudoProps->count() );
@@ -469,38 +472,66 @@ RenderStyle *CSSStyleSelector::styleForElement(ElementImpl *e)
         }
     }
 
+    // Now adjust all our pseudo-styles.
+    RenderStyle *pseudoStyle = style->pseudoStyle;
+    while (pseudoStyle) {
+        adjustRenderStyle(pseudoStyle, 0);
+        pseudoStyle = pseudoStyle->pseudoStyle;
+    }
+
+    // Now return the style.
+    return style;
+}
+
+void CSSStyleSelector::adjustRenderStyle(RenderStyle* style, DOM::ElementImpl *e)
+{
+    // If we have a <td> that specifies a float property, in quirks mode we just drop the float
+    // property (Chris Lydon's blog is an example of a site afflicted by this problem).
+    // Sites also commonly use display:inline/block on <td>s and <table>s.  In quirks mode we force
+    // these tags to retain their display types.
+    if (!strictParsing && e) {
+        if (e->id() == ID_TD) {
+            style->setDisplay(TABLE_CELL);
+            style->setFloating(FNONE);
+        }
+        else if (e->id() == ID_TABLE)
+            style->setDisplay(style->isDisplayInlineType() ? INLINE_TABLE : TABLE);
+    }
+
     // Mutate the display to BLOCK or TABLE for certain cases, e.g., if someone attempts to
     // position or float an inline, compact, or run-in.  Cache the original display, since it
     // may be needed for positioned elements that have to compute their static normal flow
     // positions.  We also force inline-level roots to be block-level.
-    style->setOriginalDisplay(style->display());
-    if (style->display() != NONE && style->display() != BLOCK && style->display() != TABLE && style->display() != BOX &&
-        (style->position() == ABSOLUTE || style->position() == FIXED || style->floating() != FNONE ||
-         e->getDocument()->documentElement() == e)) {
-        if (style->display() == INLINE_TABLE)
-            style->setDisplay(TABLE);
-        else if (style->display() == INLINE_BOX)
-            style->setDisplay(BOX);
-        else if (style->display() == LIST_ITEM) {
-            // It is a WinIE bug that floated list items lose their bullets, so we'll emulate the quirk,
-            // but only in quirks mode.
-            if (!strictParsing && style->floating() != FNONE)
+    // FIXME: For now we do not mutate pseudo styles.  This is because we do not yet support the
+    // ability to position and float generated content.  This is per the CSS 2 spec, but it's changing
+    // in CSS2.1.  For now, we will just support CSS2.
+    if (e) {
+        style->setOriginalDisplay(style->display());
+        if (style->display() != NONE && style->display() != BLOCK && style->display() != TABLE && style->display() != BOX &&
+            (style->position() == ABSOLUTE || style->position() == FIXED || style->floating() != FNONE ||
+            e->getDocument()->documentElement() == e)) {
+            if (style->display() == INLINE_TABLE)
+                style->setDisplay(TABLE);
+            else if (style->display() == INLINE_BOX)
+                style->setDisplay(BOX);
+            else if (style->display() == LIST_ITEM) {
+                // It is a WinIE bug that floated list items lose their bullets, so we'll emulate the quirk,
+                // but only in quirks mode.
+                if (!strictParsing && style->floating() != FNONE)
+                    style->setDisplay(BLOCK);
+            }
+            else
                 style->setDisplay(BLOCK);
         }
-        else
-            style->setDisplay(BLOCK);
     }
-
+    
     // Finally update our text decorations in effect, but don't allow text-decoration to percolate through
     // tables, inline blocks, inline tables, or run-ins.
-    if (style->display() == TABLE || style->display() == INLINE_TABLE || style->display() == RUN_IN)
-        // || style->display() == INLINE_BLOCK) FIXME!
+    if (style->display() == TABLE || style->display() == INLINE_TABLE || style->display() == RUN_IN
+        || style->display() == INLINE_BLOCK || style->display() == INLINE_BOX)
         style->setTextDecorationsInEffect(style->textDecoration());
     else
         style->addToTextDecorationsInEffect(style->textDecoration());
-
-    // Now return the style.
-    return style;
 }
 
 unsigned int CSSStyleSelector::addInlineDeclarations(DOM::ElementImpl* e,
diff --git a/WebCore/khtml/css/cssstyleselector.h b/WebCore/khtml/css/cssstyleselector.h
index b5ff308..54a3f34 100644
--- a/WebCore/khtml/css/cssstyleselector.h
+++ b/WebCore/khtml/css/cssstyleselector.h
@@ -156,8 +156,10 @@ namespace khtml
 	void buildLists();
 	void clearLists();
 
-    unsigned int addInlineDeclarations(DOM::ElementImpl* e, DOM::CSSStyleDeclarationImpl *decl,
-                                       unsigned int numProps);
+        unsigned int addInlineDeclarations(DOM::ElementImpl* e, DOM::CSSStyleDeclarationImpl *decl,
+                                           unsigned int numProps);
+
+        void adjustRenderStyle(RenderStyle* style, DOM::ElementImpl *e);
     
 	static DOM::CSSStyleSheetImpl *defaultSheet;
         static DOM::CSSStyleSheetImpl *quirksSheet;
diff --git a/WebCore/khtml/rendering/render_container.cpp b/WebCore/khtml/rendering/render_container.cpp
index 009936e..bff9de3 100644
--- a/WebCore/khtml/rendering/render_container.cpp
+++ b/WebCore/khtml/rendering/render_container.cpp
@@ -232,14 +232,11 @@ void RenderContainer::updatePseudoChild(RenderStyle::PseudoId type, RenderObject
     // 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.
+        // Nuke the child. 
+        if (child && child->style()->styleType() == type) {
+            oldContentPresent = false;
             removeChild(child);
-            child = (type == RenderStyle::BEFORE) ? child->nextSibling() : child->previousSibling();
         }
-
-        oldContentPresent = child && (child->style()->styleType() == type);
     }
 
     // If we have no pseudo-style or if the pseudo's display type is NONE, then we
@@ -267,54 +264,67 @@ void RenderContainer::updatePseudoChild(RenderStyle::PseudoId type, RenderObject
         pseudo->setDisplay(INLINE);
     
     if (oldContentPresent) {
-        while (child && child->style()->styleType() == type) {
+        if (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();
+            for (RenderObject* genChild = child->firstChild(); genChild; genChild = genChild->nextSibling()) {
+                if (genChild->isText())
+                    // Generated text content is a child whose style also needs to be set to the pseudo
+                    // style.
+                    genChild->setStyle(pseudo);
+                else {
+                    // Images get an empty style that inherits from the pseudo.
+                    RenderStyle* style = new RenderStyle();
+                    style->inheritFrom(pseudo);
+                    genChild->setStyle(style);
+                }
+            }
         }
         return; // We've updated the generated content. That's all we needed to do.
     }
     
     RenderObject* insertBefore = (type == RenderStyle::BEFORE) ? child : 0;
-        
+
+    // Generated content consists of a single container that houses multiple children (specified
+    // by the content property).  This pseudo container gets the pseudo style set on it.
+    RenderObject* pseudoContainer = 0;
+    
     // Now walk our list of generated content and create render objects for every type
     // we encounter.
     for (ContentData* contentData = pseudo->contentData();
          contentData; contentData = contentData->_nextContent) {
+        if (!pseudoContainer)
+            pseudoContainer = RenderFlow::createFlow(0, pseudo, renderArena()); /* anonymous box */
+        
         if (contentData->contentType() == CONTENT_TEXT)
         {
-            RenderObject* po = RenderFlow::createFlow(0, pseudo, renderArena()); /* anonymous box */
-            
             RenderText* t = new (renderArena()) RenderText(0 /*anonymous object */, contentData->contentText());
             t->setStyle(pseudo);
-            po->addChild(t);
-
-            // Add this after we've installed our text, so that addChild will be able to find the text
-            // inside the inline for e.g., first-letter styling.
-            addChild(po, insertBefore);
-            
-//            kdDebug() << DOM::DOMString(contentData->contentText()).string() << endl;
-
+            pseudoContainer->addChild(t);
             t->close();
-            po->close();
         }
         else if (contentData->contentType() == CONTENT_OBJECT)
         {
-            RenderImage* po = new (renderArena()) RenderImage(0);
-            po->setStyle(pseudo);
-            po->setContentObject(contentData->contentObject());
-            addChild(po, insertBefore);
-            po->close();
+            RenderImage* img = new (renderArena()) RenderImage(0);
+            RenderStyle* style = new RenderStyle();
+            style->inheritFrom(pseudo);
+            img->setStyle(style);
+            img->setContentObject(contentData->contentObject());
+            pseudoContainer->addChild(img);
+            img->close();
         }
     }
+
+    if (pseudoContainer) {
+        // Add the pseudo after we've installed all our content, so that addChild will be able to find the text
+        // inside the inline for e.g., first-letter styling.
+        addChild(pseudoContainer, insertBefore);
+        pseudoContainer->close();
+    }
 }
 
 
diff --git a/WebCore/khtml/rendering/render_object.cpp b/WebCore/khtml/rendering/render_object.cpp
index f97d453..73d7801 100644
--- a/WebCore/khtml/rendering/render_object.cpp
+++ b/WebCore/khtml/rendering/render_object.cpp
@@ -68,21 +68,10 @@ RenderObject *RenderObject::createObject(DOM::NodeImpl* node,  RenderStyle* styl
     case NONE:
         break;
     case INLINE:
+        o = new (arena) RenderInline(node);
+        break;
     case BLOCK:
-        // In compat mode, if <td> has a display of block, build a table cell instead.
-        // This corrects erroneous HTML.  A better fix would be to implement full-blown
-        // CSS2 anonymous table render object construction, but until then, this will have
-        // to suffice. -dwh
-        if (style->display() == BLOCK && node->id() == ID_TD && style->htmlHacks())
-            o = new (arena) RenderTableCell(node);
-        // In quirks mode if <table> has a display of block, make a table. If it has 
-        // a display of inline, make an inline-table.
-        else if (node->id() == ID_TABLE && style->htmlHacks())
-            o = new (arena) RenderTable(node);
-        else if (style->display() == INLINE)
-            o = new (arena) RenderInline(node);
-        else
-            o = new (arena) RenderBlock(node);
+        o = new (arena) RenderBlock(node);
         break;
     case INLINE_BLOCK:
         o = new (arena) RenderBlock(node);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list