When converting the GdkEvent to XEvent we need to send the
hardware_keycode as XEvent::keycode. Instead we where sending
the GdkEvent::keyval. This is already tested by
plugins/keyboard-events.html, but a bug in the test plugin was
resulting in false positive.

nrwt - clean up create_driver interface and print out the
command line used for DumpRenderTree/TestShell.

This patch adds a driver_cmd_line() call to the Port class in
order to retrive the command line to print it out (as part of
--print config).

In addition, this patch cleans up the Port.create_driver()
signature and the Driver constructor interface to take a worker
number and no longer require the image_path argument (Chromium's
drivers now synthesize the image_path from the worker number
internally).

(WebKit::WebPageContextMenuClient::customContextMenuItemSelected): Added for WK2 apps to get a callback.

UIProcess/WebPageContextMenuClient.h:

UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::contextMenuItemSelected):

UIProcess/mac/WebContextMenuProxyMac.mm:

(-[WebUserDataWrapper initWithUserData:WebKit::]): Add an "APIObject" user data wrapper class to associate with the NSMenuItem.
(-[WebUserDataWrapper WebKit::]):
(-[WebMenuTarget forwardContextMenuAction:]): Include the user data object in the created ContextMenuItemData.
(WebKit::nsMenuItemVector):

This adds a basic texture manager to the Chromium compositor to limit the amount of VRAM
used by compositor textures and switches ContentLayerChromium, ImageLayerChromium, and
RenderSurfaceChromium to use managed LayerTexture. The other *LayerChromium classes (Canvas,
Video, and WebGL) and the root layer are still unmanaged.

The TextureManager works by providing tokens to callers that want to use a managed texture.
The token can be used to request a texture, see if the previously requested texture is still
available, and to protect/unprotect textures when they cannot be collected. Whenever a
texture is created the manager attempts to free up the least recently used textures until the
total memory use is below the provided threshhold. If the manager cannot satisfy the memory
limit it will not return any new textures until some old textures are released.

A LayerTexture wraps a TextureManager token, size, and format. A LayerChromium can check if a
previously requested texture is still available for use and reserve the LayerTexture's underlying
storage between the updateContentsIfDirty() and the draw() call.

Also changes LayerChromium from having separate contentsDirty()/updateContents() calls to a single
updateContentsIfDirty().

Modify Mac, Windows and GTK DRT implementations to disable pixel output
when encountering a text/plain response (the Chromium one already does
this, and none of the other ports special-case text/plain output in
the first place).

Instead of listing two targets for rules that have two outputs, make
a dependency chain. This fixes the issue where some files are generated
unconditionally. Also remove all unnecessary semicolons from the file.

Add signals that encapsulate the functionality of the Mac EditingDelegate. These signals
are private for now, but DRT consumes them to produce proper output for editing tests.
After some time, these may be part of the public API.

Add ASSERT_NOT_REACHED() if the given WebCore type doesn't have an equivalent type in Qt.
Also change the return value of toQtLineJoin() from Qt::MiterJoin to the default Qt::SvgMiterJoin,
because the previous one doesn't work currently.

GLib methods use UTF-8 strings, so we have to convert from UTF-16 to
UTF-8 to perform the case operations and then convert back the result to
UTF-16. GLib conversion methods return a new allocated string, so we
have to memcpy the result into the destination buffer too. Using our
own methods to convert between UTF-8 and UTF-16 from wtf/unicode/UTF8.h
we don't need such memcpy, since they take an already allocated buffer
rather than returning a new one. There's another optimization for the
case when the destination buffer is not large enough. In that case,
methods should return the expected destination buffer size and are
called again with a new buffer. We can avoid the conversion to UTF-16 by
pre-calculating the required size for the destination buffer.

This is an asynchronous script test which navigates the main page but
relies on js-test-post.js calling LayoutTestController.waitUntilDone().
It's possible for the main page to be navigated and hence the load of
js-test-post.js to be cancelled before
LayoutTestController.waitUntilDone() is called, which causes the test to
fail.

This patch cleans up the logic used to shard tests into groups a
bit and adds the --worker-model flag to NRWT. The flag is only
used at the moment to control whether to run single-threaded or
not, but eventually will also allow toggling between threads and
processes.

Also add a minor cleanup with _test_is_slow(), which just
eliminates some repetition and gives slightly better encapsulation.

dispatchEvent call in EventSource endRequest can lead to calling endRequest
again which frees up the pending activity. Make sure we have request in flight
to prevent that from happening.​https://bugs.webkit.org/show_bug.cgi?id=49448

Set the area of the widget where the tooltip should be shown when
a new tooltip is set. Since the widget is the same (the view), if
the tooltip area is not set and a new tooltip is triggered while
the previous one is still visible, the text of the tooltip is
updated but its position doesn't change.

DocumentLoader::m_documentLoadTiming is used to record how long firing
the load event took. But the DocumentLoader was being destroyed while
the event was being dispatched (due to a call to document.open), which
meant that when we tried to record the time when the load event
finished, we were writing into freed memory. We now protect the
DocumentLoader using a RefPtr. (I initially made a change where we
would only access the DocumentLoader after the event has finished
firing, but it seemed possible that a different DocumentLoader could
have come into existence by then, which would cause us to record the
times on the wrong DocumentLoadTiming struct.)

I only saw a crash when firing the load event, but the code for timing
the unload event seemed like it was vulnerable to the same issue, so I
made the same fix for it.

Currently the speech input event 'onwebkitspeechchange' receives no parameters. WebCore already
has the full list of recognition results and populates only the top result into the input field
automatically. In this patch we pass a SpeechInputEvent object to the event handler, and the JS
code can access the full list of results via "event.results.length", "results[i].utterance" and
"results[i].confidence". Also updated mock object with appropriate methods to test multiple results.

This tile based backing store is a grid of tiles where each tile is
an Evas_Object showing a piece of the page content. The
new ewk_view_tiled.c is an implementation of some of the functions of
the original ewk_view, that makes calls to the Tiled Backing Store
specific functions.

The rendering occurs in the pixels stored in each tile (Evas_Object),
in the same way as the previous single backing store. Tiles not being
shown in the viewport are stored in a cache, and can be reused later
to avoid having to be rendered again.

Scrolling occurs as just moving the tiles, using Evas move operations,
and when more than one tile size is scrolled, a shift of rows or
columns needs to be done.

This works if there are multiple svn tracking branches
and/or if the tracking branch is refs/remots/origin/master
instead of refs/remotes/trunk which is the direction we're trying
to head since that makes fetches faster.

Changed the return value of SelectionController::typingStyle() to EditingStyle*.
Also added SelectionController::copyTypingStyle() to copy the typing style
as an instance of CSSMutableStyleDeclaration.

Changed the return type of SelectionController::typingStyle to EditingStyle*.

Extracted textDirection from Editor::textDirectionForSelection to hide the underlying
CSSMutableStyleDeclaration.

Also extracted the code to preserve unicode-bidi and direction CSS properties in
InsertTextCommand::input, and moved into EditingStyle::prepareToApplyAt. ShouldPreserveWritingDirection,
which is added to the argument list of EditingStyle::prepareToApplyAt, decides whether or not
these two properties are preserved.

Also added SelectionController::copyTypingStyle() to copy the typing style as an instance of
CSSMutableStyleDeclaration.

Ensures that history's previousItem is non-null when clients try to
update content state (e.g., Chromium's UpdateSessionHistory). We now
track load completions with a boolean field rather than by clearing
previousItem.

Use paths relative to $WebKitVSPropsRedirectionDir to access shared .vsprops files

Apple's Windows build allows placing header files and import libraries for WebKit's
dependencies (CoreGraphics, CFNetwork, SQLite, etc.) outside the source tree via the
$WebKitLibrariesDir environment variable. This is both required for production builds and
convenient for Apple-internal developer builds. Apple's production builds also require that
WebKit's shared .vsprops files be accessed relative to $WebKitLibrariesDir. In production
builds, the files are copied into that directory tree by the
WebKitLibraries/win/tools/WinTools.make file. In Apple-internal developer builds, the
copying is done by
JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make.

This .vsprops copying is problematic in one very important case: when a developer updates
their source tree and then tries to build. Visual Studio only reads .vsprops files when a
project is first loaded. So, when Visual Studio is first opened after the .vsprops files are
updated, it reads in the old files that were already residing in $WebKitLibrariesDir. When a
build is started, JavaScriptCoreGenerated.make copies the new .vsprops files into
$WebKitLibrariesDir, but Visual Studio will not pick up the changes. The rest of the build
will proceed with out-of-date .vsprops files, which will likely result in a build failure.

To fix this, we now use normal relative paths to access the .vsprops files in the source
tree rather than in $WebKitLibrariesDir, but prefix those paths with a new environment
variable, $WebKitVSPropsRedirectionDir. In developer builds, this environment variable is
unset, so the normal relative paths are used to read the .vsprops files out of the source
tree directly. In production builds, this environment variable is set to a fake directory
that will cause the .vsprops files in $WebKitLibrariesDir to be found when the relative path
is resolved.

For example, JavaScriptCore.vcproj uses this path for FeatureDefines.vsprops:

In developer builds, where $WebKitVSPropsRedirectionDir is unset, this will point to the
files in WebKitLibraries\win\tools\vsprops in the source tree. In production builds,JavaScriptCore.make sets $WebKitVSPropsRedirectionDir to
"$(SRCROOT)\AppleInternal\tools\vsprops\OpenSource\1\2\3\", so the full path for
FeatureDefines.vsprops becomes:

AppleInternal\tools\vsprops that matches the source directory tree. This allows production
builds to redirect the relative paths used to find the shared .vsprops files into
AppleInternal by setting $WebKitVSPropsRedirectionDir to the appropriate value.

WebKitTools:

DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj:

DumpRenderTree/win/DumpRenderTree.vcproj:

DumpRenderTree/win/ImageDiff.vcproj:

FindSafari/FindSafari.vcproj:

MiniBrowser/MiniBrowser.vcproj:

TestWebKitAPI/win/TestWebKitAPI.vcproj:

TestWebKitAPI/win/TestWebKitAPIGenerated.vcproj:

WebKitAPITest/WebKitAPITest.vcproj:

WebKitLauncherWin/WebKitLauncherWin.vcproj:

WebKitTestRunner/win/InjectedBundle.vcproj:

WebKitTestRunner/win/WebKitTestRunner.vcproj:

WinLauncher/WinLauncher.vcproj:

record-memory-win/record-memory-win.vcproj:

Changed to use paths relative to $WebKitVSPropsRedirectionDir to access shared .vsprops
files.

Make it possible to run tests on Windows without Visual Studio or VC++ Express installed

webkitdir.pm::setupCygwinEnv dies when Visual Studio and VC++ Express
are not installed. But this function doesn't need to be called when we
already have a build available and are just trying to run the tests.

To avoid adding code to classes DOMWindow and Document a new class MediaQueryMatcher was created.

css/MediaQueryMatcher.cpp: Added.

css/MediaQueryMatcher.h: Added.

Document and DOMWindow have changed to support new features. DOMWindow is the class that
publishes methods matchMedia but for page cache to work properly the reference to the
MediaQueryMatcher must be in Document.

Web Inspector: dump inspector protocol messages into console.
Sometimes I need to dump inspector messages into console.
It'd be much simple to have this code in repository and
enable protocol dumping just by a flag.

Fix the position of outside markers by setting its logicalLeft member. Embedded markers need special treatment.
First, the total width of markers should be calculated. Subtracting it from logicalLeft we get the outermost bullet's
position. As for the others, this sum should be decremented with the previous marker's width.
In case of vertical markers the padding is unneeded.

Test: fast/lists/outSideListMarkers.html

rendering/InlineFlowBox.cpp:

(WebCore::InlineFlowBox::placeBoxesInInlineDirection):

rendering/RenderListItem.cpp:

(WebCore::RenderListItem::positionListMarker):

LayoutTests:

Add new test for checking outside marker's position and update the related expecteds of tests.

Modify the Spatial Navigation algorithm, to better handle initial focus and
navigation between frames.
The new algorithm takes the rect of the focused node as the startingRect,
instead of the node itself. That allows us to construct a virtual rect if
there is no focused node, or if it is off the screen.
The virtual rect is the edge of the container in the direction of the navigation.

With this patch, scrollable containers and frames will scroll regardless of weather
they have focusable content. Users will be able to use arrow keys to view all the
content of such a container. The only exception is if the container has style overflow:hidden.
We will not scroll in that case.

With this patch, we handle z-index and positioning so that if there are 2 overlapping focusable nodes,
we do a hit test and only the node on top can get focus.

hasOffScreenRect() was modified so that it can check if a node will be off-screen even after we scrolled
its parent container. We do not add the scrolling conditions for containers that have overflow:hidden
and cannot scroll.

calculateScrollbarModesForLayout is used to decide if a frame can scroll or not. We cannot rely on
the exsistance of the scrollbar, because it could be removed via the API, while the frame is still
allowed to scroll.

Write tests for SVGNumberList/SVGPointList/SVGStringList/SVGTransformList and extend SVGLengthList tests.
SVG DOM <-> XML DOM synchronization is now tested for all these types, and works great. Unify the string format produced
by the various valueAsString() functions for maximum compatibility with Firefox / Opera.

Build a real transform string for SVGTransformList, instead of dumping the elements of the concatted matrix.

bindings/js/JSSVGLengthCustom.cpp:
(WebCore::JSSVGLength::setValue): Throw NO_MODIFICATION_ALLOWED_ERR when the SVGPropertyTearOffs role is AnimValRole.
(WebCore::JSSVGLength::convertToSpecifiedUnits): Ditto.

svg/SVGTests.cpp: Rewrite, similar to SVGPolyElement, to synchronize the requiredFeatures/requiredExtension/systemLanguage SVGStringLists with their XML DOM attributes.
(WebCore::SVGTests::SVGTests):
(WebCore::SVGTests::isValid):
(WebCore::SVGTests::parseMappedAttribute):
(WebCore::SVGTests::isKnownAttribute):
(WebCore::SVGTests::handleAttributeChange):
(WebCore::SVGTests::synchronizeProperties): To be called by all classes inheriting from SVGTests, in their synchronizeProperty() methods.
(WebCore::SVGTests::synchronizeRequiredFeatures):
(WebCore::SVGTests::synchronizeRequiredExtensions):
(WebCore::SVGTests::synchronizeSystemLanguage):
(WebCore::SVGTests::requiredFeatures):
(WebCore::SVGTests::requiredExtensions):
(WebCore::SVGTests::systemLanguage):

svg/properties/SVGListProperty.h: s/TYPE_MISMATCH_ERR/SVGException::SVG_WRONG_TYPE_ERR/ for compatibility with Firefox.
(WebCore::SVGListProperty::initializeValuesAndWrappers):
(WebCore::SVGListProperty::insertItemBeforeValuesAndWrappers):
(WebCore::SVGListProperty::replaceItemValues):
(WebCore::SVGListProperty::replaceItemValuesAndWrappers):
(WebCore::SVGListProperty::removeItemValuesAndWrappers): Handle corner case, the item passed to removeItem() was the only on in the list, list is empty now, nothing to replace.
(WebCore::SVGListProperty::appendItemValuesAndWrappers):
(WebCore::SVGListProperty::role): Expose the role of this list property.

This patch finishes the implementation, from the point of view of
the Atk library, of those objects exposed to ATK as combo boxes,
and their related elements (menus and menu items). It therefore
implements the proper interfaces for each type of object related
to combo boxes (AtkSelection for the combo box, AtkText for every
menu item and AtkAction for the combo box, the menu and the menu
items), takes care of emitting the proper signals when focus or a
given a selection changes and adds a new unit test to check all
this new stuff.

Make possible to ask an AccessibleMenuListOption for a sensible
string representation, so far only available through the private
and MSAA related method nameForMSAA. Just moved the implementation
of that method to an overriden version of stringValue(), which is
platform independent, and called that from nameForMSAA().

accessibility/AccessibilityMenuListOption.h:

accessibility/AccessibilityMenuListOption.cpp:
(WebCore::AccessibilityMenuListOption::nameForMSAA): Just call to
stringValue(), which holds from now on that used to be here.
(WebCore::AccessibilityMenuListOption::stringValue): New, override
of AccessibilityObject::stringValue() to return a proper string.

Emit the missing signals when a selection is made.

accessibility/gtk/AXObjectCacheAtk.cpp:
(WebCore::AXObjectCache::postPlatformNotification): Emit the usual
'focus' signals when a selection is made over the combo box.

accessibility/gtk/AccessibilityObjectWrapperAtk.cpp:
(setAtkStateSetFromCoreObject): Ensure the EXPANDABLE and EXPANDED
Atk states are added to the state set when needed.
(listObjectForSelection): New, returns the proper list object (the
one holding the list of available options as its children) for an
specific AtkObject implementing AtkSelection. This is needed
because sometimes the selectable options are not directly children
of the AtkSelection object (i.e. a combo box has a 'menu' object
as its only child of it, holding the list of options as children).
(optionFromList): Use listObjectForSelection() to get the actual
object holding the list of children as the available options.
(optionFromSelection): Add support for combo boxes.
(webkit_accessible_selection_add_selection): Ditto.
(webkit_accessible_selection_clear_selection): Ditto.
(webkit_accessible_selection_get_selection_count): Ditto.
(webkit_accessible_selection_is_child_selected): Ditto.
(webkit_accessible_selection_remove_selection): Ditto.
(webkit_accessible_text_get_text): Makes sure stringValue() is
considered to get the result substring when it was already
considered when checking the maximum text length for the object.
(getInterfaceMaskFromObject): Make sure the AtkSelection interface
is implemented for the combo boxes, that the AtkText is
implemented for the menu items and that the AtkAction interface is
now implemented for every object (WebCore will decide what to do).

Avoid a segfault crash when using this from unit tests.

platform/gtk/PopupMenuGtk.cpp:
(WebCore::PopupMenuGtk::show): Make sure we got a valid GdkWindow
before calling gdk_window_get_origin() over it.

Initial attempt to have a kind of poor man's garbage collection
for GObject DOM objects. We tie the object's lifecycle to their
parent Frame and/or its document; that is, all objects will be
collected when their parent frame is destroyed or when that frame
transitions to a new document. Manual management (calling
g_object_unref on them) is also allowed, and is required for
objects that are not in the DOM tree (eg NodeLists).

Initial attempt to have a kind of poor man's garbage collection
for GObject DOM objects. We tie the object's lifecycle to their
parent Frame and/or its document; that is, all objects will be
collected when their parent frame is destroyed or when that frame
transitions to a new document. Manual management (calling
g_object_unref on them) is also allowed, and is required for
objects that are not in the DOM tree (eg NodeLists).