[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da
robert at webkit.org
robert at webkit.org
Wed Dec 22 18:19:00 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 03b42a0863f6138e355da33c4aea8a4bed9f9a41
Author: robert at webkit.org <robert at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Dec 9 19:54:19 2010 +0000
2010-12-09 Robert Hogan <robert at webkit.org>
Reviewed by Andreas Kling.
[Qt] Search input field doesn't have cancel button
Add a cancel button to the search field and make it customizable
by the client. For now, use the close dialog button associated
with the application's style as the default.
Unskip a bunch of search field related tests that pass now:
fast/forms/search-cancel-button-mouseup.html
fast/forms/search-rtl.html
fast/forms/search-abs-pos-cancel-button.html
fast/forms/search-styled.html
fast/forms/search-transformed.html
fast/forms/search-zoomed.html
fast/forms/search-cancel-button-style-sharing.html
fast/forms/search-display-none-cancel-button.html
fast/forms/search-placeholder-value-changed.html
fast/repaint/search-field-cancel.html
fast/forms/search-cancel-button-events.html
https://bugs.webkit.org/show_bug.cgi?id=42887
* platform/qt/Skipped:
2010-12-09 Robert Hogan <robert at webkit.org>
Reviewed by Andreas Kling.
[Qt] Search input field doesn't have cancel button
Add a cancel button to the search field and make it customizable
by the client. For now, use the close dialog button associated
with the application's style as the default.
https://bugs.webkit.org/show_bug.cgi?id=42887
* platform/graphics/qt/ImageQt.cpp:
(loadResourcePixmap):
* platform/qt/RenderThemeQt.cpp:
(WebCore::RenderThemeQt::computeSizeBasedOnStyle):
(WebCore::RenderThemeQt::paintSearchField):
(WebCore::RenderThemeQt::adjustSearchFieldStyle):
(WebCore::RenderThemeQt::adjustSearchFieldCancelButtonStyle):
(WebCore::RenderThemeQt::convertToPaintingRect):
(WebCore::RenderThemeQt::paintSearchFieldCancelButton):
* platform/qt/RenderThemeQt.h:
2010-12-09 Robert Hogan <robert at webkit.org>
Reviewed by Andreas Kling.
[Qt] Search input field doesn't have cancel button
Add a cancel button to the search field and make it customizable
by the client. For now, use the close dialog button associated
with the application's style as the default.
https://bugs.webkit.org/show_bug.cgi?id=42887
* Api/qwebsettings.cpp:
(graphics):
* Api/qwebsettings.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73635 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index abb1ef8..14a3ef8 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,30 @@
+2010-12-09 Robert Hogan <robert at webkit.org>
+
+ Reviewed by Andreas Kling.
+
+ [Qt] Search input field doesn't have cancel button
+ Add a cancel button to the search field and make it customizable
+ by the client. For now, use the close dialog button associated
+ with the application's style as the default.
+
+ Unskip a bunch of search field related tests that pass now:
+
+ fast/forms/search-cancel-button-mouseup.html
+ fast/forms/search-rtl.html
+ fast/forms/search-abs-pos-cancel-button.html
+ fast/forms/search-styled.html
+ fast/forms/search-transformed.html
+ fast/forms/search-zoomed.html
+ fast/forms/search-cancel-button-style-sharing.html
+ fast/forms/search-display-none-cancel-button.html
+ fast/forms/search-placeholder-value-changed.html
+ fast/repaint/search-field-cancel.html
+ fast/forms/search-cancel-button-events.html
+
+ https://bugs.webkit.org/show_bug.cgi?id=42887
+
+ * platform/qt/Skipped:
+
2010-12-09 Yael Aharon <yael.aharon at nokia.com>
Reviewed by Antonio Gomes.
diff --git a/LayoutTests/platform/qt/Skipped b/LayoutTests/platform/qt/Skipped
index 5145283..27541e2 100644
--- a/LayoutTests/platform/qt/Skipped
+++ b/LayoutTests/platform/qt/Skipped
@@ -509,7 +509,6 @@ fast/dom/open-and-close-by-DOM.html
fast/dom/Window/new-window-opener.html
fast/forms/001.html
fast/forms/focus2.html
-fast/forms/search-cancel-button-mouseup.html
fast/frames/001.html
fast/text/monospace-width-cache.html
@@ -2340,7 +2339,6 @@ fast/forms/listbox-onchange.html
fast/forms/listbox-selection-2.html
fast/forms/listbox-selection.html
fast/forms/onselect-textarea.html
-fast/forms/search-rtl.html
fast/forms/select-writing-direction-natural.html
fast/forms/tabbing-input-iframe.html
fast/forms/textAreaLineHeight.html
@@ -2400,7 +2398,6 @@ fast/encoding/hebrew/8859-8-i.html
fast/encoding/hebrew/logical.html
fast/events/crash-on-mutate-during-drop.html
fast/forms/option-mouseevents.html
-fast/forms/search-abs-pos-cancel-button.html
fast/forms/text-control-intrinsic-widths.html
fast/forms/textarea-metrics.html
fast/history/window-open.html
@@ -2458,9 +2455,6 @@ fast/forms/listbox-deselect-scroll.html
fast/forms/listbox-hit-test-zoomed.html
fast/forms/negativeLineHeight.html
fast/forms/placeholder-pseudo-style.html
-fast/forms/search-styled.html
-fast/forms/search-transformed.html
-fast/forms/search-zoomed.html
fast/forms/textarea-align.html
fast/forms/textarea-setinnerhtml.html
fast/forms/textarea-width.html
@@ -3234,9 +3228,6 @@ fast/forms/radio-nested-labels.html
fast/forms/radio_checked.html
fast/forms/radio_checked_dynamic.html
fast/forms/range-thumb-height-percentage.html
-fast/forms/search-cancel-button-style-sharing.html
-fast/forms/search-display-none-cancel-button.html
-fast/forms/search-placeholder-value-changed.html
fast/forms/searchfield-heights.html
fast/forms/select-accesskey.html
fast/forms/select-align.html
@@ -3574,7 +3565,6 @@ fast/repaint/reflection-redraw.html
fast/repaint/reflection-repaint-test.html
fast/repaint/renderer-destruction-by-invalidateSelection-crash.html
fast/repaint/repaint-resized-overflow.html
-fast/repaint/search-field-cancel.html
fast/repaint/selected-replaced.html
fast/repaint/selection-clear.html
fast/repaint/static-to-positioned.html
@@ -5236,10 +5226,6 @@ animations/suspend-resume-animation.html
animations/suspend-resume-animation-events.html
animations/stop-animation-on-suspend.html
-# [Qt] Search input field doesn't have cancel button
-# https://bugs.webkit.org/show_bug.cgi?id=42887
-fast/forms/search-cancel-button-events.html
-
# [Qt] DRT sideeffect revealed by r63657
# https://bugs.webkit.org/show_bug.cgi?id=42578
http/tests/security/mixedContent/insecure-css-in-main-frame.html
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 60c0735..78919ea 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,26 @@
+2010-12-09 Robert Hogan <robert at webkit.org>
+
+ Reviewed by Andreas Kling.
+
+ [Qt] Search input field doesn't have cancel button
+
+ Add a cancel button to the search field and make it customizable
+ by the client. For now, use the close dialog button associated
+ with the application's style as the default.
+
+ https://bugs.webkit.org/show_bug.cgi?id=42887
+
+ * platform/graphics/qt/ImageQt.cpp:
+ (loadResourcePixmap):
+ * platform/qt/RenderThemeQt.cpp:
+ (WebCore::RenderThemeQt::computeSizeBasedOnStyle):
+ (WebCore::RenderThemeQt::paintSearchField):
+ (WebCore::RenderThemeQt::adjustSearchFieldStyle):
+ (WebCore::RenderThemeQt::adjustSearchFieldCancelButtonStyle):
+ (WebCore::RenderThemeQt::convertToPaintingRect):
+ (WebCore::RenderThemeQt::paintSearchFieldCancelButton):
+ * platform/qt/RenderThemeQt.h:
+
2010-12-09 Yael Aharon <yael.aharon at nokia.com>
Reviewed by Antonio Gomes.
diff --git a/WebCore/platform/graphics/qt/ImageQt.cpp b/WebCore/platform/graphics/qt/ImageQt.cpp
index 3611308..6ce725e 100644
--- a/WebCore/platform/graphics/qt/ImageQt.cpp
+++ b/WebCore/platform/graphics/qt/ImageQt.cpp
@@ -68,6 +68,10 @@ static QPixmap loadResourcePixmap(const char *name)
pixmap = QWebSettings::webGraphic(QWebSettings::DeleteButtonGraphic);
else if (!qstrcmp(name, "inputSpeech"))
pixmap = QWebSettings::webGraphic(QWebSettings::InputSpeechButtonGraphic);
+ else if (!qstrcmp(name, "searchCancelButton"))
+ pixmap = QWebSettings::webGraphic(QWebSettings::SearchCancelButtonGraphic);
+ else if (!qstrcmp(name, "searchCancelButtonPressed"))
+ pixmap = QWebSettings::webGraphic(QWebSettings::SearchCancelButtonPressedGraphic);
return pixmap;
}
diff --git a/WebCore/platform/qt/RenderThemeQt.cpp b/WebCore/platform/qt/RenderThemeQt.cpp
index 789abb6..7fd0412 100644
--- a/WebCore/platform/qt/RenderThemeQt.cpp
+++ b/WebCore/platform/qt/RenderThemeQt.cpp
@@ -49,6 +49,7 @@
#include "Page.h"
#include "QWebPageClient.h"
#include "QtStyleOptionWebComboBox.h"
+#include "qwebsettings.h"
#include "RenderBox.h"
#if ENABLE(PROGRESS_TAG)
#include "RenderProgress.h"
@@ -75,6 +76,16 @@
#include <QStyleOptionSlider>
#include <QWidget>
+// These values all match Safari/Win/Chromium
+static const float defaultControlFontPixelSize = 13;
+static const float defaultCancelButtonSize = 9;
+static const float minCancelButtonSize = 5;
+static const float maxCancelButtonSize = 21;
+static const float defaultSearchFieldResultsDecorationSize = 13;
+static const float minSearchFieldResultsDecorationSize = 9;
+static const float maxSearchFieldResultsDecorationSize = 30;
+static const float defaultSearchFieldResultsButtonWidth = 18;
+
namespace WebCore {
@@ -394,6 +405,7 @@ void RenderThemeQt::computeSizeBasedOnStyle(RenderStyle* renderStyle) const
switch (renderStyle->appearance()) {
case TextAreaPart:
+ case SearchFieldPart:
case TextFieldPart: {
int padding = findFrameLineWidth(style);
@@ -867,28 +879,69 @@ void RenderThemeQt::adjustSliderThumbStyle(CSSStyleSelector*, RenderStyle* style
bool RenderThemeQt::paintSearchField(RenderObject* o, const PaintInfo& pi,
const IntRect& r)
{
- return true;
+ return paintTextField(o, pi, r);
}
void RenderThemeQt::adjustSearchFieldStyle(CSSStyleSelector* selector, RenderStyle* style,
Element* e) const
{
- notImplemented();
- RenderTheme::adjustSearchFieldStyle(selector, style, e);
+ style->setBackgroundColor(Color::transparent);
+ style->resetBorder();
+ style->resetPadding();
+ computeSizeBasedOnStyle(style);
}
void RenderThemeQt::adjustSearchFieldCancelButtonStyle(CSSStyleSelector* selector, RenderStyle* style,
Element* e) const
{
- notImplemented();
- RenderTheme::adjustSearchFieldCancelButtonStyle(selector, style, e);
+ // Taken from RenderThemeChromium.cpp
+
+ // Scale the button size based on the font size
+ float fontScale = style->fontSize() / defaultControlFontPixelSize;
+ int cancelButtonSize = lroundf(qMin(qMax(minCancelButtonSize, defaultCancelButtonSize * fontScale), maxCancelButtonSize));
+ style->setWidth(Length(cancelButtonSize, Fixed));
+ style->setHeight(Length(cancelButtonSize, Fixed));
+}
+
+// Taken from RenderThemeChromium.cpp
+IntRect RenderThemeQt::convertToPaintingRect(RenderObject* inputRenderer, const RenderObject* partRenderer, IntRect partRect, const IntRect& localOffset) const
+{
+ // Compute an offset between the part renderer and the input renderer.
+ IntSize offsetFromInputRenderer = -(partRenderer->offsetFromAncestorContainer(inputRenderer));
+ // Move the rect into partRenderer's coords.
+ partRect.move(offsetFromInputRenderer);
+ // Account for the local drawing offset.
+ partRect.move(localOffset.x(), localOffset.y());
+
+ return partRect;
}
bool RenderThemeQt::paintSearchFieldCancelButton(RenderObject* o, const PaintInfo& pi,
const IntRect& r)
{
- notImplemented();
- return RenderTheme::paintSearchFieldCancelButton(o, pi, r);
+ // Adapted from RenderThemeChromium.cpp
+
+ // Get the renderer of <input> element.
+ Node* input = o->node()->shadowAncestorNode();
+ if (!input->renderer()->isBox())
+ return false;
+ RenderBox* inputRenderBox = toRenderBox(input->renderer());
+ IntRect inputContentBox = inputRenderBox->contentBoxRect();
+
+ // Make sure the scaled button stays square and will fit in its parent's box.
+ int cancelButtonSize = qMin(inputContentBox.width(), qMin(inputContentBox.height(), r.height()));
+ // Calculate cancel button's coordinates relative to the input element.
+ // Center the button vertically. Round up though, so if it has to be one pixel off-center, it will
+ // be one pixel closer to the bottom of the field. This tends to look better with the text.
+ IntRect cancelButtonRect(o->offsetFromAncestorContainer(inputRenderBox).width(),
+ inputContentBox.y() + (inputContentBox.height() - cancelButtonSize + 1) / 2,
+ cancelButtonSize, cancelButtonSize);
+ IntRect paintingRect = convertToPaintingRect(inputRenderBox, o, cancelButtonRect, r);
+ static Image* cancelImage = Image::loadPlatformResource("searchCancelButton").releaseRef();
+ static Image* cancelPressedImage = Image::loadPlatformResource("searchCancelButtonPressed").releaseRef();
+ pi.context->drawImage(isPressed(o) ? cancelPressedImage : cancelImage,
+ o->style()->colorSpace(), paintingRect);
+ return false;
}
void RenderThemeQt::adjustSearchFieldDecorationStyle(CSSStyleSelector* selector, RenderStyle* style,
diff --git a/WebCore/platform/qt/RenderThemeQt.h b/WebCore/platform/qt/RenderThemeQt.h
index 7ab6769..059308a 100644
--- a/WebCore/platform/qt/RenderThemeQt.h
+++ b/WebCore/platform/qt/RenderThemeQt.h
@@ -177,6 +177,8 @@ private:
QStyle* fallbackStyle() const;
+ IntRect convertToPaintingRect(RenderObject* inputRenderer, const RenderObject* partRenderer, IntRect partRect, const IntRect& localOffset) const;
+
Page* m_page;
#ifdef Q_WS_MAC
diff --git a/WebKit/qt/Api/qwebsettings.cpp b/WebKit/qt/Api/qwebsettings.cpp
index ed425c2..6c59d73 100644
--- a/WebKit/qt/Api/qwebsettings.cpp
+++ b/WebKit/qt/Api/qwebsettings.cpp
@@ -48,6 +48,7 @@
#include <QSharedData>
#include <QUrl>
#include <QFileInfo>
+#include <QStyle>
#include "NetworkStateNotifier.h"
@@ -101,6 +102,8 @@ static WebGraphicHash* graphics()
hash->insert(QWebSettings::TextAreaSizeGripCornerGraphic, QPixmap(QLatin1String(":webkit/resources/textAreaResizeCorner.png")));
hash->insert(QWebSettings::DeleteButtonGraphic, QPixmap(QLatin1String(":webkit/resources/deleteButton.png")));
hash->insert(QWebSettings::InputSpeechButtonGraphic, QPixmap(QLatin1String(":webkit/resources/inputSpeech.png")));
+ hash->insert(QWebSettings::SearchCancelButtonGraphic, QApplication::style()->standardPixmap(QStyle::SP_DialogCloseButton));
+ hash->insert(QWebSettings::SearchCancelButtonPressedGraphic, QApplication::style()->standardPixmap(QStyle::SP_DialogCloseButton));
}
return hash;
@@ -372,6 +375,9 @@ QWebSettings* QWebSettings::globalSettings()
\value DefaultFrameIconGraphic The default icon for QWebFrame::icon().
\value TextAreaSizeGripCornerGraphic The graphic shown for the size grip of text areas.
\value DeleteButtonGraphic The graphic shown for the WebKit-Editing-Delete-Button in Deletion UI.
+ \value InputSpeechButtonGraphic The graphic shown in input fields that support speech recognition.
+ \value SearchCancelButtonGraphic The graphic shown for clearing the text in a search field.
+ \value SearchCancelButtonPressedGraphic The graphic shown when SearchCancelButtonGraphic is pressed.
*/
/*!
diff --git a/WebKit/qt/Api/qwebsettings.h b/WebKit/qt/Api/qwebsettings.h
index 0569ab0..008035b 100644
--- a/WebKit/qt/Api/qwebsettings.h
+++ b/WebKit/qt/Api/qwebsettings.h
@@ -85,7 +85,9 @@ public:
DefaultFrameIconGraphic,
TextAreaSizeGripCornerGraphic,
DeleteButtonGraphic,
- InputSpeechButtonGraphic
+ InputSpeechButtonGraphic,
+ SearchCancelButtonGraphic,
+ SearchCancelButtonPressedGraphic
};
enum FontSize {
MinimumFontSize,
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index bd964b7..90dbfbf 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,19 @@
+2010-12-09 Robert Hogan <robert at webkit.org>
+
+ Reviewed by Andreas Kling.
+
+ [Qt] Search input field doesn't have cancel button
+
+ Add a cancel button to the search field and make it customizable
+ by the client. For now, use the close dialog button associated
+ with the application's style as the default.
+
+ https://bugs.webkit.org/show_bug.cgi?id=42887
+
+ * Api/qwebsettings.cpp:
+ (graphics):
+ * Api/qwebsettings.h:
+
2010-12-09 Siddharth Mathur <siddharth.mathur at nokia.com>
Reviewed by Laszlo Gombos.
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list