Chromium Code Reviews| 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 281 scrollbarGraphicsLayer->setContentsOpaque(isMainFrame && isOpaqueScr ollbar); | 281 scrollbarGraphicsLayer->setContentsOpaque(isMainFrame && isOpaqueScr ollbar); |
| 282 scrollbarLayer->layer()->setOpaque(scrollbarGraphicsLayer->contentsOpaqu e()); | 282 scrollbarLayer->layer()->setOpaque(scrollbarGraphicsLayer->contentsOpaqu e()); |
| 283 | 283 |
| 284 setupScrollbarLayer(scrollbarGraphicsLayer, scrollbarLayer, scrollingWeb LayerForScrollableArea(scrollableArea)); | 284 setupScrollbarLayer(scrollbarGraphicsLayer, scrollbarLayer, scrollingWeb LayerForScrollableArea(scrollableArea)); |
| 285 } else | 285 } else |
| 286 removeWebScrollbarLayer(scrollableArea, orientation); | 286 removeWebScrollbarLayer(scrollableArea, orientation); |
| 287 } | 287 } |
| 288 | 288 |
| 289 bool ScrollingCoordinator::scrollableAreaScrollLayerDidChange(ScrollableArea* sc rollableArea) | 289 bool ScrollingCoordinator::scrollableAreaScrollLayerDidChange(ScrollableArea* sc rollableArea) |
| 290 { | 290 { |
| 291 TRACE_EVENT_INSTANT2("comp-scroll", "ScrollingCoordinator::scrollableAreaScr ollLayerDidChange", | |
| 292 "width", scrollableArea->scrollableAreaBoundingBox().width(), | |
| 293 "height", scrollableArea->scrollableAreaBoundingBox().height()); | |
| 294 | |
| 291 GraphicsLayer* scrollLayer = scrollLayerForScrollableArea(scrollableArea); | 295 GraphicsLayer* scrollLayer = scrollLayerForScrollableArea(scrollableArea); |
| 292 if (scrollLayer) { | 296 if (scrollLayer) { |
| 293 bool isMainFrame = isForMainFrame(scrollableArea); | 297 bool isMainFrame = isForMainFrame(scrollableArea); |
| 294 scrollLayer->setScrollableArea(scrollableArea, isMainFrame); | 298 scrollLayer->setScrollableArea(scrollableArea, isMainFrame); |
| 295 } | 299 } |
| 296 | 300 |
| 297 WebLayer* webLayer = scrollingWebLayerForScrollableArea(scrollableArea); | 301 WebLayer* webLayer = scrollingWebLayerForScrollableArea(scrollableArea); |
| 298 if (webLayer) { | 302 if (webLayer) { |
| 299 webLayer->setScrollable(true); | 303 webLayer->setScrollable(true); |
| 300 webLayer->setScrollPosition(IntPoint(scrollableArea->scrollPosition() - scrollableArea->minimumScrollPosition())); | 304 webLayer->setScrollPosition(IntPoint(scrollableArea->scrollPosition() - scrollableArea->minimumScrollPosition())); |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 486 if (m_page->mainFrame()->view()->needsLayout()) | 490 if (m_page->mainFrame()->view()->needsLayout()) |
| 487 return; | 491 return; |
| 488 | 492 |
| 489 TRACE_EVENT0("input", "ScrollingCoordinator::touchEventTargetRectsDidChange" ); | 493 TRACE_EVENT0("input", "ScrollingCoordinator::touchEventTargetRectsDidChange" ); |
| 490 | 494 |
| 491 LayerHitTestRects touchEventTargetRects; | 495 LayerHitTestRects touchEventTargetRects; |
| 492 computeTouchEventTargetRects(touchEventTargetRects); | 496 computeTouchEventTargetRects(touchEventTargetRects); |
| 493 setTouchEventTargetRects(touchEventTargetRects); | 497 setTouchEventTargetRects(touchEventTargetRects); |
| 494 } | 498 } |
| 495 | 499 |
| 496 void ScrollingCoordinator::willDestroyRenderLayer(RenderLayer* layer) | 500 void ScrollingCoordinator::updateScrollParentForLayer(RenderLayer* child, Render Layer* parent) |
| 497 { | 501 { |
| 498 m_layersWithTouchRects.remove(layer); | 502 if (!child || !child->backing()) |
|
enne (OOO)
2013/08/22 20:54:30
Shouldn't these always be true?
| |
| 503 return; | |
| 504 | |
| 505 WebLayer* childWebLayer = scrollingWebLayerForGraphicsLayer(child->layerForS crollChild()); | |
| 506 if (!childWebLayer) | |
| 507 return; | |
| 508 | |
| 509 WebLayer* scrollParentWebLayer = 0; | |
| 510 if (parent && parent->backing()) | |
| 511 scrollParentWebLayer = scrollingWebLayerForGraphicsLayer(parent->backing ()->parentForSublayers()); | |
| 512 | |
| 513 TRACE_EVENT_INSTANT2("comp-scroll2", "ScrollingCoordinator::updateScrollPare ntForLayer", | |
| 514 "childId", childWebLayer->id(), | |
| 515 "ancestorId", scrollParentWebLayer ? scrollParentWebLayer->id() : -1); | |
| 516 | |
| 517 childWebLayer->setScrollParent(scrollParentWebLayer); | |
| 518 } | |
| 519 | |
| 520 void ScrollingCoordinator::updateClipParentForLayer(RenderLayer* child, RenderLa yer* parent) | |
| 521 { | |
| 522 if (!child || !child->backing()) | |
| 523 return; | |
| 524 | |
| 525 WebLayer* childWebLayer = scrollingWebLayerForGraphicsLayer(child->backing() ->graphicsLayer()); | |
| 526 if (!childWebLayer) | |
| 527 return; | |
| 528 | |
| 529 WebLayer* clipParentWebLayer = 0; | |
| 530 if (parent && parent->backing()) | |
| 531 clipParentWebLayer = scrollingWebLayerForGraphicsLayer(parent->backing() ->parentForSublayers()); | |
| 532 | |
| 533 TRACE_EVENT_INSTANT2("comp-scroll", "ScrollingCoordinator::updateClipParentF orLayer", | |
| 534 "childId", childWebLayer->id(), | |
| 535 "ancestorId", clipParentWebLayer ? clipParentWebLayer->id() : -1); | |
| 536 | |
| 537 childWebLayer->setClipParent(clipParentWebLayer); | |
| 499 } | 538 } |
| 500 | 539 |
| 501 void ScrollingCoordinator::setWheelEventHandlerCount(unsigned count) | 540 void ScrollingCoordinator::setWheelEventHandlerCount(unsigned count) |
| 502 { | 541 { |
| 503 if (WebLayer* scrollLayer = scrollingWebLayerForScrollableArea(m_page->mainF rame()->view())) | 542 if (WebLayer* scrollLayer = scrollingWebLayerForScrollableArea(m_page->mainF rame()->view())) |
| 504 scrollLayer->setHaveWheelEventHandlers(count > 0); | 543 scrollLayer->setHaveWheelEventHandlers(count > 0); |
| 505 } | 544 } |
| 506 | 545 |
| 507 void ScrollingCoordinator::recomputeWheelEventHandlerCountForFrameView(FrameView * frameView) | 546 void ScrollingCoordinator::recomputeWheelEventHandlerCountForFrameView(FrameView * frameView) |
| 508 { | 547 { |
| 509 UNUSED_PARAM(frameView); | 548 UNUSED_PARAM(frameView); |
| 510 setWheelEventHandlerCount(computeCurrentWheelEventHandlerCount()); | 549 setWheelEventHandlerCount(computeCurrentWheelEventHandlerCount()); |
| 511 } | 550 } |
| 512 | 551 |
| 513 void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(MainTh readScrollingReasons reasons) | 552 void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(MainTh readScrollingReasons reasons) |
| 514 { | 553 { |
| 515 if (WebLayer* scrollLayer = scrollingWebLayerForScrollableArea(m_page->mainF rame()->view())) | 554 if (WebLayer* scrollLayer = scrollingWebLayerForScrollableArea(m_page->mainF rame()->view())) { |
| 555 TRACE_EVENT_INSTANT2("impl-scroll", "ScrollingCoordinator::setShouldUpda teScrollLayerPositionOnMainThread", | |
| 556 "layerId", scrollLayer->id(), | |
| 557 "reasons", reasons); | |
| 516 scrollLayer->setShouldScrollOnMainThread(reasons); | 558 scrollLayer->setShouldScrollOnMainThread(reasons); |
| 559 } | |
| 517 } | 560 } |
| 518 | 561 |
| 519 void ScrollingCoordinator::pageDestroyed() | 562 void ScrollingCoordinator::pageDestroyed() |
| 520 { | 563 { |
| 521 ASSERT(m_page); | 564 ASSERT(m_page); |
| 522 m_page = 0; | 565 m_page = 0; |
| 523 } | 566 } |
| 524 | 567 |
| 525 bool ScrollingCoordinator::coordinatesScrollingForFrameView(FrameView* frameView ) const | 568 bool ScrollingCoordinator::coordinatesScrollingForFrameView(FrameView* frameView ) const |
| 526 { | 569 { |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 811 stringBuilder.resize(stringBuilder.length() - 2); | 854 stringBuilder.resize(stringBuilder.length() - 2); |
| 812 return stringBuilder.toString(); | 855 return stringBuilder.toString(); |
| 813 } | 856 } |
| 814 | 857 |
| 815 String ScrollingCoordinator::mainThreadScrollingReasonsAsText() const | 858 String ScrollingCoordinator::mainThreadScrollingReasonsAsText() const |
| 816 { | 859 { |
| 817 return mainThreadScrollingReasonsAsText(mainThreadScrollingReasons()); | 860 return mainThreadScrollingReasonsAsText(mainThreadScrollingReasons()); |
| 818 } | 861 } |
| 819 | 862 |
| 820 } // namespace WebCore | 863 } // namespace WebCore |
| OLD | NEW |