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

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:17:50 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit c5764f8dd7cc9998891f93517009f6ca9e6cb53e
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Dec 30 07:51:41 2002 +0000

            Reviewed by Don.
    
    	- fixed 3130566 -- REGRESSION: list item numbers are overlapping the text of the list items
    
    	Moved the hack that handles list items that are not in lists out of the parser and into
    	the DOM and Render tree code itself. This fixes the issue where the parser doesn't know which
    	will be the parent node of the list item, and other problems with the old hack.
    
            * khtml/html/html_listimpl.cpp: (HTMLLIElementImpl::attach): Find the parent list (OL or UL).
    	If there is no parent list, set a "not in list" flag on the render object so it knows to render
    	"inside" no matter what the style says. Also use this parent and a safer check to make the
    	start attribute work even when there is an intervening DOM element in the hierarchy.
    
            * khtml/html/htmlparser.cpp: (KHTMLParser::getElement): Remove the code that tries to set
    	the style of an LI based on the current node at the time it's parsed, because the current node
    	is now often not the OL or the UL due to our DTD fix to allow other nodes in lists.
    
            * khtml/rendering/render_list.h: Add isInside() to RenderListMarker, setNotInList(), notInList(),
    	and _notInList to RenderListItem.
    
            * khtml/rendering/render_list.cpp:
            (RenderListItem::RenderListItem): Initialize _notInList to false.
            (RenderListMarker::paintObject): Use isInside() instead of checking listStylePosition().
            (RenderListMarker::calcMinMaxWidth): Ditto.
            (RenderListMarker::baselinePosition): Ditto.
            (RenderListMarker::isInside): Return true if we are not in a list, or if "inside" style is requested.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3208 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index dbf4e66..b47420c 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -2,6 +2,35 @@
 
         Reviewed by Don.
 
+	- fixed 3130566 -- REGRESSION: list item numbers are overlapping the text of the list items
+
+	Moved the hack that handles list items that are not in lists out of the parser and into
+	the DOM and Render tree code itself. This fixes the issue where the parser doesn't know which
+	will be the parent node of the list item, and other problems with the old hack.
+
+        * khtml/html/html_listimpl.cpp: (HTMLLIElementImpl::attach): Find the parent list (OL or UL).
+	If there is no parent list, set a "not in list" flag on the render object so it knows to render
+	"inside" no matter what the style says. Also use this parent and a safer check to make the
+	start attribute work even when there is an intervening DOM element in the hierarchy.
+
+        * khtml/html/htmlparser.cpp: (KHTMLParser::getElement): Remove the code that tries to set
+	the style of an LI based on the current node at the time it's parsed, because the current node
+	is now often not the OL or the UL due to our DTD fix to allow other nodes in lists.
+
+        * khtml/rendering/render_list.h: Add isInside() to RenderListMarker, setNotInList(), notInList(),
+	and _notInList to RenderListItem.
+
+        * khtml/rendering/render_list.cpp:
+        (RenderListItem::RenderListItem): Initialize _notInList to false.
+        (RenderListMarker::paintObject): Use isInside() instead of checking listStylePosition().
+        (RenderListMarker::calcMinMaxWidth): Ditto.
+        (RenderListMarker::baselinePosition): Ditto.
+        (RenderListMarker::isInside): Return true if we are not in a list, or if "inside" style is requested.
+
+2002-12-29  Darin Adler  <darin at apple.com>
+
+        Reviewed by Don.
+
 	- fixed 3134346 -- country menu at www.apple.com does not work when you go back to that page
 
         * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::openURLFromPageCache): Add call to checkCompleted().
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index dbf4e66..b47420c 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -2,6 +2,35 @@
 
         Reviewed by Don.
 
+	- fixed 3130566 -- REGRESSION: list item numbers are overlapping the text of the list items
+
+	Moved the hack that handles list items that are not in lists out of the parser and into
+	the DOM and Render tree code itself. This fixes the issue where the parser doesn't know which
+	will be the parent node of the list item, and other problems with the old hack.
+
+        * khtml/html/html_listimpl.cpp: (HTMLLIElementImpl::attach): Find the parent list (OL or UL).
+	If there is no parent list, set a "not in list" flag on the render object so it knows to render
+	"inside" no matter what the style says. Also use this parent and a safer check to make the
+	start attribute work even when there is an intervening DOM element in the hierarchy.
+
+        * khtml/html/htmlparser.cpp: (KHTMLParser::getElement): Remove the code that tries to set
+	the style of an LI based on the current node at the time it's parsed, because the current node
+	is now often not the OL or the UL due to our DTD fix to allow other nodes in lists.
+
+        * khtml/rendering/render_list.h: Add isInside() to RenderListMarker, setNotInList(), notInList(),
+	and _notInList to RenderListItem.
+
+        * khtml/rendering/render_list.cpp:
+        (RenderListItem::RenderListItem): Initialize _notInList to false.
+        (RenderListMarker::paintObject): Use isInside() instead of checking listStylePosition().
+        (RenderListMarker::calcMinMaxWidth): Ditto.
+        (RenderListMarker::baselinePosition): Ditto.
+        (RenderListMarker::isInside): Return true if we are not in a list, or if "inside" style is requested.
+
+2002-12-29  Darin Adler  <darin at apple.com>
+
+        Reviewed by Don.
+
 	- fixed 3134346 -- country menu at www.apple.com does not work when you go back to that page
 
         * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::openURLFromPageCache): Add call to checkCompleted().
diff --git a/WebCore/khtml/html/html_listimpl.cpp b/WebCore/khtml/html/html_listimpl.cpp
index 6e46fe9..0dd3578 100644
--- a/WebCore/khtml/html/html_listimpl.cpp
+++ b/WebCore/khtml/html/html_listimpl.cpp
@@ -143,19 +143,34 @@ void HTMLLIElementImpl::attach()
     HTMLElementImpl::attach();
 
     if ( m_render && m_render->style()->display() == LIST_ITEM ) {
-	// If we are first, and the OL has a start attr.
-	if (parentNode() && parentNode()->id() == ID_OL) {
-	    HTMLOListElementImpl *ol = static_cast<HTMLOListElementImpl *>(parentNode());
-
-	    if(ol->firstChild() && ol->firstChild() == this &&  m_render)
-		static_cast<RenderListItem*>(m_render)->setValue(ol->start());
+        RenderListItem *render = static_cast<RenderListItem *>(m_render);
+        
+        // Find the enclosing list node.
+        NodeImpl *listNode = 0;
+        NodeImpl *n = this;
+        while (!listNode && (n = n->parentNode())) {
+            switch (n->id()) {
+                case ID_UL:
+                case ID_OL:
+                    listNode = n;
+            }
+        }
+        
+        // If we are not in a list, tell the renderer so it can position us inside.
+        // We don't want to change our style to say "inside" since that would affect nested nodes.
+        if (!listNode)
+            render->setNotInList(true);
+
+	// If we are first, and the OL has a start attr, set the value.
+	if (listNode && listNode->id() == ID_OL && !m_render->previousSibling()) {
+	    HTMLOListElementImpl *ol = static_cast<HTMLOListElementImpl *>(listNode);
+            render->setValue(ol->start());
 	}
 
 	// If we had a value attr.
-	if (isValued && m_render)
-	    static_cast<RenderListItem*>(m_render)->setValue(requestedValue);
+	if (isValued)
+	    render->setValue(requestedValue);
     }
-
 }
 
 
diff --git a/WebCore/khtml/html/htmlparser.cpp b/WebCore/khtml/html/htmlparser.cpp
index ba71c50..060a6d8 100644
--- a/WebCore/khtml/html/htmlparser.cpp
+++ b/WebCore/khtml/html/htmlparser.cpp
@@ -896,10 +896,7 @@ NodeImpl *KHTMLParser::getElement(Token* t)
     case ID_LI:
     {
         popBlock(ID_LI);
-        HTMLElementImpl *e = new HTMLLIElementImpl(document);
-        n = e;
-        if( current->id() != ID_UL && current->id() != ID_OL )
-                e->addCSSProperty(CSS_PROP_LIST_STYLE_POSITION, CSS_VAL_INSIDE);
+        n = new HTMLLIElementImpl(document);
         break;
     }
 // formatting elements (block)
diff --git a/WebCore/khtml/rendering/render_list.cpp b/WebCore/khtml/rendering/render_list.cpp
index ddd26c0..fb8048d 100644
--- a/WebCore/khtml/rendering/render_list.cpp
+++ b/WebCore/khtml/rendering/render_list.cpp
@@ -121,7 +121,7 @@ static QString toHebrew( int number ) {
 // -------------------------------------------------------------------------
 
 RenderListItem::RenderListItem(DOM::NodeImpl* node)
-    : RenderFlow(node)
+    : RenderFlow(node), _notInList(false)
 {
     // init RenderObject attributes
     setInline(false);   // our object is not Inline
@@ -367,7 +367,7 @@ void RenderListMarker::paintObject(QPainter *p, int, int _y,
     RenderObject* listItem = 0;
     int leftLineOffset = 0;
     int rightLineOffset = 0;
-    if (style()->listStylePosition() == OUTSIDE) {
+    if (!isInside()) {
         listItem = this;
         int yOffset = 0;
         int xOffset = 0;
@@ -411,7 +411,7 @@ void RenderListMarker::paintObject(QPainter *p, int, int _y,
     int xoff = 0;
     int yoff = fm.ascent() - offset;
 
-    if(style()->listStylePosition() == OUTSIDE)
+    if (!isInside())
         if (listItem->style()->direction() == LTR)
             xoff = -7 - offset;
         else 
@@ -424,7 +424,7 @@ void RenderListMarker::paintObject(QPainter *p, int, int _y,
         // For LTR don't forget to add in the width of the image to the offset as
         // well (you are moving the image left, so you have to also add in the width
         // of the image's border box as well). -dwh
-        if (style()->listStylePosition() == OUTSIDE) {
+        if (!isInside()) {
             if (style()->direction() == LTR)
                 xoff -= m_listImage->pixmap().width() - fm.ascent()*1/3;
             else
@@ -468,7 +468,7 @@ void RenderListMarker::paintObject(QPainter *p, int, int _y,
 #else
        	    //_ty += fm.ascent() - fm.height()/2 + 1;
 #endif
-            if (style()->listStylePosition() == INSIDE) {
+            if (isInside()) {
             	if( style()->direction() == LTR)
                     p->drawText(_tx, _ty, 0, 0, Qt::AlignLeft|Qt::DontClip, m_item);
             	else
@@ -515,7 +515,7 @@ void RenderListMarker::calcMinMaxWidth()
     m_width = 0;
 
     if(m_listImage) {
-        if(style()->listStylePosition() == INSIDE)
+        if (isInside())
             m_width = m_listImage->pixmap().width() + 5;
         m_height = m_listImage->pixmap().height();
         m_minWidth = m_maxWidth = m_width;
@@ -534,7 +534,7 @@ void RenderListMarker::calcMinMaxWidth()
     case DISC:
     case CIRCLE:
     case SQUARE:
-        if(style()->listStylePosition() == INSIDE) {
+        if (isInside()) {
             m_width = m_height; //fm.ascent();
         }
     	goto end;
@@ -585,7 +585,7 @@ void RenderListMarker::calcMinMaxWidth()
     }
     m_item += QString::fromLatin1(". ");
 
-    if(style()->listStylePosition() == INSIDE)
+    if (isInside())
         m_width = fm.width(m_item);
 
 end:
@@ -616,4 +616,9 @@ short RenderListMarker::baselinePosition(bool b) const
     return RenderBox::baselinePosition(b);
 }
 
+bool RenderListMarker::isInside() const
+{
+    return m_listItem->notInList() || style()->listStylePosition() == INSIDE;
+}
+
 #undef BOX_DEBUG
diff --git a/WebCore/khtml/rendering/render_list.h b/WebCore/khtml/rendering/render_list.h
index 88ead3e..01c69b0 100644
--- a/WebCore/khtml/rendering/render_list.h
+++ b/WebCore/khtml/rendering/render_list.h
@@ -69,6 +69,8 @@ public:
     
 protected:
     friend class RenderListItem;
+    
+    bool isInside() const;
 
     QString m_item;
     CachedImage *m_listImage;
@@ -99,10 +101,14 @@ public:
                        int xoff, int yoff, int paintPhase);
 
     virtual void layout( );
+    
+    void setNotInList(bool notInList) { _notInList = notInList; }
+    bool notInList() const { return _notInList; }
 
 protected:
     long int predefVal;
     RenderListMarker *m_marker;
+    bool _notInList;
 };
 
 }; //namespace

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list