summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Iacovitti <aiacovitti@libero.it>2012-04-20 06:18:27 (GMT)
committerAndrea Iacovitti <aiacovitti@libero.it>2012-04-20 06:18:27 (GMT)
commitdee2801c0a86fec1c642da9710b17b0a7bec3ecd (patch)
tree3ccde7cdf91f0661746980ec4101fb7b61a3ca80
parentfc7b021433bba347fffeab15c4be5f1a26b8fa74 (diff)
Fix rendering of text input elements having padding by removing the use
of cached parent's proxy style, that end up to return a wrong content rect size, and using ad-hoc style() function instead. Actually only KLineEdit inherits KdeUiProxyStyle (since kde 4.5) so the behavior of our internal proxy is unchanged for the other form elements (i.e m_proxy was always 0 for them). Also the crash reported in #197270 is no longer reproducible after this change, likely it has been fixed elsewhere... BUGS: 280445, 280226 FIXED-IN: 4.8.3
-rw-r--r--khtml/rendering/render_form.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/khtml/rendering/render_form.cpp b/khtml/rendering/render_form.cpp
index f7c0e9b..b32a4c4 100644
--- a/khtml/rendering/render_form.cpp
+++ b/khtml/rendering/render_form.cpp
@@ -91,15 +91,12 @@ using namespace DOM;
{
noBorder = false;
left = right = top = bottom = 0;
- m_proxy = qobject_cast<KdeUiProxyStyle*>(parent->style());
setParent(parent);
}
- QStyle* proxy() const { return m_proxy ? m_proxy : style(); }
-
QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const
{
- QRect r = proxy()->subElementRect(element, option, widget);
+ QRect r = style()->subElementRect(element, option, widget);
switch (element) {
case QStyle::SE_PushButtonContents:
case QStyle::SE_LineEditContents:
@@ -117,12 +114,12 @@ using namespace DOM;
const QStyleOptionButton *o = qstyleoption_cast<const QStyleOptionButton *>(option);
if (o) {
QStyleOptionButton opt = *o;
- opt.rect = proxy()->subElementRect(SE_PushButtonFocusRect, &opt, widget);
- KdeUiProxyStyle::drawControl(CE_PushButtonLabel, &opt, painter, widget);
+ opt.rect = style()->subElementRect(SE_PushButtonFocusRect, &opt, widget);
+ style()->drawControl(CE_PushButtonLabel, &opt, painter, widget);
}
return;
}
- KdeUiProxyStyle::drawControl(element,option,painter,widget);
+ style()->drawControl(element,option,painter,widget);
}
QRect subControlRect(ComplexControl cc, const QStyleOptionComplex* opt, SubControl sc, const QWidget* widget) const
@@ -146,23 +143,22 @@ using namespace DOM;
}
// Now let sizeFromContent add in extra stuff.
- maxW = proxy()->sizeFromContents(QStyle::CT_ComboBox, opt, QSize(maxW, 1), widget).width();
+ maxW = style()->sizeFromContents(QStyle::CT_ComboBox, opt, QSize(maxW, 1), widget).width();
// How much more room do we need for the text?
int extraW = maxW > cbOpt->rect.width() ? maxW - cbOpt->rect.width() : 0;
- QRect r = proxy()->subControlRect(cc, opt, sc, widget);
+ QRect r = style()->subControlRect(cc, opt, sc, widget);
r.setWidth(r.width() + extraW);
return r;
}
}
- return proxy()->subControlRect(cc, opt, sc, widget);
+ return style()->subControlRect(cc, opt, sc, widget);
}
int left, right, top, bottom;
bool noBorder;
- KdeUiProxyStyle* m_proxy;
};
// ---------------------------------------------------------------------