Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/views/tabs/tab.h" | 5 #include "chrome/browser/ui/views/tabs/tab.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 // The minimum opacity (out of 1) when a tab (either active or inactive) is | 110 // The minimum opacity (out of 1) when a tab (either active or inactive) is |
| 111 // throbbing in the immersive mode light strip. | 111 // throbbing in the immersive mode light strip. |
| 112 const double kImmersiveTabMinThrobOpacity = 0.66; | 112 const double kImmersiveTabMinThrobOpacity = 0.66; |
| 113 | 113 |
| 114 // Number of steps in the immersive mode loading animation. | 114 // Number of steps in the immersive mode loading animation. |
| 115 const int kImmersiveLoadingStepCount = 32; | 115 const int kImmersiveLoadingStepCount = 32; |
| 116 | 116 |
| 117 const char kTabCloseButtonName[] = "TabCloseButton"; | 117 const char kTabCloseButtonName[] = "TabCloseButton"; |
| 118 | 118 |
| 119 //////////////////////////////////////////////////////////////////////////////// | 119 //////////////////////////////////////////////////////////////////////////////// |
| 120 // PaintBackgroundParams | |
| 121 | |
| 122 struct PaintBackgroundParams { | |
|
Peter Kasting
2016/07/29 18:58:52
Nit: I'd probably define this just above the funct
Greg Levin
2016/08/08 18:01:32
In the final CL, this comes right above TabImageSo
| |
| 123 bool is_active; | |
| 124 gfx::ImageSkia fill_image; | |
| 125 bool has_custom_image; | |
| 126 gfx::Point offset; | |
| 127 gfx::Size size; | |
|
Greg Levin
2016/07/29 15:02:56
Are offset and size logically connected enough tha
Peter Kasting
2016/07/29 18:58:52
Probably, but if you do this I would also change P
Greg Levin
2016/08/08 18:01:32
Done ... Do you think this is an improvement? I'm
| |
| 128 SkColor stroke_color; | |
| 129 SkColor toolbar_color; | |
| 130 SkColor background_color; | |
| 131 }; | |
| 132 | |
| 133 //////////////////////////////////////////////////////////////////////////////// | |
| 120 // ImageCacheEntryMetadata | 134 // ImageCacheEntryMetadata |
| 121 // | 135 // |
| 122 // All metadata necessary to uniquely identify a cached image. | 136 // All metadata necessary to uniquely identify a cached image. |
| 123 struct ImageCacheEntryMetadata { | 137 struct ImageCacheEntryMetadata { |
| 124 ImageCacheEntryMetadata(int resource_id, | 138 ImageCacheEntryMetadata(int resource_id, |
| 125 SkColor fill_color, | 139 SkColor fill_color, |
| 126 SkColor stroke_color, | 140 SkColor stroke_color, |
| 127 ui::ScaleFactor scale_factor, | 141 ui::ScaleFactor scale_factor, |
| 128 const gfx::Size& size); | 142 const gfx::Size& size); |
| 129 | 143 |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 344 1.5 * scale); | 358 1.5 * scale); |
| 345 } | 359 } |
| 346 path->lineTo(right - 2 * scale, bottom - 1 - 1.5 * scale); | 360 path->lineTo(right - 2 * scale, bottom - 1 - 1.5 * scale); |
| 347 path->rCubicTo(0.375 * scale, scale, 1.25 * scale, 1.5 * scale, 2 * scale, | 361 path->rCubicTo(0.375 * scale, scale, 1.25 * scale, 1.5 * scale, 2 * scale, |
| 348 1.5 * scale); | 362 1.5 * scale); |
| 349 path->rLineTo(0, 1); | 363 path->rLineTo(0, 1); |
| 350 path->close(); | 364 path->close(); |
| 351 } | 365 } |
| 352 | 366 |
| 353 void PaintTabFill(gfx::Canvas* canvas, | 367 void PaintTabFill(gfx::Canvas* canvas, |
| 354 gfx::ImageSkia* fill_image, | 368 const gfx::ImageSkia& fill_image, |
| 355 int x_offset, | 369 int x_offset, |
| 356 int y_offset, | 370 int y_offset, |
| 357 const gfx::Size& size, | 371 const gfx::Size& size, |
| 358 bool is_active) { | 372 bool is_active) { |
| 359 const gfx::Insets tab_insets(GetLayoutInsets(TAB)); | 373 const gfx::Insets tab_insets(GetLayoutInsets(TAB)); |
| 360 // If this isn't the foreground tab, don't draw over the toolbar, but do | 374 // If this isn't the foreground tab, don't draw over the toolbar, but do |
| 361 // include the 1 px divider stroke at the bottom. | 375 // include the 1 px divider stroke at the bottom. |
| 362 const int toolbar_overlap = is_active ? 0 : (tab_insets.bottom() - 1); | 376 const int toolbar_overlap = is_active ? 0 : (tab_insets.bottom() - 1); |
| 363 | 377 |
| 364 // Draw left edge. | 378 // Draw left edge. |
| 365 gfx::ImageSkia tab_l = gfx::ImageSkiaOperations::CreateTiledImage( | 379 gfx::ImageSkia tab_l = gfx::ImageSkiaOperations::CreateTiledImage( |
| 366 *fill_image, x_offset, y_offset, g_mask_images.l_width, size.height()); | 380 fill_image, x_offset, y_offset, g_mask_images.l_width, size.height()); |
| 367 gfx::ImageSkia theme_l = gfx::ImageSkiaOperations::CreateMaskedImage( | 381 gfx::ImageSkia theme_l = gfx::ImageSkiaOperations::CreateMaskedImage( |
| 368 tab_l, *g_mask_images.image_l); | 382 tab_l, *g_mask_images.image_l); |
| 369 canvas->DrawImageInt( | 383 canvas->DrawImageInt( |
| 370 theme_l, 0, 0, theme_l.width(), theme_l.height() - toolbar_overlap, 0, 0, | 384 theme_l, 0, 0, theme_l.width(), theme_l.height() - toolbar_overlap, 0, 0, |
| 371 theme_l.width(), theme_l.height() - toolbar_overlap, false); | 385 theme_l.width(), theme_l.height() - toolbar_overlap, false); |
| 372 | 386 |
| 373 // Draw right edge. | 387 // Draw right edge. |
| 374 gfx::ImageSkia tab_r = gfx::ImageSkiaOperations::CreateTiledImage( | 388 gfx::ImageSkia tab_r = gfx::ImageSkiaOperations::CreateTiledImage( |
| 375 *fill_image, x_offset + size.width() - g_mask_images.r_width, y_offset, | 389 fill_image, x_offset + size.width() - g_mask_images.r_width, y_offset, |
| 376 g_mask_images.r_width, size.height()); | 390 g_mask_images.r_width, size.height()); |
| 377 gfx::ImageSkia theme_r = gfx::ImageSkiaOperations::CreateMaskedImage( | 391 gfx::ImageSkia theme_r = gfx::ImageSkiaOperations::CreateMaskedImage( |
| 378 tab_r, *g_mask_images.image_r); | 392 tab_r, *g_mask_images.image_r); |
| 379 canvas->DrawImageInt(theme_r, 0, 0, theme_r.width(), | 393 canvas->DrawImageInt(theme_r, 0, 0, theme_r.width(), |
| 380 theme_r.height() - toolbar_overlap, | 394 theme_r.height() - toolbar_overlap, |
| 381 size.width() - theme_r.width(), 0, theme_r.width(), | 395 size.width() - theme_r.width(), 0, theme_r.width(), |
| 382 theme_r.height() - toolbar_overlap, false); | 396 theme_r.height() - toolbar_overlap, false); |
| 383 | 397 |
| 384 // Draw center. Instead of masking out the top portion we simply skip over it | 398 // Draw center. Instead of masking out the top portion we simply skip over it |
| 385 // by incrementing by the top padding, since it's a simple rectangle. | 399 // by incrementing by the top padding, since it's a simple rectangle. |
| 386 canvas->TileImageInt( | 400 canvas->TileImageInt( |
| 387 *fill_image, x_offset + g_mask_images.l_width, | 401 fill_image, x_offset + g_mask_images.l_width, y_offset + tab_insets.top(), |
| 388 y_offset + tab_insets.top(), g_mask_images.l_width, tab_insets.top(), | 402 g_mask_images.l_width, tab_insets.top(), |
| 389 size.width() - g_mask_images.l_width - g_mask_images.r_width, | 403 size.width() - g_mask_images.l_width - g_mask_images.r_width, |
| 390 size.height() - tab_insets.top() - toolbar_overlap); | 404 size.height() - tab_insets.top() - toolbar_overlap); |
| 391 } | 405 } |
| 392 | 406 |
| 407 // For use by Tab and TabImageSource | |
|
Peter Kasting
2016/07/29 18:58:52
Nit: There's no TabImageSource yet, so this commen
Greg Levin
2016/08/08 18:01:32
Done.
| |
| 408 void PaintTabBackgroundUsingFillId(gfx::Canvas* canvas, | |
| 409 views::GlowHoverController* hc, | |
| 410 const PaintBackgroundParams& params) { | |
| 411 const SkScalar kMinHoverRadius = 16; | |
| 412 const SkScalar radius = | |
| 413 std::max(SkFloatToScalar(params.size.width() / 4.f), kMinHoverRadius); | |
| 414 const bool draw_hover = !params.is_active && hc; | |
| 415 SkPoint hover_location( | |
| 416 PointToSkPoint(draw_hover ? hc->location() : gfx::Point())); | |
| 417 const SkColor hover_color = | |
| 418 SkColorSetA(params.toolbar_color, draw_hover ? hc->GetAlpha() : 255); | |
| 419 | |
| 420 if (ui::MaterialDesignController::IsModeMaterial()) { | |
| 421 gfx::ScopedCanvas scoped_canvas(canvas); | |
| 422 const float scale = canvas->UndoDeviceScaleFactor(); | |
| 423 | |
| 424 // Draw the fill. | |
| 425 SkPath fill; | |
| 426 GetFillPath(scale, params.size, &fill); | |
| 427 SkPaint paint; | |
| 428 paint.setAntiAlias(true); | |
| 429 { | |
| 430 gfx::ScopedCanvas clip_scoper(canvas); | |
| 431 canvas->ClipPath(fill, true); | |
| 432 if (params.has_custom_image) { | |
|
Greg Levin
2016/07/29 15:02:56
Given the change below at 1586, it looks like we c
Peter Kasting
2016/07/29 18:58:52
I think that would work.
Greg Levin
2016/08/08 18:01:32
Done.
| |
| 433 gfx::ScopedCanvas scale_scoper(canvas); | |
| 434 canvas->sk_canvas()->scale(scale, scale); | |
| 435 canvas->TileImageInt(params.fill_image, params.offset.x(), | |
| 436 params.offset.y(), 0, 0, params.size.width(), | |
| 437 params.size.height()); | |
| 438 } else { | |
| 439 paint.setColor(params.is_active ? params.toolbar_color | |
| 440 : params.background_color); | |
| 441 canvas->DrawRect( | |
| 442 gfx::ScaleToEnclosingRect(gfx::Rect(params.size), scale), paint); | |
| 443 } | |
| 444 if (draw_hover) { | |
| 445 hover_location.scale(SkFloatToScalar(scale)); | |
| 446 DrawHighlight(canvas, hover_location, radius * scale, hover_color); | |
| 447 } | |
| 448 } | |
| 449 | |
| 450 // Draw the stroke. | |
| 451 SkPath stroke; | |
| 452 GetBorderPath(scale, params.size, false, &stroke); | |
| 453 Op(stroke, fill, kDifference_SkPathOp, &stroke); | |
| 454 if (!params.is_active) { | |
| 455 // Clip out the bottom line; this will be drawn for us by | |
| 456 // TabStrip::PaintChildren(). | |
| 457 canvas->sk_canvas()->clipRect(SkRect::MakeWH( | |
| 458 params.size.width() * scale, params.size.height() * scale - 1)); | |
| 459 } | |
| 460 paint.setColor(params.stroke_color); | |
| 461 canvas->DrawPath(stroke, paint); | |
| 462 } else { | |
| 463 if (draw_hover) { | |
| 464 // Draw everything to a temporary canvas so we can extract an image for | |
| 465 // use in masking the hover glow. | |
| 466 gfx::Canvas background_canvas(params.size, canvas->image_scale(), false); | |
| 467 PaintTabFill(&background_canvas, params.fill_image, params.offset.x(), | |
| 468 params.offset.y(), params.size, params.is_active); | |
| 469 gfx::ImageSkia background_image(background_canvas.ExtractImageRep()); | |
| 470 canvas->DrawImageInt(background_image, 0, 0); | |
| 471 | |
| 472 gfx::Canvas hover_canvas(params.size, canvas->image_scale(), false); | |
| 473 DrawHighlight(&hover_canvas, hover_location, radius, hover_color); | |
| 474 gfx::ImageSkia result = gfx::ImageSkiaOperations::CreateMaskedImage( | |
| 475 gfx::ImageSkia(hover_canvas.ExtractImageRep()), background_image); | |
| 476 canvas->DrawImageInt(result, 0, 0); | |
| 477 } else { | |
| 478 PaintTabFill(canvas, params.fill_image, params.offset.x(), | |
| 479 params.offset.y(), params.size, params.is_active); | |
| 480 } | |
| 481 | |
| 482 // Now draw the stroke, highlights, and shadows around the tab edge. | |
| 483 TabImages* stroke_images = | |
| 484 params.is_active ? &g_active_images : &g_inactive_images; | |
| 485 canvas->DrawImageInt(*stroke_images->image_l, 0, 0); | |
| 486 canvas->TileImageInt( | |
| 487 *stroke_images->image_c, stroke_images->l_width, 0, | |
| 488 params.size.width() - stroke_images->l_width - stroke_images->r_width, | |
| 489 params.size.height()); | |
| 490 canvas->DrawImageInt(*stroke_images->image_r, | |
| 491 params.size.width() - stroke_images->r_width, 0); | |
| 492 } | |
| 493 } | |
| 494 | |
| 393 } // namespace | 495 } // namespace |
| 394 | 496 |
| 395 //////////////////////////////////////////////////////////////////////////////// | 497 //////////////////////////////////////////////////////////////////////////////// |
| 396 // FaviconCrashAnimation | 498 // FaviconCrashAnimation |
| 397 // | 499 // |
| 398 // A custom animation subclass to manage the favicon crash animation. | 500 // A custom animation subclass to manage the favicon crash animation. |
| 399 class Tab::FaviconCrashAnimation : public gfx::LinearAnimation, | 501 class Tab::FaviconCrashAnimation : public gfx::LinearAnimation, |
| 400 public gfx::AnimationDelegate { | 502 public gfx::AnimationDelegate { |
| 401 public: | 503 public: |
| 402 explicit FaviconCrashAnimation(Tab* target) | 504 explicit FaviconCrashAnimation(Tab* target) |
| (...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1469 it = g_image_cache->begin(); | 1571 it = g_image_cache->begin(); |
| 1470 } | 1572 } |
| 1471 canvas->DrawImageInt(it->image, 0, 0); | 1573 canvas->DrawImageInt(it->image, 0, 0); |
| 1472 } | 1574 } |
| 1473 | 1575 |
| 1474 void Tab::PaintTabBackgroundUsingFillId(gfx::Canvas* canvas, | 1576 void Tab::PaintTabBackgroundUsingFillId(gfx::Canvas* canvas, |
| 1475 bool is_active, | 1577 bool is_active, |
| 1476 int fill_id, | 1578 int fill_id, |
| 1477 bool has_custom_image, | 1579 bool has_custom_image, |
| 1478 int y_offset) { | 1580 int y_offset) { |
| 1479 const ui::ThemeProvider* tp = GetThemeProvider(); | 1581 views::GlowHoverController* hc = |
| 1480 const SkColor toolbar_color = tp->GetColor(ThemeProperties::COLOR_TOOLBAR); | 1582 hover_controller_.ShouldDraw() ? &hover_controller_ : nullptr; |
|
Peter Kasting
2016/07/29 18:58:52
Nit: Looking at the original CL, I see why you did
Greg Levin
2016/08/08 18:01:32
Added constructor, will declare params_ const in T
Peter Kasting
2016/08/09 02:52:31
It sounds like the objection was to depending on t
| |
| 1481 gfx::ImageSkia* fill_image = tp->GetImageSkiaNamed(fill_id); | 1583 PaintBackgroundParams params; |
| 1584 params.is_active = is_active; | |
| 1585 if (has_custom_image || !ui::MaterialDesignController::IsModeMaterial()) | |
| 1586 params.fill_image = *GetThemeProvider()->GetImageSkiaNamed(fill_id); | |
|
Greg Levin
2016/07/29 15:02:56
Changed so that we only load the image if it's goi
| |
| 1587 params.has_custom_image = has_custom_image; | |
| 1482 // The tab image needs to be lined up with the background image | 1588 // The tab image needs to be lined up with the background image |
| 1483 // so that it feels partially transparent. These offsets represent the tab | 1589 // so that it feels partially transparent. These offsets represent the tab |
| 1484 // position within the frame background image. | 1590 // position within the frame background image. |
| 1485 const int x_offset = GetMirroredX() + background_offset_.x(); | 1591 params.offset.SetPoint(GetMirroredX() + background_offset_.x(), y_offset); |
| 1592 params.size = size(); | |
| 1593 params.stroke_color = controller_->GetToolbarTopSeparatorColor(); | |
| 1594 params.toolbar_color = | |
| 1595 GetThemeProvider()->GetColor(ThemeProperties::COLOR_TOOLBAR); | |
| 1596 params.background_color = | |
| 1597 GetThemeProvider()->GetColor(ThemeProperties::COLOR_BACKGROUND_TAB); | |
| 1486 | 1598 |
| 1487 const SkScalar kMinHoverRadius = 16; | 1599 ::PaintTabBackgroundUsingFillId(canvas, hc, params); |
|
Peter Kasting
2016/07/29 18:58:52
Nit: This no longer takes a fill ID, so the name i
Greg Levin
2016/08/08 18:01:32
Done.
| |
| 1488 const SkScalar radius = | |
| 1489 std::max(SkFloatToScalar(width() / 4.f), kMinHoverRadius); | |
| 1490 const bool draw_hover = !is_active && hover_controller_.ShouldDraw(); | |
| 1491 SkPoint hover_location(PointToSkPoint(hover_controller_.location())); | |
| 1492 const SkColor hover_color = | |
| 1493 SkColorSetA(toolbar_color, hover_controller_.GetAlpha()); | |
| 1494 | |
| 1495 if (ui::MaterialDesignController::IsModeMaterial()) { | |
| 1496 gfx::ScopedCanvas scoped_canvas(canvas); | |
| 1497 const float scale = canvas->UndoDeviceScaleFactor(); | |
| 1498 | |
| 1499 // Draw the fill. | |
| 1500 SkPath fill; | |
| 1501 GetFillPath(scale, size(), &fill); | |
| 1502 SkPaint paint; | |
| 1503 paint.setAntiAlias(true); | |
| 1504 { | |
| 1505 gfx::ScopedCanvas clip_scoper(canvas); | |
| 1506 canvas->ClipPath(fill, true); | |
| 1507 if (has_custom_image) { | |
| 1508 gfx::ScopedCanvas scale_scoper(canvas); | |
| 1509 canvas->sk_canvas()->scale(scale, scale); | |
| 1510 canvas->TileImageInt(*fill_image, x_offset, y_offset, 0, 0, width(), | |
| 1511 height()); | |
| 1512 } else { | |
| 1513 paint.setColor( | |
| 1514 is_active ? toolbar_color | |
| 1515 : tp->GetColor(ThemeProperties::COLOR_BACKGROUND_TAB)); | |
| 1516 canvas->DrawRect(gfx::ScaleToEnclosingRect(GetLocalBounds(), scale), | |
| 1517 paint); | |
| 1518 } | |
| 1519 if (draw_hover) { | |
| 1520 hover_location.scale(SkFloatToScalar(scale)); | |
| 1521 DrawHighlight(canvas, hover_location, radius * scale, hover_color); | |
| 1522 } | |
| 1523 } | |
| 1524 | |
| 1525 // Draw the stroke. | |
| 1526 SkPath stroke; | |
| 1527 GetBorderPath(scale, size(), false, &stroke); | |
| 1528 Op(stroke, fill, kDifference_SkPathOp, &stroke); | |
| 1529 if (!is_active) { | |
| 1530 // Clip out the bottom line; this will be drawn for us by | |
| 1531 // TabStrip::PaintChildren(). | |
| 1532 canvas->sk_canvas()->clipRect( | |
| 1533 SkRect::MakeWH(width() * scale, height() * scale - 1)); | |
| 1534 } | |
| 1535 paint.setColor(controller_->GetToolbarTopSeparatorColor()); | |
| 1536 canvas->DrawPath(stroke, paint); | |
| 1537 } else { | |
| 1538 if (draw_hover) { | |
| 1539 // Draw everything to a temporary canvas so we can extract an image for | |
| 1540 // use in masking the hover glow. | |
| 1541 gfx::Canvas background_canvas(size(), canvas->image_scale(), false); | |
| 1542 PaintTabFill(&background_canvas, fill_image, x_offset, y_offset, size(), | |
| 1543 is_active); | |
| 1544 gfx::ImageSkia background_image(background_canvas.ExtractImageRep()); | |
| 1545 canvas->DrawImageInt(background_image, 0, 0); | |
| 1546 | |
| 1547 gfx::Canvas hover_canvas(size(), canvas->image_scale(), false); | |
| 1548 DrawHighlight(&hover_canvas, hover_location, radius, hover_color); | |
| 1549 gfx::ImageSkia result = gfx::ImageSkiaOperations::CreateMaskedImage( | |
| 1550 gfx::ImageSkia(hover_canvas.ExtractImageRep()), background_image); | |
| 1551 canvas->DrawImageInt(result, 0, 0); | |
| 1552 } else { | |
| 1553 PaintTabFill(canvas, fill_image, x_offset, y_offset, size(), is_active); | |
| 1554 } | |
| 1555 | |
| 1556 // Now draw the stroke, highlights, and shadows around the tab edge. | |
| 1557 TabImages* stroke_images = | |
| 1558 is_active ? &g_active_images : &g_inactive_images; | |
| 1559 canvas->DrawImageInt(*stroke_images->image_l, 0, 0); | |
| 1560 canvas->TileImageInt( | |
| 1561 *stroke_images->image_c, stroke_images->l_width, 0, | |
| 1562 width() - stroke_images->l_width - stroke_images->r_width, height()); | |
| 1563 canvas->DrawImageInt(*stroke_images->image_r, | |
| 1564 width() - stroke_images->r_width, 0); | |
| 1565 } | |
| 1566 } | 1600 } |
| 1567 | 1601 |
| 1568 void Tab::PaintPinnedTabTitleChangedIndicatorAndIcon( | 1602 void Tab::PaintPinnedTabTitleChangedIndicatorAndIcon( |
| 1569 gfx::Canvas* canvas, | 1603 gfx::Canvas* canvas, |
| 1570 const gfx::Rect& favicon_draw_bounds) { | 1604 const gfx::Rect& favicon_draw_bounds) { |
| 1571 // The pinned tab title changed indicator consists of two parts: | 1605 // The pinned tab title changed indicator consists of two parts: |
| 1572 // . a clear (totally transparent) part over the bottom right (or left in rtl) | 1606 // . a clear (totally transparent) part over the bottom right (or left in rtl) |
| 1573 // of the favicon. This is done by drawing the favicon to a canvas, then | 1607 // of the favicon. This is done by drawing the favicon to a canvas, then |
| 1574 // drawing the clear part on top of the favicon. | 1608 // drawing the clear part on top of the favicon. |
| 1575 // . a circle in the bottom right (or left in rtl) of the favicon. | 1609 // . a circle in the bottom right (or left in rtl) of the favicon. |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1804 gfx::Rect Tab::GetImmersiveBarRect() const { | 1838 gfx::Rect Tab::GetImmersiveBarRect() const { |
| 1805 // The main bar is as wide as the normal tab's horizontal top line. | 1839 // The main bar is as wide as the normal tab's horizontal top line. |
| 1806 // This top line of the tab extends a few pixels left and right of the | 1840 // This top line of the tab extends a few pixels left and right of the |
| 1807 // center image due to pixels in the rounded corner images. | 1841 // center image due to pixels in the rounded corner images. |
| 1808 const int kBarPadding = 1; | 1842 const int kBarPadding = 1; |
| 1809 int main_bar_left = g_active_images.l_width - kBarPadding; | 1843 int main_bar_left = g_active_images.l_width - kBarPadding; |
| 1810 int main_bar_right = width() - g_active_images.r_width + kBarPadding; | 1844 int main_bar_right = width() - g_active_images.r_width + kBarPadding; |
| 1811 return gfx::Rect( | 1845 return gfx::Rect( |
| 1812 main_bar_left, 0, main_bar_right - main_bar_left, kImmersiveBarHeight); | 1846 main_bar_left, 0, main_bar_right - main_bar_left, kImmersiveBarHeight); |
| 1813 } | 1847 } |
| OLD | NEW |