Bug 48450

Summary: [Qt] Extend the Platform Plugin to define the padding of HitTestResult
Product: WebKit Reporter: Andre Pedralho <andre.pedralho>
Component: PlatformAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: ademar, benjamin, christian.webkit, commit-queue, hausmann, kenneth, kling, luiz, tonikitoo, yael
Priority: P3    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 44089    
Attachments:
Description Flags
Adding the TouchAdjusts extension in the Platform Plugin.
kenneth: review-
Updating last patch according to Kenneth suggestions.
tonikitoo: commit-queue-
Patch updated with Antonio's and Simon's suggestions.
none
Patch updated according to Luiz suggestions.
kenneth: review-, kenneth: commit-queue-
Sorry, removing one of the ChangeLogs entries.
kenneth: review+
Renaming extension name from TouchInteraction to TouchModifier and making its implementation simpler. none

Andre Pedralho
Reported 2010-10-27 11:58:51 PDT
After some discussion on bug #44088 it was decided that the padding values used by the HitTestResult should be defined in the Platform Plugin. This way different platforms will be able to set its own preferred value to the HitTestResult rect.
Attachments
Adding the TouchAdjusts extension in the Platform Plugin. (8.16 KB, patch)
2010-10-28 12:47 PDT, Andre Pedralho
kenneth: review-
Updating last patch according to Kenneth suggestions. (7.57 KB, patch)
2010-10-28 15:13 PDT, Andre Pedralho
tonikitoo: commit-queue-
Patch updated with Antonio's and Simon's suggestions. (8.83 KB, patch)
2010-10-29 13:21 PDT, Andre Pedralho
no flags
Patch updated according to Luiz suggestions. (8.97 KB, patch)
2010-11-02 16:12 PDT, Andre Pedralho
kenneth: review-
kenneth: commit-queue-
Sorry, removing one of the ChangeLogs entries. (8.09 KB, patch)
2010-11-02 16:27 PDT, Andre Pedralho
kenneth: review+
Renaming extension name from TouchInteraction to TouchModifier and making its implementation simpler. (7.30 KB, patch)
2010-11-03 07:59 PDT, Andre Pedralho
no flags
Andre Pedralho
Comment 1 2010-10-28 12:47:44 PDT
Created attachment 72219 [details] Adding the TouchAdjusts extension in the Platform Plugin.
Kenneth Rohde Christiansen
Comment 2 2010-10-28 13:30:53 PDT
Comment on attachment 72219 [details] Adding the TouchAdjusts extension in the Platform Plugin. I like to have this more like the Haptics. Thus call the Extension for Touch, and just make the plugin implement something like: class QWebTouchInteraction : public QObject { enum PaddingDirection { ... } virtual int hitTestPaddingForTouch(const PaddingDirection) const = 0; } I dislike the Adjust* and the setHitTestPadding is unneeded.
Kenneth Rohde Christiansen
Comment 3 2010-10-28 13:31:25 PDT
Btw, nice to have you back hacking on webkit!
Andre Pedralho
Comment 4 2010-10-28 15:13:06 PDT
Created attachment 72241 [details] Updating last patch according to Kenneth suggestions.
Andre Pedralho
Comment 5 2010-10-28 15:41:27 PDT
(In reply to comment #3) > Btw, nice to have you back hacking on webkit! It's nice to be back!
Antonio Gomes
Comment 6 2010-10-28 21:37:45 PDT
Comment on attachment 72241 [details] Updating last patch according to Kenneth suggestions. View in context: https://bugs.webkit.org/attachment.cgi?id=72241&action=review Looks great! > WebKit/qt/Api/qwebkitplatformplugin.h:113 > + enum PaddingDirection { > + Up, Right, Down, Left > + }; Is not it against the webkit style? > WebKit/qt/ChangeLog:15 > + (TouchAdjuster::setHitTestPadding): you do not have the setter anymore, and it is not called touchadjuster neither. > WebKit/qt/examples/platformplugin/WebPlugin.cpp:254 > + return new TouchInteraction(); who deletes it?
Simon Hausmann
Comment 7 2010-10-29 08:14:10 PDT
Nice! When you change the platform plugin interface, please also change the version string.
Andre Pedralho
Comment 8 2010-10-29 10:48:23 PDT
(In reply to comment #6) > (From update of attachment 72241 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=72241&action=review > > Looks great! > > > WebKit/qt/Api/qwebkitplatformplugin.h:113 > > + enum PaddingDirection { > > + Up, Right, Down, Left > > + }; > > Is not it against the webkit style? > Sorry, I just followed the style of the other extensions. > > WebKit/qt/ChangeLog:15 > > + (TouchAdjuster::setHitTestPadding): > > you do not have the setter anymore, and it is not called touchadjuster neither. > Ops! Forget to update Changelog and commit header. > > WebKit/qt/examples/platformplugin/WebPlugin.cpp:254 > > + return new TouchInteraction(); > > who deletes it? Ok! I'll add a private QObject* m_extension variable and delete it in the plugin destructor. Other suggestion?
Andre Pedralho
Comment 9 2010-10-29 13:21:24 PDT
Created attachment 72379 [details] Patch updated with Antonio's and Simon's suggestions.
Luiz Agostini
Comment 10 2010-10-29 14:16:07 PDT
> > WebKit/qt/examples/platformplugin/WebPlugin.cpp:254 > > + return new TouchInteraction(); > > who deletes it? Ok! I'll add a private QObject* m_extension variable and delete it in the plugin destructor. Other suggestion? The user of the plugin should responsible for destroying the TouchInteraction object. createExtension caller should be the owner of the returned object.
Luiz Agostini
Comment 11 2010-10-29 14:18:36 PDT
(In reply to comment #10) > > > WebKit/qt/examples/platformplugin/WebPlugin.cpp:254 > > > + return new TouchInteraction(); > > > > who deletes it? > Ok! I'll add a private QObject* m_extension variable and delete it in the plugin destructor. Other suggestion? > The user of the plugin should responsible for destroying the TouchInteraction object. createExtension caller should be the owner of the returned object.
Antonio Gomes
Comment 12 2010-10-29 22:40:19 PDT
(In reply to comment #11) > > (In reply to comment #10) > > > > WebKit/qt/examples/platformplugin/WebPlugin.cpp:254 > > > > + return new TouchInteraction(); > > > > > > who deletes it? > > Ok! I'll add a private QObject* m_extension variable and delete it in the plugin destructor. Other suggestion? > > > > The user of the plugin should responsible for destroying the TouchInteraction object. createExtension caller should be the owner of the returned object. Pedralho, please go for what luiz suggested. Other than that, looks good to me.
Andre Pedralho
Comment 13 2010-11-02 16:12:02 PDT
Created attachment 72761 [details] Patch updated according to Luiz suggestions.
Kenneth Rohde Christiansen
Comment 14 2010-11-02 16:22:22 PDT
Comment on attachment 72761 [details] Patch updated according to Luiz suggestions. r- due to double entry in the ChangeLog
Andre Pedralho
Comment 15 2010-11-02 16:27:08 PDT
Created attachment 72764 [details] Sorry, removing one of the ChangeLogs entries.
Kenneth Rohde Christiansen
Comment 16 2010-11-02 16:28:40 PDT
Comment on attachment 72761 [details] Patch updated according to Luiz suggestions. View in context: https://bugs.webkit.org/attachment.cgi?id=72761&action=review > WebKit/qt/examples/platformplugin/WebPlugin.cpp:226 > +unsigned TouchInteraction::hitTestPaddingForTouch(const PaddingDirection direction) const > +{ > + switch (direction) { > + case Down: > + return bottomPadding; > + case Left: > + return leftPadding; > + case Right: > + return rightPadding; > + case Up: > + return topPadding; > + default: > + Q_ASSERT(0); > + return 0; > + } > +} I don't understand why you make such a complicated example, but well :-) I would just have done return 10; // Use 10 as padding in each direction. > WebKit/qt/examples/platformplugin/WebPlugin.h:102 > +{ > + Q_OBJECT > +public: > + TouchInteraction() > + : bottomPadding(10) > + , leftPadding(10) > + , rightPadding(10) > + , topPadding(10) > + {} > + > + unsigned hitTestPaddingForTouch(const PaddingDirection) const; > + > +private: > + unsigned bottomPadding; > + unsigned leftPadding; > + unsigned rightPadding; > + unsigned topPadding; This seems a bit overengineered... in real life you mostly want the same padding in each direction, but maybe a bit more padding in the top, but that could easily be implemented just in the histTestPaddingForTouch method like if (direction == PaddingDirection::Up) return 15; return 8; or similar. > WebKit/qt/examples/platformplugin/qwebkitplatformplugin.h:123 > + Touch Is Touch a good name here... maybe TouchInteraction ? I'm just thinking out loud... maybe others have comments.
Kenneth Rohde Christiansen
Comment 17 2010-11-02 16:30:34 PDT
> > if (direction == PaddingDirection::Up) > return 15; > return 8; I think that something like this would make for a better, more clear example. Anyways, that is the whole point of an example - to be simple and easy to follow and understand.
Kenneth Rohde Christiansen
Comment 18 2010-11-02 16:32:19 PDT
Comment on attachment 72764 [details] Sorry, removing one of the ChangeLogs entries. r+, but please consider my suggestions before setting cq+
Andre Pedralho
Comment 19 2010-11-02 16:59:46 PDT
(In reply to comment #16) > (From update of attachment 72761 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=72761&action=review > > I don't understand why you make such a complicated example, but well :-) I would just have done > > return 10; // Use 10 as padding in each direction. > > This seems a bit overengineered... in real life you mostly want the same padding in each direction, but maybe a bit more padding in the top, but that could easily be implemented just in the histTestPaddingForTouch method > > like > > if (direction == PaddingDirection::Up) > return 15; > return 8; > > or similar. > // Use 10 as padding in each direction but Up. if (direction == QWebTouchInteraction::Up) return 15; return 10; Better? > > WebKit/qt/examples/platformplugin/qwebkitplatformplugin.h:123 > > + Touch > > Is Touch a good name here... maybe TouchInteraction ? I'm just thinking out loud... maybe others have comments. TouchInteraction is a better name but it is also the class name, then it conflicts. Suggestions?
Kenneth Rohde Christiansen
Comment 20 2010-11-03 00:58:10 PDT
(In reply to comment #19) > (In reply to comment #16) > > (From update of attachment 72761 [details] [details]) > > View in context: https://bugs.webkit.org/attachment.cgi?id=72761&action=review > > > > I don't understand why you make such a complicated example, but well :-) I would just have done > > > > return 10; // Use 10 as padding in each direction. > > > > This seems a bit overengineered... in real life you mostly want the same padding in each direction, but maybe a bit more padding in the top, but that could easily be implemented just in the histTestPaddingForTouch method > > > > like > > > > if (direction == PaddingDirection::Up) > > return 15; > > return 8; > > > > or similar. > > > > // Use 10 as padding in each direction but Up. > if (direction == QWebTouchInteraction::Up) > return 15; > return 10; > > Better? yes > > > > WebKit/qt/examples/platformplugin/qwebkitplatformplugin.h:123 > > > + Touch > > > > Is Touch a good name here... maybe TouchInteraction ? I'm just thinking out loud... maybe others have comments. > TouchInteraction is a better name but it is also the class name, then it conflicts. Suggestions? You could call the class TouchModifier
Andre Pedralho
Comment 21 2010-11-03 07:59:23 PDT
Created attachment 72822 [details] Renaming extension name from TouchInteraction to TouchModifier and making its implementation simpler.
WebKit Commit Bot
Comment 22 2010-11-03 20:55:42 PDT
Comment on attachment 72822 [details] Renaming extension name from TouchInteraction to TouchModifier and making its implementation simpler. Clearing flags on attachment: 72822 Committed r71303: <http://trac.webkit.org/changeset/71303>
WebKit Commit Bot
Comment 23 2010-11-03 20:55:49 PDT
All reviewed patches have been landed. Closing bug.
Ademar Reis
Comment 24 2010-11-05 08:25:06 PDT
Revision r71303 cherry-picked into qtwebkit-2.1 with commit 78ff335 <http://gitorious.org/webkit/qtwebkit/commit/78ff335>
Note You need to log in before you can comment on or make changes to this bug.