<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>131366</bug_id>
          
          <creation_ts>2006-07-25 22:10:07 +0000</creation_ts>
          <short_desc>Padding-bottom and padding-top not applied to inline elements</short_desc>
          <delta_ts>2006-08-23 04:50:23 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>2</classification_id>
          <classification>Applications</classification>
          <product>konqueror</product>
          <component>khtml renderer</component>
          <version>unspecified</version>
          <rep_platform>Ubuntu</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Brandon Snider">brandonjsnider</reporter>
          <assigned_to name="Konqueror Bugs">konqueror-bugs-null</assigned_to>
          <cc>kde</cc>
          
          <cf_commitlink></cf_commitlink>
          <cf_versionfixedin></cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>455862</commentid>
    <comment_count>0</comment_count>
    <who name="Brandon Snider">brandonjsnider</who>
    <bug_when>2006-07-25 22:10:07 +0000</bug_when>
    <thetext>Version:            (using KDE KDE 3.5.3)
Installed from:    Ubuntu Packages
OS:                Linux

Konq &amp; Safari are failing to apply padding-bottom instructions on inline containers such as div with the display:inline attribute or span. The other 3 paddings work, but not padding-bottom.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>455869</commentid>
    <comment_count>1</comment_count>
    <who name="Maksim Orlovich">maksim</who>
    <bug_when>2006-07-25 22:22:05 +0000</bug_when>
    <thetext>Any chance you could attach a testcase? Thanks.
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>455881</commentid>
    <comment_count>2</comment_count>
    <who name="Brandon Snider">brandonjsnider</who>
    <bug_when>2006-07-25 22:48:30 +0000</bug_when>
    <thetext>&lt;html&gt;
This should appear as a link surrounded by red colour. In the code, this container is &quot;navbar&quot;. On the left and right, there is padding applied successfully. There is none applied to the top and bottom. But it is in the code. Now look at the page in Firefox or Opera. You can clearly see the padding applied successfully.
&lt;div&gt;&lt;FONT face=&quot;Lucida Handwriting, Cursive&quot;&gt;&lt;EM&gt;- Brandon J. Snider&lt;/EM&gt;&lt;/FONT&gt;&lt;/div&gt;&lt;/html&gt;




[bugs.kde.org quoted mail]

_________________________________________________________________
Play Q6 for your chance to WIN great prizes.  http://q6trivia.imagine-live.com/enca/landing


Created an attachment (id=17127)
testcase.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>456875</commentid>
    <comment_count>3</comment_count>
    <who name="Allan Sandfeld">kde</who>
    <bug_when>2006-07-31 12:03:59 +0000</bug_when>
    <thetext>Inline elements doesn&apos;t have padding. If I remember correctly MSIE has some horrible quirk where they change display:inline to display:block if the inline elements gets padding or border.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>456879</commentid>
    <comment_count>4</comment_count>
    <who name="Allan Sandfeld">kde</who>
    <bug_when>2006-07-31 12:09:26 +0000</bug_when>
    <thetext>On the other hand Firefox and Opera does it too. 

The really silly thing here is that the padding of the DIV and that of SPAN is &quot;collapsing&quot;. This is really quirky.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>457110</commentid>
    <comment_count>5</comment_count>
    <who name="Brandon Snider">brandonjsnider</who>
    <bug_when>2006-07-31 21:08:38 +0000</bug_when>
    <thetext>&lt;html&gt;
Why should there be padding on the outsides but not on the top and bottom of inline elements?
&lt;div&gt;&lt;FONT face=&quot;Lucida Handwriting, Cursive&quot;&gt;&lt;EM&gt;- Brandon J. Snider&lt;/EM&gt;&lt;/FONT&gt;&lt;/div&gt;&lt;/html&gt;




[bugs.kde.org quoted mail]

_________________________________________________________________
Play Q6 for your chance to WIN great prizes.  http://q6trivia.imagine-live.com/enca/landing
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>457180</commentid>
    <comment_count>6</comment_count>
    <who name="Germain Garand">germain</who>
    <bug_when>2006-07-31 23:30:32 +0000</bug_when>
    <thetext>re: #3/#4

mmh, after investigation the bug report looks valid to me. There&apos;s no provision in CSS against padding being applied to inline flow elements, so it definetly should be applied to the line boxes.

&gt; The really silly thing here is that the padding of the DIV and that of SPAN 
&gt; is &quot;collapsing&quot;.

It isn&apos;t silly if you consider it doesn&apos;t affect the line boxes&apos; line-height, so doesn&apos;t add up to the line spacing.

This is clearly stated in 10.8.1 (emphasis is mine):

&quot;Although margins, borders, *and padding* of non-replaced elements do not enter into the line box calculation, *they are still rendered around inline boxes*. This means that if the height specified by &apos;line-height&apos; is less than the content height of contained boxes, backgrounds and colors of padding and borders may &quot;bleed&quot; into adjoining line boxes. User agents should render the boxes in document order. This will cause the borders on subsequent lines to paint over the borders and text of previous lines. &quot;

Since it has no spacing effect it went mostly unnoticed, but it does look like an inline model screw up in khtml.
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>457258</commentid>
    <comment_count>7</comment_count>
    <who name="Allan Sandfeld">kde</who>
    <bug_when>2006-08-01 09:42:26 +0000</bug_when>
    <thetext>I came to the same conclusion after investigating. Note that border-top and border-bottom share the same problem. While the borders are painted their width does not contribute to the height, and thus thick borders are sometimes painted on top of the text.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>462548</commentid>
    <comment_count>8</comment_count>
    <who name="Germain Garand">germain</who>
    <bug_when>2006-08-23 04:39:50 +0000</bug_when>
    <thetext>turns out it&apos;s a problem of depth of in line box&apos;s hasTextChildren flag.

hasTextChildren only says if a linebox has immediate text children (e.g in testcase, removing the intermediate &lt;a&gt; tag will solve problem).

It&apos;s important to have it in order to know if a root &quot;strut&quot; should be applied to current line or not, but it has also been used abusively for things like shrinking of line boxes with no text children in quirk mode.

Those should definetly have an hasTextDescendant flag.
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>462549</commentid>
    <comment_count>9</comment_count>
    <who name="Germain Garand">germain</who>
    <bug_when>2006-08-23 04:50:21 +0000</bug_when>
    <thetext>SVN commit 576084 by ggarand:

introduce hasTextDescendant flag for inline boxes.
hasTextChildren is good for evaluating a root&apos;s strut immediate relevance, 
but not for top/bottom overflow and other quirky shrinking. Those need depth.

BUG: 131366



 M  +3 -3      render_line.cpp  
 M  +9 -2      render_line.h  


--- branches/KDE/3.5/kdelibs/khtml/rendering/render_line.cpp #576083:576084
@@ -441,7 +441,7 @@
         else if (curr-&gt;yPos() == PositionBottom)
             curr-&gt;setYPos(y + maxHeight - curr-&gt;height());
         else {
-            if (!curr-&gt;hasTextChildren() &amp;&amp; !strictMode)
+            if (!strictMode &amp;&amp; !curr-&gt;hasTextDescendant())
                 childAffectsTopBottomPos = false;
             curr-&gt;setYPos(curr-&gt;yPos() + y + maxAscent - curr-&gt;baseline());
         }
@@ -499,7 +499,7 @@
             setBaseline(ascent);
         }
 #endif
-        if (hasTextChildren() || strictMode) {
+        if (hasTextDescendant() || strictMode) {
             if (yPos() &lt; topPosition)
                 topPosition = yPos();
             if (yPos() + height() &gt; bottomPosition)
@@ -520,7 +520,7 @@
     }
 
     // See if we have text children. If not, then we need to shrink ourselves to fit on the line.
-    if (!hasTextChildren()) {
+    if (!hasTextDescendant()) {
         if (yPos() &lt; topPos)
             setYPos(topPos);
         if (yPos() + height() &gt; bottomPos)
--- branches/KDE/3.5/kdelibs/khtml/rendering/render_line.h #576083:576084
@@ -96,6 +96,7 @@
     int baseline() const { return m_baseline; }
 
     virtual bool hasTextChildren() const { return true; }
+    virtual bool hasTextDescendant() const { return true; }
 
     virtual int topOverflow() const { return yPos(); }
     virtual int bottomOverflow() const { return yPos()+height(); }
@@ -155,6 +156,7 @@
         m_lastChild = 0;
         m_includeLeftEdge = m_includeRightEdge = false;
         m_hasTextChildren = false;
+        m_hasTextDescendant = false;
         m_afterPageBreak = false;
     }
 
@@ -180,8 +182,11 @@
         }
         child-&gt;setFirstLineStyleBit(m_firstLine);
         child-&gt;setParent(this);
-        if (child-&gt;isInlineTextBox())
-            m_hasTextChildren = true;
+        if (!m_hasTextChildren &amp;&amp; child-&gt;isInlineTextBox()) {
+            m_hasTextDescendant = m_hasTextChildren = true;
+            for (InlineFlowBox* p = m_parent; p &amp;&amp; !p-&gt;hasTextDescendant(); p = p-&gt;parent())
+                p-&gt;m_hasTextDescendant = true;
+        }
     }
     void removeFromLine(InlineBox* child);
     virtual void paintBackgroundAndBorder(RenderObject::PaintInfo&amp;, int _tx, int _ty, int xOffsetOnLine);
@@ -207,6 +212,7 @@
         m_includeRightEdge = includeRight;
     }
     virtual bool hasTextChildren() const { return m_hasTextChildren; }
+    bool hasTextDescendant() const { return m_hasTextDescendant; }
 
     // Helper functions used during line construction and placement.
     void determineSpacingForFlowBoxes(bool lastLine, RenderObject* endObject);
@@ -235,6 +241,7 @@
     bool m_includeLeftEdge : 1;
     bool m_includeRightEdge : 1;
     bool m_hasTextChildren : 1;
+    bool m_hasTextDescendant : 1;
     bool m_afterPageBreak : 1;
 };
 
</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>17127</attachid>
            <date>2006-07-25 22:48:30 +0000</date>
            <delta_ts>2006-07-25 22:48:30 +0000</delta_ts>
            <desc>testcase.html</desc>
            <filename>testcase.html</filename>
            <type>text/html</type>
            <size>778</size>
            <attacher name="Brandon Snider">brandonjsnider</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWwgUFVCTElDICItLy9XM0MvL0RURCBYSFRNTCAxLjAgVHJhbnNpdGlvbmFs
Ly9FTiIgImh0dHA6Ly93d3cudzMub3JnL1RSL3hodG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