[GTK] [CMake] Add support for building DumpRenderTree
https://bugs.webkit.org/show_bug.cgi?id=125767

Reviewed by Gustavo Noronha Silva.

* CMakeLists.txt: Load the DumpRenderTree cmake file for GTK+ when WebKit1 is enabled.
* DumpRenderTree/PlatformGTK.cmake: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160937 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] [CMake] Add support for building ImageDiff
https://bugs.webkit.org/show_bug.cgi?id=125960

Reviewed by Gustavo Noronha Silva.

* CMakeLists.txt: Build ImageDiff for GTK+.
* ImageDiff/PlatformGTK.cmake: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160938 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WK2] Add SPI for using a custom protocol handler
https://bugs.webkit.org/show_bug.cgi?id=126089

Reviewed by Anders Carlsson.

* UIProcess/API/C/mac/WKContextPrivateMac.h:
* UIProcess/API/C/mac/WKContextPrivateMac.mm:
(WKContextRegisterSchemeForCustomProtocol):
(WKContextUnregisterSchemeForCustomProtocol):
* UIProcess/API/Cocoa/WKBrowsingContextController.mm:
(+[WKBrowsingContextController registerSchemeForCustomProtocol:]):
(+[WKBrowsingContextController unregisterSchemeForCustomProtocol:]):
* UIProcess/WebContext.cpp:
(WebKit::WebContext::globalURLSchemesWithCustomProtocolHandlers):
(WebKit::WebContext::registerGlobalURLSchemeAsHavingCustomProtocolHandlers):
(WebKit::WebContext::unregisterGlobalURLSchemeAsHavingCustomProtocolHandlers):
* UIProcess/WebContext.h:
* UIProcess/mac/WebContextMac.mm:
(WebKit::WebContext::platformInitializeWebProcess):
(WebKit::WebContext::platformInitializeNetworkProcess):
(WebKit::WebContext::registerNotificationObservers):
(WebKit::WebContext::unregisterNotificationObservers):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160939 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Rename PlugInAutoStartProvider's ...EntriesAddedBeforeTime facility to ...EntriesAddedAfterTime
https://bugs.webkit.org/show_bug.cgi?id=126078

Patch by Ricky Mondello <rmondello@apple.com> on 2013-12-20
Reviewed by Anders Carlsson.

r160922 accidentally named a facility for filtering out data added after a certain time,
"...FilteringOutEntriesAddedBeforeTime", which was incorrect. This patch renames those instances
to "...FilteringOutEntriesAddedAfterTime".

* UIProcess/API/C/WKContext.cpp:
(WKContextSetPlugInAutoStartOriginsFilteringOutEntriesAddedAfterTime):
* UIProcess/API/C/WKContext.h:
* UIProcess/Plugins/PlugInAutoStartProvider.cpp:
(WebKit::PlugInAutoStartProvider::setAutoStartOriginsFilteringOutEntriesAddedAfterTime):
* UIProcess/Plugins/PlugInAutoStartProvider.h:
* UIProcess/WebContext.cpp:
(WebKit::WebContext::setPlugInAutoStartOriginsFilteringOutEntriesAddedAfterTime):
* UIProcess/WebContext.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160940 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Pretty print LayoutUnit, LayoutPoint, and LayoutSize in gdb and lldb
https://bugs.webkit.org/show_bug.cgi?id=126080

Reviewed by Anders Carlsson.

This changes the output of printing LayoutUnits to be in px, removing
the need to divide by 64 manually.

This will lead to gdb output like:

m_frameRect = {
    m_location = LayoutPoint(0px, 0px),
    m_size = LayoutSize(800px, 585px)
}

And lldb output like:

(const WebCore::LayoutRect) $0 = {
  m_location = { x = 744px, y = 1px }
  m_size = { width = 236px, height = 40px }
}

This patch is based on patch for Blink by cbiesinger@chromium.org.

* gdb/webkit.py:
(WebCoreLayoutUnitPrinter):
(WebCoreLayoutUnitPrinter.__init__):
(WebCoreLayoutUnitPrinter.to_string):
(WebCoreLayoutSizePrinter):
(WebCoreLayoutSizePrinter.__init__):
(WebCoreLayoutSizePrinter.to_string):
(WebCoreLayoutPointPrinter):
(WebCoreLayoutPointPrinter.__init__):
(WebCoreLayoutPointPrinter.to_string):
(add_pretty_printers):
* lldb/lldb_webkit.py:
(__lldb_init_module):
(WebCoreLayoutUnit_SummaryProvider):
(WebCoreLayoutSize_SummaryProvider):
(WebCoreLayoutPoint_SummaryProvider):
(WebCoreLayoutUnitProvider):
(WebCoreLayoutUnitProvider.__init__):
(WebCoreLayoutUnitProvider.to_string):
(WebCoreLayoutSizeProvider):
(WebCoreLayoutSizeProvider.__init__):
(WebCoreLayoutSizeProvider.get_width):
(WebCoreLayoutSizeProvider.get_height):
(WebCoreLayoutPointProvider):
(WebCoreLayoutPointProvider.__init__):
(WebCoreLayoutPointProvider.get_x):
(WebCoreLayoutPointProvider.get_y):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160941 268f45cc-cd09-0410-ab3c-d52691b4dbfc
PostAttachCallbackDisabler should take a Document
https://bugs.webkit.org/show_bug.cgi?id=126090

Reviewed by Andreas Kling.

suspendPostAttachCallbacks and resumePostAttachCallbacks always only get the document from the
container node, so make them static member functions that take a Document&. Also, move PostAttachCallbackDisabler
to Element.h in preparation for moving post attach callback handling to Element.

* dom/ContainerNode.cpp:
(WebCore::ContainerNode::suspendPostAttachCallbacks):
(WebCore::ContainerNode::resumePostAttachCallbacks):
* dom/ContainerNode.h:
* dom/Element.h:
(WebCore::PostAttachCallbackDisabler::PostAttachCallbackDisabler):
(WebCore::PostAttachCallbackDisabler::~PostAttachCallbackDisabler):
* style/StyleResolveTree.cpp:
(WebCore::Style::attachRenderTree):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160942 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Revert r160327, r160273, and r160260.

We'll come up with something less aggressive, as this doesn't quite work.

* loader/cache/CachedImage.h:
* loader/cache/CachedResource.h:
* loader/cache/MemoryCache.cpp:
(WebCore::MemoryCache::pruneLiveResourcesToSize):
* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::destroyDecodedDataIfNecessary):
* platform/graphics/BitmapImage.h:
* platform/graphics/Image.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160943 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Change "threaded scrolling" terminology to "asynchronous scrolling"
https://bugs.webkit.org/show_bug.cgi?id=126094

Source/WebCore:

Reviewed by Tim Horton.

Rename ENABLE_THREADED_SCROLLING to ENABLE_ASYNC_SCROLLING, and change
references to "main thread scrolling" to "synchronous scrolling".

In a few places, functions with names like shouldUpdateScrollLayerPositionOnMainThread()
were actually returning SynchronousScrollingReasons, so rename them appropriately.

* WebCore.exp.in:
* page/FrameView.cpp:
(WebCore::FrameView::shouldUpdateCompositingLayersAfterScrolling):
(WebCore::FrameView::isRubberBandInProgress):
(WebCore::FrameView::requestScrollPositionUpdate):
(WebCore::FrameView::updatesScrollLayerPositionOnMainThread):
(WebCore::FrameView::wheelEvent):
* page/Page.cpp:
(WebCore::Page::synchronousScrollingReasonsAsText):
* page/Page.h:
* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::ScrollingCoordinator::create):
(WebCore::ScrollingCoordinator::ScrollingCoordinator):
(WebCore::ScrollingCoordinator::frameViewHasSlowRepaintObjectsDidChange):
(WebCore::ScrollingCoordinator::frameViewFixedObjectsDidChange):
(WebCore::ScrollingCoordinator::frameViewRootLayerDidChange):
(WebCore::ScrollingCoordinator::synchronousScrollingReasons):
(WebCore::ScrollingCoordinator::updateSynchronousScrollingReasons):
(WebCore::ScrollingCoordinator::setForceSynchronousScrollLayerPositionUpdates):
(WebCore::ScrollingCoordinator::synchronousScrollingReasonsAsText):
* page/scrolling/ScrollingCoordinator.h:
(WebCore::ScrollingCoordinator::shouldUpdateScrollLayerPositionSynchronously):
(WebCore::ScrollingCoordinator::setSynchronousScrollingReasons):
* page/scrolling/ScrollingStateFixedNode.cpp:
* page/scrolling/ScrollingStateFixedNode.h:
* page/scrolling/ScrollingStateNode.cpp:
* page/scrolling/ScrollingStateNode.h:
* page/scrolling/ScrollingStateScrollingNode.cpp:
(WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
(WebCore::ScrollingStateScrollingNode::setSynchronousScrollingReasons):
(WebCore::ScrollingStateScrollingNode::dumpProperties):
* page/scrolling/ScrollingStateScrollingNode.h: Awkward "ReasonsForSynchronousScrolling" to avoid
conflict with the enum called SynchronousScrollingReasons.
* page/scrolling/ScrollingStateStickyNode.cpp:
* page/scrolling/ScrollingStateStickyNode.h:
* page/scrolling/ScrollingStateTree.cpp:
* page/scrolling/ScrollingStateTree.h:
* page/scrolling/ScrollingThread.cpp:
* page/scrolling/ScrollingThread.h:
* page/scrolling/ScrollingTree.cpp:
* page/scrolling/ScrollingTree.h:
* page/scrolling/ScrollingTreeNode.cpp:
* page/scrolling/ScrollingTreeNode.h:
* page/scrolling/ScrollingTreeScrollingNode.cpp:
(WebCore::ScrollingTreeScrollingNode::ScrollingTreeScrollingNode):
(WebCore::ScrollingTreeScrollingNode::updateBeforeChildren):
* page/scrolling/ScrollingTreeScrollingNode.h:
(WebCore::ScrollingTreeScrollingNode::synchronousScrollingReasons):
(WebCore::ScrollingTreeScrollingNode::shouldUpdateScrollLayerPositionSynchronously):
* page/scrolling/mac/ScrollingCoordinatorMac.h:
* page/scrolling/mac/ScrollingCoordinatorMac.mm:
(WebCore::ScrollingCoordinatorMac::setSynchronousScrollingReasons):
(WebCore::ScrollingCoordinatorMac::commitTreeState):
* page/scrolling/mac/ScrollingStateNodeMac.mm:
* page/scrolling/mac/ScrollingStateScrollingNodeMac.mm:
* page/scrolling/mac/ScrollingThreadMac.mm:
* page/scrolling/mac/ScrollingTreeFixedNode.h:
* page/scrolling/mac/ScrollingTreeFixedNode.mm:
* page/scrolling/mac/ScrollingTreeScrollingNodeMac.h:
* page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm:
(WebCore::ScrollingTreeScrollingNodeMac::updateBeforeChildren):
(WebCore::ScrollingTreeScrollingNodeMac::scrollPosition):
(WebCore::ScrollingTreeScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints):
(WebCore::ScrollingTreeScrollingNodeMac::setScrollLayerPosition):
(WebCore::logThreadedScrollingMode):
* page/scrolling/mac/ScrollingTreeStickyNode.h:
* page/scrolling/mac/ScrollingTreeStickyNode.mm:
* platform/Scrollbar.cpp:
(WebCore::Scrollbar::supportsUpdateOnSecondaryThread):
* platform/graphics/TiledBacking.h:
* platform/graphics/ca/mac/TileController.mm:
(WebCore::TileController::TileController):
(WebCore::TileController::updateTileCoverageMap):
* platform/mac/MemoryPressureHandlerMac.mm:
(WebCore::MemoryPressureHandler::releaseMemory):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::setupFontSubpixelQuantization):
* rendering/RenderLayerBacking.cpp:
(WebCore::computeTileCoverage):
* testing/Internals.cpp:
(WebCore::Internals::mainThreadScrollingReasons):
* testing/Internals.idl:

Source/WebKit2:

Reviewed by Tim Horton.

Rename ENABLE_THREADED_SCROLLING to ENABLE_ASYNC_SCROLLING, and change
references to "main thread scrolling" to "synchronous scrolling".

* WebProcess/WebPage/EventDispatcher.cpp:
(WebKit::EventDispatcher::wheelEvent):
* WebProcess/WebPage/EventDispatcher.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
(WebKit::WebPage::~WebPage):
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::didInstallPageOverlay):
(WebKit::TiledCoreAnimationDrawingArea::didUninstallPageOverlay):
(WebKit::TiledCoreAnimationDrawingArea::updatePreferences):
(WebKit::TiledCoreAnimationDrawingArea::dispatchAfterEnsuringUpdatedScrollPosition):

Source/WTF:

Reviewed by Tim Horton.

Rename ENABLE_THREADED_SCROLLING to ENABLE_ASYNC_SCROLLING.

* wtf/FeatureDefines.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160944 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Allow ImageBuffer to re-use IOSurfaces
https://bugs.webkit.org/show_bug.cgi?id=125477

Reviewed by Geoff Garen.

PerformanceTests:

This test times creating a variety of different sizes of canvases
once some have already been created. The second creation of the
canvases should re-use the existing IOSurfaces.

* Canvas/reuse.html: Added.

Source/WebCore:

This test adds a static class, ImageBufferBackingStoreCache, that vends
IOSurfaces. It remembers IOSurfaces that have been returned to it until
a configurable timeout.

The storage used by this class is in the form of a HashMap from a
bucketed size to the IOSurface. There are many other data structures
that could be used, but this implementation gives a 80% hit rate on
normal browsing of some example sites with Canvas and
text-decoration-skip: ink. Because the buckets are fairly
small (rounding the width and height up to multiples of 8), traversing the
bucket contents takes on average 2 steps.

Test: fast/canvas/canvas-backing-store-reuse.html

* WebCore.xcodeproj/project.pbxproj: Added new caching class
* platform/graphics/cg/ImageBufferBackingStoreCache.cpp: Added.
(WebCore::createIOSurface): Moved from ImageBufferCG.cpp
(WebCore::ImageBufferBackingStoreCache::timerFired): Forget the cache
contents
(WebCore::ImageBufferBackingStoreCache::schedulePurgeTimer):
(WebCore::ImageBufferBackingStoreCache::get): Static getter
(WebCore::ImageBufferBackingStoreCache::ImageBufferBackingStoreCache):
(WebCore::ImageBufferBackingStoreCache::insertIntoCache): Memory-management
creation function
(WebCore::ImageBufferBackingStoreCache::takeFromCache): Memory-management
deletion function
(WebCore::ImageBufferBackingStoreCache::isAcceptableSurface): Does this cached
IOSurface fit the bill?
(WebCore::ImageBufferBackingStoreCache::tryTakeFromCache): Lookup
a bucket and walk through its contents
(WebCore::ImageBufferBackingStoreCache::getOrAllocate): Public function
for clients who want a IOSurface from the cache
(WebCore::ImageBufferBackingStoreCache::deallocate): Public
function for clients to return an IOSurface to the pool
* platform/graphics/cg/ImageBufferBackingStoreCache.h: Added.
* platform/graphics/cg/ImageBufferCG.cpp: Update to use new cache
(WebCore::ImageBuffer::ImageBuffer):
(WebCore::ImageBuffer::~ImageBuffer):

LayoutTests:

Now that we're re-using the backing store of canvases, this
test makes sure that if we draw to a canvas, then destroy it,
then create a new canvas (which should share the same backing
store) that it doesn't have the stale data in it

* fast/canvas/canvas-backing-store-reuse-expected.txt: Added.
* fast/canvas/canvas-backing-store-reuse.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160945 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: Give the CommandLineAPIModule its own Host object, making InjectedScriptHost viable for a JS Context
https://bugs.webkit.org/show_bug.cgi?id=126082

Reviewed by Timothy Hatcher.

Extract CommandLineAPIHost from InjectedScriptHost. The command line API contained
a bunch of DOM specific JavaScript that would not be suitable for a pure JavaScript
environment. Now that the DOM related code is in this WebCore only module, give this
module a host object that WebCore will provide.

No new tests, no observable change in functionality.

* CMakeLists.txt:
* DerivedSources.cpp:
* DerivedSources.make:
* GNUmakefile.list.am:
* UseJSC.cmake:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSBindingsAllInOne.cpp:
Add new files.

* bindings/js/JSCommandLineAPIHostCustom.cpp: Added.
(WebCore::JSCommandLineAPIHost::inspectedObject):
(WebCore::getJSListenerFunctions):
(WebCore::JSCommandLineAPIHost::getEventListeners):
(WebCore::JSCommandLineAPIHost::inspect):
(WebCore::JSCommandLineAPIHost::databaseId):
(WebCore::JSCommandLineAPIHost::storageId):
* bindings/js/JSInjectedScriptHostCustom.cpp:
* inspector/CommandLineAPIHost.cpp: Copied from Source/WebCore/inspector/InjectedScriptHost.cpp.
(WebCore::CommandLineAPIHost::create):
(WebCore::CommandLineAPIHost::CommandLineAPIHost):
(WebCore::CommandLineAPIHost::~CommandLineAPIHost):
(WebCore::CommandLineAPIHost::disconnect):
(WebCore::CommandLineAPIHost::inspectImpl):
(WebCore::CommandLineAPIHost::getEventListenersImpl):
(WebCore::CommandLineAPIHost::clearConsoleMessages):
(WebCore::CommandLineAPIHost::copyText):
(WebCore::CommandLineAPIHost::InspectableObject::get):
(WebCore::CommandLineAPIHost::addInspectedObject):
(WebCore::CommandLineAPIHost::clearInspectedObjects):
(WebCore::CommandLineAPIHost::inspectedObject):
(WebCore::CommandLineAPIHost::databaseIdImpl):
(WebCore::CommandLineAPIHost::storageIdImpl):
* inspector/CommandLineAPIHost.h: Copied from Source/WebCore/inspector/InjectedScriptHost.h.
(WebCore::CommandLineAPIHost::init):
* inspector/CommandLineAPIHost.idl: Copied from Source/WebCore/inspector/InjectedScriptHost.idl.
* inspector/CommandLineAPIModule.cpp:
These are almost all pure copies from InjectedScriptHost files. Cleaned up a bit.

* inspector/InjectedScriptModule.h:
* inspector/InjectedScriptModule.cpp:
(WebCore::InjectedScriptModule::ensureInjected):
Modules can now define a host object when they are getting injected.

(WebCore::CommandLineAPIModule::host):
* inspector/CommandLineAPIModule.h:
Provide a CommandLineAPIHost, host object.

* inspector/InjectedScriptCanvasModule.h:
* inspector/InjectedScriptCanvasModule.cpp:
(WebCore::InjectedScriptCanvasModule::host):
No host object is needed for the CanvasModule.

* inspector/InjectedScriptSource.js:
* inspector/CommandLineAPIModuleSource.js:
When injecting a module, pass on an optional host object to
the module's source. Move a little more code between the
two files. The two files are very tightly coupled right now.

* inspector/InjectedScriptHost.cpp:
(WebCore::InjectedScriptHost::create):
* inspector/InjectedScriptHost.h:
(WebCore::InjectedScriptHost::~InjectedScriptHost):
(WebCore::InjectedScriptHost::InjectedScriptHost):
* inspector/InjectedScriptHost.idl:
Move any command line specific logic to CommandLineAPIHost classes.

* inspector/InjectedScriptManager.cpp:
(WebCore::InjectedScriptManager::disconnect):
* inspector/InjectedScriptManager.h:
(WebCore::InjectedScriptManager::commandLineAPIHost):
* inspector/InspectorConsoleAgent.cpp:
(WebCore::InspectorConsoleAgent::addInspectedHeapObject):
* inspector/InspectorController.cpp:
(WebCore::InspectorController::InspectorController):
* inspector/InspectorHeapProfilerAgent.cpp:
(WebCore::InspectorHeapProfilerAgent::resetState):
* inspector/InspectorProfilerAgent.cpp:
(WebCore::InspectorProfilerAgent::resetState):
* inspector/PageConsoleAgent.cpp:
(WebCore::PageConsoleAgent::addInspectedNode):
* inspector/PageInjectedScriptManager.cpp:
(WebCore::PageInjectedScriptManager::PageInjectedScriptManager):
(WebCore::PageInjectedScriptManager::disconnect):
* inspector/PageInjectedScriptManager.h:
* inspector/WorkerInspectorController.cpp:
(WebCore::WorkerInspectorController::WorkerInspectorController):
An InjectedScriptManager may optionally have a commandLineAPIHost object.
If it does, initialize it, and send it messages.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160946 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Try to fix the Windows build.

* WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160948 268f45cc-cd09-0410-ab3c-d52691b4dbfc