StringImpl.h should compile with -Wshorten-64-to-32
<http://webkit.org/b/114970>

Reviewed by Darin Adler.

Fixes the following warnings with -Wshorten-64-to-32:

    StringImpl.h:317:25: error: implicit conversion loses integer precision: 'uintptr_t' (aka 'unsigned long') to 'unsigned int' [-Werror,-Wshorten-64-to-32]
            unsigned hash = reinterpret_cast<uintptr_t>(this);
                     ~~~~   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

* wtf/text/StringImpl.h:
(WTF::StringImpl::StringImpl): Add static_cast<uint32_t>() to
formalize taking the lower 32-bits of the pointer value on
64-bit architectures.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148900 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Refactor creation of the full screen window into an (overridable) method.
https://bugs.webkit.org/show_bug.cgi?id=110369

Reviewed by Eric Carlson.

Add a new WKView method -(NSWindow)createFullScreenWindow which can be overridden
by subclasses to provide custom full screen windows to the WKFullScreenWindowController.

* UIProcess/API/mac/WKView.mm:
(-[WKView fullScreenWindowController]):
(-[WKView createFullScreenWindow]):
* UIProcess/API/mac/WKViewPrivate.h:
* UIProcess/mac/WKFullScreenWindowController.mm:
(-[WKFullScreenWindowController initWithWindow:]):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148901 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Hard code plug-in sandbox profile lookup directories and move
the profiles to WebKit2.

Reviewed by Anders Carlsson.

* PluginProcess/EntryPoint/mac/LegacyProcess/PluginProcessMain.mm:
(WebKit::PluginProcessMainDelegate::getExtraInitializationData):
* PluginProcess/EntryPoint/mac/XPCService/PluginServiceEntryPoint.mm:
(WebKit::PluginServiceInitializerDelegate::getExtraInitializationData):
* UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
(WebKit::PluginProcessProxy::platformGetLaunchOptions):
Stop passing the sandbox-profile-directory-path to the plug-in process.

* PluginProcess/mac/PluginProcessMac.mm:
(WebKit::loadSandboxProfileForDirectory):
(WebKit::loadSandboxProfile):
(WebKit::PluginProcess::initializeSandbox):
Hard code the plug-in sandbox profile lookup to only look in the WebKit2 bundle
and /System/Library/Sandbox/Profiles/.

* Resources/PlugInSandboxProfiles: Added.
Add profiles.

* WebKit2.xcodeproj/project.pbxproj:
Copy the profiles to the bundle.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148902 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] Set up libPlatform.la
https://bugs.webkit.org/show_bug.cgi?id=114168

Reviewed by Martin Robinson.

.: 

* GNUmakefile.am: Define the platform_cppflags and platform_sources variables.

Source/Platform: 

* GNUmakefile.am: Set up the libPlatform.la static library to build the source files listed in platform_sources.
As with the libPlatformGtk.la library, only the Source/WebCore/platform and its subdirectories are allowed to be
searched for headers to include, providing a convenient way to detect any platform violations. These directories
are listed in the platform_webcore_cppflags variable.

Source/WebCore: 

No new tests - no new functionality.

* GNUmakefile.am: Also add the LevelDB-specific cppflags to the platform_cppflags if required as the LevelDB
code is now built into the new libPlatform.la library.
* GNUmakefile.list.am: Build a small set of non-GTK-specific platform source files that are already free of
platform violations into the new libPlatform.la library.

Source/WebKit/gtk: 

* GNUmakefile.am: Add the new libPlatform.la library to the libwebkitgtk library.

Source/WebKit2: 

* GNUmakefile.am: Add the new libPlatform.la library to the libwebkitgtk library. Link the WebKitPluginProcess
executable against libPlatform.la as well.

Tools: 

* GNUmakefile.am: Link the DumpRenderTree executable against both libPlatform.la and libPlatformGtk.la libraries.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148903 268f45cc-cd09-0410-ab3c-d52691b4dbfc
        <rdar://problem/13681842> [Mac] Tweak WebProcess sandbox profile to use
        system-graphics function when available.

        Reviewed by Sam Weinig.

        * WebProcess/com.apple.WebProcess.sb.in:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148904 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Don't kill our XPC services in response to memory pressure
https://bugs.webkit.org/show_bug.cgi?id=114985
<rdar://problem/13229217>

Reviewed by Mark Rowe.

* Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
(WebKit::XPCServiceInitializer):
Call xpc_transaction_begin() so we'll never be killed by the kernel when there's memory pressure;
we prefer to manage our own lifetime thank you very much!

* Shared/mac/ChildProcessMac.mm:
(WebKit::ChildProcess::platformInitialize):
Remove call to disable sudden termination.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148905 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Cancelling load may cause deadlock in -[AVPlayerItem release]
https://bugs.webkit.org/show_bug.cgi?id=114962

Reviewed by Eric Carlson.

Work around a bug in AVAssetResourceLoader by using a generic, non-main dispatch queue
to recieve AVAssetResourceLoaderDelegate callbacks, and then marshalling those
callbacks to the main thread asynchronously.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::globalLoaderDelegateQueue): Added.
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL): Use the new global queue.
(-[WebCoreAVFLoaderDelegate resourceLoader:shouldWaitForLoadingOfRequestedResource:]):
    Marshall the request to the main queue, and return YES (wait) immediately.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148906 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Mac] "automatic" track selection should only select a track that matches user language
https://bugs.webkit.org/show_bug.cgi?id=114976

Reviewed by Jer Noble.

Source/WebCore:

Test: media/track/track-automatic-subtitles.html

* page/CaptionUserPreferencesMac.mm:
(WebCore::CaptionUserPreferencesMac::textTrackSelectionScore): When in "automatic" mode, only
    consider text tracks that match the user's preferred language when the primary audio track
    does not.

LayoutTests:

* media/track/track-automatic-subtitles-expected.txt: Added.
* media/track/track-automatic-subtitles.html: Added.
* platform/mac/TestExpectations: Skip track-user-preferences.html, the logic is no longer
     correct for the Mac port.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148907 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Use-after-free in CompositeEditCommand::cloneParagraphUnderNewElement
https://bugs.webkit.org/show_bug.cgi?id=114911

Reviewed by Oliver Hunt.

Back ported https://src.chromium.org/viewvc/blink?revision=148680&view=revision.

* editing/CompositeEditCommand.cpp:
(WebCore::CompositeEditCommand::cloneParagraphUnderNewElement):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148908 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] Update about:config lists
https://bugs.webkit.org/show_bug.cgi?id=114967

Patch by Eli Fidler <efidler@blackberry.com> on 2013-04-22
Reviewed by Rob Buis.

* WebCoreSupport/AboutDataEnableFeatures.in:
* WebCoreSupport/AboutDataHaveFeatures.in:
* WebCoreSupport/AboutDataUseFeatures.in:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148909 268f45cc-cd09-0410-ab3c-d52691b4dbfc
        <rdar://problem/13334446> [Mac] Tweak sandbox profiles.

        Reviewed by Sam Weinig.

        * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
        * WebProcess/com.apple.WebProcess.sb.in:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148910 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Slow/beachballing when using the find bar on a page with plug-ins
https://bugs.webkit.org/show_bug.cgi?id=114990
<rdar://problem/12832313>

Reviewed by Tim Horton.

* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::notifyWidget):
Call shouldCreateTransientPaintingSnapshot().

(WebKit::PluginView::shouldCreateTransientPaintingSnapshot):
Don't create a painting snapshot if we're asked to paint the find indicator.

* WebProcess/Plugins/PluginView.h:
Add new member function.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148911 268f45cc-cd09-0410-ab3c-d52691b4dbfc
PDFPlugin: Support unlocking encrypted PDFs
https://bugs.webkit.org/show_bug.cgi?id=114938
<rdar://problem/12872888>

Reviewed by Alexey Proskuryakov and Oliver Hunt.

If we try to load an encrypted PDF, we need to provide a sane mechanism
through which the user can provide the password. Add a slightly-below-center
password field to match PDFKit's normal behavior.

* WebKit2.xcodeproj/project.pbxproj: Add PDFPluginPasswordField.{h,mm}
* WebProcess/Plugins/PDF/PDFLayerControllerDetails.h: Add attemptToUnlockWithPassword:
* WebProcess/Plugins/PDF/PDFPlugin.h:
Add createPasswordEntryForm, attemptToUnlockPDF, m_passwordField.
* WebProcess/Plugins/PDF/PDFPlugin.mm:
(annotationStyle): Make #annotationContainer a flexbox that centers its contents.
This won't affect the normal absolutely-positioned form fields, but the inline
password field will be centered vertically and horizontally.

(WebKit::PDFPlugin::pdfDocumentDidLoad):
If the document is locked when loaded, create a password field.

(WebKit::PDFPlugin::createPasswordEntryForm):
Create a PDFPluginPasswordField and attach it to the document.

(WebKit::PDFPlugin::attemptToUnlockPDF):
Try to unlock the PDF with the given password. If this succeeds, remove
the password field and relayout the scroll view.

(WebKit::PDFPlugin::calculateSizes):
Make the document 0x0 if it is locked, preventing scrolling.

(WebKit::PDFPlugin::handleMouseEvent):
Don't pass mouse events to PDFLayerController while it is locked,
as it has no useful events to provide, and will try to present a
dialog asking for the password if we let a click through.

* WebProcess/Plugins/PDF/PDFPluginAnnotation.h:
(WebKit::PDFPluginAnnotation::eventListener): Added.
* WebProcess/Plugins/PDF/PDFPluginAnnotation.mm:
(WebKit::PDFPluginAnnotation::handleEvent):
Move event-handling code here from PDFPluginAnnotationEventListener::handleEvent
so that subclasses can override this instead of having to have their own
event listeners (this is also why we now expose eventListener()).

(WebKit::PDFPluginAnnotation::PDFPluginAnnotationEventListener::handleEvent):
Forward the event to our owning PDFPluginAnnotation.

* WebProcess/Plugins/PDF/PDFPluginPasswordField.h: Added.
(WebKit::PDFPluginPasswordField::PDFPluginPasswordField):
* WebProcess/Plugins/PDF/PDFPluginPasswordField.mm: Added.
(WebKit::PDFPluginPasswordField::create):
(WebKit::PDFPluginPasswordField::~PDFPluginPasswordField):
Unregister for keyup.

(WebKit::PDFPluginPasswordField::createAnnotationElement):
Register for keyup, and set our element's class to "password".

(WebKit::PDFPluginPasswordField::updateGeometry):
Added. Override updateGeometry and do nothing, as the password field
has a geometry defined by CSS instead of by the PDF content.

(WebKit::PDFPluginPasswordField::handleEvent):
If the enter/return key is pressed, attempt to unlock the PDF. Also,
we do not call either of our superclass' implementations of handleEvent,
because blurring the password field should not destroy it, and tabbing
between fields has no relevance when there can only be one field.

* WebProcess/Plugins/PDF/PDFPluginTextAnnotation.h:
(WebKit::PDFPluginTextAnnotation::PDFPluginTextAnnotationEventListener):
Removed. We now share our superclass' event listener.

(WebKit::PDFPluginTextAnnotation::textAnnotation): Const.
* WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm:
(WebKit::PDFPluginTextAnnotation::~PDFPluginTextAnnotation):
PDFPluginTextAnnotation no longer has its own event listener,
so there's nothing left to clear here. Just make sure to unregister
our event from PDFPluginAnnotation's shared event listener!

(WebKit::PDFPluginTextAnnotation::createAnnotationElement):
Ensure that we can create a PDFPluginTextAnnotation with a null annotation.

(WebKit::PDFPluginTextAnnotation::commit): Use value().
(WebKit::PDFPluginTextAnnotation::value):
Factor retrieving the value of the form control out of commit().

(WebKit::PDFPluginTextAnnotation::handleEvent):
Call up to PDFPluginAnnotation's handler so that defocus destroys the annotation.

Export HTMLNames::typeAttr.

* WebCore.exp.in:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148912 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Make it easier to extend NetworkResourceLoadParameters
https://bugs.webkit.org/show_bug.cgi?id=114992

Reviewed by Sam Weinig.

Turn NetworkResourceLoadParameters into a struct which matches all our other parameter classes in WebKit2. Fill in the struct manually
instead of having a constructor with 9 parameters.

* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::scheduleResourceLoad):
(WebKit::NetworkConnectionToWebProcess::performSynchronousLoad):
* NetworkProcess/SchedulableLoader.cpp:
(WebKit::SchedulableLoader::SchedulableLoader):
* Shared/Network/NetworkResourceLoadParameters.cpp:
(WebKit::NetworkResourceLoadParameters::NetworkResourceLoadParameters):
(WebKit::NetworkResourceLoadParameters::encode):
(WebKit::NetworkResourceLoadParameters::decode):
* Shared/Network/NetworkResourceLoadParameters.h:
(NetworkResourceLoadParameters):
* WebProcess/Network/WebResourceLoadScheduler.cpp:
(WebKit::WebResourceLoadScheduler::scheduleLoad):
* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
(WebKit::WebPlatformStrategies::loadResourceSynchronously):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148913 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] Fix remaining introspection warnings
https://bugs.webkit.org/show_bug.cgi?id=114980

Reviewed by Gustavo Noronha Silva.

Source/WebCore:

* bindings/gobject/WebKitDOMCustom.h: Add scope and transfer annotations and flesh
out gtkdoc for completeness.
* bindings/gobject/WebKitDOMEventTarget.h:
(_WebKitDOMEventTargetIface): Ditto and also align virtual method names with those used
for the concrete ones.

Source/WebKit/gtk:

* webkit/webkitspellchecker.h:
(_WebKitSpellCheckerInterface): Align the name of the check_spelling_of_string virtual
method with the concrete method to avoid a g-ir-scanner warning.
* webkit/webkitversion.h.in: Skip WEBKITGTK_API_VERSION for introspection because it
doesn't follow the appropriate namespace name.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148914 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[css exclusions] shape-inside-recursive-layout.html should not yet test display: inline-grid
https://bugs.webkit.org/show_bug.cgi?id=114986

Reviewed by Dirk Schulze.

Because the inline-grid value is not yet supported, the test case is falling back to
display: block. This causes an incorrect layout, as block and inline content react to
shape-inside differently.

* fast/exclusions/shape-inside/shape-inside-recursive-layout-expected.html:
* fast/exclusions/shape-inside/shape-inside-recursive-layout.html:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148915 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] Enable introspection always for developer builds
https://bugs.webkit.org/show_bug.cgi?id=114983

Reviewed by Gustavo Noronha Silva.

.:

* Source/autotools/SetupAutoconfHeader.m4: No longer expose the ENABLE_INTROSPECTION
autoconf header variable. It isn't used and it means that when introspection is enabled
or disabled, there is an unnecessary full rebuild.

Source/WebKit/gtk:

* GNUmakefile.am: Make warnings during gir scanning cause the build to fail. Eliminate
warnings about deprecated API that the g-ir-scanner uses when generating
the scanner program. Use --quiet to avoid printing lots of output to
non-verbose builds.

Source/WebKit2:

* GNUmakefile.am: Make warnings during gir scanning cause the build to fail. Eliminate
warnings about deprecated API that the g-ir-scanner uses when generating
the scanner program. Use --quiet.

Tools:

* Scripts/webkitdirs.pm:
(runAutogenForAutotoolsProjectIfNecessary): Always enable introspection
when using build-webkit.
* gtk/jhbuildrc: Enable documentation for all jhbuild modules and explicitly
choose the memory gsettings backend while in the jhbuild. This eliminates
warnings from programs that fall back to the memory backend.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148916 268f45cc-cd09-0410-ab3c-d52691b4dbfc
        <rdar://problem/13334446> [Mac] Tweak sandbox profiles.

        Reviewed by Anders Carlsson.

        Unbreak Lion, which doesn't provide detailed control over IPC.

        * WebProcess/com.apple.WebProcess.sb.in:



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

* platform/mac-lion/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148918 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Plugin Snapshotting: Don't consume insane amounts of time detecting the primary plugin
https://bugs.webkit.org/show_bug.cgi?id=114994
<rdar://problem/13696269>

Reviewed by Anders Carlsson.

On some pages, we currently waste a lot of time on every subframe load
and every addPluginView doing primary plugin detection. This patch
attempts to address this via a few minor changes:

- Only allow detection after the main frame's didFinishLoad comes, instead of the first subframe.

- Only explicitly detect on the main frame's didFinishLoad (not subframes).

- Coalesce calls to determinePrimarySnapshottedPlugIn from both addPluginView
(in case JS is adding lots of plugins in a loop) and didFinishLoad.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::addPluginView): Coalesce calls to determinePrimarySnapshottedPlugIn.
(WebKit::WebPage::didFinishLoad):
Coalesce calls to determinePrimarySnapshottedPlugIn.
Bail on subframe loads, we're only interested in the main frame being complete.
(WebKit::WebPage::determinePrimarySnapshottedPlugInTimerFired):
Call determinePrimarySnapshottedPlugIn.
* WebProcess/WebPage/WebPage.h:
Add m_determinePrimarySnapshottedPlugInTimer and determinePrimarySnapshottedPlugInTimerFired


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