Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Show a scrolling indicator light when compositing borders are turned on
https://bugs.webkit.org/show_bug.cgi?id=82758 <rdar://problem/11143892> Reviewed by Andreas Kling. Source/WebCore: With this change, turning on compositing borders also turn on a tiny indicator in the top left corner. This indicator uses color coding to show where wheel events are handled and where the scroll layer position is updated: - Green means that both wheel events and scroll layer position updates are handled on the scrolling thread. - Yellow means that wheel events need to be dispatched to the main thread (due to wheel event handlers), but that scroll layer position updates still happen on the scrolling thread. - Red means that scroll layer position updates happen on the main thread (due to background-attachment: fixed or fixed position objects). * WebCore.exp.in: * WebCore.xcodeproj/project.pbxproj: * page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::commitNewTreeState): Call updateDebugRootLayer(). * page/scrolling/ScrollingTreeNode.h: (WebCore::ScrollingTreeNode::shouldUpdateScrollLayerPositionOnMainThread): Make this public. (ScrollingTreeNode): * page/scrolling/mac/ScrollingTreeMac.mm: Added. (WebCore::ScrollingTree::setDebugRootLayer): Set up a new debug info sublayer. (WebCore::ScrollingTree::updateDebugRootLayer): Update the debug root layer background color based on the scrolling tree state. Source/WebKit2: * WebProcess/WebPage/DrawingArea.h: (WebKit::DrawingArea::updatePreferences): Add a hook for letting drawing area subclasses know when preferences change. * WebProcess/WebPage/WebPage.cpp: Call DrawingArea::updatePreferences. (WebKit::WebPage::updatePreferences): * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea): Call updatePreferences. (WebKit::TiledCoreAnimationDrawingArea::updatePreferences): If compositing borders are enabled, create a debug root layer and tell the scrolling tree about it. (WebKit::TiledCoreAnimationDrawingArea::setRootCompositingLayer): If we have a debug root layer, make sure it's in front. Canonical link: https://commits.webkit.org/100087@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@112707 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Anders Carlsson
committed
Mar 30, 2012
1 parent
fac78d5
commit 44558a3
Showing
12 changed files
with
198 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* Copyright (C) 2012 Apple Inc. All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | ||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | ||
* THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#import "config.h" | ||
#import "ScrollingTree.h" | ||
|
||
#import "AutodrainedPool.h" | ||
#import "ScrollingTreeNodeMac.h" | ||
#import <QuartzCore/CATextLayer.h> | ||
|
||
namespace WebCore { | ||
|
||
void ScrollingTree::setDebugRootLayer(CALayer *rootLayer) | ||
{ | ||
AutodrainedPool pool; | ||
|
||
[m_debugInfoLayer.get() removeFromSuperlayer]; | ||
|
||
if (!rootLayer) | ||
return; | ||
|
||
m_debugInfoLayer = [CALayer layer]; | ||
[rootLayer addSublayer:m_debugInfoLayer.get()]; | ||
|
||
[m_debugInfoLayer.get() setBorderWidth:1]; | ||
[m_debugInfoLayer.get() setBorderColor:CGColorGetConstantColor(kCGColorBlack)]; | ||
|
||
[m_debugInfoLayer.get() setFrame:CGRectMake(0, 0, 25, 25)]; | ||
updateDebugRootLayer(); | ||
} | ||
|
||
void ScrollingTree::updateDebugRootLayer() | ||
{ | ||
if (!m_debugInfoLayer) | ||
return; | ||
|
||
AutodrainedPool pool; | ||
|
||
RetainPtr<CGColorRef> backgroundColor; | ||
|
||
if (m_rootNode->shouldUpdateScrollLayerPositionOnMainThread()) | ||
backgroundColor = adoptCF(CGColorCreateGenericRGB(1, 0, 0, .7)); | ||
|
||
{ | ||
MutexLocker lock(m_mutex); | ||
if (m_hasWheelEventHandlers) { | ||
if (!backgroundColor) | ||
backgroundColor = adoptCF(CGColorCreateGenericRGB(1, 1, 0, .7)); | ||
} | ||
} | ||
|
||
if (!backgroundColor) | ||
backgroundColor = adoptCF(CGColorCreateGenericRGB(0, 1, 0, .7)); | ||
|
||
[m_debugInfoLayer.get() setBackgroundColor:backgroundColor.get()]; | ||
} | ||
|
||
} // namespace WebCore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters