Changeset 73635 in webkit
- Timestamp:
- Dec 9, 2010 11:54:19 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r73634 r73635 1 2010-12-09 Robert Hogan <robert@webkit.org> 2 3 Reviewed by Andreas Kling. 4 5 [Qt] Search input field doesn't have cancel button 6 Add a cancel button to the search field and make it customizable 7 by the client. For now, use the close dialog button associated 8 with the application's style as the default. 9 10 Unskip a bunch of search field related tests that pass now: 11 12 fast/forms/search-cancel-button-mouseup.html 13 fast/forms/search-rtl.html 14 fast/forms/search-abs-pos-cancel-button.html 15 fast/forms/search-styled.html 16 fast/forms/search-transformed.html 17 fast/forms/search-zoomed.html 18 fast/forms/search-cancel-button-style-sharing.html 19 fast/forms/search-display-none-cancel-button.html 20 fast/forms/search-placeholder-value-changed.html 21 fast/repaint/search-field-cancel.html 22 fast/forms/search-cancel-button-events.html 23 24 https://bugs.webkit.org/show_bug.cgi?id=42887 25 26 * platform/qt/Skipped: 27 1 28 2010-12-09 Yael Aharon <yael.aharon@nokia.com> 2 29 -
trunk/LayoutTests/platform/qt/Skipped
r73503 r73635 510 510 fast/forms/001.html 511 511 fast/forms/focus2.html 512 fast/forms/search-cancel-button-mouseup.html513 512 fast/frames/001.html 514 513 fast/text/monospace-width-cache.html … … 2341 2340 fast/forms/listbox-selection.html 2342 2341 fast/forms/onselect-textarea.html 2343 fast/forms/search-rtl.html2344 2342 fast/forms/select-writing-direction-natural.html 2345 2343 fast/forms/tabbing-input-iframe.html … … 2401 2399 fast/events/crash-on-mutate-during-drop.html 2402 2400 fast/forms/option-mouseevents.html 2403 fast/forms/search-abs-pos-cancel-button.html2404 2401 fast/forms/text-control-intrinsic-widths.html 2405 2402 fast/forms/textarea-metrics.html … … 2459 2456 fast/forms/negativeLineHeight.html 2460 2457 fast/forms/placeholder-pseudo-style.html 2461 fast/forms/search-styled.html2462 fast/forms/search-transformed.html2463 fast/forms/search-zoomed.html2464 2458 fast/forms/textarea-align.html 2465 2459 fast/forms/textarea-setinnerhtml.html … … 3235 3229 fast/forms/radio_checked_dynamic.html 3236 3230 fast/forms/range-thumb-height-percentage.html 3237 fast/forms/search-cancel-button-style-sharing.html3238 fast/forms/search-display-none-cancel-button.html3239 fast/forms/search-placeholder-value-changed.html3240 3231 fast/forms/searchfield-heights.html 3241 3232 fast/forms/select-accesskey.html … … 3575 3566 fast/repaint/renderer-destruction-by-invalidateSelection-crash.html 3576 3567 fast/repaint/repaint-resized-overflow.html 3577 fast/repaint/search-field-cancel.html3578 3568 fast/repaint/selected-replaced.html 3579 3569 fast/repaint/selection-clear.html … … 5237 5227 animations/stop-animation-on-suspend.html 5238 5228 5239 # [Qt] Search input field doesn't have cancel button5240 # https://bugs.webkit.org/show_bug.cgi?id=428875241 fast/forms/search-cancel-button-events.html5242 5243 5229 # [Qt] DRT sideeffect revealed by r63657 5244 5230 # https://bugs.webkit.org/show_bug.cgi?id=42578 -
trunk/WebCore/ChangeLog
r73634 r73635 1 2010-12-09 Robert Hogan <robert@webkit.org> 2 3 Reviewed by Andreas Kling. 4 5 [Qt] Search input field doesn't have cancel button 6 7 Add a cancel button to the search field and make it customizable 8 by the client. For now, use the close dialog button associated 9 with the application's style as the default. 10 11 https://bugs.webkit.org/show_bug.cgi?id=42887 12 13 * platform/graphics/qt/ImageQt.cpp: 14 (loadResourcePixmap): 15 * platform/qt/RenderThemeQt.cpp: 16 (WebCore::RenderThemeQt::computeSizeBasedOnStyle): 17 (WebCore::RenderThemeQt::paintSearchField): 18 (WebCore::RenderThemeQt::adjustSearchFieldStyle): 19 (WebCore::RenderThemeQt::adjustSearchFieldCancelButtonStyle): 20 (WebCore::RenderThemeQt::convertToPaintingRect): 21 (WebCore::RenderThemeQt::paintSearchFieldCancelButton): 22 * platform/qt/RenderThemeQt.h: 23 1 24 2010-12-09 Yael Aharon <yael.aharon@nokia.com> 2 25 -
trunk/WebCore/platform/graphics/qt/ImageQt.cpp
r72588 r73635 69 69 else if (!qstrcmp(name, "inputSpeech")) 70 70 pixmap = QWebSettings::webGraphic(QWebSettings::InputSpeechButtonGraphic); 71 else if (!qstrcmp(name, "searchCancelButton")) 72 pixmap = QWebSettings::webGraphic(QWebSettings::SearchCancelButtonGraphic); 73 else if (!qstrcmp(name, "searchCancelButtonPressed")) 74 pixmap = QWebSettings::webGraphic(QWebSettings::SearchCancelButtonPressedGraphic); 71 75 72 76 return pixmap; -
trunk/WebCore/platform/qt/RenderThemeQt.cpp
r72004 r73635 50 50 #include "QWebPageClient.h" 51 51 #include "QtStyleOptionWebComboBox.h" 52 #include "qwebsettings.h" 52 53 #include "RenderBox.h" 53 54 #if ENABLE(PROGRESS_TAG) … … 75 76 #include <QStyleOptionSlider> 76 77 #include <QWidget> 78 79 // These values all match Safari/Win/Chromium 80 static const float defaultControlFontPixelSize = 13; 81 static const float defaultCancelButtonSize = 9; 82 static const float minCancelButtonSize = 5; 83 static const float maxCancelButtonSize = 21; 84 static const float defaultSearchFieldResultsDecorationSize = 13; 85 static const float minSearchFieldResultsDecorationSize = 9; 86 static const float maxSearchFieldResultsDecorationSize = 30; 87 static const float defaultSearchFieldResultsButtonWidth = 18; 77 88 78 89 … … 395 406 switch (renderStyle->appearance()) { 396 407 case TextAreaPart: 408 case SearchFieldPart: 397 409 case TextFieldPart: { 398 410 int padding = findFrameLineWidth(style); … … 868 880 const IntRect& r) 869 881 { 870 return true;882 return paintTextField(o, pi, r); 871 883 } 872 884 … … 874 886 Element* e) const 875 887 { 876 notImplemented(); 877 RenderTheme::adjustSearchFieldStyle(selector, style, e); 888 style->setBackgroundColor(Color::transparent); 889 style->resetBorder(); 890 style->resetPadding(); 891 computeSizeBasedOnStyle(style); 878 892 } 879 893 … … 881 895 Element* e) const 882 896 { 883 notImplemented(); 884 RenderTheme::adjustSearchFieldCancelButtonStyle(selector, style, e); 897 // Taken from RenderThemeChromium.cpp 898 899 // Scale the button size based on the font size 900 float fontScale = style->fontSize() / defaultControlFontPixelSize; 901 int cancelButtonSize = lroundf(qMin(qMax(minCancelButtonSize, defaultCancelButtonSize * fontScale), maxCancelButtonSize)); 902 style->setWidth(Length(cancelButtonSize, Fixed)); 903 style->setHeight(Length(cancelButtonSize, Fixed)); 904 } 905 906 // Taken from RenderThemeChromium.cpp 907 IntRect RenderThemeQt::convertToPaintingRect(RenderObject* inputRenderer, const RenderObject* partRenderer, IntRect partRect, const IntRect& localOffset) const 908 { 909 // Compute an offset between the part renderer and the input renderer. 910 IntSize offsetFromInputRenderer = -(partRenderer->offsetFromAncestorContainer(inputRenderer)); 911 // Move the rect into partRenderer's coords. 912 partRect.move(offsetFromInputRenderer); 913 // Account for the local drawing offset. 914 partRect.move(localOffset.x(), localOffset.y()); 915 916 return partRect; 885 917 } 886 918 … … 888 920 const IntRect& r) 889 921 { 890 notImplemented(); 891 return RenderTheme::paintSearchFieldCancelButton(o, pi, r); 922 // Adapted from RenderThemeChromium.cpp 923 924 // Get the renderer of <input> element. 925 Node* input = o->node()->shadowAncestorNode(); 926 if (!input->renderer()->isBox()) 927 return false; 928 RenderBox* inputRenderBox = toRenderBox(input->renderer()); 929 IntRect inputContentBox = inputRenderBox->contentBoxRect(); 930 931 // Make sure the scaled button stays square and will fit in its parent's box. 932 int cancelButtonSize = qMin(inputContentBox.width(), qMin(inputContentBox.height(), r.height())); 933 // Calculate cancel button's coordinates relative to the input element. 934 // Center the button vertically. Round up though, so if it has to be one pixel off-center, it will 935 // be one pixel closer to the bottom of the field. This tends to look better with the text. 936 IntRect cancelButtonRect(o->offsetFromAncestorContainer(inputRenderBox).width(), 937 inputContentBox.y() + (inputContentBox.height() - cancelButtonSize + 1) / 2, 938 cancelButtonSize, cancelButtonSize); 939 IntRect paintingRect = convertToPaintingRect(inputRenderBox, o, cancelButtonRect, r); 940 static Image* cancelImage = Image::loadPlatformResource("searchCancelButton").releaseRef(); 941 static Image* cancelPressedImage = Image::loadPlatformResource("searchCancelButtonPressed").releaseRef(); 942 pi.context->drawImage(isPressed(o) ? cancelPressedImage : cancelImage, 943 o->style()->colorSpace(), paintingRect); 944 return false; 892 945 } 893 946 -
trunk/WebCore/platform/qt/RenderThemeQt.h
r62104 r73635 178 178 QStyle* fallbackStyle() const; 179 179 180 IntRect convertToPaintingRect(RenderObject* inputRenderer, const RenderObject* partRenderer, IntRect partRect, const IntRect& localOffset) const; 181 180 182 Page* m_page; 181 183 -
trunk/WebKit/qt/Api/qwebsettings.cpp
r71499 r73635 49 49 #include <QUrl> 50 50 #include <QFileInfo> 51 #include <QStyle> 51 52 52 53 #include "NetworkStateNotifier.h" … … 102 103 hash->insert(QWebSettings::DeleteButtonGraphic, QPixmap(QLatin1String(":webkit/resources/deleteButton.png"))); 103 104 hash->insert(QWebSettings::InputSpeechButtonGraphic, QPixmap(QLatin1String(":webkit/resources/inputSpeech.png"))); 105 hash->insert(QWebSettings::SearchCancelButtonGraphic, QApplication::style()->standardPixmap(QStyle::SP_DialogCloseButton)); 106 hash->insert(QWebSettings::SearchCancelButtonPressedGraphic, QApplication::style()->standardPixmap(QStyle::SP_DialogCloseButton)); 104 107 } 105 108 … … 373 376 \value TextAreaSizeGripCornerGraphic The graphic shown for the size grip of text areas. 374 377 \value DeleteButtonGraphic The graphic shown for the WebKit-Editing-Delete-Button in Deletion UI. 378 \value InputSpeechButtonGraphic The graphic shown in input fields that support speech recognition. 379 \value SearchCancelButtonGraphic The graphic shown for clearing the text in a search field. 380 \value SearchCancelButtonPressedGraphic The graphic shown when SearchCancelButtonGraphic is pressed. 375 381 */ 376 382 -
trunk/WebKit/qt/Api/qwebsettings.h
r72604 r73635 86 86 TextAreaSizeGripCornerGraphic, 87 87 DeleteButtonGraphic, 88 InputSpeechButtonGraphic 88 InputSpeechButtonGraphic, 89 SearchCancelButtonGraphic, 90 SearchCancelButtonPressedGraphic 89 91 }; 90 92 enum FontSize { -
trunk/WebKit/qt/ChangeLog
r73602 r73635 1 2010-12-09 Robert Hogan <robert@webkit.org> 2 3 Reviewed by Andreas Kling. 4 5 [Qt] Search input field doesn't have cancel button 6 7 Add a cancel button to the search field and make it customizable 8 by the client. For now, use the close dialog button associated 9 with the application's style as the default. 10 11 https://bugs.webkit.org/show_bug.cgi?id=42887 12 13 * Api/qwebsettings.cpp: 14 (graphics): 15 * Api/qwebsettings.h: 16 1 17 2010-12-09 Siddharth Mathur <siddharth.mathur@nokia.com> 2 18
Note: See TracChangeset
for help on using the changeset viewer.