RESOLVED FIXED 67773
[Qt] Remove the QStyle dependency in Qt's mobile theme
https://bugs.webkit.org/show_bug.cgi?id=67773
Summary [Qt] Remove the QStyle dependency in Qt's mobile theme
Pierre Rossi
Reported 2011-09-08 03:45:16 PDT
[Qt] Remove the QStyle dependency in Qt's mobile theme
Attachments
Patch (2.77 KB, patch)
2011-09-08 03:50 PDT, Pierre Rossi
no flags
Patch (214.86 KB, patch)
2011-09-08 04:51 PDT, Pierre Rossi
no flags
More readable version (still pretty huge) (107.19 KB, patch)
2011-09-08 04:55 PDT, Pierre Rossi
no flags
Patch (215.00 KB, patch)
2011-09-08 09:54 PDT, Pierre Rossi
no flags
Review-friendly version. (107.33 KB, patch)
2011-09-08 09:57 PDT, Pierre Rossi
no flags
Patch (148.37 KB, patch)
2011-11-11 04:19 PST, Pierre Rossi
no flags
Patch (148.71 KB, patch)
2011-11-11 05:01 PST, Pierre Rossi
no flags
Patch (148.76 KB, patch)
2011-11-11 06:20 PST, Pierre Rossi
hausmann: review+
Pierre Rossi
Comment 1 2011-09-08 03:50:54 PDT
Andreas Kling
Comment 2 2011-09-08 04:30:26 PDT
Comment on attachment 106720 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=106720&action=review r=me with nits. > Source/WebCore/ChangeLog:6 > + GraphicsContext3DQt doesn't actually use QStyleOption use -> need > Source/WebCore/ChangeLog:10 > + No new tests as there should be no functionnal change. functionnal -> functional
Pierre Rossi
Comment 3 2011-09-08 04:51:43 PDT
WebKit Review Bot
Comment 4 2011-09-08 04:54:37 PDT
Attachment 106723 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1 Source/WebCore/platform/qt/RenderThemeQtMobile.cpp:50: Alphabetical sorting problem. [build/include_order] [4] Source/WebCore/platform/qt/RenderThemeQStyle.cpp:57: Alphabetical sorting problem. [build/include_order] [4] Total errors found: 2 in 11 files If any of these errors are false positives, please file a bug against check-webkit-style.
Pierre Rossi
Comment 5 2011-09-08 04:55:09 PDT
Created attachment 106725 [details] More readable version (still pretty huge) This is just a more review-friendly version of the patch above since it takes the "git mv" into account.
Early Warning System Bot
Comment 6 2011-09-08 05:07:56 PDT
Pierre Rossi
Comment 7 2011-09-08 09:54:15 PDT
WebKit Review Bot
Comment 8 2011-09-08 09:57:47 PDT
Attachment 106751 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1 Source/WebCore/platform/qt/RenderThemeQtMobile.cpp:50: Alphabetical sorting problem. [build/include_order] [4] Source/WebCore/platform/qt/RenderThemeQStyle.cpp:57: Alphabetical sorting problem. [build/include_order] [4] Total errors found: 2 in 11 files If any of these errors are false positives, please file a bug against check-webkit-style.
Pierre Rossi
Comment 9 2011-09-08 09:57:56 PDT
Created attachment 106752 [details] Review-friendly version.
Laszlo Gombos
Comment 10 2011-09-09 07:34:13 PDT
I think we should consider making the mobile theme (perhaps we should find a better name) the default and having an option to turn on QStyle. Mobile theme should be available anywhere where Qt runs, while QStyle might end up being an optional Qt class in Qt5. This would involve change the name of the build option and the guard names and adjusting the LayotuTests results to default to the mobile theme. I'm not sure if this change needs to be part of this patch/bug, but I find this discussion relevant here.
Simon Hausmann
Comment 11 2011-11-03 10:34:04 PDT
Comment on attachment 106751 [details] Patch Clearing review and taking this out of the review queue as the patch is going to change soon :)
Pierre Rossi
Comment 12 2011-11-11 04:19:47 PST
Created attachment 114665 [details] Patch So here's a new approach that doesn't require a compile time decision. It has the benefit of allowing us to still use QStyle for the WebKit1 API and potentially for the desktop webview.
Simon Hausmann
Comment 13 2011-11-11 04:27:07 PST
Comment on attachment 114665 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=114665&action=review > Source/WebCore/html/HTMLSelectElement.h:203 > + if (!qgetenv("QT_WEBKIT_USE_MOBILE_THEME").isNull()) Initial feedback: It would be nice to centralize the qgetenv() calls into for example a class method in RenderThemeQt.h.
Pierre Rossi
Comment 14 2011-11-11 05:01:30 PST
Pierre Rossi
Comment 15 2011-11-11 06:20:38 PST
Simon Hausmann
Comment 16 2011-11-11 07:14:30 PST
Comment on attachment 114691 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=114691&action=review r=me with the proposed changes. > Source/WebCore/Target.pri:-25 > -contains(DEFINES, WTF_USE_QT_MOBILE_THEME=1) { > - DEFINES += ENABLE_NO_LISTBOX_RENDERING=1 > -} IT looks like that we may be able to replace the NO_LISTBOX_RENDERING feature define with PLATFORM(QT) if we want to. > Source/WebCore/html/HTMLSelectElement.h:208 > +#if PLATFORM(QT) > + if (RenderThemeQt::useMobileTheme()) > +#endif > return true; I think this is easier to read if the PLATFORM(QT) branch had its own return statement. > Source/WebCore/platform/qt/RenderThemeQtMobile.cpp:400 > +#else > + qputenv("QT_WEBKIT_USE_MOBILE_THEME", QByteArray("1")); > +#endif This should be removed, useMobileTheme() should return true if we don't have QStyle. > Source/WebCore/platform/qt/RenderThemeQtMobile.cpp:570 > +void RenderThemeQtMobile::adjustMenuListStyle(CSSStyleSelector*, RenderStyle* style, Element*) const > +{ > + style->resetBorder(); > + > + // Height is locked to auto. > + style->setHeight(Length(Auto)); > + > + // White-space is locked to pre > + style->setWhiteSpace(PRE); > + > + computeSizeBasedOnStyle(style); > + > + // Add in the padding that we'd like to use. > + setPopupPadding(style); > + style->setPaddingLeft(Length(menuListPadding, Fixed)); > +} It would be nicer if the QtMobileImplementation would call the base class implementation and then do the padding adjustment. This can be fixed in a separate patch. > Source/WebKit/qt/Api/qwebpage.cpp:3276 > + if (qgetenv("QT_WEBKIT_USE_MOBILE_THEME").isNull()) { I think this should be replaced with a call to RenderThemeQt::useMobileTheme().
Kent Tamura
Comment 17 2011-11-12 05:57:47 PST
Comment on attachment 114691 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=114691&action=review > Source/WebCore/html/HTMLSelectElement.h:210 > #if ENABLE(NO_LISTBOX_RENDERING) > +#if PLATFORM(QT) > + if (RenderThemeQt::useMobileTheme()) > +#endif > return true; > -#else > - return !m_multiple && m_size <= 1; > #endif > + return !m_multiple && m_size <= 1; We should introduce a function like usesMenuListFor(const HTMLSelectElement*) to RenderTheme, and remove NO_LISTBOX_RENDERING. RenderThemeQtMobile should return true from this function.
Simon Hausmann
Comment 18 2011-11-14 03:06:27 PST
(In reply to comment #17) > (From update of attachment 114691 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=114691&action=review > > > Source/WebCore/html/HTMLSelectElement.h:210 > > #if ENABLE(NO_LISTBOX_RENDERING) > > +#if PLATFORM(QT) > > + if (RenderThemeQt::useMobileTheme()) > > +#endif > > return true; > > -#else > > - return !m_multiple && m_size <= 1; > > #endif > > + return !m_multiple && m_size <= 1; > > We should introduce a function like usesMenuListFor(const HTMLSelectElement*) to RenderTheme, and remove NO_LISTBOX_RENDERING. > RenderThemeQtMobile should return true from this function. Yes, good idea! We'll do that separately when removing the NO_LISTBOX_RENDERING define altogether.
Simon Hausmann
Comment 19 2011-11-14 04:19:48 PST
Landed with qgetenv usage fixed and minor instantiation fix in themeForPage Committed r100123: <http://trac.webkit.org/changeset/100123>
Note You need to log in before you can comment on or make changes to this bug.