[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:48:42 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 450813dcc07ec77b232718e0d33a3a1382e48afb
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Jul 25 20:22:34 2003 +0000

    	Fix for 3343529, inline blocks crashing Safari.  There were lots of problems with
    	inlne-blocks.  This code gets basic inline-blocks working properly (with no crashes).
    
    	Several functions have been patched to take an isRootLineBox parameter.  This is used
    	to tell whether you're supposed to examine the root line box for a block or the block
    	itself.  In the case of baselinePosition and lineHeight, it indicates whether the caller
    	wants to measure the outside or inside of the box.
    
    	The outside of an inline-block is like a replaced element (e.g., an image), but the
    	inside is like a block, e.g., you want measurements for
    	the line height and baseline position of a root line box for that block.
    
    	Similarly, createInlineBox has been patched in order to know whether you're making a
    	root inline box *inside* the inline-block or an inline box that *encompasses* the
    	inline-block element (like you'd do for an image).
    
    	A number of places had isInline() calls and needed to be patched to also check
    	isInlineBlockOrInlineTable().  How to treat the inline-block again basically depends
    	on whether the caller is looking at the outside of the block (in which case you're like
    	an inline replaced element) or the inside of the block (in which case you're just like
    	a block).
    
            Reviewed by darin
    
            * ChangeLog:
            * khtml/rendering/bidi.cpp:
            * khtml/rendering/render_block.cpp:
            * khtml/rendering/render_block.h:
            * khtml/rendering/render_box.cpp:
            (RenderBox::calcWidth):
            (RenderBox::calcHeight):
            * khtml/rendering/render_flow.cpp:
            (RenderFlow::createInlineBox):
            * khtml/rendering/render_flow.h:
            * khtml/rendering/render_form.cpp:
            (RenderFormElement::baselinePosition):
            (RenderButton::baselinePosition):
            (RenderSubmitButton::baselinePosition):
            (RenderSelect::baselinePosition):
            * khtml/rendering/render_form.h:
            * khtml/rendering/render_line.cpp:
            (InlineFlowBox::verticallyAlignBoxes):
            (InlineFlowBox::computeLogicalBoxHeights):
            * khtml/rendering/render_list.cpp:
            (RenderListMarker::lineHeight):
            (RenderListMarker::baselinePosition):
            * khtml/rendering/render_list.h:
            * khtml/rendering/render_object.cpp:
            (RenderObject::sizesToMaxWidth):
            (RenderObject::getVerticalPosition):
            (RenderObject::lineHeight):
            (RenderObject::baselinePosition):
            (RenderObject::createInlineBox):
            * khtml/rendering/render_object.h:
            * khtml/rendering/render_replaced.cpp:
            (RenderReplaced::lineHeight):
            (RenderReplaced::baselinePosition):
            * khtml/rendering/render_replaced.h:
            * khtml/rendering/render_table.cpp:
            * khtml/rendering/render_table.h:
            * khtml/rendering/render_text.cpp:
            (RenderText::lineHeight):
            (RenderText::baselinePosition):
            (RenderText::createInlineBox):
            * khtml/rendering/render_text.h:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@4712 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index e7a6f56..ec0a09f 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,5 +1,73 @@
 2003-07-25  Dave Hyatt  <hyatt at apple.com>
 
+	Fix for 3343529, inline blocks crashing Safari.  There were lots of problems with
+	inlne-blocks.  This code gets basic inline-blocks working properly (with no crashes).
+
+	Several functions have been patched to take an isRootLineBox parameter.  This is used
+	to tell whether you're supposed to examine the root line box for a block or the block
+	itself.  In the case of baselinePosition and lineHeight, it indicates whether the caller
+	wants to measure the outside or inside of the box.  
+
+	The outside of an inline-block is like a replaced element (e.g., an image), but the 
+	inside is like a block, e.g., you want measurements for
+	the line height and baseline position of a root line box for that block.
+
+	Similarly, createInlineBox has been patched in order to know whether you're making a
+	root inline box *inside* the inline-block or an inline box that *encompasses* the
+	inline-block element (like you'd do for an image).
+
+	A number of places had isInline() calls and needed to be patched to also check
+	isInlineBlockOrInlineTable().  How to treat the inline-block again basically depends
+	on whether the caller is looking at the outside of the block (in which case you're like
+	an inline replaced element) or the inside of the block (in which case you're just like
+	a block).
+	
+        Reviewed by darin
+
+        * ChangeLog:
+        * khtml/rendering/bidi.cpp:
+        * khtml/rendering/render_block.cpp:
+        * khtml/rendering/render_block.h:
+        * khtml/rendering/render_box.cpp:
+        (RenderBox::calcWidth):
+        (RenderBox::calcHeight):
+        * khtml/rendering/render_flow.cpp:
+        (RenderFlow::createInlineBox):
+        * khtml/rendering/render_flow.h:
+        * khtml/rendering/render_form.cpp:
+        (RenderFormElement::baselinePosition):
+        (RenderButton::baselinePosition):
+        (RenderSubmitButton::baselinePosition):
+        (RenderSelect::baselinePosition):
+        * khtml/rendering/render_form.h:
+        * khtml/rendering/render_line.cpp:
+        (InlineFlowBox::verticallyAlignBoxes):
+        (InlineFlowBox::computeLogicalBoxHeights):
+        * khtml/rendering/render_list.cpp:
+        (RenderListMarker::lineHeight):
+        (RenderListMarker::baselinePosition):
+        * khtml/rendering/render_list.h:
+        * khtml/rendering/render_object.cpp:
+        (RenderObject::sizesToMaxWidth):
+        (RenderObject::getVerticalPosition):
+        (RenderObject::lineHeight):
+        (RenderObject::baselinePosition):
+        (RenderObject::createInlineBox):
+        * khtml/rendering/render_object.h:
+        * khtml/rendering/render_replaced.cpp:
+        (RenderReplaced::lineHeight):
+        (RenderReplaced::baselinePosition):
+        * khtml/rendering/render_replaced.h:
+        * khtml/rendering/render_table.cpp:
+        * khtml/rendering/render_table.h:
+        * khtml/rendering/render_text.cpp:
+        (RenderText::lineHeight):
+        (RenderText::baselinePosition):
+        (RenderText::createInlineBox):
+        * khtml/rendering/render_text.h:
+
+2003-07-25  Dave Hyatt  <hyatt at apple.com>
+
 	Fix for 3343527, crash when attempting to access rules in the CSS OM.
 	Our KWQListImpl doesn't null check accesses, so anything out
 	of bounds would cause a crash.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index e7a6f56..ec0a09f 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,5 +1,73 @@
 2003-07-25  Dave Hyatt  <hyatt at apple.com>
 
+	Fix for 3343529, inline blocks crashing Safari.  There were lots of problems with
+	inlne-blocks.  This code gets basic inline-blocks working properly (with no crashes).
+
+	Several functions have been patched to take an isRootLineBox parameter.  This is used
+	to tell whether you're supposed to examine the root line box for a block or the block
+	itself.  In the case of baselinePosition and lineHeight, it indicates whether the caller
+	wants to measure the outside or inside of the box.  
+
+	The outside of an inline-block is like a replaced element (e.g., an image), but the 
+	inside is like a block, e.g., you want measurements for
+	the line height and baseline position of a root line box for that block.
+
+	Similarly, createInlineBox has been patched in order to know whether you're making a
+	root inline box *inside* the inline-block or an inline box that *encompasses* the
+	inline-block element (like you'd do for an image).
+
+	A number of places had isInline() calls and needed to be patched to also check
+	isInlineBlockOrInlineTable().  How to treat the inline-block again basically depends
+	on whether the caller is looking at the outside of the block (in which case you're like
+	an inline replaced element) or the inside of the block (in which case you're just like
+	a block).
+	
+        Reviewed by darin
+
+        * ChangeLog:
+        * khtml/rendering/bidi.cpp:
+        * khtml/rendering/render_block.cpp:
+        * khtml/rendering/render_block.h:
+        * khtml/rendering/render_box.cpp:
+        (RenderBox::calcWidth):
+        (RenderBox::calcHeight):
+        * khtml/rendering/render_flow.cpp:
+        (RenderFlow::createInlineBox):
+        * khtml/rendering/render_flow.h:
+        * khtml/rendering/render_form.cpp:
+        (RenderFormElement::baselinePosition):
+        (RenderButton::baselinePosition):
+        (RenderSubmitButton::baselinePosition):
+        (RenderSelect::baselinePosition):
+        * khtml/rendering/render_form.h:
+        * khtml/rendering/render_line.cpp:
+        (InlineFlowBox::verticallyAlignBoxes):
+        (InlineFlowBox::computeLogicalBoxHeights):
+        * khtml/rendering/render_list.cpp:
+        (RenderListMarker::lineHeight):
+        (RenderListMarker::baselinePosition):
+        * khtml/rendering/render_list.h:
+        * khtml/rendering/render_object.cpp:
+        (RenderObject::sizesToMaxWidth):
+        (RenderObject::getVerticalPosition):
+        (RenderObject::lineHeight):
+        (RenderObject::baselinePosition):
+        (RenderObject::createInlineBox):
+        * khtml/rendering/render_object.h:
+        * khtml/rendering/render_replaced.cpp:
+        (RenderReplaced::lineHeight):
+        (RenderReplaced::baselinePosition):
+        * khtml/rendering/render_replaced.h:
+        * khtml/rendering/render_table.cpp:
+        * khtml/rendering/render_table.h:
+        * khtml/rendering/render_text.cpp:
+        (RenderText::lineHeight):
+        (RenderText::baselinePosition):
+        (RenderText::createInlineBox):
+        * khtml/rendering/render_text.h:
+
+2003-07-25  Dave Hyatt  <hyatt at apple.com>
+
 	Fix for 3343527, crash when attempting to access rules in the CSS OM.
 	Our KWQListImpl doesn't null check accesses, so anything out
 	of bounds would cause a crash.
diff --git a/WebCore/khtml/rendering/bidi.cpp b/WebCore/khtml/rendering/bidi.cpp
index 794cb4c..b4db617 100644
--- a/WebCore/khtml/rendering/bidi.cpp
+++ b/WebCore/khtml/rendering/bidi.cpp
@@ -96,7 +96,7 @@ static int inlineWidth(RenderObject* child, bool start = true, bool end = true)
 {
     int extraWidth = 0;
     RenderObject* parent = child->parent();
-    while (parent->isInline()) {
+    while (parent->isInline() && !parent->isInlineBlockOrInlineTable()) {
         if (start && parent->firstChild() == child)
             extraWidth += getBorderPaddingMargin(parent, false);
         if (end && parent->lastChild() == child)
@@ -553,7 +553,7 @@ InlineFlowBox* RenderBlock::createLineBoxes(RenderObject* obj)
     if (!box || box->isConstructed() || box->nextOnLine()) {
         // We need to make a new box for this render object.  Once
         // made, we need to place it at the end of the current line.
-        InlineBox* newBox = obj->createInlineBox(false);
+        InlineBox* newBox = obj->createInlineBox(false, obj == this);
         KHTMLAssert(newBox->isInlineFlowBox());
         box = static_cast<InlineFlowBox*>(newBox);
         box->setFirstLineStyleBit(m_firstLine);
@@ -579,7 +579,7 @@ InlineFlowBox* RenderBlock::constructLine(const BidiIterator &start, const BidiI
     InlineFlowBox* parentBox = 0;
     for (BidiRun* r = sFirstBidiRun; r; r = r->nextRun) {
         // Create a box for our object.
-        r->box = r->obj->createInlineBox(r->obj->isPositioned());
+        r->box = r->obj->createInlineBox(r->obj->isPositioned(), false);
         
         // If we have no parent box yet, or if the run is not simply a sibling,
         // then we need to construct inline boxes as necessary to properly enclose the
@@ -726,7 +726,7 @@ void RenderBlock::bidiReorderLine(const BidiIterator &start, const BidiIterator
 {
     if ( start == end ) {
         if ( start.current() == '\n' ) {
-            m_height += lineHeight( m_firstLine );
+            m_height += lineHeight( m_firstLine, true );
         }
         return;
     }
diff --git a/WebCore/khtml/rendering/render_block.cpp b/WebCore/khtml/rendering/render_block.cpp
index f341475..fde177f 100644
--- a/WebCore/khtml/rendering/render_block.cpp
+++ b/WebCore/khtml/rendering/render_block.cpp
@@ -279,7 +279,7 @@ void RenderBlock::makeChildrenNonInline(RenderObject *insertionPoint)
     // means that we cannot coalesce inlines before |insertionPoint| with inlines following
     // |insertionPoint|, because the new child is going to be inserted in between the inlines,
     // splitting them.
-    KHTMLAssert(!isInline());
+    KHTMLAssert(isInlineBlockOrInlineTable() || !isInline());
     KHTMLAssert(!insertionPoint || insertionPoint->parent() == this);
 
     m_childrenInline = false;
@@ -2274,6 +2274,28 @@ void RenderBlock::close()
     RenderFlow::close();
 }
 
+short RenderBlock::lineHeight(bool b, bool isRootLineBox) const
+{
+    // Inline blocks are replaced elements. Otherwise, just pass off to
+    // the base class.  If we're being queried as though we're the root line
+    // box, then the fact that we're an inline-block is irrelevant, and we behave
+    // just like a block.
+    if (isReplaced() && !isRootLineBox)
+        return height()+marginTop()+marginBottom();
+    return RenderFlow::lineHeight(b, isRootLineBox);
+}
+
+short RenderBlock::baselinePosition(bool b, bool isRootLineBox) const
+{
+    // Inline blocks are replaced elements. Otherwise, just pass off to
+    // the base class.  If we're being queried as though we're the root line
+    // box, then the fact that we're an inline-block is irrelevant, and we behave
+    // just like a block.
+    if (isReplaced() && !isRootLineBox)
+        return height()+marginTop()+marginBottom();
+    return RenderFlow::baselinePosition(b, isRootLineBox);
+}
+
 int RenderBlock::getBaselineOfFirstLineBox()
 {
     if (m_firstLineBox)
diff --git a/WebCore/khtml/rendering/render_block.h b/WebCore/khtml/rendering/render_block.h
index 234a9e0..12775b2 100644
--- a/WebCore/khtml/rendering/render_block.h
+++ b/WebCore/khtml/rendering/render_block.h
@@ -39,6 +39,10 @@ public:
 
     virtual const char *renderName() const;
 
+    // These two functions are overridden for inline-block.
+    virtual short lineHeight(bool b, bool isRootLineBox=false) const;
+    virtual short baselinePosition(bool b, bool isRootLineBox=false) const;
+    
     virtual bool isRenderBlock() const { return true; }
     virtual bool isBlockFlow() const { return !isInline() && !isTable(); }
     virtual bool isInlineFlow() const { return isInline() && !isReplaced(); }
diff --git a/WebCore/khtml/rendering/render_box.cpp b/WebCore/khtml/rendering/render_box.cpp
index a8b7492..a7ab9a0 100644
--- a/WebCore/khtml/rendering/render_box.cpp
+++ b/WebCore/khtml/rendering/render_box.cpp
@@ -676,7 +676,8 @@ void RenderBox::calcWidth()
 
         bool inVerticalBox = parent()->isFlexibleBox() && parent()->style()->boxOrient() == VERTICAL;
         bool stretching = parent()->style()->boxAlign() == BSTRETCH;
-        bool treatAsReplaced = isReplaced() && (!inVerticalBox || !stretching);
+        bool treatAsReplaced = isReplaced() && !isInlineBlockOrInlineTable() &&
+            (!inVerticalBox || !stretching);
         Length w;
         if (treatAsReplaced)
             w = Length( calcReplacedWidth(), Fixed );
@@ -698,7 +699,7 @@ void RenderBox::calcWidth()
         m_marginLeft = 0;
         m_marginRight = 0;
 
-        if (isInline())
+        if (isInline() && !isInlineBlockOrInlineTable())
         {
             // just calculate margins
             m_marginLeft = ml.minWidth(cw);
@@ -860,7 +861,8 @@ void RenderBox::calcHeight()
             && parent()->isFlexingChildren() && style()->boxFlexedHeight() != -1)
             h = Length(style()->boxFlexedHeight() - borderTop() - borderBottom() -
                        paddingTop() - paddingBottom(), Fixed);
-        else if ( isReplaced() && (!inHorizontalBox || !stretching )) {
+        else if ( isReplaced() && !isInlineBlockOrInlineTable() &&
+                  (!inHorizontalBox || !stretching )) {
             h = Length( calcReplacedHeight(), Fixed );
         }
         else
diff --git a/WebCore/khtml/rendering/render_flow.cpp b/WebCore/khtml/rendering/render_flow.cpp
index 0577b87..53bc676 100644
--- a/WebCore/khtml/rendering/render_flow.cpp
+++ b/WebCore/khtml/rendering/render_flow.cpp
@@ -151,10 +151,11 @@ void RenderFlow::detach(RenderArena* renderArena)
     RenderBox::detach(renderArena);
 }
 
-InlineBox* RenderFlow::createInlineBox(bool makePlaceHolderBox)
+InlineBox* RenderFlow::createInlineBox(bool makePlaceHolderBox, bool isRootLineBox)
 {
-    if (isReplaced() || makePlaceHolderBox)          // Inline tables and inline blocks
-        return RenderBox::createInlineBox(false);    // (or positioned element placeholders).
+    if (!isRootLineBox &&
+	(isReplaced() || makePlaceHolderBox))                     // Inline tables and inline blocks
+        return RenderBox::createInlineBox(false, isRootLineBox);  // (or positioned element placeholders).
 
     InlineFlowBox* flowBox = 0;
     if (isInlineFlow())
diff --git a/WebCore/khtml/rendering/render_flow.h b/WebCore/khtml/rendering/render_flow.h
index c9029bb..0ef9399 100644
--- a/WebCore/khtml/rendering/render_flow.h
+++ b/WebCore/khtml/rendering/render_flow.h
@@ -62,7 +62,7 @@ public:
     InlineFlowBox* firstLineBox() const { return m_firstLineBox; }
     InlineFlowBox* lastLineBox() const { return m_lastLineBox; }
 
-    virtual InlineBox* createInlineBox(bool makePlaceHolderBox);
+    virtual InlineBox* createInlineBox(bool makePlaceHolderBox, bool isRootLineBox);
 
     void paintLineBoxBackgroundBorder(QPainter *p, int _x, int _y,
                         int _w, int _h, int _tx, int _ty, PaintAction paintAction);
diff --git a/WebCore/khtml/rendering/render_form.cpp b/WebCore/khtml/rendering/render_form.cpp
index 5cd9ce4..9dd188b 100644
--- a/WebCore/khtml/rendering/render_form.cpp
+++ b/WebCore/khtml/rendering/render_form.cpp
@@ -67,12 +67,12 @@ RenderFormElement::~RenderFormElement()
 {
 }
 
-short RenderFormElement::baselinePosition( bool f ) const
+short RenderFormElement::baselinePosition( bool f, bool isRootLineBox ) const
 {
 #if APPLE_CHANGES
     return marginTop() + widget()->baselinePosition();
 #else
-    return RenderWidget::baselinePosition( f ) - 2 - style()->fontMetrics().descent();
+    return RenderWidget::baselinePosition( f, isRootLineBox ) - 2 - style()->fontMetrics().descent();
 #endif
 }
 
@@ -209,12 +209,12 @@ RenderButton::RenderButton(HTMLGenericFormElementImpl *element)
 {
 }
 
-short RenderButton::baselinePosition( bool f ) const
+short RenderButton::baselinePosition( bool f, bool isRootLineBox ) const
 {
 #if APPLE_CHANGES
-    return RenderFormElement::baselinePosition( f );
+    return RenderFormElement::baselinePosition( f, isRootLineBox );
 #else
-    return RenderWidget::baselinePosition( f ) - 2;
+    return RenderWidget::baselinePosition( f, isRootLineBox ) - 2;
 #endif
 }
 
@@ -389,9 +389,9 @@ QString RenderSubmitButton::defaultLabel()
 #endif
 }
 
-short RenderSubmitButton::baselinePosition( bool f ) const
+short RenderSubmitButton::baselinePosition( bool f, bool isRootLineBox ) const
 {
-    return RenderFormElement::baselinePosition( f );
+    return RenderFormElement::baselinePosition( f, isRootLineBox );
 }
 
 // -------------------------------------------------------------------------------
@@ -1031,12 +1031,12 @@ void RenderSelect::updateFromElement()
 
 #if APPLE_CHANGES
 // Override to deal with our widget.
-short RenderSelect::baselinePosition( bool f ) const
+short RenderSelect::baselinePosition( bool f, bool isRootLineBox ) const
 {
     if (!m_useListBox) {
-        return RenderFormElement::baselinePosition( f );
+        return RenderFormElement::baselinePosition( f, isRootLineBox );
     } else {
-        return RenderWidget::baselinePosition( f ) - 7;
+        return RenderWidget::baselinePosition( f, isRootLineBox ) - 7;
     }
 }
 #endif
diff --git a/WebCore/khtml/rendering/render_form.h b/WebCore/khtml/rendering/render_form.h
index 3f33d69..3861a68 100644
--- a/WebCore/khtml/rendering/render_form.h
+++ b/WebCore/khtml/rendering/render_form.h
@@ -99,7 +99,7 @@ public:
     virtual void updateFromElement();
 
     virtual void layout();
-    virtual short baselinePosition( bool ) const;
+    virtual short baselinePosition( bool, bool ) const;
 
     DOM::HTMLGenericFormElementImpl *element() const
     { return static_cast<DOM::HTMLGenericFormElementImpl*>(RenderObject::element()); }
@@ -133,7 +133,7 @@ public:
 #endif
 
     virtual const char *renderName() const { return "RenderButton"; }
-    virtual short baselinePosition( bool ) const;
+    virtual short baselinePosition( bool, bool ) const;
 
     // don't even think about making this method virtual!
     DOM::HTMLInputElementImpl* element() const
@@ -193,7 +193,7 @@ public:
 
     virtual void calcMinMaxWidth();
     virtual void updateFromElement();
-    virtual short baselinePosition( bool ) const;
+    virtual short baselinePosition( bool, bool ) const;
 private:
     QString rawText();
 };
@@ -380,7 +380,7 @@ public:
     virtual const char *renderName() const { return "RenderSelect"; }
 
 #if APPLE_CHANGES
-    short baselinePosition( bool f ) const;
+    short baselinePosition( bool f, bool b ) const;
     int calcReplacedHeight() const { if (!m_useListBox) return intrinsicHeight(); return RenderFormElement::calcReplacedHeight(); }
     virtual bool canHaveIntrinsicMargins() const { return true; }
 #endif
diff --git a/WebCore/khtml/rendering/render_line.cpp b/WebCore/khtml/rendering/render_line.cpp
index 3e0be6d..dd616a2 100644
--- a/WebCore/khtml/rendering/render_line.cpp
+++ b/WebCore/khtml/rendering/render_line.cpp
@@ -279,7 +279,8 @@ void InlineFlowBox::verticallyAlignBoxes(int& heightOfBlock)
     int maxAscent = 0;
     int maxDescent = 0;
 
-    // Figure out if we're in strict mode.
+    // Figure out if we're in strict mode.  Note that we can't simply use !style()->htmlHacks(),
+    // because that would match almost strict mode as well.
     RenderObject* curr = object();
     while (curr && !curr->element())
         curr = curr->container();
@@ -336,14 +337,14 @@ void InlineFlowBox::computeLogicalBoxHeights(int& maxPositionTop, int& maxPositi
 {
     if (isRootInlineBox()) {
         // Examine our root box.
-        setHeight(object()->lineHeight(m_firstLine));
+        setHeight(object()->lineHeight(m_firstLine, true));
         bool isTableCell = object()->isTableCell();
         if (isTableCell) {
             RenderTableCell* tableCell = static_cast<RenderTableCell*>(object());
-            setBaseline(tableCell->RenderBlock::baselinePosition(m_firstLine));
+            setBaseline(tableCell->RenderBlock::baselinePosition(m_firstLine, true));
         }
         else
-            setBaseline(object()->baselinePosition(m_firstLine));
+            setBaseline(object()->baselinePosition(m_firstLine, true));
         if (hasTextChildren() || strictMode) {
             int ascent = baseline();
             int descent = height() - ascent;
diff --git a/WebCore/khtml/rendering/render_list.cpp b/WebCore/khtml/rendering/render_list.cpp
index 8ba6d8d..47b76d2 100644
--- a/WebCore/khtml/rendering/render_list.cpp
+++ b/WebCore/khtml/rendering/render_list.cpp
@@ -595,12 +595,12 @@ void RenderListMarker::calcWidth()
     RenderBox::calcWidth();
 }
 
-short RenderListMarker::lineHeight(bool b) const
+short RenderListMarker::lineHeight(bool, bool) const
 {
     return height();
 }
 
-short RenderListMarker::baselinePosition(bool b) const
+short RenderListMarker::baselinePosition(bool, bool) const
 {
     return height();
 }
diff --git a/WebCore/khtml/rendering/render_list.h b/WebCore/khtml/rendering/render_list.h
index e2baf4d..9ea9d42 100644
--- a/WebCore/khtml/rendering/render_list.h
+++ b/WebCore/khtml/rendering/render_list.h
@@ -59,8 +59,8 @@ public:
 
     virtual void calcWidth();
 
-    virtual short lineHeight(bool b) const;
-    virtual short baselinePosition(bool b) const;
+    virtual short lineHeight(bool b, bool isRootLineBox=false) const;
+    virtual short baselinePosition(bool b, bool isRootLineBox=false) const;
     
     virtual bool isListMarker() const { return true; }
     
diff --git a/WebCore/khtml/rendering/render_object.cpp b/WebCore/khtml/rendering/render_object.cpp
index b3e4843..0e26ccb 100644
--- a/WebCore/khtml/rendering/render_object.cpp
+++ b/WebCore/khtml/rendering/render_object.cpp
@@ -485,7 +485,7 @@ int RenderObject::containingBlockHeight() const
 
 bool RenderObject::sizesToMaxWidth() const
 {
-    if (isFloating() || isCompact() ||
+    if (isFloating() || isCompact() || isInlineBlockOrInlineTable() ||
         (element() && (element()->id() == ID_BUTTON || element()->id() == ID_LEGEND)))
         return true;
 
@@ -1444,7 +1444,8 @@ short RenderObject::getVerticalPosition( bool firstLine ) const
     } else if ( va == LENGTH ) {
         vpos = -style()->verticalAlignLength().width( lineHeight( firstLine ) );
     } else  {
-        vpos = parent()->verticalPositionHint( firstLine );
+        bool checkParent = parent()->isInline() && !parent()->isInlineBlockOrInlineTable();
+        vpos = checkParent ? parent()->verticalPositionHint( firstLine ) : 0;
         // don't allow elements nested inside text-top to have a different valignment.
         if ( va == BASELINE )
             return vpos;
@@ -1465,7 +1466,8 @@ short RenderObject::getVerticalPosition( bool firstLine ) const
 //                 qDebug( "CSSLH: %d, CSS_FS: %d, basepos: %d", fontheight, fontsize, parent()->baselinePosition( firstLine ) );
 //                 qDebug( "this:" );
 //                 qDebug( "CSSLH: %d, CSS_FS: %d, basepos: %d", lineHeight( firstLine ), style()->font().pixelSize(), baselinePosition( firstLine ) );
-            vpos += ( baselinePosition( firstLine ) - parent()->baselinePosition( firstLine ) );
+            vpos += ( baselinePosition( firstLine ) -
+                      parent()->baselinePosition( firstLine, !checkParent ) );
         } else if ( va == MIDDLE ) {
 #if APPLE_CHANGES
             vpos += - (int)(QFontMetrics(f).xHeight()/2) - lineHeight( firstLine )/2 + baselinePosition( firstLine );
@@ -1484,7 +1486,7 @@ short RenderObject::getVerticalPosition( bool firstLine ) const
     return vpos;
 }
 
-short RenderObject::lineHeight( bool firstLine ) const
+short RenderObject::lineHeight( bool firstLine, bool ) const
 {
     Length lh = style(firstLine)->lineHeight();
 
@@ -1499,10 +1501,10 @@ short RenderObject::lineHeight( bool firstLine ) const
     return lh.value;
 }
 
-short RenderObject::baselinePosition( bool firstLine ) const
+short RenderObject::baselinePosition( bool firstLine, bool isRootLineBox ) const
 {
     const QFontMetrics &fm = fontMetrics( firstLine );
-    return fm.ascent() + ( lineHeight( firstLine ) - fm.height() ) / 2;
+    return fm.ascent() + ( lineHeight( firstLine, isRootLineBox ) - fm.height() ) / 2;
 }
 
 void RenderObject::invalidateVerticalPositions()
@@ -1569,8 +1571,9 @@ void RenderObject::removeLeftoverAnonymousBoxes()
 {
 }
 
-InlineBox* RenderObject::createInlineBox(bool makePlaceHolderBox)
+InlineBox* RenderObject::createInlineBox(bool,bool isRootLineBox)
 {
+    KHTMLAssert(!isRootLineBox);
     return new (renderArena()) InlineBox(this);
 }
 
diff --git a/WebCore/khtml/rendering/render_object.h b/WebCore/khtml/rendering/render_object.h
index d10e463..a11ebcf 100644
--- a/WebCore/khtml/rendering/render_object.h
+++ b/WebCore/khtml/rendering/render_object.h
@@ -283,15 +283,15 @@ public:
 
     void scheduleRelayout(RenderObject* clippedObj = 0);
 
-    virtual InlineBox* createInlineBox(bool makePlaceHolderBox);
+    virtual InlineBox* createInlineBox(bool makePlaceHolderBox, bool isRootLineBox);
     
     // for discussion of lineHeight see CSS2 spec
-    virtual short lineHeight( bool firstLine ) const;
+    virtual short lineHeight( bool firstLine, bool isRootLineBox=false ) const;
     // for the vertical-align property of inline elements
     // the difference between this objects baseline position and the lines baseline position.
     virtual short verticalPositionHint( bool firstLine ) const;
     // the offset of baseline from the top of the object.
-    virtual short baselinePosition( bool firstLine ) const;
+    virtual short baselinePosition( bool firstLine, bool isRootLineBox=false ) const;
 
     /*
      * Paint the object and its children, clipped by (x|y|w|h).
diff --git a/WebCore/khtml/rendering/render_replaced.cpp b/WebCore/khtml/rendering/render_replaced.cpp
index f6b477e..3d1d8eb 100644
--- a/WebCore/khtml/rendering/render_replaced.cpp
+++ b/WebCore/khtml/rendering/render_replaced.cpp
@@ -97,12 +97,12 @@ void RenderReplaced::calcMinMaxWidth()
     setMinMaxKnown();
 }
 
-short RenderReplaced::lineHeight( bool ) const
+short RenderReplaced::lineHeight( bool, bool ) const
 {
     return height()+marginTop()+marginBottom();
 }
 
-short RenderReplaced::baselinePosition( bool ) const
+short RenderReplaced::baselinePosition( bool, bool ) const
 {
     return height()+marginTop()+marginBottom();
 }
diff --git a/WebCore/khtml/rendering/render_replaced.h b/WebCore/khtml/rendering/render_replaced.h
index a6a85ef..de438a5 100644
--- a/WebCore/khtml/rendering/render_replaced.h
+++ b/WebCore/khtml/rendering/render_replaced.h
@@ -36,8 +36,8 @@ public:
 
     virtual const char *renderName() const { return "RenderReplaced"; }
 
-    virtual short lineHeight( bool firstLine) const;
-    virtual short baselinePosition( bool firstLine ) const;
+    virtual short lineHeight( bool firstLine, bool isRootLineBox=false ) const;
+    virtual short baselinePosition( bool firstLine, bool isRootLineBox=false ) const;
 
     virtual void calcMinMaxWidth();
 
diff --git a/WebCore/khtml/rendering/render_table.cpp b/WebCore/khtml/rendering/render_table.cpp
index f68fb23..a146f07 100644
--- a/WebCore/khtml/rendering/render_table.cpp
+++ b/WebCore/khtml/rendering/render_table.cpp
@@ -103,24 +103,6 @@ void RenderTable::setStyle(RenderStyle *_style)
     }
 }
 
-short RenderTable::lineHeight(bool b) const
-{
-    // Inline tables are replaced elements. Otherwise, just pass off to
-    // the base class.
-    if (isReplaced())
-        return height()+marginTop()+marginBottom();
-    return RenderBlock::lineHeight(b);
-}
-
-short RenderTable::baselinePosition(bool b) const
-{
-    // Inline tables are replaced elements. Otherwise, just pass off to
-    // the base class.
-    if (isReplaced())
-        return height()+marginTop()+marginBottom();
-    return RenderBlock::baselinePosition(b);
-}
-
 void RenderTable::addChild(RenderObject *child, RenderObject *beforeChild)
 {
 #ifdef DEBUG_LAYOUT
diff --git a/WebCore/khtml/rendering/render_table.h b/WebCore/khtml/rendering/render_table.h
index 25a1e11..6501a4c 100644
--- a/WebCore/khtml/rendering/render_table.h
+++ b/WebCore/khtml/rendering/render_table.h
@@ -103,9 +103,6 @@ public:
     virtual void calcMinMaxWidth();
     virtual void close();
 
-    virtual short lineHeight(bool b) const;
-    virtual short baselinePosition(bool b) const;
-
     virtual void setCellWidths( );
 
     virtual void calcWidth();
diff --git a/WebCore/khtml/rendering/render_text.cpp b/WebCore/khtml/rendering/render_text.cpp
index 03dbdff..226f806 100644
--- a/WebCore/khtml/rendering/render_text.cpp
+++ b/WebCore/khtml/rendering/render_text.cpp
@@ -1208,7 +1208,7 @@ int RenderText::height() const
     return retval;
 }
 
-short RenderText::lineHeight( bool firstLine ) const
+short RenderText::lineHeight( bool firstLine, bool ) const
 {
     if ( firstLine )
  	return RenderObject::lineHeight( firstLine );
@@ -1216,16 +1216,17 @@ short RenderText::lineHeight( bool firstLine ) const
     return m_lineHeight;
 }
 
-short RenderText::baselinePosition( bool firstLine ) const
+short RenderText::baselinePosition( bool firstLine, bool ) const
 {
     const QFontMetrics &fm = metrics( firstLine );
     return fm.ascent() +
         ( lineHeight( firstLine ) - fm.height() ) / 2;
 }
 
-InlineBox* RenderText::createInlineBox(bool)
+InlineBox* RenderText::createInlineBox(bool, bool isRootLineBox)
 {
     // FIXME: Either ditch the array or get this object into it.
+    KHTMLAssert(!isRootLineBox);
     return new (renderArena()) TextRun(this);
 }
 
diff --git a/WebCore/khtml/rendering/render_text.h b/WebCore/khtml/rendering/render_text.h
index 64eae30..032d6a1 100644
--- a/WebCore/khtml/rendering/render_text.h
+++ b/WebCore/khtml/rendering/render_text.h
@@ -137,7 +137,7 @@ public:
     DOM::DOMString data() const { return str; }
     DOM::DOMStringImpl *string() const { return str; }
 
-    virtual InlineBox* createInlineBox(bool);
+    virtual InlineBox* createInlineBox(bool,bool);
     
     virtual void layout() {assert(false);}
 
@@ -158,8 +158,8 @@ public:
     virtual int height() const;
 
     // height of the contents (without paddings, margins and borders)
-    virtual short lineHeight( bool firstLine ) const;
-    virtual short baselinePosition( bool firstLine ) const;
+    virtual short lineHeight( bool firstLine, bool isRootLineBox=false ) const;
+    virtual short baselinePosition( bool firstLine, bool isRootLineBox=false ) const;
 
     // overrides
     virtual void calcMinMaxWidth();

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list