Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(578)

Unified Diff: sky/sdk/lib/widgets/tabs.dart

Issue 1209413004: Instead of applying a transform for every RenderObject, pass down an Offset for where to paint. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sky/sdk/lib/widgets/tabs.dart
diff --git a/sky/sdk/lib/widgets/tabs.dart b/sky/sdk/lib/widgets/tabs.dart
index 09d03be9df8a2b0fa35f882b0701c291a97318b1..1edc4fe2dbae7faf381d3f810abcb4064a28bd7f 100644
--- a/sky/sdk/lib/widgets/tabs.dart
+++ b/sky/sdk/lib/widgets/tabs.dart
@@ -131,21 +131,22 @@ class RenderTabBar extends RenderBox with
defaultHitTestChildren(result, position: position);
}
- void _paintIndicator(RenderCanvas canvas, RenderBox selectedTab) {
+ void _paintIndicator(RenderCanvas canvas, RenderBox selectedTab, Offset offset) {
if (indicatorColor == null)
return;
var size = new Size(selectedTab.size.width, _kTabIndicatorHeight);
var point = new Point(
selectedTab.parentData.position.x,
- _tabBarHeight - _kTabIndicatorHeight);
- Rect rect = new Rect.fromPointAndSize(point, size);
+ _tabBarHeight - _kTabIndicatorHeight
+ );
+ Rect rect = new Rect.fromPointAndSize(point + offset, size);
canvas.drawRect(rect, new Paint()..color = indicatorColor);
}
- void paint(RenderCanvas canvas) {
+ void paint(RenderCanvas canvas, Offset offset) {
if (backgroundColor != null) {
- Rect rect = new Rect.fromSize(size);
+ Rect rect = offset + size;
canvas.drawRect(rect, new Paint()..color = backgroundColor);
}
@@ -153,9 +154,9 @@ class RenderTabBar extends RenderBox with
RenderBox child = firstChild;
while (child != null) {
assert(child.parentData is TabBarParentData);
- canvas.paintChild(child, child.parentData.position);
+ canvas.paintChild(child, child.parentData.position + offset);
if (index++ == selectedIndex)
- _paintIndicator(canvas, child);
+ _paintIndicator(canvas, child, offset);
child = child.parentData.nextSibling;
}
}

Powered by Google App Engine
This is Rietveld 408576698