OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 return; | 388 return; |
389 | 389 |
390 FrameView* frameView = m_page->mainFrame()->view(); | 390 FrameView* frameView = m_page->mainFrame()->view(); |
391 if (!frameView) | 391 if (!frameView) |
392 return; | 392 return; |
393 | 393 |
394 frameView->scrollAnimator()->handleWheelEventPhase(phase); | 394 frameView->scrollAnimator()->handleWheelEventPhase(phase); |
395 } | 395 } |
396 #endif | 396 #endif |
397 | 397 |
398 bool ScrollingCoordinator::hasVisibleSlowRepaintFixedObjects(FrameView* frameVie
w) const | 398 bool ScrollingCoordinator::hasVisibleSlowRepaintViewportConstrainedObjects(Frame
View* frameView) const |
399 { | 399 { |
400 const FrameView::ViewportConstrainedObjectSet* viewportConstrainedObjects =
frameView->viewportConstrainedObjects(); | 400 const FrameView::ViewportConstrainedObjectSet* viewportConstrainedObjects =
frameView->viewportConstrainedObjects(); |
401 if (!viewportConstrainedObjects) | 401 if (!viewportConstrainedObjects) |
402 return false; | 402 return false; |
403 | 403 |
404 #if USE(ACCELERATED_COMPOSITING) | 404 #if USE(ACCELERATED_COMPOSITING) |
405 for (FrameView::ViewportConstrainedObjectSet::const_iterator it = viewportCo
nstrainedObjects->begin(), end = viewportConstrainedObjects->end(); it != end; +
+it) { | 405 for (FrameView::ViewportConstrainedObjectSet::const_iterator it = viewportCo
nstrainedObjects->begin(), end = viewportConstrainedObjects->end(); it != end; +
+it) { |
406 RenderObject* viewportConstrainedObject = *it; | 406 RenderObject* viewportConstrainedObject = *it; |
407 if (!viewportConstrainedObject->isBoxModelObject() || !viewportConstrain
edObject->hasLayer()) | 407 if (!viewportConstrainedObject->isBoxModelObject() || !viewportConstrain
edObject->hasLayer()) |
408 return true; | 408 return true; |
409 RenderLayer* layer = toRenderBoxModelObject(viewportConstrainedObject)->
layer(); | 409 RenderLayer* layer = toRenderBoxModelObject(viewportConstrainedObject)->
layer(); |
410 // Any explicit reason that a fixed position element is not composited s
houldn't cause slow scrolling. | 410 // Any explicit reason that a fixed position element is not composited s
houldn't cause slow scrolling. |
411 if (!layer->isComposited() && layer->compositor()->fixedPositionLayerNot
CompositedReason(layer) == RenderLayerCompositor::NoReason) | 411 if (!layer->isComposited() && layer->viewportConstrainedNotCompositedRea
son() == RenderLayer::NoNotCompositedReason) |
412 return true; | 412 return true; |
413 } | 413 } |
414 return false; | 414 return false; |
415 #else | 415 #else |
416 return viewportConstrainedObjects->size(); | 416 return viewportConstrainedObjects->size(); |
417 #endif | 417 #endif |
418 } | 418 } |
419 | 419 |
420 MainThreadScrollingReasons ScrollingCoordinator::mainThreadScrollingReasons() co
nst | 420 MainThreadScrollingReasons ScrollingCoordinator::mainThreadScrollingReasons() co
nst |
421 { | 421 { |
422 FrameView* frameView = m_page->mainFrame()->view(); | 422 FrameView* frameView = m_page->mainFrame()->view(); |
423 | 423 |
424 MainThreadScrollingReasons mainThreadScrollingReasons = (MainThreadScrolling
Reasons)0; | 424 MainThreadScrollingReasons mainThreadScrollingReasons = (MainThreadScrolling
Reasons)0; |
425 | 425 |
426 if (m_forceMainThreadScrollLayerPositionUpdates) | 426 if (m_forceMainThreadScrollLayerPositionUpdates) |
427 mainThreadScrollingReasons |= ForcedOnMainThread; | 427 mainThreadScrollingReasons |= ForcedOnMainThread; |
428 if (frameView->hasSlowRepaintObjects()) | 428 if (frameView->hasSlowRepaintObjects()) |
429 mainThreadScrollingReasons |= HasSlowRepaintObjects; | 429 mainThreadScrollingReasons |= HasSlowRepaintObjects; |
430 if (!supportsFixedPositionLayers() && frameView->hasViewportConstrainedObjec
ts()) | 430 if (!supportsFixedPositionLayers() && frameView->hasViewportConstrainedObjec
ts()) |
431 mainThreadScrollingReasons |= HasViewportConstrainedObjectsWithoutSuppor
tingFixedLayers; | 431 mainThreadScrollingReasons |= HasViewportConstrainedObjectsWithoutSuppor
tingFixedLayers; |
432 if (supportsFixedPositionLayers() && hasVisibleSlowRepaintFixedObjects(frame
View)) | 432 if (supportsFixedPositionLayers() && hasVisibleSlowRepaintViewportConstraine
dObjects(frameView)) |
433 mainThreadScrollingReasons |= HasNonLayerFixedObjects; | 433 mainThreadScrollingReasons |= HasNonLayerViewportConstrainedObjects; |
434 if (m_page->mainFrame()->document()->isImageDocument()) | 434 if (m_page->mainFrame()->document()->isImageDocument()) |
435 mainThreadScrollingReasons |= IsImageDocument; | 435 mainThreadScrollingReasons |= IsImageDocument; |
436 | 436 |
437 return mainThreadScrollingReasons; | 437 return mainThreadScrollingReasons; |
438 } | 438 } |
439 | 439 |
440 void ScrollingCoordinator::updateShouldUpdateScrollLayerPositionOnMainThread() | 440 void ScrollingCoordinator::updateShouldUpdateScrollLayerPositionOnMainThread() |
441 { | 441 { |
442 setShouldUpdateScrollLayerPositionOnMainThread(mainThreadScrollingReasons())
; | 442 setShouldUpdateScrollLayerPositionOnMainThread(mainThreadScrollingReasons())
; |
443 } | 443 } |
(...skipping 21 matching lines...) Expand all Loading... |
465 String ScrollingCoordinator::mainThreadScrollingReasonsAsText(MainThreadScrollin
gReasons reasons) | 465 String ScrollingCoordinator::mainThreadScrollingReasonsAsText(MainThreadScrollin
gReasons reasons) |
466 { | 466 { |
467 StringBuilder stringBuilder; | 467 StringBuilder stringBuilder; |
468 | 468 |
469 if (reasons & ScrollingCoordinator::ForcedOnMainThread) | 469 if (reasons & ScrollingCoordinator::ForcedOnMainThread) |
470 stringBuilder.append("Forced on main thread, "); | 470 stringBuilder.append("Forced on main thread, "); |
471 if (reasons & ScrollingCoordinator::HasSlowRepaintObjects) | 471 if (reasons & ScrollingCoordinator::HasSlowRepaintObjects) |
472 stringBuilder.append("Has slow repaint objects, "); | 472 stringBuilder.append("Has slow repaint objects, "); |
473 if (reasons & ScrollingCoordinator::HasViewportConstrainedObjectsWithoutSupp
ortingFixedLayers) | 473 if (reasons & ScrollingCoordinator::HasViewportConstrainedObjectsWithoutSupp
ortingFixedLayers) |
474 stringBuilder.append("Has viewport constrained objects without supportin
g fixed layers, "); | 474 stringBuilder.append("Has viewport constrained objects without supportin
g fixed layers, "); |
475 if (reasons & ScrollingCoordinator::HasNonLayerFixedObjects) | 475 if (reasons & ScrollingCoordinator::HasNonLayerViewportConstrainedObjects) |
476 stringBuilder.append("Has non-layer fixed objects, "); | 476 stringBuilder.append("Has non-layer viewport-constrained objects, "); |
477 if (reasons & ScrollingCoordinator::IsImageDocument) | 477 if (reasons & ScrollingCoordinator::IsImageDocument) |
478 stringBuilder.append("Is image document, "); | 478 stringBuilder.append("Is image document, "); |
479 | 479 |
480 if (stringBuilder.length()) | 480 if (stringBuilder.length()) |
481 stringBuilder.resize(stringBuilder.length() - 2); | 481 stringBuilder.resize(stringBuilder.length() - 2); |
482 return stringBuilder.toString(); | 482 return stringBuilder.toString(); |
483 } | 483 } |
484 | 484 |
485 String ScrollingCoordinator::mainThreadScrollingReasonsAsText() const | 485 String ScrollingCoordinator::mainThreadScrollingReasonsAsText() const |
486 { | 486 { |
487 return mainThreadScrollingReasonsAsText(mainThreadScrollingReasons()); | 487 return mainThreadScrollingReasonsAsText(mainThreadScrollingReasons()); |
488 } | 488 } |
489 | 489 |
490 } // namespace WebCore | 490 } // namespace WebCore |
OLD | NEW |