Add page overlays that show regions with mouseWheel event handlers, and the non-fast...
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Nov 2014 00:12:48 +0000 (00:12 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Nov 2014 00:12:48 +0000 (00:12 +0000)
commit943ec0cc4128f4725190e6e69d04427ea5f56cb5
tree150c97706a06e14001d3db7a6890796bcc0a5f2e
parentd3f61b00a0e5d1b3543eb83b2e511650f4b41b4b
Add page overlays that show regions with mouseWheel event handlers, and the non-fast-scrollable region, and code to toggle them in MiniBrowser WK2
https://bugs.webkit.org/show_bug.cgi?id=138257

Reviewed by Tim Horton.
Source/WebCore:

Add code for debugging page overlays that show the non-fast scrollable region,
and the region with wheel event handlers. The list of region types is intended
to be easily extensible.

A singleton DebugPageOverlays maintains a map of Frame -> vector of overlays.
A purely inline code path is provided so that DebugPageOverlays::didLayout() is
fast.

For each region type, a PageOverlay::Client subclass knows how to generate
the region, which is painted into a document-level page overlay.

Add a set of bitflags to Settings to control region visibility.

* WebCore.exp.in:
* WebCore.xcodeproj/project.pbxproj:
* page/DebugPageOverlays.cpp: Added.
(WebCore::RegionOverlay::overlay):
(WebCore::MouseWheelRegionOverlay::updateRegion):
(WebCore::NonFastScrollableRegionOverlay::updateRegion):
(WebCore::RegionOverlay::create):
(WebCore::RegionOverlay::RegionOverlay):
(WebCore::RegionOverlay::~RegionOverlay):
(WebCore::RegionOverlay::pageOverlayDestroyed):
(WebCore::RegionOverlay::willMoveToPage):
(WebCore::RegionOverlay::didMoveToPage):
(WebCore::RegionOverlay::drawRect):
(WebCore::RegionOverlay::mouseEvent):
(WebCore::RegionOverlay::didScrollFrame):
(WebCore::RegionOverlay::recomputeRegion):
(WebCore::DebugPageOverlays::shared):
(WebCore::indexOf):
(WebCore::DebugPageOverlays::ensureRegionOverlayForFrame):
(WebCore::DebugPageOverlays::showRegionOverlay):
(WebCore::DebugPageOverlays::hideRegionOverlay):
(WebCore::DebugPageOverlays::regionChanged):
(WebCore::DebugPageOverlays::regionOverlayForFrame):
(WebCore::DebugPageOverlays::updateOverlayRegionVisibility):
(WebCore::DebugPageOverlays::settingsChanged):
* page/DebugPageOverlays.h: Added.
(WebCore::DebugPageOverlays::hasOverlaysForFrame):
(WebCore::DebugPageOverlays::hasOverlays):
(WebCore::DebugPageOverlays::didLayout):
* page/FrameView.cpp:
(WebCore::FrameView::layout):
* page/Settings.h:
* page/Settings.in:

Source/WebKit2:

Add private prefs to control visibility of debug-related page region overlays.

* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/Cocoa/WKPreferences.mm:
(-[WKPreferences _visibleDebugOverlayRegions]):
(-[WKPreferences _setVisibleDebugOverlayRegions:]):
* UIProcess/API/Cocoa/WKPreferencesPrivate.h:
* UIProcess/mac/WebPreferencesMac.mm:
(WebKit::setDebugUInt32ValueIfInUserDefaults):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):
* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::updatePreferences): Update the overlays.
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::updatePreferences): Update the overlays.

Tools:

Add a "Debug Overlays" submenu item under "WebKit2-only Settings" which allows
the user to toggle region page overlays on and off. Two overlays are available,
for the non-fast scrollable region, and the region of element with wheel
event handlers.

* MiniBrowser/mac/SettingsController.h:
* MiniBrowser/mac/SettingsController.m:
(-[SettingsController _populateMenu]):
(-[SettingsController validateMenuItem:]):
(-[SettingsController nonFastScrollableRegionOverlayVisible]):
(-[SettingsController wheelEventHandlerRegionOverlayVisible]):
(-[SettingsController preferenceKeyForRegionOverlayTag:]):
(-[SettingsController toggleDebugOverlay:]):
(-[SettingsController debugOverlayVisible:]):
* MiniBrowser/mac/WK2BrowserWindowController.m:
(-[WK2BrowserWindowController didChangeSettings]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@175494 268f45cc-cd09-0410-ab3c-d52691b4dbfc
23 files changed:
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/page/DebugPageOverlays.cpp [new file with mode: 0644]
Source/WebCore/page/DebugPageOverlays.h [new file with mode: 0644]
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/Settings.h
Source/WebCore/page/Settings.in
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebPreferencesDefinitions.h
Source/WebKit2/UIProcess/API/Cocoa/WKPreferences.mm
Source/WebKit2/UIProcess/API/Cocoa/WKPreferencesPrivate.h
Source/WebKit2/UIProcess/mac/WebPreferencesMac.mm
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm
Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm
Tools/ChangeLog
Tools/MiniBrowser/mac/SettingsController.h
Tools/MiniBrowser/mac/SettingsController.m
Tools/MiniBrowser/mac/WK2BrowserWindowController.m