[webkit-changes] cvs commit: WebCore/khtml/rendering render_style.cpp render_style.h

David hyatt at opensource.apple.com
Thu Sep 29 17:03:21 PDT 2005


hyatt       05/09/29 17:03:21

  Modified:    .        ChangeLog
               khtml/css cssparser.cpp cssproperties.in
                        cssstyleselector.cpp cssvalues.in
               khtml/rendering render_style.cpp render_style.h
  Log:
  	Add support for parsing of the CSS3 box-sizing property.  This
  	property will have to be fully implemented for form controls that
  	respect border and padding (buttons, textfields, list boxes, etc.).
  
          Reviewed by john
  
          Test cases added: (NONE, property just being parsed, not supported)
  
          * khtml/css/cssparser.cpp:
          (CSSParser::parseValue):
          * khtml/css/cssproperties.in:
          * khtml/css/cssstyleselector.cpp:
          (khtml::CSSStyleSelector::applyProperty):
          * khtml/css/cssvalues.in:
          * khtml/rendering/render_style.cpp:
          (StyleBoxData::StyleBoxData):
          (StyleBoxData::operator==):
          (RenderStyle::diff):
          * khtml/rendering/render_style.h:
          (khtml::):
          (khtml::RenderStyle::boxSizing):
          (khtml::RenderStyle::setBoxSizing):
          (khtml::RenderStyle::initialBoxSizing):
  
  Revision  Changes    Path
  1.176     +26 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.175
  retrieving revision 1.176
  diff -u -r1.175 -r1.176
  --- ChangeLog	29 Sep 2005 20:10:53 -0000	1.175
  +++ ChangeLog	30 Sep 2005 00:03:16 -0000	1.176
  @@ -1,3 +1,29 @@
  +2005-09-29  David Hyatt  <hyatt at apple.com>
  +
  +	Add support for parsing of the CSS3 box-sizing property.  This
  +	property will have to be fully implemented for form controls that
  +	respect border and padding (buttons, textfields, list boxes, etc.).
  +	
  +        Reviewed by john
  +
  +        Test cases added: (NONE, property just being parsed, not supported)
  +
  +        * khtml/css/cssparser.cpp:
  +        (CSSParser::parseValue):
  +        * khtml/css/cssproperties.in:
  +        * khtml/css/cssstyleselector.cpp:
  +        (khtml::CSSStyleSelector::applyProperty):
  +        * khtml/css/cssvalues.in:
  +        * khtml/rendering/render_style.cpp:
  +        (StyleBoxData::StyleBoxData):
  +        (StyleBoxData::operator==):
  +        (RenderStyle::diff):
  +        * khtml/rendering/render_style.h:
  +        (khtml::):
  +        (khtml::RenderStyle::boxSizing):
  +        (khtml::RenderStyle::setBoxSizing):
  +        (khtml::RenderStyle::initialBoxSizing):
  +
   2005-09-28  David Hyatt  <hyatt at apple.com>
   
   	Make all form controls treat width: auto as width:intrinsic and
  
  
  
  1.107     +8 -0      WebCore/khtml/css/cssparser.cpp
  
  Index: cssparser.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/css/cssparser.cpp,v
  retrieving revision 1.106
  retrieving revision 1.107
  diff -u -r1.106 -r1.107
  --- cssparser.cpp	30 Aug 2005 21:36:22 -0000	1.106
  +++ cssparser.cpp	30 Sep 2005 00:03:18 -0000	1.107
  @@ -1061,6 +1061,14 @@
       case CSS_PROP__KHTML_BOX_ORDINAL_GROUP:
           valid_primitive = validUnit(value, FInteger|FNonNeg, true);
           break;
  +    case CSS_PROP_BOX_SIZING: {
  +        // We don't preface this with -khtml, since MacIE defined this property without the prefix.
  +        // Thus the damage has been done, and it's known that this property's definition isn't going
  +        // to fluctuate.
  +        if (id == CSS_VAL_BORDER_BOX || id == CSS_VAL_CONTENT_BOX)
  +            valid_primitive = true;
  +        break;
  +    }
       case CSS_PROP__KHTML_MARQUEE: {
           const int properties[5] = { CSS_PROP__KHTML_MARQUEE_DIRECTION, CSS_PROP__KHTML_MARQUEE_INCREMENT,
                                       CSS_PROP__KHTML_MARQUEE_REPETITION,
  
  
  
  1.36      +1 -0      WebCore/khtml/css/cssproperties.in
  
  Index: cssproperties.in
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/css/cssproperties.in,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- cssproperties.in	27 Aug 2005 00:14:18 -0000	1.35
  +++ cssproperties.in	30 Sep 2005 00:03:18 -0000	1.36
  @@ -49,6 +49,7 @@
   -khtml-box-ordinal-group
   -khtml-box-orient
   -khtml-box-pack
  +box-sizing
   caption-side
   clear
   clip
  
  
  
  1.208     +8 -0      WebCore/khtml/css/cssstyleselector.cpp
  
  Index: cssstyleselector.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/css/cssstyleselector.cpp,v
  retrieving revision 1.207
  retrieving revision 1.208
  diff -u -r1.207 -r1.208
  --- cssstyleselector.cpp	29 Sep 2005 20:10:55 -0000	1.207
  +++ cssstyleselector.cpp	30 Sep 2005 00:03:19 -0000	1.208
  @@ -3754,6 +3754,14 @@
               return; // Error case.
           style->setBoxOrdinalGroup((unsigned int)(primitiveValue->getFloatValue(CSSPrimitiveValue::CSS_NUMBER)));
           return;
  +    case CSS_PROP_BOX_SIZING:
  +        HANDLE_INHERIT_AND_INITIAL(boxSizing, BoxSizing)
  +        if (!primitiveValue) return;
  +        if (primitiveValue->getIdent() == CSS_VAL_CONTENT_BOX)
  +            style->setBoxSizing(CONTENT_BOX);
  +        else
  +            style->setBoxSizing(BORDER_BOX);
  +        break;
       case CSS_PROP__KHTML_MARQUEE:
           if (value->cssValueType() != CSSValue::CSS_INHERIT || !parentNode) return;
           style->setMarqueeDirection(parentStyle->marqueeDirection());
  
  
  
  1.33      +6 -0      WebCore/khtml/css/cssvalues.in
  
  Index: cssvalues.in
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/css/cssvalues.in,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- cssvalues.in	30 Aug 2005 21:36:23 -0000	1.32
  +++ cssvalues.in	30 Sep 2005 00:03:19 -0000	1.33
  @@ -481,3 +481,9 @@
   border
   content
   padding
  +
  +#
  +# CSS_PROP_BOX_SIZING
  +#
  +border-box
  +content-box
  
  
  
  1.71      +12 -11    WebCore/khtml/rendering/render_style.cpp
  
  Index: render_style.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_style.cpp,v
  retrieving revision 1.70
  retrieving revision 1.71
  diff -u -r1.70 -r1.71
  --- render_style.cpp	29 Sep 2005 20:10:57 -0000	1.70
  +++ render_style.cpp	30 Sep 2005 00:03:20 -0000	1.71
  @@ -53,7 +53,7 @@
   }
   
   StyleBoxData::StyleBoxData()
  -    : z_index( 0 ), z_auto(true)
  +    : z_index( 0 ), z_auto(true), boxSizing(CONTENT_BOX)
   {
       // Initialize our min/max widths/heights.
       min_width = min_height = RenderStyle::initialMinSize();
  @@ -65,21 +65,21 @@
         width( o.width ), height( o.height ),
         min_width( o.min_width ), max_width( o.max_width ),
         min_height ( o.min_height ), max_height( o.max_height ),
  -      z_index( o.z_index ), z_auto( o.z_auto )
  +      z_index( o.z_index ), z_auto( o.z_auto ), boxSizing(o.boxSizing)
   {
   }
   
   bool StyleBoxData::operator==(const StyleBoxData& o) const
   {
  -    return
  -	    width == o.width &&
  -	    height == o.height &&
  -	    min_width == o.min_width &&
  -	    max_width == o.max_width &&
  -	    min_height == o.min_height &&
  -	    max_height == o.max_height &&
  -	    z_index == o.z_index &&
  -        z_auto == o.z_auto;
  +    return width == o.width &&
  +           height == o.height &&
  +           min_width == o.min_width &&
  +           max_width == o.max_width &&
  +           min_height == o.min_height &&
  +           max_height == o.max_height &&
  +           z_index == o.z_index &&
  +           z_auto == o.z_auto &&
  +           boxSizing == o.boxSizing;
   }
   
   
  @@ -715,6 +715,7 @@
            box->min_height != other->box->min_height ||
            box->max_height != other->box->max_height ||
            box->vertical_align != other->box->vertical_align ||
  +         box->boxSizing != other->box->boxSizing ||
            !(surround->margin == other->surround->margin) ||
            !(surround->padding == other->surround->padding) ||
            css3NonInheritedData->m_appearance != other->css3NonInheritedData->m_appearance ||
  
  
  
  1.92      +6 -0      WebCore/khtml/rendering/render_style.h
  
  Index: render_style.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_style.h,v
  retrieving revision 1.91
  retrieving revision 1.92
  diff -u -r1.91 -r1.92
  --- render_style.h	29 Sep 2005 20:10:57 -0000	1.91
  +++ render_style.h	30 Sep 2005 00:03:20 -0000	1.92
  @@ -384,6 +384,8 @@
   //------------------------------------------------
   // Box attributes. Not inherited.
   
  +enum EBoxSizing { CONTENT_BOX, BORDER_BOX };
  +
   class StyleBoxData : public Shared<StyleBoxData>, public FastAllocated
   {
   public:
  @@ -412,6 +414,7 @@
   
       int z_index;
       bool z_auto : 1;
  +    EBoxSizing boxSizing : 1;
   };
   
   //------------------------------------------------
  @@ -1342,6 +1345,7 @@
       unsigned int boxOrdinalGroup() const { return css3NonInheritedData->flexibleBox->ordinal_group; }
       EBoxOrient boxOrient() const { return css3NonInheritedData->flexibleBox->orient; }
       EBoxAlignment boxPack() const { return css3NonInheritedData->flexibleBox->pack; }
  +    EBoxSizing boxSizing() const { return box->boxSizing; }
       Length marqueeIncrement() const { return css3NonInheritedData->marquee->increment; }
       int marqueeSpeed() const { return css3NonInheritedData->marquee->speed; }
       int marqueeLoopCount() const { return css3NonInheritedData->marquee->loops; }
  @@ -1564,6 +1568,7 @@
       void setBoxOrdinalGroup(unsigned int og) { SET_VAR(css3NonInheritedData.access()->flexibleBox, ordinal_group, og); }
       void setBoxOrient(EBoxOrient o) { SET_VAR(css3NonInheritedData.access()->flexibleBox, orient, o); }
       void setBoxPack(EBoxAlignment p) { SET_VAR(css3NonInheritedData.access()->flexibleBox, pack, p); }
  +    void setBoxSizing(EBoxSizing s) { SET_VAR(box, boxSizing, s); }
       void setMarqueeIncrement(const Length& f) { SET_VAR(css3NonInheritedData.access()->marquee, increment, f); }
       void setMarqueeSpeed(int f) { SET_VAR(css3NonInheritedData.access()->marquee, speed, f); }
       void setMarqueeDirection(EMarqueeDirection d) { SET_VAR(css3NonInheritedData.access()->marquee, direction, d); }
  @@ -1688,6 +1693,7 @@
       static float initialBoxFlex() { return 0.0f; }
       static int initialBoxFlexGroup() { return 1; }
       static int initialBoxOrdinalGroup() { return 1; }
  +    static EBoxSizing initialBoxSizing() { return CONTENT_BOX; }
       static int initialMarqueeLoopCount() { return -1; }
       static int initialMarqueeSpeed() { return 85; }
       static Length initialMarqueeIncrement() { return Length(6, Fixed); }
  
  
  



More information about the webkit-changes mailing list