RESOLVED FIXED Bug 81016
[mac/chromium] Change platform code to use pixelSnappedRect methods
https://bugs.webkit.org/show_bug.cgi?id=81016
Summary [mac/chromium] Change platform code to use pixelSnappedRect methods
Emil A Eklund
Reported 2012-03-13 11:54:46 PDT
Change platform code to use Node::getPixelSnappedRect, pixelSnappedBoundingBoxRect and pixelSnappedAbsoluteClippedOverflowRect to avoid exposing subpixel types to the platform layer.
Attachments
Patch (11.41 KB, patch)
2012-03-13 11:57 PDT, Emil A Eklund
no flags
Patch (10.56 KB, patch)
2012-03-13 15:11 PDT, Emil A Eklund
no flags
Patch (10.98 KB, patch)
2012-03-14 18:12 PDT, Emil A Eklund
no flags
Patch for landing (9.72 KB, patch)
2012-03-19 14:22 PDT, Emil A Eklund
no flags
Emil A Eklund
Comment 1 2012-03-13 11:57:36 PDT
Eric Seidel (no email)
Comment 2 2012-03-13 12:03:42 PDT
Comment on attachment 131688 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=131688&action=review > Source/WebKit/chromium/src/WebViewImpl.cpp:810 > - IntRect rect = node->Node::getRect(); > + IntRect rect = node->Node::getPixelSnappedRect(); Why does this method have "get" in the name? That's generlaly disroucaged in WebKIt? Is it DOM API or somethign? > Source/WebKit/mac/WebView/WebFrame.mm:1297 > + float printWidth = root->style()->isHorizontalWritingMode() ? static_cast<float>(documentRect.width()) / printScaleFactor : pageSize.width; Isn't there a .toFloat() method instead of a static_cast? I guess that's only for hte rect as a whole since LayoutUnit isn't a class yet... > Source/WebKit/mac/WebView/WebView.mm:2039 > + WebDashboardRegion *webRegion = [[WebDashboardRegion alloc] initWithRect:pixelSnappedIntRect(region.bounds) clip:pixelSnappedIntRect(region.clip) type:type]; Are bounds/clip LayoutRects here? > Source/WebKit/mac/WebView/WebView.mm:2500 > + [rectsArray addObject:[NSValue valueWithRect:pixelSnappedIntRect(repaintRects[i])]]; Here too? I'm surprised you need these functions much at this layer. Apple Graphics APIs all function in floats.
Emil A Eklund
Comment 3 2012-03-13 12:07:11 PDT
Comment on attachment 131688 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=131688&action=review >> Source/WebKit/chromium/src/WebViewImpl.cpp:810 >> + IntRect rect = node->Node::getPixelSnappedRect(); > > Why does this method have "get" in the name? That's generlaly disroucaged in WebKIt? Is it DOM API or somethign? To be consistent with the current API. I'd gladly rename both to rect and pixelSnappedRect respectively. >> Source/WebKit/mac/WebView/WebFrame.mm:1297 >> + float printWidth = root->style()->isHorizontalWritingMode() ? static_cast<float>(documentRect.width()) / printScaleFactor : pageSize.width; > > Isn't there a .toFloat() method instead of a static_cast? I guess that's only for hte rect as a whole since LayoutUnit isn't a class yet... LayoutUnit has a toFloat method, int doesn't though. This way it'll work both with LayoutRect defined as an IntRect and as a FractionalLayoutRect. >> Source/WebKit/mac/WebView/WebView.mm:2039 >> + WebDashboardRegion *webRegion = [[WebDashboardRegion alloc] initWithRect:pixelSnappedIntRect(region.bounds) clip:pixelSnappedIntRect(region.clip) type:type]; > > Are bounds/clip LayoutRects here? Yeah. >> Source/WebKit/mac/WebView/WebView.mm:2500 >> + [rectsArray addObject:[NSValue valueWithRect:pixelSnappedIntRect(repaintRects[i])]]; > > Here too? I'm surprised you need these functions much at this layer. Apple Graphics APIs all function in floats. The APIs are all float but we do most painting snapped to device pixels.
Early Warning System Bot
Comment 4 2012-03-13 12:51:29 PDT
WebKit Review Bot
Comment 5 2012-03-13 13:21:35 PDT
Comment on attachment 131688 [details] Patch Attachment 131688 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/11941746
Early Warning System Bot
Comment 6 2012-03-13 13:48:36 PDT
Emil A Eklund
Comment 7 2012-03-13 15:11:40 PDT
WebKit Review Bot
Comment 8 2012-03-13 17:19:00 PDT
Comment on attachment 131723 [details] Patch Attachment 131723 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/11949730
Early Warning System Bot
Comment 9 2012-03-14 02:19:24 PDT
Early Warning System Bot
Comment 10 2012-03-14 02:50:55 PDT
Emil A Eklund
Comment 11 2012-03-14 18:12:29 PDT
Emil A Eklund
Comment 12 2012-03-16 14:29:07 PDT
Eric, would you mind taking another look at this when you get a chance?
Eric Seidel (no email)
Comment 13 2012-03-16 14:40:21 PDT
Comment on attachment 131968 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=131968&action=review Thank you for the reminder. bug mail gets lost in the torrent... > Source/WebCore/dom/Node.h:378 > virtual LayoutRect getRect() const; > + IntRect getPixelSnappedRect() const { return pixelSnappedIntRect(getRect()); } I really don't like the "get" here. "Rect" is also not very useful, as you don't know what "rect" it means. :(
Emil A Eklund
Comment 14 2012-03-16 14:54:15 PDT
Thanks Eric! > > Source/WebCore/dom/Node.h:378 > > virtual LayoutRect getRect() const; > > + IntRect getPixelSnappedRect() const { return pixelSnappedIntRect(getRect()); } > > I really don't like the "get" here. "Rect" is also not very useful, as you don't know what "rect" it means. :( If we can come up with a better name I'll gladly do the work to rename it. I filed bug 81413 to track this.
WebKit Review Bot
Comment 15 2012-03-16 16:08:04 PDT
Comment on attachment 131968 [details] Patch Rejecting attachment 131968 [details] from commit-queue. Failed to run "['/mnt/git/webkit-commit-queue/Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '-..." exit_code: 2 Last 500 characters of output: webkit-commit-queue/Source/WebKit/chromium/webkit --revision 126866 --non-interactive --force --accept theirs-conflict --ignore-externals' in '/mnt/git/webkit-commit-queue/Source/WebKit/chromium' 48>At revision 126866. ________ running '/usr/bin/python tools/clang/scripts/update.py --mac-only' in '/mnt/git/webkit-commit-queue/Source/WebKit/chromium' ________ running '/usr/bin/python gyp_webkit' in '/mnt/git/webkit-commit-queue/Source/WebKit/chromium' Updating webkit projects from gyp files... Full output: http://queues.webkit.org/results/11963520
Emil A Eklund
Comment 16 2012-03-19 14:22:26 PDT
Created attachment 132671 [details] Patch for landing
WebKit Review Bot
Comment 17 2012-03-19 16:34:11 PDT
Comment on attachment 132671 [details] Patch for landing Clearing flags on attachment: 132671 Committed r111268: <http://trac.webkit.org/changeset/111268>
WebKit Review Bot
Comment 18 2012-03-19 16:34:16 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.