[webkit-changes] cvs commit: WebCore/khtml/rendering bidi.cpp render_block.cpp render_box.cpp render_box.h render_flexbox.cpp render_form.cpp render_layer.cpp render_line.cpp render_object.cpp render_object.h render_replaced.cpp render_style.cpp render_style.h render_table.cpp render_theme_mac.mm table_layout.cpp

David hyatt at opensource.apple.com
Thu Sep 29 13:11:02 PDT 2005


hyatt       05/09/29 13:11:01

  Modified:    .        ChangeLog
               khtml/css cssstyleselector.cpp
               khtml/misc khtmllayout.h
               khtml/rendering bidi.cpp render_block.cpp render_box.cpp
                        render_box.h render_flexbox.cpp render_form.cpp
                        render_layer.cpp render_line.cpp render_object.cpp
                        render_object.h render_replaced.cpp
                        render_style.cpp render_style.h render_table.cpp
                        render_theme_mac.mm table_layout.cpp
  Log:
  	Make all form controls treat width: auto as width:intrinsic and
  	add support for intrinsic widths when computing sizes of
  	block-level flows.
  
  	Rename the term Variable to Auto, since this more accurately
  	matches the term in the CSS spec.
  
          Reviewed by darin
  
          Test cases added: (None needed, <button> and <legend> test this)
  
          * khtml/css/cssstyleselector.cpp:
          (khtml::CSSStyleSelector::adjustRenderStyle):
          * khtml/misc/khtmllayout.h:
          (khtml::):
          (khtml::Length::width):
          (khtml::Length::minWidth):
          (khtml::Length::isAuto):
          (khtml::Length::isIntrinsicOrAuto):
          * khtml/rendering/bidi.cpp:
          (khtml::getBPMWidth):
          * khtml/rendering/render_block.cpp:
          (khtml::RenderBlock::MarginInfo::MarginInfo):
          (khtml::RenderBlock::isSelfCollapsingBlock):
          (khtml::RenderBlock::layoutBlock):
          (khtml::RenderBlock::determineHorizontalPosition):
          (khtml::getBPMWidth):
          (khtml::RenderBlock::calcInlineMinMaxWidth):
          (khtml::shouldCheckLines):
          * khtml/rendering/render_box.cpp:
          (RenderBox::getClipRect):
          (RenderBox::relativePositionOffset):
          (RenderBox::calcWidth):
          (RenderBox::calcWidthUsing):
          (RenderBox::sizesToIntrinsicWidth):
          (RenderBox::calcHorizontalMargins):
          (RenderBox::calcHeight):
          (RenderBox::calcHeightUsing):
          (RenderBox::calcPercentageHeight):
          (RenderBox::availableHeightUsing):
          (RenderBox::calcAbsoluteHorizontal):
          (RenderBox::calcAbsoluteHorizontalValues):
          (RenderBox::calcAbsoluteVertical):
          (RenderBox::calcAbsoluteVerticalValues):
          * khtml/rendering/render_box.h:
          * khtml/rendering/render_flexbox.cpp:
          (khtml::RenderFlexibleBox::calcHorizontalMinMaxWidth):
          (khtml::RenderFlexibleBox::layoutVerticalBox):
          * khtml/rendering/render_form.cpp:
          (RenderFormElement::addIntrinsicMarginsIfAllowed):
          (RenderSlider::calcMinMaxWidth):
          * khtml/rendering/render_layer.cpp:
          (khtml::Marquee::updateMarqueeStyle):
          * khtml/rendering/render_line.cpp:
          (khtml::InlineFlowBox::marginLeft):
          (khtml::InlineFlowBox::marginRight):
          * khtml/rendering/render_object.cpp:
          (RenderObject::hasStaticX):
          (RenderObject::hasStaticY):
          (RenderObject::paddingTop):
          (RenderObject::paddingBottom):
          (RenderObject::paddingLeft):
          (RenderObject::paddingRight):
          (RenderObject::usesLineWidth):
          * khtml/rendering/render_object.h:
          * khtml/rendering/render_replaced.cpp:
          (RenderReplaced::calcMinMaxWidth):
          * khtml/rendering/render_style.cpp:
          (StyleSurroundData::StyleSurroundData):
          * khtml/rendering/render_style.h:
          (khtml::RenderStyle::resetPadding):
          (khtml::RenderStyle::initialPadding):
          * khtml/rendering/render_table.cpp:
          (RenderTable::setStyle):
          (RenderTable::calcWidth):
          (RenderTableSection::addCell):
          (RenderTableSection::layoutRows):
          * khtml/rendering/render_theme_mac.mm:
          (khtml::RenderThemeMac::setSizeFromFont):
          (khtml::RenderThemeMac::setCheckboxSize):
          (khtml::RenderThemeMac::setRadioSize):
          * khtml/rendering/table_layout.cpp:
          (FixedTableLayout::calcWidthArray):
          (FixedTableLayout::layout):
          (AutoTableLayout::recalcColumn):
          (AutoTableLayout::fullRecalc):
          (shouldScaleColumns):
          (AutoTableLayout::calcEffectiveWidth):
          (AutoTableLayout::layout):
  
  Revision  Changes    Path
  1.175     +92 -1     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.174
  retrieving revision 1.175
  diff -u -r1.174 -r1.175
  --- ChangeLog	29 Sep 2005 07:47:04 -0000	1.174
  +++ ChangeLog	29 Sep 2005 20:10:53 -0000	1.175
  @@ -1,3 +1,95 @@
  +2005-09-28  David Hyatt  <hyatt at apple.com>
  +
  +	Make all form controls treat width: auto as width:intrinsic and
  +	add support for intrinsic widths when computing sizes of 
  +	block-level flows.
  +
  +	Rename the term Variable to Auto, since this more accurately
  +	matches the term in the CSS spec.
  +
  +        Reviewed by darin
  +
  +        Test cases added: (None needed, <button> and <legend> test this)
  +
  +        * khtml/css/cssstyleselector.cpp:
  +        (khtml::CSSStyleSelector::adjustRenderStyle):
  +        * khtml/misc/khtmllayout.h:
  +        (khtml::):
  +        (khtml::Length::width):
  +        (khtml::Length::minWidth):
  +        (khtml::Length::isAuto):
  +        (khtml::Length::isIntrinsicOrAuto):
  +        * khtml/rendering/bidi.cpp:
  +        (khtml::getBPMWidth):
  +        * khtml/rendering/render_block.cpp:
  +        (khtml::RenderBlock::MarginInfo::MarginInfo):
  +        (khtml::RenderBlock::isSelfCollapsingBlock):
  +        (khtml::RenderBlock::layoutBlock):
  +        (khtml::RenderBlock::determineHorizontalPosition):
  +        (khtml::getBPMWidth):
  +        (khtml::RenderBlock::calcInlineMinMaxWidth):
  +        (khtml::shouldCheckLines):
  +        * khtml/rendering/render_box.cpp:
  +        (RenderBox::getClipRect):
  +        (RenderBox::relativePositionOffset):
  +        (RenderBox::calcWidth):
  +        (RenderBox::calcWidthUsing):
  +        (RenderBox::sizesToIntrinsicWidth):
  +        (RenderBox::calcHorizontalMargins):
  +        (RenderBox::calcHeight):
  +        (RenderBox::calcHeightUsing):
  +        (RenderBox::calcPercentageHeight):
  +        (RenderBox::availableHeightUsing):
  +        (RenderBox::calcAbsoluteHorizontal):
  +        (RenderBox::calcAbsoluteHorizontalValues):
  +        (RenderBox::calcAbsoluteVertical):
  +        (RenderBox::calcAbsoluteVerticalValues):
  +        * khtml/rendering/render_box.h:
  +        * khtml/rendering/render_flexbox.cpp:
  +        (khtml::RenderFlexibleBox::calcHorizontalMinMaxWidth):
  +        (khtml::RenderFlexibleBox::layoutVerticalBox):
  +        * khtml/rendering/render_form.cpp:
  +        (RenderFormElement::addIntrinsicMarginsIfAllowed):
  +        (RenderSlider::calcMinMaxWidth):
  +        * khtml/rendering/render_layer.cpp:
  +        (khtml::Marquee::updateMarqueeStyle):
  +        * khtml/rendering/render_line.cpp:
  +        (khtml::InlineFlowBox::marginLeft):
  +        (khtml::InlineFlowBox::marginRight):
  +        * khtml/rendering/render_object.cpp:
  +        (RenderObject::hasStaticX):
  +        (RenderObject::hasStaticY):
  +        (RenderObject::paddingTop):
  +        (RenderObject::paddingBottom):
  +        (RenderObject::paddingLeft):
  +        (RenderObject::paddingRight):
  +        (RenderObject::usesLineWidth):
  +        * khtml/rendering/render_object.h:
  +        * khtml/rendering/render_replaced.cpp:
  +        (RenderReplaced::calcMinMaxWidth):
  +        * khtml/rendering/render_style.cpp:
  +        (StyleSurroundData::StyleSurroundData):
  +        * khtml/rendering/render_style.h:
  +        (khtml::RenderStyle::resetPadding):
  +        (khtml::RenderStyle::initialPadding):
  +        * khtml/rendering/render_table.cpp:
  +        (RenderTable::setStyle):
  +        (RenderTable::calcWidth):
  +        (RenderTableSection::addCell):
  +        (RenderTableSection::layoutRows):
  +        * khtml/rendering/render_theme_mac.mm:
  +        (khtml::RenderThemeMac::setSizeFromFont):
  +        (khtml::RenderThemeMac::setCheckboxSize):
  +        (khtml::RenderThemeMac::setRadioSize):
  +        * khtml/rendering/table_layout.cpp:
  +        (FixedTableLayout::calcWidthArray):
  +        (FixedTableLayout::layout):
  +        (AutoTableLayout::recalcColumn):
  +        (AutoTableLayout::fullRecalc):
  +        (shouldScaleColumns):
  +        (AutoTableLayout::calcEffectiveWidth):
  +        (AutoTableLayout::layout):
  +
   2005-09-29  Justin Garcia  <justin.garcia at apple.com>
   
           Reviewed by harrison
  @@ -42,7 +134,6 @@
           (khtml::RebalanceWhitespaceCommand::doUnapply): Removed the unused m_downstreamOffset
           * layout-tests/editing/editingStyle.css: Added.
   
  -
   2005-09-27  Maciej Stachowiak  <mjs at apple.com>
   
           Reviewed by Eric.
  
  
  
  1.207     +8 -0      WebCore/khtml/css/cssstyleselector.cpp
  
  Index: cssstyleselector.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/css/cssstyleselector.cpp,v
  retrieving revision 1.206
  retrieving revision 1.207
  diff -u -r1.206 -r1.207
  --- cssstyleselector.cpp	28 Sep 2005 22:01:28 -0000	1.206
  +++ cssstyleselector.cpp	29 Sep 2005 20:10:55 -0000	1.207
  @@ -973,6 +973,14 @@
       if (style->opacity() < 1.0f && style->hasAutoZIndex())
           style->setZIndex(0);
       
  +    // Button, legend, input, select and textarea all consider width values of 'auto' to be 'intrinsic'.
  +    // This will be important when we use block flows for all form controls.
  +    if (e && (e->hasTagName(legendTag) || e->hasTagName(buttonTag) || e->hasTagName(inputTag) ||
  +              e->hasTagName(selectTag) || e->hasTagName(textareaTag))) {
  +        if (style->width().isAuto())
  +            style->setWidth(Length(Intrinsic));
  +    }
  +
       // 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
  
  
  
  1.9       +5 -4      WebCore/khtml/misc/khtmllayout.h
  
  Index: khtmllayout.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/misc/khtmllayout.h,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- khtmllayout.h	5 Oct 2004 20:25:19 -0000	1.8
  +++ khtmllayout.h	29 Sep 2005 20:10:55 -0000	1.9
  @@ -41,7 +41,7 @@
       /*
        * %multiLength and %Length
        */
  -    enum LengthType { Variable = 0, Relative, Percent, Fixed, Static, Intrinsic, MinIntrinsic };
  +    enum LengthType { Auto = 0, Relative, Percent, Fixed, Static, Intrinsic, MinIntrinsic };
       struct Length
       {
   	Length() { *((Q_UINT32 *)this) = 0; }
  @@ -71,7 +71,7 @@
   		    return value;
   		case Percent:
   		    return maxWidth*value/100;
  -		case Variable:
  +		case Auto:
   		    return maxWidth;
   		default:
   		    return -1;
  @@ -88,16 +88,17 @@
   		    return value;
   		case Percent:
   		    return maxWidth*value/100;
  -		case Variable:
  +		case Auto:
   		default:
   		    return 0;
   		}
   	    }
  -        bool isVariable() const { return (type == Variable); }
  +        bool isAuto() const { return (type == Auto); }
           bool isRelative() const { return (type == Relative); }
           bool isPercent() const { return (type == Percent); }
           bool isFixed() const { return (type == Fixed); }
           bool isStatic() const { return (type == Static); }
  +        bool isIntrinsicOrAuto() const { return (type == Auto || type == MinIntrinsic || type == Intrinsic); }
   
           int value : 28;
           LengthType type : 3;
  
  
  
  1.143     +1 -1      WebCore/khtml/rendering/bidi.cpp
  
  Index: bidi.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/bidi.cpp,v
  retrieving revision 1.142
  retrieving revision 1.143
  diff -u -r1.142 -r1.143
  --- bidi.cpp	24 Sep 2005 11:45:16 -0000	1.142
  +++ bidi.cpp	29 Sep 2005 20:10:56 -0000	1.143
  @@ -107,7 +107,7 @@
   
   static int getBPMWidth(int childValue, Length cssUnit)
   {
  -    if (cssUnit.type != Variable)
  +    if (cssUnit.type != Auto)
           return (cssUnit.type == Fixed ? cssUnit.value : childValue);
       return 0;
   }
  
  
  
  1.206     +9 -9      WebCore/khtml/rendering/render_block.cpp
  
  Index: render_block.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_block.cpp,v
  retrieving revision 1.205
  retrieving revision 1.206
  diff -u -r1.205 -r1.206
  --- render_block.cpp	24 Sep 2005 01:19:01 -0000	1.205
  +++ render_block.cpp	29 Sep 2005 20:10:56 -0000	1.206
  @@ -65,7 +65,7 @@
       // effects when the children overflow out of the parent block and yet still collapse
       // with it.  We also don't collapse if we have any bottom border/padding.
       m_canCollapseBottomWithChildren = m_canCollapseWithChildren && (bottom == 0) &&
  -        (block->style()->height().isVariable() && block->style()->height().value == 0) && block->style()->marginBottomCollapse() != MSEPARATE;
  +        (block->style()->height().isAuto() && block->style()->height().value == 0) && block->style()->marginBottomCollapse() != MSEPARATE;
       
       m_quirkContainer = block->isTableCell() || block->isBody() || block->style()->marginTopCollapse() == MDISCARD || 
           block->style()->marginBottomCollapse() == MDISCARD;
  @@ -391,7 +391,7 @@
           style()->marginTopCollapse() == MSEPARATE || style()->marginBottomCollapse() == MSEPARATE)
           return false;
   
  -    bool hasAutoHeight = style()->height().isVariable();
  +    bool hasAutoHeight = style()->height().isAuto();
       if (style()->height().isPercent() && !style()->htmlHacks()) {
           hasAutoHeight = true;
           for (RenderBlock* cb = containingBlock(); !cb->isCanvas(); cb = cb->containingBlock()) {
  @@ -539,7 +539,7 @@
               m_height = m_overflowHeight + borderBottom() + paddingBottom();
       }
   
  -    if (hasOverhangingFloats() && ((isFloating() && style()->height().isVariable()) || isTableCell())) {
  +    if (hasOverhangingFloats() && ((isFloating() && style()->height().isAuto()) || isTableCell())) {
           m_height = floatBottom();
           m_height += borderBottom() + paddingBottom();
       }
  @@ -922,7 +922,7 @@
           // to shift over as necessary to dodge any floats that might get in the way.
           if (child->avoidsFloats()) {
               int leftOff = leftOffset(m_height);
  -            if (style()->textAlign() != KHTML_CENTER && child->style()->marginLeft().type != Variable) {
  +            if (style()->textAlign() != KHTML_CENTER && child->style()->marginLeft().type != Auto) {
                   if (child->marginLeft() < 0)
                       leftOff += child->marginLeft();
                   chPos = kMax(chPos, leftOff); // Let the float sit in the child's margin if it can fit.
  @@ -943,7 +943,7 @@
           int chPos = xPos - (child->width() + child->marginRight());
           if (child->avoidsFloats()) {
               int rightOff = rightOffset(m_height);
  -            if (style()->textAlign() != KHTML_CENTER && child->style()->marginRight().type != Variable) {
  +            if (style()->textAlign() != KHTML_CENTER && child->style()->marginRight().type != Auto) {
                   if (child->marginRight() < 0)
                       rightOff -= child->marginRight();
                   chPos = kMin(chPos, rightOff - child->width()); // Let the float sit in the child's margin if it can fit.
  @@ -2773,7 +2773,7 @@
   
   static int getBPMWidth(int childValue, Length cssUnit)
   {
  -    if (cssUnit.type != Variable)
  +    if (cssUnit.type != Auto)
           return (cssUnit.type == Fixed ? cssUnit.value : childValue);
       return 0;
   }
  @@ -2887,10 +2887,10 @@
                       // Inline replaced elts add in their margins to their min/max values.
                       int margins = 0;
                       LengthType type = cstyle->marginLeft().type;
  -                    if ( type != Variable )
  +                    if ( type != Auto )
                           margins += (type == Fixed ? cstyle->marginLeft().value : child->marginLeft());
                       type = cstyle->marginRight().type;
  -                    if ( type != Variable )
  +                    if ( type != Auto )
                           margins += (type == Fixed ? cstyle->marginRight().value : child->marginRight());
                       childMin += margins;
                       childMax += margins;
  @@ -3401,7 +3401,7 @@
   static bool shouldCheckLines(RenderObject* obj)
   {
       return !obj->isFloatingOrPositioned() && !obj->isCompact() && !obj->isRunIn() &&
  -            obj->isBlockFlow() && obj->style()->height().isVariable() &&
  +            obj->isBlockFlow() && obj->style()->height().isAuto() &&
               (!obj->isFlexibleBox() || obj->style()->boxOrient() == VERTICAL);
   }
   
  
  
  
  1.168     +66 -37    WebCore/khtml/rendering/render_box.cpp
  
  Index: render_box.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_box.cpp,v
  retrieving revision 1.167
  retrieving revision 1.168
  diff -u -r1.167 -r1.168
  --- render_box.cpp	24 Sep 2005 11:45:16 -0000	1.167
  +++ render_box.cpp	29 Sep 2005 20:10:56 -0000	1.168
  @@ -607,26 +607,26 @@
       int clipw = m_width;
       int cliph = m_height;
   
  -    if (!style()->clipLeft().isVariable())
  +    if (!style()->clipLeft().isAuto())
       {
           int c=style()->clipLeft().width(m_width);
           clipx+=c;
           clipw-=c;
       }
           
  -    if (!style()->clipRight().isVariable())
  +    if (!style()->clipRight().isAuto())
       {
           int w = style()->clipRight().width(m_width);
           clipw -= m_width - w;
       }
       
  -    if (!style()->clipTop().isVariable())
  +    if (!style()->clipTop().isAuto())
       {
           int c=style()->clipTop().width(m_height);
           clipy+=c;
           cliph-=c;
       }
  -    if (!style()->clipBottom().isVariable())
  +    if (!style()->clipBottom().isAuto())
       {
           int h = style()->clipBottom().width(m_height);
           cliph -= m_height - h;
  @@ -801,17 +801,17 @@
   
   void RenderBox::relativePositionOffset(int &tx, int &ty)
   {
  -    if(!style()->left().isVariable())
  +    if(!style()->left().isAuto())
           tx += style()->left().width(containingBlockWidth());
  -    else if(!style()->right().isVariable())
  +    else if(!style()->right().isAuto())
           tx -= style()->right().width(containingBlockWidth());
  -    if(!style()->top().isVariable())
  +    if(!style()->top().isAuto())
       {
           if (!style()->top().isPercent()
                   || containingBlock()->style()->height().isFixed())
               ty += style()->top().width(containingBlockHeight());
       }
  -    else if(!style()->bottom().isVariable())
  +    else if(!style()->bottom().isAuto())
       {
           if (!style()->bottom().isPercent()
                   || containingBlock()->style()->height().isFixed())
  @@ -895,7 +895,7 @@
                   }
               }
               
  -            if (widthType == Variable) {
  +            if (widthType == Auto) {
       //          kdDebug( 6040 ) << "variable" << endl;
                   m_marginLeft = ml.minWidth(cw);
                   m_marginRight = mr.minWidth(cw);
  @@ -933,15 +933,13 @@
           w = style()->minWidth();
       else
           w = style()->maxWidth();
  -        
  -    lengthType = w.type;
  -    
  -    if (lengthType == Variable) {
  +
  +    if (w.isIntrinsicOrAuto()) {
           int marginLeft = style()->marginLeft().minWidth(cw);
           int marginRight = style()->marginRight().minWidth(cw);
           if (cw) width = cw - marginLeft - marginRight;
           
  -        if (sizesToMaxWidth()) {
  +        if (sizesToIntrinsicWidth(widthType)) {
               if (width < m_minWidth) 
                   width = m_minWidth;
               if (width > m_maxWidth) 
  @@ -957,6 +955,37 @@
       return width;
   }
   
  +bool RenderBox::sizesToIntrinsicWidth(WidthType widthType) const
  +{
  +    // Marquees in WinIE are like a mixture of blocks and inline-blocks.  They size as though they're blocks,
  +    // but they allow text to sit on the same line as the marquee.
  +    if (isFloating() || (isCompact() && isInline()) || 
  +        (isInlineBlockOrInlineTable() && !isHTMLMarquee()))
  +        return true;
  +    
  +    // This code may look a bit strange.  Basically width:intrinsic should clamp the size when testing both
  +    // min-width and width.  max-width is only clamped if it is also intrinsic.
  +    Length width = widthType == MaxWidth ? style()->maxWidth() : style()->width();
  +    if (width.type == Intrinsic)
  +        return true;
  +    
  +    // Children of a horizontal marquee do not fill the container by default.
  +    // FIXME: Need to deal with MAUTO value properly.  It could be vertical.
  +    if (parent()->style()->overflow() == OMARQUEE) {
  +        EMarqueeDirection dir = parent()->style()->marqueeDirection();
  +        if (dir == MAUTO || dir == MFORWARD || dir == MBACKWARD || dir == MLEFT || dir == MRIGHT)
  +            return true;
  +    }
  +    
  +    // Flexible horizontal boxes lay out children at their intrinsic widths.  Also vertical boxes
  +    // that don't stretch their kids lay out their children at their intrinsic widths.
  +    if (parent()->isFlexibleBox() &&
  +        (parent()->style()->boxOrient() == HORIZONTAL || parent()->style()->boxAlign() != BSTRETCH))
  +        return true;
  +
  +    return false;
  +}
  +
   void RenderBox::calcHorizontalMargins(const Length& ml, const Length& mr, int cw)
   {
       if (isFloating() || isInline()) // Inline blocks/tables and floats don't have their margins increased.
  @@ -966,23 +995,23 @@
       }
       else
       {
  -        if ( (ml.type == Variable && mr.type == Variable && m_width<cw) ||
  -             (ml.type != Variable && mr.type != Variable &&
  +        if ( (ml.type == Auto && mr.type == Auto && m_width<cw) ||
  +             (ml.type != Auto && mr.type != Auto &&
                   containingBlock()->style()->textAlign() == KHTML_CENTER) )
           {
               m_marginLeft = (cw - m_width)/2;
               if (m_marginLeft<0) m_marginLeft=0;
               m_marginRight = cw - m_width - m_marginLeft;
           }
  -        else if ( (mr.type == Variable && m_width<cw) ||
  -                 (ml.type != Variable && containingBlock()->style()->direction() == RTL &&
  +        else if ( (mr.type == Auto && m_width<cw) ||
  +                 (ml.type != Auto && containingBlock()->style()->direction() == RTL &&
                     containingBlock()->style()->textAlign() == KHTML_LEFT))
           {
               m_marginLeft = ml.width(cw);
               m_marginRight = cw - m_width - m_marginLeft;
           }
  -        else if ( (ml.type == Variable && m_width<cw) ||
  -                 (mr.type != Variable && containingBlock()->style()->direction() == LTR &&
  +        else if ( (ml.type == Auto && m_width<cw) ||
  +                 (mr.type != Auto && containingBlock()->style()->direction() == LTR &&
                     containingBlock()->style()->textAlign() == KHTML_RIGHT))
           {
               m_marginRight = mr.width(cw);
  @@ -1037,7 +1066,7 @@
           }
           
           // Block children of horizontal flexible boxes fill the height of the box.
  -        if (h.isVariable() && parent()->isFlexibleBox() && parent()->style()->boxOrient() == HORIZONTAL
  +        if (h.isAuto() && parent()->isFlexibleBox() && parent()->style()->boxOrient() == HORIZONTAL
               && parent()->isStretchingChildren()) {
               h = Length(parent()->contentHeight() - marginTop() - marginBottom() -
                          borderTop() - paddingTop() - borderBottom() - paddingBottom(), Fixed);
  @@ -1073,7 +1102,7 @@
       // WinIE quirk: The <html> block always fills the entire canvas in quirks mode.  The <body> always fills the
       // <html> block in quirks mode.  Only apply this quirk if the block is normal flow and no height
       // is specified.
  -    if (style()->htmlHacks() && style()->height().isVariable() &&
  +    if (style()->htmlHacks() && style()->height().isAuto() &&
           !isFloatingOrPositioned() && (isRoot() || isBody())) {
           int margins = collapsedMarginTop() + collapsedMarginBottom();
           int visHeight = canvas()->view()->visibleHeight();
  @@ -1090,7 +1119,7 @@
   int RenderBox::calcHeightUsing(const Length& h)
   {
       int height = -1;
  -    if (!h.isVariable()) {
  +    if (!h.isAuto()) {
           if (h.isFixed())
               height = h.value;
           else if (h.isPercent())
  @@ -1114,7 +1143,7 @@
           // specification, which states that percentage heights just revert to auto if the containing
           // block has an auto height.
           for ( ; !cb->isCanvas() && !cb->isBody() && !cb->isTableCell() && !cb->isPositioned() &&
  -                cb->style()->height().isVariable(); cb = cb->containingBlock());
  +                cb->style()->height().isAuto(); cb = cb->containingBlock());
       }
   
       // Table cells violate what the CSS spec says to do with heights.  Basically we
  @@ -1132,7 +1161,7 @@
               // preferable to the alternative (sizing intrinsically and making the row end up too big).
               RenderTableCell* cell = static_cast<RenderTableCell*>(cb);
               if (scrollsOverflow() && 
  -                (!cell->style()->height().isVariable() || !cell->table()->style()->height().isVariable()))
  +                (!cell->style()->height().isAuto() || !cell->table()->style()->height().isAuto()))
                   return 0;
               return -1;
           }
  @@ -1259,7 +1288,7 @@
       // We need to stop here, since we don't want to increase the height of the table
       // artificially.  We're going to rely on this cell getting expanded to some new
       // height, and then when we lay out again we'll use the calculation below.
  -    if (isTableCell() && (h.isVariable() || h.isPercent())) {
  +    if (isTableCell() && (h.isAuto() || h.isPercent())) {
           return overrideSize() - (borderLeft()+borderRight()+paddingLeft()+paddingRight());
       }
       
  @@ -1312,9 +1341,9 @@
       RenderObject* cb = container();
       cw = containingBlockWidth() + cb->paddingLeft() + cb->paddingRight();
   
  -    if (!style()->left().isVariable())
  +    if (!style()->left().isAuto())
           l = style()->left().width(cw);
  -    if (!style()->right().isVariable())
  +    if (!style()->right().isAuto())
           r = style()->right().width(cw);
   
       int static_distance=0;
  @@ -1375,9 +1404,9 @@
       const int AUTO = -666666;
       w = ml = mr = AUTO;
   
  -    if (!style()->marginLeft().isVariable())
  +    if (!style()->marginLeft().isAuto())
           ml = style()->marginLeft().width(cw);
  -    if (!style()->marginRight().isVariable())
  +    if (!style()->marginRight().isAuto())
           mr = style()->marginRight().width(cw);
   
       Length width;
  @@ -1388,7 +1417,7 @@
       else
           width = style()->maxWidth();
   
  -    if (!width.isVariable())
  +    if (!width.isAuto())
           w = width.width(cw);
       else if (isReplaced())
           w = intrinsicWidth();
  @@ -1495,9 +1524,9 @@
       else
           ch = cb->height() - cb->borderTop() - cb->borderBottom();
   
  -    if (!style()->top().isVariable())
  +    if (!style()->top().isAuto())
           t = style()->top().width(ch);
  -    if (!style()->bottom().isVariable())
  +    if (!style()->bottom().isAuto())
           b = style()->bottom().width(ch);
   
       int h, mt, mb, y;
  @@ -1543,9 +1572,9 @@
       const int AUTO = -666666;
       h = mt = mb = AUTO;
   
  -    if (!style()->marginTop().isVariable())
  +    if (!style()->marginTop().isAuto())
           mt = style()->marginTop().width(ch);
  -    if (!style()->marginBottom().isVariable())
  +    if (!style()->marginBottom().isAuto())
           mb = style()->marginBottom().width(ch);
   
       Length height;
  @@ -1558,11 +1587,11 @@
   
       int ourHeight = m_height;
   
  -    if (isTable() && height.isVariable())
  +    if (isTable() && height.isAuto())
           // Height is never unsolved for tables. "auto" means shrink to fit.  Use our
           // height instead.
           h = ourHeight - pab;
  -    else if (!height.isVariable())
  +    else if (!height.isAuto())
       {
           h = height.width(ch);
           if (ourHeight - pab > h)
  
  
  
  1.58      +4 -0      WebCore/khtml/rendering/render_box.h
  
  Index: render_box.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_box.h,v
  retrieving revision 1.57
  retrieving revision 1.58
  diff -u -r1.57 -r1.58
  --- render_box.h	24 Sep 2005 11:45:16 -0000	1.57
  +++ render_box.h	29 Sep 2005 20:10:56 -0000	1.58
  @@ -114,6 +114,10 @@
       virtual void calcWidth();
       virtual void calcHeight();
   
  +    // Whether or not the element shrinks to its intrinsic width (rather than filling the width
  +    // of a containing block).  HTML4 buttons, <select>s, <input>s, legends, and floating/compact elements do this.
  +    bool sizesToIntrinsicWidth(WidthType widthType) const;
  +
       int calcWidthUsing(WidthType widthType, int cw, LengthType& lengthType);
       int calcHeightUsing(const Length& height);
       int calcReplacedWidthUsing(WidthType widthType) const;
  
  
  
  1.26      +7 -7      WebCore/khtml/rendering/render_flexbox.cpp
  
  Index: render_flexbox.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_flexbox.cpp,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- render_flexbox.cpp	29 Jul 2005 23:42:49 -0000	1.25
  +++ render_flexbox.cpp	29 Sep 2005 20:10:56 -0000	1.26
  @@ -127,9 +127,9 @@
           // calculated its margins (which are computed inside calcWidth).
           child->calcWidth();
   
  -        if (!(ml.type==Variable) && !(mr.type==Variable))
  +        if (!(ml.type==Auto) && !(mr.type==Auto))
           {
  -            if (!(child->style()->width().type==Variable))
  +            if (!(child->style()->width().type==Auto))
               {
                   if (child->style()->direction()==LTR)
                       margin = child->marginLeft();
  @@ -140,9 +140,9 @@
                   margin = child->marginLeft()+child->marginRight();
   
           }
  -        else if (!(ml.type == Variable))
  +        else if (!(ml.type == Auto))
               margin = child->marginLeft();
  -        else if (!(mr.type == Variable))
  +        else if (!(mr.type == Auto))
               margin = child->marginRight();
   
           if (margin < 0) margin = 0;
  @@ -700,7 +700,7 @@
           while (child) {
               if (!child->isPositioned()) {
                   if (relayoutChildren || (child->isReplaced() && (child->style()->width().isPercent() || child->style()->height().isPercent())) ||
  -                    (child->style()->height().isVariable() && child->isBlockFlow() && !child->needsLayout())) {
  +                    (child->style()->height().isAuto() && child->isBlockFlow() && !child->needsLayout())) {
                       child->setChildNeedsLayout(true);
                       
                       // Dirty all the positioned objects.
  @@ -708,7 +708,7 @@
                       static_cast<RenderBlock*>(child)->clearTruncation();
                   }
                   child->layoutIfNeeded();
  -                if (child->style()->height().isVariable() && child->isBlockFlow())
  +                if (child->style()->height().isAuto() && child->isBlockFlow())
                       maxLineCount = kMax(maxLineCount, static_cast<RenderBlock*>(child)->lineCount());
               }
               child = iterator.next();
  @@ -719,7 +719,7 @@
           int numVisibleLines = int((maxLineCount+1)*style()->lineClamp()/100.0);
           if (numVisibleLines < maxLineCount) {
               for (child = iterator.first(); child; child = iterator.next()) {
  -                if (child->isPositioned() || !child->style()->height().isVariable() || !child->isBlockFlow())
  +                if (child->isPositioned() || !child->style()->height().isAuto() || !child->isBlockFlow())
                       continue;
                   
                   RenderBlock* blockChild = static_cast<RenderBlock*>(child);
  
  
  
  1.123     +5 -4      WebCore/khtml/rendering/render_form.cpp
  
  Index: render_form.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_form.cpp,v
  retrieving revision 1.122
  retrieving revision 1.123
  diff -u -r1.122 -r1.123
  --- render_form.cpp	16 Sep 2005 22:42:15 -0000	1.122
  +++ render_form.cpp	29 Sep 2005 20:10:57 -0000	1.123
  @@ -224,15 +224,16 @@
       if (_style->font().pixelSize() < 11)
           return;
       
  +    // FIXME: Using width/height alone and not also dealing with min-width/max-width is flawed.
       int m = intrinsicMargin();
  -    if (_style->width().isVariable()) {
  +    if (_style->width().isIntrinsicOrAuto()) {
           if (_style->marginLeft().quirk)
               _style->setMarginLeft(Length(m, Fixed));
           if (_style->marginRight().quirk)
               _style->setMarginRight(Length(m, Fixed));
       }
   
  -    if (_style->height().isVariable()) {
  +    if (_style->height().isAuto()) {
           if (_style->marginTop().quirk)
               _style->setMarginTop(Length(m, Fixed));
           if (_style->marginBottom().quirk)
  @@ -1690,8 +1691,8 @@
       
       // Let the widget tell us how big it wants to be.
       QSize s(widget()->sizeHint());
  -    bool widthSet = !style()->width().isVariable();
  -    bool heightSet = !style()->height().isVariable();
  +    bool widthSet = !style()->width().isAuto();
  +    bool heightSet = !style()->height().isAuto();
       if (heightSet && !widthSet) {
           // Flip the intrinsic dimensions.
           int barLength = s.width();
  
  
  
  1.105     +1 -1      WebCore/khtml/rendering/render_layer.cpp
  
  Index: render_layer.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_layer.cpp,v
  retrieving revision 1.104
  retrieving revision 1.105
  diff -u -r1.104 -r1.105
  --- render_layer.cpp	19 Sep 2005 20:54:09 -0000	1.104
  +++ render_layer.cpp	29 Sep 2005 20:10:57 -0000	1.105
  @@ -1683,7 +1683,7 @@
       if (isHorizontal()) {
           if (s->height().isFixed() && (s->height().value < s->fontSize())) 
               s->setHeight(Length(s->fontSize(),Fixed));
  -    } else if (s->height().isVariable())  //vertical marquee with no specified height
  +    } else if (s->height().isAuto())  //vertical marquee with no specified height
           s->setHeight(Length(200,Fixed)); 
      
       if (speed() != marqueeSpeed()) {
  
  
  
  1.52      +2 -2      WebCore/khtml/rendering/render_line.cpp
  
  Index: render_line.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_line.cpp,v
  retrieving revision 1.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- render_line.cpp	16 Sep 2005 22:42:16 -0000	1.51
  +++ render_line.cpp	29 Sep 2005 20:10:57 -0000	1.52
  @@ -275,7 +275,7 @@
       
       RenderStyle* cstyle = object()->style();
       Length margin = cstyle->marginLeft();
  -    if (margin.type != Variable)
  +    if (margin.type != Auto)
           return (margin.type == Fixed ? margin.value : object()->marginLeft());
       return 0;
   }
  @@ -287,7 +287,7 @@
       
       RenderStyle* cstyle = object()->style();
       Length margin = cstyle->marginRight();
  -    if (margin.type != Variable)
  +    if (margin.type != Auto)
           return (margin.type == Fixed ? margin.value : object()->marginRight());
       return 0;
   }
  
  
  
  1.217     +7 -33     WebCore/khtml/rendering/render_object.cpp
  
  Index: render_object.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_object.cpp,v
  retrieving revision 1.216
  retrieving revision 1.217
  diff -u -r1.216 -r1.217
  --- render_object.cpp	19 Sep 2005 20:54:10 -0000	1.216
  +++ render_object.cpp	29 Sep 2005 20:10:57 -0000	1.217
  @@ -635,7 +635,7 @@
   bool
   RenderObject::hasStaticX() const
   {
  -    return (style()->left().isVariable() && style()->right().isVariable()) ||
  +    return (style()->left().isAuto() && style()->right().isAuto()) ||
               style()->left().isStatic() ||
               style()->right().isStatic();
   }
  @@ -643,7 +643,7 @@
   bool
   RenderObject::hasStaticY() const
   {
  -    return (style()->top().isVariable() && style()->bottom().isVariable()) || style()->top().isStatic();
  +    return (style()->top().isAuto() && style()->bottom().isAuto()) || style()->top().isStatic();
   }
   
   void RenderObject::markAllDescendantsWithFloatsForLayout(RenderObject*)
  @@ -750,32 +750,6 @@
       return containingBlock()->contentHeight();
   }
   
  -bool RenderObject::sizesToMaxWidth() const
  -{
  -    // Marquees in WinIE are like a mixture of blocks and inline-blocks.  They size as though they're blocks,
  -    // but they allow text to sit on the same line as the marquee.
  -    if (isFloating() || (isCompact() && isInline()) || 
  -        (isInlineBlockOrInlineTable() && !isHTMLMarquee()) ||
  -        (element() && (element()->hasTagName(buttonTag) || element()->hasTagName(legendTag))))
  -        return true;
  -    
  -    // Children of a horizontal marquee do not fill the container by default.
  -    // FIXME: Need to deal with MAUTO value properly.  It could be vertical.
  -    if (parent()->style()->overflow() == OMARQUEE) {
  -        EMarqueeDirection dir = parent()->style()->marqueeDirection();
  -        if (dir == MAUTO || dir == MFORWARD || dir == MBACKWARD || dir == MLEFT || dir == MRIGHT)
  -            return true;
  -    }
  -    
  -    // Flexible horizontal boxes lay out children at their maxwidths.  Also vertical boxes
  -    // that don't stretch their kids lay out their children at their maxwidths.
  -    if (parent()->isFlexibleBox() &&
  -        (parent()->style()->boxOrient() == HORIZONTAL || parent()->style()->boxAlign() != BSTRETCH))
  -        return true;
  -
  -    return false;
  -}
  -
   void RenderObject::drawBorder(QPainter *p, int x1, int y1, int x2, int y2,
                                 BorderSide s, QColor c, const QColor& textcolor, EBorderStyle style,
                                 int adjbw1, int adjbw2, bool invalidisInvert)
  @@ -1899,7 +1873,7 @@
       if (padding.isPercent())
           w = containingBlock()->contentWidth();
       w = padding.minWidth(w);
  -    if ( isTableCell() && padding.isVariable() )
  +    if ( isTableCell() && padding.isAuto() )
   	w = static_cast<const RenderTableCell *>(this)->table()->cellPadding();
       return w;
   }
  @@ -1911,7 +1885,7 @@
       if (padding.isPercent())
           w = containingBlock()->contentWidth();
       w = padding.minWidth(w);
  -    if ( isTableCell() && padding.isVariable() )
  +    if ( isTableCell() && padding.isAuto() )
   	w = static_cast<const RenderTableCell *>(this)->table()->cellPadding();
       return w;
   }
  @@ -1923,7 +1897,7 @@
       if (padding.isPercent())
           w = containingBlock()->contentWidth();
       w = padding.minWidth(w);
  -    if ( isTableCell() && padding.isVariable() )
  +    if ( isTableCell() && padding.isAuto() )
   	w = static_cast<const RenderTableCell *>(this)->table()->cellPadding();
       return w;
   }
  @@ -1935,7 +1909,7 @@
       if (padding.isPercent())
           w = containingBlock()->contentWidth();
       w = padding.minWidth(w);
  -    if ( isTableCell() && padding.isVariable() )
  +    if ( isTableCell() && padding.isAuto() )
   	w = static_cast<const RenderTableCell *>(this)->table()->cellPadding();
       return w;
   }
  @@ -2494,7 +2468,7 @@
       // (a) tables use contentWidth
       // (b) <hr>s use lineWidth
       // (c) all other objects use lineWidth in quirks mode and contentWidth in strict mode.
  -    return (avoidsFloats() && (style()->width().isVariable() || isHR() || (style()->htmlHacks() && !isTable())));
  +    return (avoidsFloats() && (style()->width().isAuto() || isHR() || (style()->htmlHacks() && !isTable())));
   }
   
   QChar RenderObject::backslashAsCurrencySymbol() const
  
  
  
  1.159     +0 -4      WebCore/khtml/rendering/render_object.h
  
  Index: render_object.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_object.h,v
  retrieving revision 1.158
  retrieving revision 1.159
  diff -u -r1.158 -r1.159
  --- render_object.h	24 Sep 2005 11:45:16 -0000	1.158
  +++ render_object.h	29 Sep 2005 20:10:57 -0000	1.159
  @@ -462,10 +462,6 @@
   
       virtual int availableHeight() const { return 0; }
   
  -    // Whether or not the element shrinks to its max width (rather than filling the width
  -    // of a containing block).  HTML4 buttons, legends, and floating/compact elements do this.
  -    bool sizesToMaxWidth() const;
  -
   #if APPLE_CHANGES
       // Called recursively to update the absolute positions of all widgets.
       virtual void updateWidgetPositions();
  
  
  
  1.86      +1 -1      WebCore/khtml/rendering/render_replaced.cpp
  
  Index: render_replaced.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_replaced.cpp,v
  retrieving revision 1.85
  retrieving revision 1.86
  diff -u -r1.85 -r1.86
  --- render_replaced.cpp	16 Sep 2005 22:42:16 -0000	1.85
  +++ render_replaced.cpp	29 Sep 2005 20:10:57 -0000	1.86
  @@ -99,7 +99,7 @@
   #endif
   
       int width = calcReplacedWidth() + paddingLeft() + paddingRight() + borderLeft() + borderRight();
  -    if (style()->width().isPercent() || (style()->width().isVariable() && style()->height().isPercent())) {
  +    if (style()->width().isPercent() || (style()->width().isAuto() && style()->height().isPercent())) {
           m_minWidth = 0;
           m_maxWidth = width;
       }
  
  
  
  1.70      +1 -1      WebCore/khtml/rendering/render_style.cpp
  
  Index: render_style.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_style.cpp,v
  retrieving revision 1.69
  retrieving revision 1.70
  diff -u -r1.69 -r1.70
  --- render_style.cpp	27 Aug 2005 00:14:21 -0000	1.69
  +++ render_style.cpp	29 Sep 2005 20:10:57 -0000	1.70
  @@ -35,7 +35,7 @@
   using DOM::DOMString;
   
   StyleSurroundData::StyleSurroundData()
  -    : margin( Fixed ), padding( Variable )
  +    : margin( Fixed ), padding( Auto )
   {
   }
   
  
  
  
  1.91      +2 -2      WebCore/khtml/rendering/render_style.h
  
  Index: render_style.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_style.h,v
  retrieving revision 1.90
  retrieving revision 1.91
  diff -u -r1.90 -r1.91
  --- render_style.h	27 Sep 2005 22:37:20 -0000	1.90
  +++ render_style.h	29 Sep 2005 20:10:57 -0000	1.91
  @@ -1515,7 +1515,7 @@
       void setMarginLeft(Length v)    {  SET_VAR(surround,margin.left,v) }
       void setMarginRight(Length v)   {  SET_VAR(surround,margin.right,v) }
   
  -    void resetPadding() { SET_VAR(surround, padding, LengthBox(Variable)) }
  +    void resetPadding() { SET_VAR(surround, padding, LengthBox(Auto)) }
       void setPaddingTop(Length v)    {  SET_VAR(surround,padding.top,v) }
       void setPaddingBottom(Length v) {  SET_VAR(surround,padding.bottom,v) }
       void setPaddingLeft(Length v)   {  SET_VAR(surround,padding.left,v) }
  @@ -1670,7 +1670,7 @@
       static Length initialMaxSize() { return Length(UNDEFINED, Fixed); }
       static Length initialOffset() { return Length(); }
       static Length initialMargin() { return Length(Fixed); }
  -    static Length initialPadding() { return Length(Variable); }
  +    static Length initialPadding() { return Length(Auto); }
       static Length initialTextIndent() { return Length(Fixed); }
       static EVerticalAlign initialVerticalAlign() { return BASELINE; }
       static int initialWidows() { return 2; }
  
  
  
  1.133     +13 -13    WebCore/khtml/rendering/render_table.cpp
  
  Index: render_table.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_table.cpp,v
  retrieving revision 1.132
  retrieving revision 1.133
  diff -u -r1.132 -r1.133
  --- render_table.cpp	19 Sep 2005 20:54:10 -0000	1.132
  +++ render_table.cpp	29 Sep 2005 20:10:58 -0000	1.133
  @@ -94,7 +94,7 @@
   
           // According to the CSS2 spec, you only use fixed table layout if an
           // explicit width is specified on the table.  Auto width implies auto table layout.
  -	if (style()->tableLayout() == TFIXED && !style()->width().isVariable()) {
  +	if (style()->tableLayout() == TFIXED && !style()->width().isAuto()) {
   	    tableLayout = new FixedTableLayout(this);
   #ifdef DEBUG_LAYOUT
   	    kdDebug( 6040 ) << "using fixed table layout" << endl;
  @@ -197,9 +197,9 @@
           
           // Subtract out any fixed margins from our available width for auto width tables.
           int marginTotal = 0;
  -        if (style()->marginLeft().type != Variable)
  +        if (style()->marginLeft().type != Auto)
               marginTotal += style()->marginLeft().width(availableWidth);
  -        if (style()->marginRight().type != Variable)
  +        if (style()->marginRight().type != Auto)
               marginTotal += style()->marginRight().width(availableWidth);
               
           // Subtract out our margins to get the available content width.
  @@ -978,7 +978,7 @@
   	    case Relative:
   #if 0
   		// we treat this as variable. This is correct according to HTML4, as it only specifies length for the height.
  -		if ( cRowHeight.type == Variable ||
  +		if ( cRowHeight.type == Auto ||
   		     ( cRowHeight.type == Relative && cRowHeight.value < height.value ) )
   		     grid[cRow].height = height;
   		     break;
  @@ -1165,10 +1165,10 @@
   
           int dh = toAdd;
   	int totalPercent = 0;
  -	int numVariable = 0;
  +	int numAuto = 0;
   	for ( int r = 0; r < totalRows; r++ ) {
  -	    if ( grid[r].height.type == Variable )
  -		numVariable++;
  +	    if ( grid[r].height.type == Auto )
  +		numAuto++;
   	    else if ( grid[r].height.type == Percent )
   		totalPercent += grid[r].height.value;
   	}
  @@ -1195,16 +1195,16 @@
                   rowPos[r+1] += add;
   	    }
   	}
  -	if ( numVariable ) {
  +	if ( numAuto ) {
   	    // distribute over variable cols
  -// 	    qDebug("distributing %d over variable rows numVariable=%d", dh,  numVariable );
  +// 	    qDebug("distributing %d over variable rows numAuto=%d", dh,  numAuto );
   	    int add = 0;
   	    for ( int r = 0; r < totalRows; r++ ) {
  -		if ( numVariable > 0 && grid[r].height.type == Variable ) {
  -		    int toAdd = dh/numVariable;
  +		if ( numAuto > 0 && grid[r].height.type == Auto ) {
  +		    int toAdd = dh/numAuto;
   		    add += toAdd;
   		    dh -= toAdd;
  -                    numVariable--;
  +                    numAuto--;
   		}
                   rowPos[r+1] += add;
   	    }
  @@ -1258,7 +1258,7 @@
               // bugs. :)
               bool cellChildrenFlex = false;
               bool flexAllChildren = cell->style()->height().isFixed() || 
  -                (!table()->style()->height().isVariable() && rHeight != cell->height());
  +                (!table()->style()->height().isAuto() && rHeight != cell->height());
               RenderObject* o = cell->firstChild();
               while (o) {
                   if (!o->isText() && o->style()->height().isPercent() && (o->isReplaced() || o->scrollsOverflow() || flexAllChildren)) {
  
  
  
  1.7       +5 -4      WebCore/khtml/rendering/render_theme_mac.mm
  
  Index: render_theme_mac.mm
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_theme_mac.mm,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- render_theme_mac.mm	8 Aug 2005 21:12:00 -0000	1.6
  +++ render_theme_mac.mm	29 Sep 2005 20:10:58 -0000	1.7
  @@ -164,10 +164,11 @@
   
   void RenderThemeMac::setSizeFromFont(RenderStyle* style, const QSize* sizes) const
   {
  +    // FIXME: Check is flawed, since it doesn't take min-width/max-width into account.
       QSize size = sizeForFont(style, sizes);
  -    if (style->width().isVariable())
  +    if (style->width().isIntrinsicOrAuto())
           style->setWidth(Length(size.width(), Fixed));
  -    if (style->height().isVariable())
  +    if (style->height().isAuto())
           style->setHeight(Length(size.height(), Fixed));
   }
   
  @@ -222,7 +223,7 @@
   void RenderThemeMac::setCheckboxSize(RenderStyle* style) const
   {
       // If the width and height are both specified, then we have nothing to do.
  -    if (!style->width().isVariable() && !style->height().isVariable())
  +    if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto())
           return;
       
       // Use the font size to determine the intrinsic width of the control.
  @@ -280,7 +281,7 @@
   void RenderThemeMac::setRadioSize(RenderStyle* style) const
   {
       // If the width and height are both specified, then we have nothing to do.
  -    if (!style->width().isVariable() && !style->height().isVariable())
  +    if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto())
           return;
       
       // Use the font size to determine the intrinsic width of the control.
  
  
  
  1.24      +40 -40    WebCore/khtml/rendering/table_layout.cpp
  
  Index: table_layout.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/table_layout.cpp,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- table_layout.cpp	11 May 2005 02:10:10 -0000	1.23
  +++ table_layout.cpp	29 Sep 2005 20:10:58 -0000	1.24
  @@ -20,7 +20,7 @@
    * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    * Boston, MA 02111-1307, USA.
    *
  - * $Id: table_layout.cpp,v 1.23 2005/05/11 02:10:10 darin Exp $
  + * $Id: table_layout.cpp,v 1.24 2005/09/29 20:10:58 hyatt Exp $
    */
   #include "table_layout.h"
   #include "render_table.h"
  @@ -98,7 +98,7 @@
       int cCol = 0;
       int nEffCols = table->numEffCols();
       width.resize( nEffCols );
  -    width.fill( Length( Variable ) );
  +    width.fill( Length( Auto ) );
   
   #ifdef DEBUG_LAYOUT
       qDebug("FixedTableLayout::calcWidthArray( %d )", tableWidth );
  @@ -114,7 +114,7 @@
   		grpWidth = col->style()->width();
   	    } else {
   		Length w = col->style()->width();
  -		if ( w.isVariable() )
  +		if ( w.isAuto() )
   		    w = grpWidth;
   		int effWidth = 0;
   		if ( w.type == Fixed && w.value > 0 )
  @@ -195,7 +195,7 @@
   		    Q_ASSERT( cCol + i < nEffCols );
   		    int eSpan = table->spanOfEffCol( cCol+i );
   		    // only set if no col element has already set it.
  -		    if ( width[cCol+i].type == Variable && w.type != Variable ) {
  +		    if ( width[cCol+i].type == Auto && w.type != Auto ) {
   			width[cCol+i] = Length( w.value*eSpan, w.type );
   			usedWidth += effWidth*eSpan;
   #ifdef DEBUG_LAYOUT
  @@ -294,17 +294,17 @@
   
       // assign variable width
       if ( available > 0 ) {
  -	int totalVariable = 0;
  +	int totalAuto = 0;
   	for ( int i = 0; i < nEffCols; i++ )
  -	    if ( width[i].type == Variable )
  -		totalVariable++;
  +	    if ( width[i].type == Auto )
  +		totalAuto++;
   
           for ( int i = 0; available > 0 && i < nEffCols; i++ ) {
  -            if ( width[i].type == Variable ) {
  -                int w = available / totalVariable;
  +            if ( width[i].type == Auto ) {
  +                int w = available / totalAuto;
                   available -= w;
                   calcWidth[i] = w;
  -		totalVariable--;
  +		totalAuto--;
               }
           }
       }
  @@ -422,7 +422,7 @@
                               l.width = w;
   			break;
   		    case Relative:
  -			if ( w.type == Variable || (w.type == Relative && w.value > l.width.value ) )
  +			if ( w.type == Auto || (w.type == Relative && w.value > l.width.value ) )
   				l.width = w;
   		    default:
   			break;
  @@ -482,7 +482,7 @@
   		grpWidth = col->style()->width();
   	    } else {
   		Length w = col->style()->width();
  -		if ( w.isVariable() )
  +		if ( w.isAuto() )
   		    w = grpWidth;
   		if ( (w.type == Fixed && w.value == 0) ||
   		     (w.type == Percent && w.value == 0) )
  @@ -491,7 +491,7 @@
   #ifdef DEBUG_LAYOUT
   		qDebug("    col element %d (eff=%d): Length=%d(%d), span=%d, effColSpan=%d",  cCol, cEffCol, w.value, w.type, span, table->spanOfEffCol(cEffCol ) );
   #endif
  -		if ( (int)w.type != Variable && span == 1 && cEffCol < nEffCols ) {
  +		if ( (int)w.type != Auto && span == 1 && cEffCol < nEffCols ) {
   		    if ( table->spanOfEffCol( cEffCol ) == 1 ) {
   			layoutStruct[cEffCol].width = w;
                           if (w.isFixed() && layoutStruct[cEffCol].maxWidth < w.value)
  @@ -526,20 +526,20 @@
       bool scale = true;
       while (table) {
           Length tw = table->style()->width();
  -        if ((tw.isVariable() || tw.isPercent()) && !table->isPositioned()) {
  +        if ((tw.isAuto() || tw.isPercent()) && !table->isPositioned()) {
               RenderBlock* cb = table->containingBlock();
               while (cb && !cb->isCanvas() && !cb->isTableCell() &&
  -                cb->style()->width().isVariable() && !cb->isPositioned())
  +                cb->style()->width().isAuto() && !cb->isPositioned())
                   cb = cb->containingBlock();
   
               table = 0;
               if (cb && cb->isTableCell() &&
  -                (cb->style()->width().isVariable() || cb->style()->width().isPercent())) {
  +                (cb->style()->width().isAuto() || cb->style()->width().isPercent())) {
                   if (tw.isPercent())
                       scale = false;
                   else {
                       RenderTableCell* cell = static_cast<RenderTableCell*>(cb);
  -                    if (cell->colSpan() > 1 || cell->table()->style()->width().isVariable())
  +                    if (cell->colSpan() > 1 || cell->table()->style()->width().isAuto())
                           scale = false;
                       else
                           table = cell->table();
  @@ -631,7 +631,7 @@
   
   	Length w = cell->style()->width();
   	if ( !(w.type == Relative) && w.value == 0 )
  -	    w = Length(); // make it Variable
  +	    w = Length(); // make it Auto
   
   	int col = table->colToEffCol( cell->col() );
   	unsigned int lastCol = col;
  @@ -642,7 +642,7 @@
   	int maxWidth = 0;
   	bool allColsArePercent = true;
   	bool allColsAreFixed = true;
  -	bool haveVariable = false;
  +	bool haveAuto = false;
   	int fixedWidth = 0;
   #ifdef DEBUG_LAYOUT
   	int cSpan = span;
  @@ -657,13 +657,13 @@
                   if (layoutStruct[lastCol].width.value > 0) {
                       fixedWidth += layoutStruct[lastCol].width.value;
                       allColsArePercent = false;
  -                    // IE resets effWidth to Variable here, but this breaks the konqueror about page and seems to be some bad
  +                    // IE resets effWidth to Auto here, but this breaks the konqueror about page and seems to be some bad
                       // legacy behaviour anyway. mozilla doesn't do this so I decided we don't neither.
                       break;
                   }
                   // fall through
  -	    case Variable:
  -		haveVariable = true;
  +	    case Auto:
  +		haveAuto = true;
   		// fall through
   	    default:
                   // If the column is a percentage width, do not let the spanning cell overwrite the
  @@ -755,7 +755,7 @@
                   
                   // Give min to variable first, to fixed second, and to others third.
                   for ( unsigned int pos = col; maxw > 0 && pos < lastCol; pos++ ) {
  -		    if ( layoutStruct[pos].width.type == Fixed && haveVariable && fixedWidth <= cMinWidth ) {
  +		    if ( layoutStruct[pos].width.type == Fixed && haveAuto && fixedWidth <= cMinWidth ) {
   			int w = kMax( layoutStruct[pos].effMinWidth, layoutStruct[pos].width.value );
   			fixedWidth -= layoutStruct[pos].width.value;
                           minw -= layoutStruct[pos].effMinWidth;
  @@ -769,7 +769,7 @@
   		}
   
                   for ( unsigned int pos = col; maxw > 0 && pos < lastCol && minw < cMinWidth; pos++ ) {
  -		    if ( !(layoutStruct[pos].width.type == Fixed && haveVariable && fixedWidth <= cMinWidth) ) {
  +		    if ( !(layoutStruct[pos].width.type == Fixed && haveAuto && fixedWidth <= cMinWidth) ) {
                           int w = kMax( layoutStruct[pos].effMinWidth, cMinWidth * layoutStruct[pos].effMaxWidth / maxw );
                           w = kMin(layoutStruct[pos].effMinWidth+(cMinWidth-minw), w);
                                                   
  @@ -871,12 +871,12 @@
       bool havePercent = false;
       bool haveRelative = false;
       int totalRelative = 0;
  -    int numVariable = 0;
  +    int numAuto = 0;
       int numFixed = 0;
  -    int totalVariable = 0;
  +    int totalAuto = 0;
       int totalFixed = 0;
       int totalPercent = 0;
  -    int allocVariable = 0;
  +    int allocAuto = 0;
   
       // fill up every cell with its minWidth
       for ( int i = 0; i < nEffCols; i++ ) {
  @@ -898,11 +898,11 @@
               totalFixed += layoutStruct[i].effMaxWidth;
               // fall through
               break;
  -        case Variable:
  +        case Auto:
           case Static:
  -            numVariable++;
  -            totalVariable += layoutStruct[i].effMaxWidth;
  -            allocVariable += w;
  +            numAuto++;
  +            totalAuto += layoutStruct[i].effMaxWidth;
  +            allocAuto += w;
           default:
               break;
           }
  @@ -967,16 +967,16 @@
       }
   
       // now satisfy variable
  -    if ( available > 0 && numVariable ) {
  -	available += allocVariable; // this gets redistributed
  - 	//qDebug("redistributing %dpx to %d variable columns. totalVariable=%d",  available,  numVariable,  totalVariable );
  +    if ( available > 0 && numAuto ) {
  +	available += allocAuto; // this gets redistributed
  + 	//qDebug("redistributing %dpx to %d variable columns. totalAuto=%d",  available,  numAuto,  totalAuto );
   	for ( int i = 0; i < nEffCols; i++ ) {
   	    Length &width = layoutStruct[i].effWidth;
  -	    if ( width.type == Variable && totalVariable != 0 ) {
  +	    if ( width.type == Auto && totalAuto != 0 ) {
   		int w = kMax( int ( layoutStruct[i].calcWidth ),
  -                              available * layoutStruct[i].effMaxWidth / totalVariable );
  +                              available * layoutStruct[i].effMaxWidth / totalAuto );
   		available -= w;
  -		totalVariable -= layoutStruct[i].effMaxWidth;
  +		totalAuto -= layoutStruct[i].effMaxWidth;
   		layoutStruct[i].calcWidth = w;
   	    }
   	}
  @@ -1042,7 +1042,7 @@
       // this seems to produce to the pixel exaxt results with IE. Wonder is some of this also holds for width distributing.
       if ( available < 0 ) {
           // Need to reduce cells with the following prioritization:
  -        // (1) Variable
  +        // (1) Auto
           // (2) Relative
           // (3) Fixed
           // (4) Percent
  @@ -1051,13 +1051,13 @@
               int mw = 0;
               for ( int i = nEffCols-1; i >= 0; i-- ) {
                   Length &width = layoutStruct[i].effWidth;
  -                if (width.isVariable())
  +                if (width.isAuto())
                       mw += layoutStruct[i].calcWidth - layoutStruct[i].effMinWidth;
               }
               
               for ( int i = nEffCols-1; i >= 0 && mw > 0; i-- ) {
                   Length &width = layoutStruct[i].effWidth;
  -                if (width.isVariable()) {
  +                if (width.isAuto()) {
                       int minMaxDiff = layoutStruct[i].calcWidth-layoutStruct[i].effMinWidth;
                       int reduce = available * minMaxDiff / mw;
                       layoutStruct[i].calcWidth += reduce;
  
  
  



More information about the webkit-changes mailing list