| Index: chrome/browser/views/tabs/dragged_tab_view.cc
|
| ===================================================================
|
| --- chrome/browser/views/tabs/dragged_tab_view.cc (revision 3391)
|
| +++ chrome/browser/views/tabs/dragged_tab_view.cc (working copy)
|
| @@ -63,9 +63,8 @@
|
| // On RTL locales, a dragged tab (when it is not attached to a tab strip)
|
| // is rendered using a right-to-left orientation so we should calculate the
|
| // window position differently.
|
| - CSize ps;
|
| - GetPreferredSize(&ps);
|
| - x = screen_point.x() - ScaleValue(ps.cx) + mouse_tab_offset_.x() +
|
| + gfx::Size ps = GetPreferredSize();
|
| + x = screen_point.x() - ScaleValue(ps.width()) + mouse_tab_offset_.x() +
|
| ScaleValue(
|
| renderer_->MirroredXCoordinateInsideView(mouse_tab_offset_.x()));
|
| } else {
|
| @@ -150,30 +149,26 @@
|
| }
|
|
|
| void DraggedTabView::Layout() {
|
| - CSize ps;
|
| - GetPreferredSize(&ps);
|
| if (attached_) {
|
| - renderer_->SetBounds(CRect(0, 0, ps.cx, ps.cy));
|
| + renderer_->SetBounds(gfx::Point(), GetPreferredSize());
|
| } else {
|
| int left = 0;
|
| if (UILayoutIsRightToLeft())
|
| - left = ps.cx - attached_tab_size_.width();
|
| + left = GetPreferredSize().width() - attached_tab_size_.width();
|
| renderer_->SetBounds(CRect(left, 0, left + attached_tab_size_.width(),
|
| attached_tab_size_.height()));
|
| }
|
| }
|
|
|
| -void DraggedTabView::GetPreferredSize(CSize* out) {
|
| - DCHECK(out);
|
| - if (attached_) {
|
| - *out = attached_tab_size_.ToSIZE();
|
| - } else {
|
| - int width = std::max(attached_tab_size_.width(), contents_size_.width()) +
|
| - kTwiceDragFrameBorderSize;
|
| - int height = attached_tab_size_.height() + kDragFrameBorderSize +
|
| - contents_size_.height();
|
| - *out = CSize(width, height);
|
| - }
|
| +gfx::Size DraggedTabView::GetPreferredSize() {
|
| + if (attached_)
|
| + return attached_tab_size_;
|
| +
|
| + int width = std::max(attached_tab_size_.width(), contents_size_.width()) +
|
| + kTwiceDragFrameBorderSize;
|
| + int height = attached_tab_size_.height() + kDragFrameBorderSize +
|
| + contents_size_.height();
|
| + return gfx::Size(width, height);
|
| }
|
|
|
| ////////////////////////////////////////////////////////////////////////////////
|
| @@ -184,21 +179,20 @@
|
| }
|
|
|
| void DraggedTabView::PaintDetachedView(ChromeCanvas* canvas) {
|
| - CSize ps;
|
| - GetPreferredSize(&ps);
|
| - ChromeCanvas scale_canvas(ps.cx, ps.cy, false);
|
| + gfx::Size ps = GetPreferredSize();
|
| + ChromeCanvas scale_canvas(ps.width(), ps.height(), false);
|
| SkBitmap& bitmap_device = const_cast<SkBitmap&>(
|
| scale_canvas.getTopPlatformDevice().accessBitmap(true));
|
| bitmap_device.eraseARGB(0, 0, 0, 0);
|
|
|
| scale_canvas.FillRectInt(kDraggedTabBorderColor, 0,
|
| attached_tab_size_.height() - kDragFrameBorderSize,
|
| - ps.cx, ps.cy - attached_tab_size_.height());
|
| + ps.width(), ps.height() - attached_tab_size_.height());
|
| int image_x = kDragFrameBorderSize;
|
| int image_y = attached_tab_size_.height();
|
| - int image_w = ps.cx - kTwiceDragFrameBorderSize;
|
| + int image_w = ps.width() - kTwiceDragFrameBorderSize;
|
| int image_h =
|
| - ps.cy - kTwiceDragFrameBorderSize - attached_tab_size_.height();
|
| + ps.height() - kTwiceDragFrameBorderSize - attached_tab_size_.height();
|
| scale_canvas.FillRectInt(SK_ColorBLACK, image_x, image_y, image_w, image_h);
|
| photobooth_->PaintScreenshotIntoCanvas(
|
| &scale_canvas,
|
| @@ -206,7 +200,7 @@
|
| renderer_->ProcessPaint(&scale_canvas);
|
|
|
| SkIRect subset;
|
| - subset.set(0, 0, ps.cx, ps.cy);
|
| + subset.set(0, 0, ps.width(), ps.height());
|
| SkBitmap mipmap = scale_canvas.ExtractBitmap();
|
| mipmap.buildMipMap(true);
|
|
|
| @@ -226,16 +220,16 @@
|
| SkRect rc;
|
| rc.fLeft = 0;
|
| rc.fTop = 0;
|
| - rc.fRight = SkIntToScalar(ps.cx);
|
| - rc.fBottom = SkIntToScalar(ps.cy);
|
| + rc.fRight = SkIntToScalar(ps.width());
|
| + rc.fBottom = SkIntToScalar(ps.height());
|
| canvas->drawRect(rc, paint);
|
| }
|
|
|
| void DraggedTabView::ResizeContainer() {
|
| - CSize ps;
|
| - GetPreferredSize(&ps);
|
| - SetWindowPos(container_->GetHWND(), HWND_TOPMOST, 0, 0, ScaleValue(ps.cx),
|
| - ScaleValue(ps.cy), SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
|
| + gfx::Size ps = GetPreferredSize();
|
| + SetWindowPos(container_->GetHWND(), HWND_TOPMOST, 0, 0,
|
| + ScaleValue(ps.width()), ScaleValue(ps.height()),
|
| + SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
|
| }
|
|
|
| int DraggedTabView::ScaleValue(int value) {
|
|
|