RESOLVED FIXED 98186
[WK2] PageViewportController.cpp is supposed to be a generic WebKit2 file but only works with Qt port.
https://bugs.webkit.org/show_bug.cgi?id=98186
Summary [WK2] PageViewportController.cpp is supposed to be a generic WebKit2 file but...
Hugo Parente Lima
Reported 2012-10-02 12:14:26 PDT
The file is located at Source/WebKit2/UIProcess, it shouldn't depend on Qt but currently it only compiles based on a implicit conversion from WebCore::FloatSize to QSize (because QSize have operator/(float)). The fix just add a operator/(float) to WebCore::FloatSize and remove the implicit conversion from WebCore::FloatSize to QSize. I don't know if WebKit have some rule against operator overloads with operands of different types, so make me know about and if so, I can update the patch to fix PageViewportController.cpp, but IMO adding the operator/ on WebCore::FloatSize seems nicer.
Attachments
Patch (4.92 KB, patch)
2012-10-02 12:20 PDT, Hugo Parente Lima
no flags
Patch (7.10 KB, patch)
2012-10-03 11:23 PDT, Hugo Parente Lima
no flags
Patch (7.82 KB, patch)
2012-10-03 13:42 PDT, Hugo Parente Lima
no flags
Hugo Parente Lima
Comment 1 2012-10-02 12:20:02 PDT
Noam Rosenthal
Comment 2 2012-10-02 14:39:46 PDT
Comment on attachment 166730 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=166730&action=review Better to use FloatSize::scale explicitly > Source/WebCore/platform/graphics/FloatSize.h:188 > +inline FloatSize operator/(const FloatSize& a, const float& b) const float& -> float
Hugo Parente Lima
Comment 3 2012-10-02 14:47:56 PDT
(In reply to comment #2) > (From update of attachment 166730 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=166730&action=review > > Better to use FloatSize::scale explicitly Ok, I'll do that. > > Source/WebCore/platform/graphics/FloatSize.h:188 > > +inline FloatSize operator/(const FloatSize& a, const float& b) > > const float& -> float So, if I'm goin to use FloatSize::scale, operator/ will disappear from this patch.
Hugo Parente Lima
Comment 4 2012-10-03 11:23:30 PDT
Noam Rosenthal
Comment 5 2012-10-03 13:21:17 PDT
Comment on attachment 166927 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=166927&action=review > Source/WebCore/platform/graphics/FloatSize.h:100 > + FloatSize scaledTo(float s) const how about scaledSize > Source/WebKit2/UIProcess/PageViewportController.cpp:148 > + if (FloatRect(clampedPos, m_viewportSize.scaledTo(1 / m_effectiveScale)).intersects(coveredRect)) { You're making the same calculation over and over... how about creating a function PageViewportController::viewportSizeInContentsCoordinates that would return that calculation? That way you also don't need a function...
Hugo Parente Lima
Comment 6 2012-10-03 13:26:29 PDT
(In reply to comment #5) > (From update of attachment 166927 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=166927&action=review > > > Source/WebCore/platform/graphics/FloatSize.h:100 > > + FloatSize scaledTo(float s) const > > how about scaledSize I used scaledTo to follow the same convention used in this file, like "expandedTo" instead of "expandedSize" > > Source/WebKit2/UIProcess/PageViewportController.cpp:148 > > + if (FloatRect(clampedPos, m_viewportSize.scaledTo(1 / m_effectiveScale)).intersects(coveredRect)) { > > You're making the same calculation over and over... how about creating a function PageViewportController::viewportSizeInContentsCoordinates that would return that calculation? That way you also don't need a function... Could be, it's used 3 times, I'll update the patch.
Hugo Parente Lima
Comment 7 2012-10-03 13:42:07 PDT
WebKit Review Bot
Comment 8 2012-10-03 14:52:09 PDT
Comment on attachment 166953 [details] Patch Clearing flags on attachment: 166953 Committed r130327: <http://trac.webkit.org/changeset/130327>
WebKit Review Bot
Comment 9 2012-10-03 14:52:13 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.