[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kfm-devel
Subject:    Re: Patch for bug #200795
From:       Andrea Iacovitti <aiacovitti () libero ! it>
Date:       2009-12-11 18:32:28
Message-ID: 200912111932.28391.aiacovitti () libero ! it
[Download RAW message or body]

Hi,
I revisited the patch sent previously because probably I had not fully 
understood what was suggested by the KHTML developers... i hope now it's the 
case :-)
Function shouldDisableNativeBorders() now really handles the case where native 
borders have not to be painted (either because we have to paint css borders 
or we have not to paint borders at all because border:none)
I added a partial fix (or workaround?) for bug #216795: force setting of 
qlineedit native frame (just in case previously disabled); may be the 
real/better fix here is to handle qlineedit widget borders through proxy 
style (if yes, i have not been able to achieve this :-( )

Is that waht's expected?

(I'm sorry if I'm only causing noise but I am new to khtml and qt4)

Best Regards,
Andrea.

["khtml_bordernone.diff" (khtml_bordernone.diff)]

--- khtml/rendering/render_form.cpp	2009-11-28 17:11:10.000000000 +0100
+++ khtml/rendering/render_form.cpp	2009-12-08 19:29:36.000000000 +0100
@@ -351,7 +351,7 @@
 void RenderButton::setStyle(RenderStyle *style)
 {
     RenderFormElement::setStyle(style);
-    if (shouldPaintBorder()) {
+    if (shouldDisableNativeBorders()) {
         // we paint the borders ourselves on this button,
         // remove the widget's native ones.
         KHTMLProxyStyle* style = static_cast<KHTMLProxyStyle*>(getProxyStyle());
@@ -564,7 +564,7 @@
     toAdd = qMax(0,toAdd);
     w += toAdd;
 
-    if (shouldPaintBorder()) {
+    if (shouldDisableNativeBorders()) {
         // we paint the borders ourselves, so let's override our height to something \
saner  h = ts.height();
     }
@@ -989,7 +989,7 @@
     RenderFormElement::setStyle( _style );
 
     widget()->setAlignment(textAlignment());
-    bool showClearButton = (!shouldPaintBorder() && !_style->hasBackgroundImage());
+    bool showClearButton = (!shouldDisableNativeBorders() && \
                !_style->hasBackgroundImage());
     static_cast<LineEditWidget*>(widget())->setClearButtonShown( showClearButton );
     if (showClearButton) {
         QList<QWidget *> wl = qFindChildren<QWidget *>(m_widget, QString());
--- khtml/rendering/render_replaced.cpp	2009-11-28 17:11:10.000000000 +0100
+++ khtml/rendering/render_replaced.cpp	2009-12-08 18:29:26.000000000 +0100
@@ -479,13 +479,14 @@
         }
 
         // Border:
-        if (shouldPaintBorder() || (!shouldPaintBackgroundOrBorder() && \
                canHaveBorder()))
-        {
+        if (shouldDisableNativeBorders()) {
             if (QFrame* frame = qobject_cast<QFrame*>(m_widget))
                 frame->setFrameShape(QFrame::NoFrame);
             else if (QLineEdit* lineEdit = qobject_cast<QLineEdit*>(m_widget))
                 lineEdit->setFrame(false);
         }
+        else if (QLineEdit* lineEdit = qobject_cast<QLineEdit*>(m_widget))
+            lineEdit->setFrame(true);  // set frame in case previously disabled \
#216795  
         // Font:
         setStyle(style());
@@ -496,7 +497,7 @@
 
 void RenderWidget::paintOneBackground(QPainter *p, const QColor& c, const \
BackgroundLayer* bgLayer, QRect clipr, int _tx, int _ty, int w, int height)  {
-    bool fudge = !shouldPaintBorder();
+    bool fudge = !shouldPaintCSSBorders();
     paintBackgroundExtended(p, c, bgLayer, clipr, _tx, _ty, w, height,
                                 fudge ? 1 : borderLeft() , fudge ? 1 : \
                borderRight(), paddingLeft(), paddingRight(),
                                 fudge ? 1 : borderTop(), fudge ? 1 : borderBottom(), \
paddingTop(), paddingBottom()); @@ -509,13 +510,13 @@
     QRect cr = r.intersected(paintInfo.r);
 
     if (qobject_cast<QAbstractScrollArea*>(m_widget) || (isRedirectedWidget() && 
-            (style()->hasBackgroundImage() || (style()->hasBackground() && \
shouldPaintBorder())))) +            (style()->hasBackgroundImage() || \
(style()->hasBackground() && shouldPaintCSSBorders()))))  {
         paintAllBackgrounds(paintInfo.p, style()->backgroundColor(), \
style()->backgroundLayers(),   cr, r.x(), r.y(), r.width(), r.height());
     }
 
-    if (shouldPaintBorder() && style()->hasBorder())
+    if (shouldPaintCSSBorders())
     {
         paintBorder(paintInfo.p, _tx, _ty, width(), height(), style());
     }
--- khtml/rendering/render_replaced.h	2009-12-08 18:26:34.000000000 +0100
+++ khtml/rendering/render_replaced.h	2009-12-08 18:26:03.000000000 +0100
@@ -123,7 +123,7 @@
     virtual bool canHaveBorder() const { return false; }
     virtual bool includesPadding() const { return false; }
 
-    bool shouldPaintBorder() const { 
+    bool shouldPaintCSSBorders() const {
         // Don't paint borders if the border-style is native
         // or borders are not supported on this widget    
         return shouldPaintBackgroundOrBorder() && canHaveBorder() && 
@@ -132,6 +132,11 @@
               style()->borderTopStyle()    != BNATIVE ||
               style()->borderBottomStyle() != BNATIVE);
     }
+
+    bool shouldDisableNativeBorders() const {
+        return (shouldPaintCSSBorders() || (!shouldPaintBackgroundOrBorder() && \
canHaveBorder())); +    }
+
     virtual bool acceptsSyntheticEvents() const { return true; }
 
 



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic