Changeset 167970 in webkit
- Timestamp:
- Apr 29, 2014 4:53:57 PM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r167969 r167970 1 2014-04-29 Simon Fraser <simon.fraser@apple.com> 2 3 Remove some PLATFORM(IOS) #ifdefs related to hasAcceleratedTouchScrolling() 4 https://bugs.webkit.org/show_bug.cgi?id=132353 5 6 Reviewed by Tim Horton & Darin Adler. 7 8 Minor cleanup and refactoring to remove #idefs. 9 10 * rendering/RenderLayer.cpp: 11 (WebCore::RenderLayer::scrollTo): No need for this #ifdef, usesCompositedScrolling() 12 gives the right answser already. 13 (WebCore::RenderLayer::visibleContentRectInternal): Use showsOverflowControls() to 14 avoid #ifdef. 15 (WebCore::RenderLayer::invalidateScrollbarRect): Ditto. 16 (WebCore::RenderLayer::invalidateScrollCornerRect): Ditto. 17 (WebCore::RenderLayer::verticalScrollbarWidth): Ditto. 18 (WebCore::RenderLayer::horizontalScrollbarHeight): Ditto. 19 (WebCore::RenderLayer::showsOverflowControls): Return false on iOS. 20 (WebCore::RenderLayer::paintOverflowControls): Ditto. 21 (WebCore::RenderLayer::calculateClipRects): Ditto. 22 * rendering/RenderLayer.h: 23 * rendering/RenderLayerBacking.cpp: 24 (WebCore::layerOrAncestorIsTransformedOrUsingCompositedScrolling): 25 Just #ifdef in side of this function rather than having two similar functions. 26 (WebCore::RenderLayerBacking::shouldClipCompositedBounds): 27 (WebCore::hasNonZeroTransformOrigin): 28 (WebCore::RenderLayerBacking::updateGraphicsLayerConfiguration): Use a local bool 29 to reduce #ifdefs. 30 (WebCore::layerOrAncestorIsTransformedOrScrolling): Deleted. 31 1 32 2014-04-29 Simon Fraser <simon.fraser@apple.com> 2 33 -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r167965 r167970 2365 2365 2366 2366 // Just schedule a full repaint of our object. 2367 #if PLATFORM(IOS)2368 if (!hasAcceleratedTouchScrolling())2369 #else2370 2367 if (requiresRepaint) 2371 #endif2372 2368 renderer().repaintUsingContainer(repaintContainer, m_repaintRect); 2373 2369 … … 2696 2692 int verticalScrollbarWidth = 0; 2697 2693 int horizontalScrollbarHeight = 0; 2698 if (s crollbarInclusion == IncludeScrollbars) {2694 if (showsOverflowControls() && scrollbarInclusion == IncludeScrollbars) { 2699 2695 verticalScrollbarWidth = (verticalScrollbar() && !verticalScrollbar()->isOverlayScrollbar()) ? verticalScrollbar()->width() : 0; 2700 2696 horizontalScrollbarHeight = (horizontalScrollbar() && !horizontalScrollbar()->isOverlayScrollbar()) ? horizontalScrollbar()->height() : 0; 2701 2702 #if PLATFORM(IOS)2703 if (hasAcceleratedTouchScrolling()) {2704 verticalScrollbarWidth = 0;2705 horizontalScrollbarHeight = 0;2706 }2707 #endif2708 2697 } 2709 2698 … … 2925 2914 void RenderLayer::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rect) 2926 2915 { 2927 #if PLATFORM(IOS) 2928 // No need to invalidate scrollbars if we're using accelerated scrolling. 2929 if (hasAcceleratedTouchScrolling()) 2930 return; 2931 #endif 2916 if (!showsOverflowControls()) 2917 return; 2932 2918 2933 2919 if (scrollbar == m_vBar.get()) { … … 2961 2947 void RenderLayer::invalidateScrollCornerRect(const IntRect& rect) 2962 2948 { 2963 #if PLATFORM(IOS) 2964 // No need to invalidate the scroll corner if we're using accelerated scrolling. 2965 if (hasAcceleratedTouchScrolling()) 2966 return; 2967 #endif 2949 if (!showsOverflowControls()) 2950 return; 2968 2951 2969 2952 if (GraphicsLayer* layer = layerForScrollCorner()) { … … 3085 3068 int RenderLayer::verticalScrollbarWidth(OverlayScrollbarSizeRelevancy relevancy) const 3086 3069 { 3087 if (!m_vBar || (m_vBar->isOverlayScrollbar() && (relevancy == IgnoreOverlayScrollbarSize || !m_vBar->shouldParticipateInHitTesting()))) 3070 if (!m_vBar 3071 || !showsOverflowControls() 3072 || (m_vBar->isOverlayScrollbar() && (relevancy == IgnoreOverlayScrollbarSize || !m_vBar->shouldParticipateInHitTesting()))) 3088 3073 return 0; 3089 3074 3090 #if PLATFORM(IOS) 3091 if (hasAcceleratedTouchScrolling()) 3075 return m_vBar->width(); 3076 } 3077 3078 int RenderLayer::horizontalScrollbarHeight(OverlayScrollbarSizeRelevancy relevancy) const 3079 { 3080 if (!m_hBar 3081 || !showsOverflowControls() 3082 || (m_hBar->isOverlayScrollbar() && (relevancy == IgnoreOverlayScrollbarSize || !m_hBar->shouldParticipateInHitTesting()))) 3092 3083 return 0; 3093 #endif3094 3095 return m_vBar->width();3096 }3097 3098 int RenderLayer::horizontalScrollbarHeight(OverlayScrollbarSizeRelevancy relevancy) const3099 {3100 if (!m_hBar || (m_hBar->isOverlayScrollbar() && (relevancy == IgnoreOverlayScrollbarSize || !m_hBar->shouldParticipateInHitTesting())))3101 return 0;3102 3103 #if PLATFORM(IOS)3104 if (hasAcceleratedTouchScrolling())3105 return 0;3106 #endif3107 3084 3108 3085 return m_hBar->height(); … … 3375 3352 } 3376 3353 3377 void RenderLayer::paintOverflowControls(GraphicsContext* context, const IntPoint& paintOffset, const IntRect& damageRect, bool paintingOverlayControls) 3378 { 3379 // Don't do anything if we have no overflow. 3380 if (!renderer().hasOverflowClip()) 3381 return; 3382 3354 bool RenderLayer::showsOverflowControls() const 3355 { 3383 3356 #if PLATFORM(IOS) 3384 3357 // Don't render (custom) scrollbars if we have accelerated scrolling. 3385 3358 if (hasAcceleratedTouchScrolling()) 3386 return ;3359 return false; 3387 3360 #endif 3361 3362 return true; 3363 } 3364 3365 void RenderLayer::paintOverflowControls(GraphicsContext* context, const IntPoint& paintOffset, const IntRect& damageRect, bool paintingOverlayControls) 3366 { 3367 // Don't do anything if we have no overflow. 3368 if (!renderer().hasOverflowClip()) 3369 return; 3370 3371 if (!showsOverflowControls()) 3372 return; 3388 3373 3389 3374 // Overlay scrollbars paint in a second pass through the layer tree so that they will paint … … 6426 6411 #endif 6427 6412 #if PLATFORM(IOS) 6428 6413 && !hasAcceleratedTouchScrolling() 6429 6414 #endif 6430 6415 #if ENABLE(CSS_COMPOSITING) … … 6433 6418 && !isTransparent() 6434 6419 && !needsCompositedScrolling() 6435 && !renderer().style().hasFlowFrom() 6436 ; 6420 && !renderer().style().hasFlowFrom(); 6437 6421 } 6438 6422 -
trunk/Source/WebCore/rendering/RenderLayer.h
r167796 r167970 459 459 void setRequiresScrollBoundsOriginUpdate(bool requiresUpdate = true) { m_requiresScrollBoundsOriginUpdate = requiresUpdate; } 460 460 461 // Returns true when the layer could do touch scrolling, but doesn't look at whether there is actually scrollable overflow. 461 462 bool hasAcceleratedTouchScrolling() const; 462 463 463 #endif 464 464 … … 1058 1058 bool hasScrollableHorizontalOverflow() const; 1059 1059 bool hasScrollableVerticalOverflow() const; 1060 1061 bool showsOverflowControls() const; 1060 1062 1061 1063 bool shouldBeNormalFlowOnly() const; -
trunk/Source/WebCore/rendering/RenderLayerBacking.cpp
r167965 r167970 401 401 #endif 402 402 403 // FIXME: the hasAcceleratedTouchScrolling()/needsCompositedScrolling() concepts need to be merged. 404 static bool layerOrAncestorIsTransformedOrUsingCompositedScrolling(RenderLayer& layer) 405 { 406 for (RenderLayer* curr = &layer; curr; curr = curr->parent()) { 407 if (curr->hasTransform() 408 #if PLATFORM(IOS) 409 || curr->hasAcceleratedTouchScrolling() 410 #else 411 || curr->needsCompositedScrolling() 412 #endif 413 ) 414 return true; 415 } 416 417 return false; 418 } 419 420 bool RenderLayerBacking::shouldClipCompositedBounds() const 421 { 422 #if !PLATFORM(IOS) 423 // Scrollbar layers use this layer for relative positioning, so don't clip. 424 if (layerForHorizontalScrollbar() || layerForVerticalScrollbar()) 425 return false; 426 #endif 427 428 if (m_usingTiledCacheLayer) 429 return false; 430 431 if (layerOrAncestorIsTransformedOrUsingCompositedScrolling(m_owningLayer)) 432 return false; 433 434 if (m_owningLayer.isFlowThreadCollectingGraphicsLayersUnderRegions()) 435 return false; 436 437 return true; 438 } 439 403 440 static bool hasNonZeroTransformOrigin(const RenderObject& renderer) 404 441 { … … 406 443 return (style.transformOriginX().type() == Fixed && style.transformOriginX().value()) 407 444 || (style.transformOriginY().type() == Fixed && style.transformOriginY().value()); 408 }409 410 #if PLATFORM(IOS)411 // FIXME: We should merge the concept of RenderLayer::{hasAcceleratedTouchScrolling, needsCompositedScrolling}()412 // so that we can remove this iOS-specific variant.413 static bool layerOrAncestorIsTransformedOrScrolling(RenderLayer& layer)414 {415 for (RenderLayer* curr = &layer; curr; curr = curr->parent()) {416 if (curr->hasTransform() || curr->hasAcceleratedTouchScrolling())417 return true;418 }419 420 return false;421 }422 #else423 static bool layerOrAncestorIsTransformedOrUsingCompositedScrolling(RenderLayer& layer)424 {425 for (RenderLayer* curr = &layer; curr; curr = curr->parent()) {426 if (curr->hasTransform() || curr->needsCompositedScrolling())427 return true;428 }429 430 return false;431 }432 #endif433 434 bool RenderLayerBacking::shouldClipCompositedBounds() const435 {436 #if !PLATFORM(IOS)437 // Scrollbar layers use this layer for relative positioning, so don't clip.438 if (layerForHorizontalScrollbar() || layerForVerticalScrollbar())439 return false;440 #endif441 442 if (m_usingTiledCacheLayer)443 return false;444 445 #if !PLATFORM(IOS)446 if (layerOrAncestorIsTransformedOrUsingCompositedScrolling(m_owningLayer))447 return false;448 #else449 if (layerOrAncestorIsTransformedOrScrolling(m_owningLayer))450 return false;451 #endif452 453 if (m_owningLayer.isFlowThreadCollectingGraphicsLayersUnderRegions())454 return false;455 456 return true;457 445 } 458 446 … … 549 537 550 538 bool needsDescendentsClippingLayer = compositor().clipsCompositingDescendants(m_owningLayer); 551 539 bool usesCompositedScrolling; 552 540 #if PLATFORM(IOS) 541 usesCompositedScrolling = m_owningLayer.hasAcceleratedTouchScrolling(); 542 #else 543 usesCompositedScrolling = m_owningLayer.needsCompositedScrolling(); 544 #endif 545 553 546 // Our scrolling layer will clip. 554 if ( m_owningLayer.hasAcceleratedTouchScrolling())547 if (usesCompositedScrolling) 555 548 needsDescendentsClippingLayer = false; 556 #else557 // Our scrolling layer will clip.558 if (m_owningLayer.needsCompositedScrolling())559 needsDescendentsClippingLayer = false;560 #endif // PLATFORM(IOS)561 549 562 550 if (updateAncestorClippingLayer(compositor().clippedByAncestor(m_owningLayer))) … … 569 557 layerConfigChanged = true; 570 558 571 #if PLATFORM(IOS) 572 if (updateScrollingLayers(m_owningLayer.hasAcceleratedTouchScrolling())) 559 if (updateScrollingLayers(usesCompositedScrolling)) 573 560 layerConfigChanged = true; 574 #else575 if (updateScrollingLayers(m_owningLayer.needsCompositedScrolling()))576 layerConfigChanged = true;577 #endif // PLATFORM(IOS)578 561 579 562 if (layerConfigChanged)
Note: See TracChangeset
for help on using the changeset viewer.