[BlackBerry] Make PagePopup implementation independent from WebCore
https://bugs.webkit.org/show_bug.cgi?id=116448

Patch by Carlos Garcia Campos <cgarcia@igalia.com> on 2013-05-21
Reviewed by Anders Carlsson.

.:

* Source/cmake/OptionsBlackBerry.cmake: Do not enable PAGE_POPUP
feature.

Source/WebKit:

* PlatformBlackBerry.cmake: Add
blackberry/WebCoreSupport/PagePopupBlackBerryClient.cpp to
compilation.

Source/WebKit/blackberry:

Add our own implementation of PagePopupClient and make all the
pickers inherit from it. Unused methods have been removed and
common implementation have been moved from the pickers to the
parent class.

* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::~WebPagePrivate): Destroy the
popup if there's one active.
(BlackBerry::WebKit::WebPagePrivate::setVisible): Call
closePagePopup() directly.
(BlackBerry::WebKit::WebPagePrivate::openPagePopup): Create a new
PagePopupBlackBerry for the given client.
(BlackBerry::WebKit::WebPagePrivate::closePagePopup): Close the
active popup if there's one.
(BlackBerry::WebKit::WebPagePrivate::hasOpenedPopup): Return
whether there's an active popup.
* Api/WebPage.h:
* Api/WebPage_p.h:
* WebCoreSupport/ChromeClientBlackBerry.cpp:
(WebCore::ChromeClientBlackBerry::chromeDestroyed): Remove
closePagePopup() call since this is now handled by
WebPagePrivate.
(WebCore::ChromeClientBlackBerry::hasOpenedPopup): Call
WebPagePrivate::hasOpenedPopup().
* WebCoreSupport/ChromeClientBlackBerry.h:
(ChromeClientBlackBerry):
* WebCoreSupport/ColorPickerClient.cpp:
(BlackBerry::WebKit::ColorPickerClient::ColorPickerClient):
(BlackBerry::WebKit::ColorPickerClient::didClosePopup):
* WebCoreSupport/ColorPickerClient.h:
(ColorPickerClient):
* WebCoreSupport/DatePickerClient.cpp:
(BlackBerry::WebKit::DatePickerClient::DatePickerClient):
(BlackBerry::WebKit::DatePickerClient::didClosePopup):
* WebCoreSupport/DatePickerClient.h:
(DatePickerClient):
* WebCoreSupport/PagePopupBlackBerry.cpp:
(BlackBerry::WebKit::PagePopupBlackBerry::PagePopupBlackBerry):
(BlackBerry::WebKit::PagePopupBlackBerry::closePopup):
* WebCoreSupport/PagePopupBlackBerry.h:
(PagePopupBlackBerry):
(BlackBerry::WebKit::PagePopupBlackBerry::SharedClientPointer::SharedClientPointer):
(BlackBerry::WebKit::PagePopupBlackBerry::SharedClientPointer::get):
(SharedClientPointer):
* WebCoreSupport/PagePopupBlackBerryClient.cpp: Added.
(BlackBerry::WebKit::PagePopupBlackBerryClient::PagePopupBlackBerryClient):
(BlackBerry::WebKit::PagePopupBlackBerryClient::closePopup):
(BlackBerry::WebKit::PagePopupBlackBerryClient::didClosePopup):
(BlackBerry::WebKit::PagePopupBlackBerryClient::contentSize):
(BlackBerry::WebKit::PagePopupBlackBerryClient::writeDocument):
* WebCoreSupport/PagePopupBlackBerryClient.h: Added.
(PagePopupBlackBerryClient):
(BlackBerry::WebKit::PagePopupBlackBerryClient::~PagePopupBlackBerryClient):
* WebCoreSupport/SelectPopupClient.cpp:
(BlackBerry::WebKit::SelectPopupClient::SelectPopupClient):
(BlackBerry::WebKit::SelectPopupClient::didClosePopup):
* WebCoreSupport/SelectPopupClient.h:
(SelectPopupClient):
* WebKitSupport/InputHandler.cpp:
(BlackBerry::WebKit::InputHandler::openDatePopup): Do not call
closePagePopup() since this is already done by openPagePopup() and
use openPagePopup() from WebPagePrivate directly.
(BlackBerry::WebKit::InputHandler::openColorPopup): Ditto.
(BlackBerry::WebKit::InputHandler::openSelectPopup): Ditto.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150434 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GStreamer] cleanup duration query
https://bugs.webkit.org/show_bug.cgi?id=116228

Reviewed by Philippe Normand.

Covered by existing tests.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::duration):
We can also cache the duration here if the query succeeds.
(MediaPlayerPrivateGStreamer::updateStates):
Don't query when we are in GST_STATE_READY state because it never succeeds.
Do it instead when we reached a stable state.
(MediaPlayerPrivateGStreamer::cacheDuration): Return early if it is already
cached. Recaching is not necessary and now we call it a lot of times.
Only look into the state if the query failed.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
(MediaPlayerPrivateGStreamer): Made m_mediaDuration mutable to be
able to cache it in duration(). Internal cached values is one of
the sensible uses of mutable.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150435 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EFL] accessibility/accessibility-node-memory-management.html is failing
https://bugs.webkit.org/show_bug.cgi?id=112025

Unreviewed EFL gardening

accessibility/accessibility-node-memory-management.html passes after r150431.

Patch by Krzysztof Czech <k.czech@samsung.com> on 2013-05-21

* platform/efl-wk2/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150436 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add FloatRect::normalized() for BlackBerry
https://bugs.webkit.org/show_bug.cgi?id=116531

Patch by Alberto Garcia <agarcia@igalia.com> on 2013-05-21
Reviewed by Carlos Garcia Campos.

This was added to FloatRectBlackBerry.cpp in r111072 when the
graphics platform code was upstreamed, but this change was
missing.

* platform/graphics/FloatRect.h:
(FloatRect):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150437 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EFL] accessibility/accessibility-node-reparent.html is failing
https://bugs.webkit.org/show_bug.cgi?id=112026

Unreviewed EFL gardening.

accessibility/accessibility-node-reparent.html passes after r150431.

Patch by Krzysztof Czech <k.czech@samsung.com> on 2013-05-21

* platform/efl-wk2/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150438 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK][WK2] accessibility/label-for-control-hittest.html is failing
https://bugs.webkit.org/show_bug.cgi?id=106341

Patch by Krzysztof Czech <k.czech@samsung.com> on 2013-05-21
Reviewed by Martin Robinson.

Tools:

Adds support for retrieving accessibility element at exact point.

* WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
(WTR::AccessibilityUIElement::elementAtPoint):

LayoutTests:

Fixing failing test. The reason of failure is missing
possibility of getting accessibility object at exact position.

* platform/gtk-wk2/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150439 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] Always use EGL to create the GL context when running on Wayland
https://bugs.webkit.org/show_bug.cgi?id=115721

Patch by Iago Toral Quiroga <itoral@igalia.com> on 2013-05-21
Reviewed by Martin Robinson.

* platform/graphics/cairo/GLContext.cpp:
(WebCore::GLContext::createContextForWindow):
(WebCore::GLContext::createOffscreenContext): Always use EGL to create the GL context
instead of GLX when running on Wayland and make createOffScreenContext reuse the code
in createContextWindow.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150440 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Expose a way to know when forms are added to a page or when form controls are added to a form
in the injected bundle
https://bugs.webkit.org/show_bug.cgi?id=116334

Reviewed by Alexey Proskuryakov.

Source/WebKit2:

Add shouldNotifyOnFormChanges and didAssociateFormControls to the WKBundlePageFormClient.

* WebProcess/InjectedBundle/API/c/WKBundlePage.h:
Add the new callbacks as part of version 2 of the WKBundlePageFormClient.

* WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp:
(WebKit::InjectedBundlePageFormClient::didAssociateFormControls):
Pass the message along to the client if the client has a handler.
(WebKit::InjectedBundlePageFormClient::shouldNotifyOnFormChanges):
Ditto.
* WebProcess/InjectedBundle/InjectedBundlePageFormClient.h:

* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::didAssociateFormControls):
Tell the injected bundle form client for the page.
(WebKit::WebChromeClient::shouldNotifyOnFormChanges):
Ditto.
* WebProcess/WebCoreSupport/WebChromeClient.h:

Tools:

Add tests for the new callbacks.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
Add DidAssociateFormControls/_Bundle.cpp and associate-form-controls.html

* TestWebKitAPI/Tests/WebKit2/DidAssociateFormControls.cpp: Added.
(TestWebKitAPI::nullJavaScriptCallback):
A "null" callback to handle the fact that WKPageRunJavaScriptInMainFrame cannot handle null
being passed in for the callback.
(TestWebKitAPI::didReceiveMessageFromInjectedBundle):
After receiving the message that didAssociateFormControls callback was invoked from adding
the form in the onload handler, tell the page to add a password field to the form, which
should also invoke didAssociateFormControls callback.
(TestWebKitAPI::setInjectedBundleClient):
Register to receive messages.
(TestWebKitAPI::TEST):
Load associate-form-controls.html and wait until the didAssociateFormControls callback has
been invoked for both adding the form and for adding a password field to the form.

* TestWebKitAPI/Tests/WebKit2/DidAssociateFormControls_Bundle.cpp: Added.
(TestWebKitAPI::shouldNotifyOnFormChanges):
Return true so the didAssociateFormControls callback is invoked.
(TestWebKitAPI::didAssociateFormControls):
Tell the UI process.
(TestWebKitAPI::DidAssociateFormControlsTest::DidAssociateFormControlsTest):
(TestWebKitAPI::DidAssociateFormControlsTest::didCreatePage):
Register for the shouldNotifyOnFormChanges and didAssociateFormControls callbacks.

* TestWebKitAPI/Tests/WebKit2/associate-form-controls.html: Added.
Add a form in response to the onload event. Add a button that will add the password field
for manual testing.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150441 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] FontCache::getFontDataForCharacters() returns nullptr
https://bugs.webkit.org/show_bug.cgi?id=116529

Patch by Alberto Garcia <agarcia@igalia.com> on 2013-05-21
Reviewed by Andreas Kling.

This cannot be converted to a PassRefPtr and breaks the build.

* platform/graphics/blackberry/FontCacheBlackBerry.cpp:
(WebCore::FontCache::getFontDataForCharacters):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150442 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add BlackBerry definition of NativeImagePtr
https://bugs.webkit.org/show_bug.cgi?id=116526

Patch by Alberto Garcia <agarcia@igalia.com> on 2013-05-21
Reviewed by Darin Adler.

* platform/graphics/NativeImagePtr.h:
(Graphics):
(WebCore):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150443 268f45cc-cd09-0410-ab3c-d52691b4dbfc
PLATFORM(*) macros used in Source/WebCore/loader/archive/ArchiveFactory.cpp
https://bugs.webkit.org/show_bug.cgi?id=116453

Reviewed by Alexey Proskuryakov.

* loader/archive/ArchiveFactory.cpp: Remove a redundant PLATFORM(QT) macro when checking whether
to include the LegacyWebArchive.h header that's specific to the WebArchive support. The Qt port
does not enable the WebArchive feature at all (which is enabled only on AppleMac, AppleWin and iOS
platforms) so there's no reason to additionally condition the header include with building on
non-Qt platforms.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150444 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] Compile everything in C++11 mode
https://bugs.webkit.org/show_bug.cgi?id=116452

Reviewed by Anders Carlsson.

.: 

* Source/autotools/SetupCompilerFlags.m4: Use the C++11 standard by default when compiling C++ source code.
Perform some minor cleanup around the comments and the order of specifying additional CXXFLAGS entries.

Source/WebKit2: 

* GNUmakefile.am: Remove the -std=c++11 flags from the various CPPFLAGS lists, the mode is now specified
by default for all the C++ source code in SetupCompilerFlags.m4.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150445 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Remove GraphicsLayerClient::contentsVisible()
https://bugs.webkit.org/show_bug.cgi?id=116523

Patch by Alberto Garcia <agarcia@igalia.com> on 2013-05-21
Reviewed by Darin Adler.

This is dead code from the BlackBerry port.

* platform/graphics/GraphicsLayerClient.h:
* rendering/RenderLayerBacking.cpp:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150446 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Added missing assert condition for PositiveOrZero in ARM branch32().
https://bugs.webkit.org/show_bug.cgi?id=116538.

Reviewed by Geoffrey Garen.

* assembler/MacroAssemblerARM.h:
(JSC::MacroAssemblerARM::branchAdd32):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150449 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add WTF::NeverDestroyed and start using it in WTF
https://bugs.webkit.org/show_bug.cgi?id=116472

Reviewed by Benjamin Poulain.

NeverDestroyed is a class template that can be used for singletons and other objects that we never
want to destroy. It's intended as a replacement for WTF_STATIC_LOCAL with the advantage that it doesn't
fragment the heap.

* GNUmakefile.list.am:
* WTF.vcproj/WTF.vcproj:
* WTF.vcxproj/WTF.vcxproj:
* WTF.vcxproj/WTF.vcxproj.filters:
* WTF.xcodeproj/project.pbxproj:
Add NeverDestroyed.h

* wtf/Compiler.h:
Add a helper macro, WTF_DELETED_FUNCTION.

* wtf/CryptographicallyRandomNumber.cpp:
Use NeverDestroyed.

* wtf/NeverDestroyed.h: Added.

* wtf/Noncopyable.h:
Use WTF_DELETED_FUNCTION.

* wtf/text/WTFString.cpp:
(WTF::emptyString):
Use

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

* wtf/NeverDestroyed.h:
(NeverDestroyed):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150451 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Implement overlap avoidance for cues with snap-to-lines flag not set
https://bugs.webkit.org/show_bug.cgi?id=84296

Reviewed by Eric Carlson.

Source/WebCore:

Test: media/track/track-cue-overlap-snap-to-lines-not-set.html

Support overlap avoidance for the non-snap-to-lines part of the WebVTT spec.

* rendering/RenderTextTrackCue.cpp:
(WebCore::RenderTextTrackCue::isOutside): Split implementation into rectIsWithinContainer().
(WebCore::RenderTextTrackCue::rectIsWithinContainer): Ditto.
(WebCore::RenderTextTrackCue::isOverlapping): Split into overlappingObject() and overlappingObjectForRect().
(WebCore::RenderTextTrackCue::overlappingObject): Ditto.
(WebCore::RenderTextTrackCue::overlappingObjectForRect): Ditto.
(WebCore::RenderTextTrackCue::moveIfNecessaryToKeepWithinContainer): Added.
(WebCore::RenderTextTrackCue::findNonOverlappingPosition): When an overlapping object is found, move the
    cue to just above or below that object and try again.
(WebCore::RenderTextTrackCue::repositionCueSnapToLinesSet): Move implementation into moveIfNecessaryToKeepWithinContainer().
(WebCore::RenderTextTrackCue::repositionCueSnapToLinesNotSet): Add implementanton based on above.
* rendering/RenderTextTrackCue.h:

LayoutTests:

* media/track/track-cue-overlap-snap-to-lines-not-set-expected.txt: Added.
* media/track/track-cue-overlap-snap-to-lines-not-set.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150452 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Implement overlap-avoidance for in-band text track cues.
https://bugs.webkit.org/show_bug.cgi?id=116540

Reviewed by Eric Carlson.

In-band (or Generic) cues need special casing for certain features
present in in-band tracks, like paint-on and roll-up modes. To avoid
the problem of overlap avoidance forcing a caption meant to appear
below a cue to appear above it when a larger font size is selected,
impose an additional sort ordering for "generic cues". Instead of
cues being ordered by the order they appear in the track, "generic
cues" further sorted by their position within the video area, such
that cues at the bottom of the video area appear first, and later
cues are pushed up to avoid them, preserving the desired apparent
ordering.

* html/HTMLMediaElement.cpp:
(WebCore::compareCueInterval): Added; wrapper around
    TextTrackCue::isOrderedBefore.
(WebCore::HTMLMediaElement::updateActiveTextTrackCues):
    After creating the list of current cues, sort them.
* html/track/TextTrackCue.cpp:
(WebCore::TextTrackCue::isOrderedBefore): Added; implementation moved
    from TextTrackCueList::add().
* html/track/TextTrackCue.h:
* html/track/TextTrackCueGeneric.cpp:
(WebCore::TextTrackCueGeneric::isOrderedBefore): Added override;
    impose additional oredring on generic cues.
* html/track/TextTrackCueGeneric.h:
* html/track/TextTrackCueList.cpp:
(WebCore::TextTrackCueList::add): Moved ordering test into
    isOrderedBefore().
* rendering/RenderTextTrackCue.cpp:
(WebCore::RenderTextTrackCue::repositionGenericCue):
    Call repositionCueSnapToLinesNotSet() after positioning the cue.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150453 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION(r101810): Media controls status text missing for live-stream videos.
https://bugs.webkit.org/show_bug.cgi?id=116547

Reviewed by Eric Carlson.

Un-reverse the logic in loadedMetadata() so that the status text isn't
hidden (when it should be shown) for live-stream videos.

* html/shadow/MediaControlsApple.cpp:
(WebCore::MediaControlsApple::loadedMetadata):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150454 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed; fix lldb synthetic representation of WTF::Vector after r148891.

* lldb/lldb_webkit.py:
(WTFVectorProvider.num_children):
(WTFVectorProvider.get_child_index):
(WTFVectorProvider.get_child_at_index):
(WTFVectorProvider.update):

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