[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:41:37 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 8f2e907a149483e41cf48e681285a74d0e0a3810
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sun May 11 01:05:12 2003 +0000

    	A refinement of our intrinsic margin rules for form controls.
    	Rather than always applying the intrinsic margin to form controls,
    	this patch makes the application conditional.
    
    	If the Web page explicitly specifies a width on a form control,
    	the form control will honor that precise pixel-width and will not
    	apply left/right intrinsic margins.  If a Web page specifies margins
    	that the control should use, then the control will honor those
    	margins.  The same rules apply for height and top/bottom margins.
    
            Reviewed by mjs
    
            * khtml/css/html4.css:
            * khtml/rendering/render_box.cpp:
            (RenderBox::calcReplacedWidth):
            (RenderBox::calcReplacedHeight):
            * khtml/rendering/render_form.cpp:
            (RenderFormElement::addIntrinsicMarginsIfNeeded):
            (RenderFormElement::setStyle):
            * khtml/rendering/render_form.h:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@4345 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index dc2bc11..27a4150 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,26 @@
+2003-05-10  David Hyatt  <hyatt at apple.com>
+
+	A refinement of our intrinsic margin rules for form controls.
+	Rather than always applying the intrinsic margin to form controls,
+	this patch makes the application conditional.
+
+	If the Web page explicitly specifies a width on a form control,
+	the form control will honor that precise pixel-width and will not
+	apply left/right intrinsic margins.  If a Web page specifies margins
+	that the control should use, then the control will honor those
+	margins.  The same rules apply for height and top/bottom margins.
+
+        Reviewed by mjs
+
+        * khtml/css/html4.css:
+        * khtml/rendering/render_box.cpp:
+        (RenderBox::calcReplacedWidth):
+        (RenderBox::calcReplacedHeight):
+        * khtml/rendering/render_form.cpp:
+        (RenderFormElement::addIntrinsicMarginsIfNeeded):
+        (RenderFormElement::setStyle):
+        * khtml/rendering/render_form.h:
+
 2003-05-10  Darin Adler  <darin at apple.com>
 
         Reviewed by Maciej.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index dc2bc11..27a4150 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,26 @@
+2003-05-10  David Hyatt  <hyatt at apple.com>
+
+	A refinement of our intrinsic margin rules for form controls.
+	Rather than always applying the intrinsic margin to form controls,
+	this patch makes the application conditional.
+
+	If the Web page explicitly specifies a width on a form control,
+	the form control will honor that precise pixel-width and will not
+	apply left/right intrinsic margins.  If a Web page specifies margins
+	that the control should use, then the control will honor those
+	margins.  The same rules apply for height and top/bottom margins.
+
+        Reviewed by mjs
+
+        * khtml/css/html4.css:
+        * khtml/rendering/render_box.cpp:
+        (RenderBox::calcReplacedWidth):
+        (RenderBox::calcReplacedHeight):
+        * khtml/rendering/render_form.cpp:
+        (RenderFormElement::addIntrinsicMarginsIfNeeded):
+        (RenderFormElement::setStyle):
+        * khtml/rendering/render_form.h:
+
 2003-05-10  Darin Adler  <darin at apple.com>
 
         Reviewed by Maciej.
diff --git a/WebCore/khtml/css/html4.css b/WebCore/khtml/css/html4.css
index 06dc980..ecaf98c 100644
--- a/WebCore/khtml/css/html4.css
+++ b/WebCore/khtml/css/html4.css
@@ -340,16 +340,7 @@ BUTTON:active {
    -dwh */
 INPUT, TEXTAREA {
 	font: 11px 'Lucida Grande';
-	margin: 3px;
-}
-
-input[type="button"], input[type="submit"], input[type="reset"]
-{
-    margin: 2px;
-}
-
-input[type="image"] {
-    margin: 0px;
+        margin: 0__qem;
 }
 
 INPUT[type="hidden"] {
@@ -360,6 +351,10 @@ INPUT[type="radio"], INPUT[type="checkbox"] {
         margin: 3px 0.5ex;
 }
 
+SELECT {
+        margin: 0__qem;
+}
+
 OPTION, 
 OPTGROUP, 
 AREA,
@@ -367,8 +362,6 @@ PARAM  {
 	display: none; 
 }
 
-SELECT { margin: 2px; }
-
 /*
  * inline elements
  */      
diff --git a/WebCore/khtml/rendering/render_box.cpp b/WebCore/khtml/rendering/render_box.cpp
index 69e2082..9e299af 100644
--- a/WebCore/khtml/rendering/render_box.cpp
+++ b/WebCore/khtml/rendering/render_box.cpp
@@ -818,14 +818,6 @@ short RenderBox::calcReplacedWidth() const
         const int cw = containingBlockWidth();
         if (cw > 0) {
             int result = w.minWidth(cw);
-#ifdef APPLE_CHANGES
-            // Because we put margins on our form controls, for percentage widths, it's best to subtract
-            // them out so the controls fit snugly and don't overflow.  This is gross.  Technically we
-            // should probably stop using margins and build the spacing into the form controls ourselves, but
-            // then how would the author override? -dwh
-            if (isFormElement())
-                result -= (marginLeft() + marginRight());
-#endif
             return result;
         }
     }
@@ -841,14 +833,6 @@ int RenderBox::calcReplacedHeight() const
     switch( h.type ) {
     case Percent: {
         int ah = availableHeight();
-#ifdef APPLE_CHANGES
-        // Because we put margins on our form controls, for percentage heights, it's best to subtract
-        // them out so the controls fit snugly and don't overflow.  This is gross.  Technically we
-        // should probably stop using margins and build the spacing into the form controls ourselves,
-        // but then how would the author override? -dwh
-        if (isFormElement())
-            ah -= (marginTop() + marginBottom());
-#endif
         return ah;
     }
     case Fixed:
diff --git a/WebCore/khtml/rendering/render_form.cpp b/WebCore/khtml/rendering/render_form.cpp
index 4da1d26..b915d64 100644
--- a/WebCore/khtml/rendering/render_form.cpp
+++ b/WebCore/khtml/rendering/render_form.cpp
@@ -173,6 +173,32 @@ void RenderFormElement::slotClicked()
     deref(arena);
 }
 
+#if APPLE_CHANGES
+void RenderFormElement::addIntrinsicMarginsIfAllowed(RenderStyle* _style)
+{
+    if (_style->width().isVariable()) {
+        if (_style->marginLeft().quirk)
+            _style->setMarginLeft(Length(intrinsicMargin(), Fixed));
+        if (_style->marginRight().quirk)
+            _style->setMarginRight(Length(intrinsicMargin(), Fixed));
+    }
+
+    if (_style->height().isVariable()) {
+        if (_style->marginTop().quirk)
+            _style->setMarginTop(Length(intrinsicMargin(), Fixed));
+        if (_style->marginBottom().quirk)
+            _style->setMarginBottom(Length(intrinsicMargin(), Fixed));
+    }
+}
+
+void RenderFormElement::setStyle(RenderStyle* _style)
+{
+    if (canHaveIntrinsicMargins())
+        addIntrinsicMarginsIfAllowed(_style);
+    RenderWidget::setStyle(_style);
+}
+#endif
+
 // -------------------------------------------------------------------------
 
 RenderButton::RenderButton(HTMLGenericFormElementImpl *element)
diff --git a/WebCore/khtml/rendering/render_form.h b/WebCore/khtml/rendering/render_form.h
index d4d55ac..809b0da 100644
--- a/WebCore/khtml/rendering/render_form.h
+++ b/WebCore/khtml/rendering/render_form.h
@@ -82,6 +82,18 @@ public:
     int paddingBottom() const { return 0; }
     int paddingLeft() const { return 0; }
     int paddingRight() const { return 0; }
+
+    // Aqua controls use intrinsic margin values in order to leave space for focus rings
+    // and to keep controls from butting up against one another.  This intrinsic margin
+    // is only applied if the Web page allows the control to size intrinsically.  If the
+    // Web page specifies an explicit width for a control, then we go ahead and honor that
+    // precise width.  Similarly, if a Web page uses a specific margin value, we will go ahead
+    // and honor that value.  
+    void addIntrinsicMarginsIfAllowed(RenderStyle* _style);
+    virtual bool canHaveIntrinsicMargins() const { return false; }
+    virtual int intrinsicMargin() const { return 2; }
+
+    virtual void setStyle(RenderStyle* _style);
 #endif
 
     virtual void updateFromElement();
@@ -117,6 +129,7 @@ public:
 
 #if APPLE_CHANGES
     int calcReplacedHeight() const { return intrinsicHeight(); }
+    virtual bool canHaveIntrinsicMargins() const { return true; }
 #endif
 
     virtual const char *renderName() const { return "RenderButton"; }
@@ -229,6 +242,8 @@ public:
     virtual void calcMinMaxWidth();
 #if APPLE_CHANGES
     int calcReplacedHeight() const { return intrinsicHeight(); }
+    virtual bool canHaveIntrinsicMargins() const { return true; }
+    virtual int intrinsicMargin() const { return 3; }
 #endif
 
     virtual const char *renderName() const { return "RenderLineEdit"; }
@@ -358,6 +373,7 @@ public:
 #if APPLE_CHANGES
     short baselinePosition( bool f ) const;
     int calcReplacedHeight() const { if (!m_useListBox) return intrinsicHeight(); return RenderFormElement::calcReplacedHeight(); }
+    virtual bool canHaveIntrinsicMargins() const { return true; }
 #endif
 
     virtual void calcMinMaxWidth();
@@ -426,6 +442,11 @@ public:
 
     void select();
 
+#if APPLE_CHANGES
+    virtual bool canHaveIntrinsicMargins() const { return true; }
+    virtual int intrinsicMargin() const { return 3; }
+#endif
+
 protected slots:
     void slotTextChanged();
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list