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

Side by Side Diff: cc/layer_tree_host_impl.cc

Issue 12147005: Hardcode scrollbar rendering for Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: hardcoded scrollbar not using layer structure. similar to M18 approach Created 7 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 "cc/layer_tree_host_impl.h" 5 #include "cc/layer_tree_host_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 , m_memoryHistory(MemoryHistory::create()) 152 , m_memoryHistory(MemoryHistory::create())
153 , m_debugRectHistory(DebugRectHistory::create()) 153 , m_debugRectHistory(DebugRectHistory::create())
154 , m_numImplThreadScrolls(0) 154 , m_numImplThreadScrolls(0)
155 , m_numMainThreadScrolls(0) 155 , m_numMainThreadScrolls(0)
156 , m_cumulativeNumLayersDrawn(0) 156 , m_cumulativeNumLayersDrawn(0)
157 , m_cumulativeNumMissingTiles(0) 157 , m_cumulativeNumMissingTiles(0)
158 , m_lastSentMemoryVisibleBytes(0) 158 , m_lastSentMemoryVisibleBytes(0)
159 , m_lastSentMemoryVisibleAndNearbyBytes(0) 159 , m_lastSentMemoryVisibleAndNearbyBytes(0)
160 , m_lastSentMemoryUseBytes(0) 160 , m_lastSentMemoryUseBytes(0)
161 , m_animationRegistrar(AnimationRegistrar::create()) 161 , m_animationRegistrar(AnimationRegistrar::create())
162 , m_hardcodedScrollbar(this)
162 { 163 {
163 DCHECK(m_proxy->isImplThread()); 164 DCHECK(m_proxy->isImplThread());
164 didVisibilityChange(this, m_visible); 165 didVisibilityChange(this, m_visible);
165 166
166 if (settings.calculateTopControlsPosition) 167 if (settings.calculateTopControlsPosition)
167 m_topControlsManager = TopControlsManager::Create(this, settings.topCont rolsHeight); 168 m_topControlsManager = TopControlsManager::Create(this, settings.topCont rolsHeight);
168 169
169 // LTHI always has an active tree. 170 // LTHI always has an active tree.
170 m_activeTree = LayerTreeImpl::create(this); 171 m_activeTree = LayerTreeImpl::create(this);
171 } 172 }
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 return m_outputSurface.get(); 238 return m_outputSurface.get();
238 } 239 }
239 240
240 void LayerTreeHostImpl::animate(base::TimeTicks monotonicTime, base::Time wallCl ockTime) 241 void LayerTreeHostImpl::animate(base::TimeTicks monotonicTime, base::Time wallCl ockTime)
241 { 242 {
242 animatePageScale(monotonicTime); 243 animatePageScale(monotonicTime);
243 animateLayers(monotonicTime, wallClockTime); 244 animateLayers(monotonicTime, wallClockTime);
244 animateScrollbars(monotonicTime); 245 animateScrollbars(monotonicTime);
245 if (m_topControlsManager) 246 if (m_topControlsManager)
246 m_topControlsManager->Animate(monotonicTime); 247 m_topControlsManager->Animate(monotonicTime);
248 m_hardcodedScrollbar.Animate(monotonicTime);
danakj 2013/02/05 17:55:02 why isn't this in animateScrollbars?
247 } 249 }
248 250
249 void LayerTreeHostImpl::manageTiles() 251 void LayerTreeHostImpl::manageTiles()
250 { 252 {
251 DCHECK(m_tileManager); 253 DCHECK(m_tileManager);
252 m_tileManager->ManageTiles(); 254 m_tileManager->ManageTiles();
253 255
254 size_t memoryRequiredBytes; 256 size_t memoryRequiredBytes;
255 size_t memoryNiceToHaveBytes; 257 size_t memoryNiceToHaveBytes;
256 size_t memoryUsedBytes; 258 size_t memoryUsedBytes;
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 != frame.renderPassesById.end()); 522 != frame.renderPassesById.end());
521 } 523 }
522 #endif 524 #endif
523 DCHECK(frame.renderPasses.back()->output_rect.origin().IsOrigin()); 525 DCHECK(frame.renderPasses.back()->output_rect.origin().IsOrigin());
524 526
525 if (!activeTree()->has_transparent_background()) { 527 if (!activeTree()->has_transparent_background()) {
526 frame.renderPasses.back()->has_transparent_background = false; 528 frame.renderPasses.back()->has_transparent_background = false;
527 appendQuadsToFillScreen(frame.renderPasses.back(), rootLayer(), activeTr ee()->background_color(), occlusionTracker); 529 appendQuadsToFillScreen(frame.renderPasses.back(), rootLayer(), activeTr ee()->background_color(), occlusionTracker);
528 } 530 }
529 531
532 m_hardcodedScrollbar.PrependQuads(frame.renderPasses.back());
533
530 if (drawFrame) 534 if (drawFrame)
531 occlusionTracker.overdrawMetrics().recordMetrics(this); 535 occlusionTracker.overdrawMetrics().recordMetrics(this);
532 536
533 removeRenderPasses(CullRenderPassesWithNoQuads(), frame); 537 removeRenderPasses(CullRenderPassesWithNoQuads(), frame);
534 m_renderer->decideRenderPassAllocationsForFrame(frame.renderPasses); 538 m_renderer->decideRenderPassAllocationsForFrame(frame.renderPasses);
535 removeRenderPasses(CullRenderPassesWithCachedTextures(*m_renderer), frame); 539 removeRenderPasses(CullRenderPassesWithCachedTextures(*m_renderer), frame);
536 540
537 return drawFrame; 541 return drawFrame;
538 } 542 }
539 543
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after
1327 pendingDelta = MathUtil::projectVector(pendingDelta, perpendicularAxis); 1331 pendingDelta = MathUtil::projectVector(pendingDelta, perpendicularAxis);
1328 1332
1329 if (gfx::ToFlooredVector2d(pendingDelta).IsZero()) 1333 if (gfx::ToFlooredVector2d(pendingDelta).IsZero())
1330 break; 1334 break;
1331 } 1335 }
1332 1336
1333 if (didScroll) { 1337 if (didScroll) {
1334 m_client->setNeedsCommitOnImplThread(); 1338 m_client->setNeedsCommitOnImplThread();
1335 m_client->setNeedsRedrawOnImplThread(); 1339 m_client->setNeedsRedrawOnImplThread();
1336 m_client->renewTreePriority(); 1340 m_client->renewTreePriority();
1341 m_hardcodedScrollbar.DidUpdateScrollOffset(base::TimeTicks::Now());
1337 } 1342 }
1338 return didScroll; 1343 return didScroll;
1339 } 1344 }
1340 1345
1341 void LayerTreeHostImpl::clearCurrentlyScrollingLayer() 1346 void LayerTreeHostImpl::clearCurrentlyScrollingLayer()
1342 { 1347 {
1343 m_activeTree->ClearCurrentlyScrollingLayer(); 1348 m_activeTree->ClearCurrentlyScrollingLayer();
1344 m_didLockScrollingLayer = false; 1349 m_didLockScrollingLayer = false;
1345 } 1350 }
1346 1351
(...skipping 29 matching lines...) Expand all
1376 1381
1377 m_previousPinchAnchor = anchor; 1382 m_previousPinchAnchor = anchor;
1378 1383
1379 if (m_settings.pageScalePinchZoomEnabled) 1384 if (m_settings.pageScalePinchZoomEnabled)
1380 move.Scale(1 / activeTree()->page_scale_factor()); 1385 move.Scale(1 / activeTree()->page_scale_factor());
1381 1386
1382 rootScrollLayer()->scrollBy(move); 1387 rootScrollLayer()->scrollBy(move);
1383 1388
1384 if (rootScrollLayer()->scrollbarAnimationController()) 1389 if (rootScrollLayer()->scrollbarAnimationController())
1385 rootScrollLayer()->scrollbarAnimationController()->didPinchGestureUpdate (base::TimeTicks::Now()); 1390 rootScrollLayer()->scrollbarAnimationController()->didPinchGestureUpdate (base::TimeTicks::Now());
1391 m_hardcodedScrollbar.DidPinchGestureUpdate(base::TimeTicks::Now());
1386 1392
1387 m_client->setNeedsCommitOnImplThread(); 1393 m_client->setNeedsCommitOnImplThread();
1388 m_client->setNeedsRedrawOnImplThread(); 1394 m_client->setNeedsRedrawOnImplThread();
1389 m_client->renewTreePriority(); 1395 m_client->renewTreePriority();
1390 } 1396 }
1391 1397
1392 void LayerTreeHostImpl::pinchGestureEnd() 1398 void LayerTreeHostImpl::pinchGestureEnd()
1393 { 1399 {
1394 m_pinchGestureActive = false; 1400 m_pinchGestureActive = false;
1395 1401
1396 if (rootScrollLayer() && rootScrollLayer()->scrollbarAnimationController()) 1402 if (rootScrollLayer() && rootScrollLayer()->scrollbarAnimationController())
1397 rootScrollLayer()->scrollbarAnimationController()->didPinchGestureEnd(ba se::TimeTicks::Now()); 1403 rootScrollLayer()->scrollbarAnimationController()->didPinchGestureEnd(ba se::TimeTicks::Now());
1404 m_hardcodedScrollbar.DidPinchGestureEnd(base::TimeTicks::Now());
1398 1405
1399 m_client->setNeedsCommitOnImplThread(); 1406 m_client->setNeedsCommitOnImplThread();
1400 } 1407 }
1401 1408
1402 void LayerTreeHostImpl::computeDoubleTapZoomDeltas(ScrollAndScaleSet* scrollInfo ) 1409 void LayerTreeHostImpl::computeDoubleTapZoomDeltas(ScrollAndScaleSet* scrollInfo )
1403 { 1410 {
1404 gfx::Vector2dF scaledScrollOffset = m_pageScaleAnimation->targetScrollOffset (); 1411 gfx::Vector2dF scaledScrollOffset = m_pageScaleAnimation->targetScrollOffset ();
1405 if (!m_settings.pageScalePinchZoomEnabled) 1412 if (!m_settings.pageScalePinchZoomEnabled)
1406 scaledScrollOffset.Scale(activeTree()->page_scale_factor()); 1413 scaledScrollOffset.Scale(activeTree()->page_scale_factor());
1407 makeScrollAndScaleSet(scrollInfo, ToFlooredVector2d(scaledScrollOffset), m_p ageScaleAnimation->targetPageScaleFactor()); 1414 makeScrollAndScaleSet(scrollInfo, ToFlooredVector2d(scaledScrollOffset), m_p ageScaleAnimation->targetPageScaleFactor());
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
1713 LayerImpl* layer = getNonCompositedContentLayerRecursive(tree->RootLayer()); 1720 LayerImpl* layer = getNonCompositedContentLayerRecursive(tree->RootLayer());
1714 return layer ? layer->getPicture() : skia::RefPtr<SkPicture>(); 1721 return layer ? layer->getPicture() : skia::RefPtr<SkPicture>();
1715 } 1722 }
1716 1723
1717 void LayerTreeHostImpl::savePaintTime(const base::TimeDelta& totalPaintTime) 1724 void LayerTreeHostImpl::savePaintTime(const base::TimeDelta& totalPaintTime)
1718 { 1725 {
1719 m_paintTimeCounter->SavePaintTime(totalPaintTime); 1726 m_paintTimeCounter->SavePaintTime(totalPaintTime);
1720 } 1727 }
1721 1728
1722 } // namespace cc 1729 } // namespace cc
OLDNEW
« cc/hardcoded_scrollbar.cc ('K') | « cc/layer_tree_host_impl.h ('k') | ui/gfx/vector2d_f.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698