summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp')
-rw-r--r--src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp
index cc9d314f6f..a9da76b8b4 100644
--- a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp
@@ -41,6 +41,7 @@
#include <QWidget>
#include <QPainter>
#include <QPushButton>
+#include <QLineEdit>
#include <QStyleFactory>
#include <QStyleOptionButton>
#include <QStyleOptionFrameV2>
@@ -123,6 +124,12 @@ RenderThemeQt::RenderThemeQt()
#endif
m_fallbackStyle = 0;
+
+ // this will need to be regenerated when the style changes
+ QLineEdit lineEdit;
+ QStyleOptionFrameV2 opt;
+ m_frameLineWidth = QApplication::style()->pixelMetric(QStyle::PM_DefaultFrameWidth,
+ &opt, &lineEdit);
}
RenderThemeQt::~RenderThemeQt()
@@ -268,7 +275,7 @@ int RenderThemeQt::minimumMenuListSize(RenderStyle*) const
return 7 * fm.width(QLatin1Char('x'));
}
-static void computeSizeBasedOnStyle(RenderStyle* renderStyle)
+void RenderThemeQt::computeSizeBasedOnStyle(RenderStyle* renderStyle) const
{
// If the width and height are both specified, then we have nothing to do.
if (!renderStyle->width().isIntrinsicOrAuto() && !renderStyle->height().isAuto())
@@ -335,13 +342,15 @@ static void computeSizeBasedOnStyle(RenderStyle* renderStyle)
int h = qMax(fm.lineSpacing(), 14) + 2*verticalMargin;
int w = fm.width(QLatin1Char('x')) * 17 + 2*horizontalMargin;
QStyleOptionFrameV2 opt;
- opt.lineWidth = applicationStyle->pixelMetric(QStyle::PM_DefaultFrameWidth,
- &opt, 0);
+ opt.lineWidth = m_frameLineWidth;
QSize sz = applicationStyle->sizeFromContents(QStyle::CT_LineEdit,
- &opt,
- QSize(w, h).expandedTo(QApplication::globalStrut()),
- 0);
+ &opt,
+ QSize(w, h).expandedTo(QApplication::globalStrut()),
+ 0);
size.setHeight(sz.height());
+
+ renderStyle->setPaddingLeft(Length(opt.lineWidth, Fixed));
+ renderStyle->setPaddingRight(Length(opt.lineWidth, Fixed));
break;
}
default:
@@ -482,6 +491,9 @@ void RenderThemeQt::adjustTextFieldStyle(CSSStyleSelector*, RenderStyle* style,
{
style->setBackgroundColor(Color::transparent);
style->setColor(QApplication::palette().text().color());
+ style->resetBorder();
+ style->resetPadding();
+ computeSizeBasedOnStyle(style);
}
bool RenderThemeQt::paintTextField(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
@@ -495,7 +507,7 @@ bool RenderThemeQt::paintTextField(RenderObject* o, const RenderObject::PaintInf
panel.initFrom(p.widget);
panel.rect = r;
- panel.lineWidth = p.style->pixelMetric(QStyle::PM_DefaultFrameWidth, &panel, p.widget);
+ panel.lineWidth = m_frameLineWidth;
panel.state |= QStyle::State_Sunken;
panel.features = QStyleOptionFrameV2::None;