Support both window and view based video fullscreen.
https://bugs.webkit.org/show_bug.cgi?id=135525

Patch by Jeremy Jones <jeremyj@apple.com> on 2014-08-02
Reviewed by Simon Fraser.

Source/WebCore:
Presenting in a separate window gives greater flexibility for rotation separately from the app.
Presenting in the same window works better if the interface is rehosted in another process.

* platform/ios/WebVideoFullscreenControllerAVKit.mm:
(-[WebVideoFullscreenController enterFullscreen:]): Use clientRect instead of screenRect.
* platform/ios/WebVideoFullscreenInterfaceAVKit.h: Add m_window and m_parentView.
* platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
(-[WebAVVideoLayer setBounds:]): Parent view might not be fullscreen; use window instead.
(WebVideoFullscreenInterfaceAVKit::setupFullscreen): Conditionally create UIWindow and UIViewController for fullscreen.
(WebVideoFullscreenInterfaceAVKit::enterFullscreen): Video, not the container should have black background.
(WebVideoFullscreenInterfaceAVKit::exitFullscreen): Conditionally translate finalRect.
(WebVideoFullscreenInterfaceAVKit::cleanupFullscreen): Clean up UIWindow and force status bar to correct orientation.
(WebVideoFullscreenInterfaceAVKit::invalidate): Clean up UIWindow.
(WebVideoFullscreenInterfaceAVKit::requestHideAndExitFullscreen): Hide window and exit without animation.
* platform/ios/WebVideoFullscreenModelMediaElement.mm:
(WebVideoFullscreenModelMediaElement::setVideoFullscreenLayer): Apply frame, because it may have been set before the layer.

Source/WebKit/mac:
Parenting in the view instead of the window gives the fullscreen implementation more latitude
in how it implements the animation.

* WebView/WebView.mm:
(-[WebView _enterFullscreenForNode:]): Use view instead of window.

Source/WebKit2:
Parenting in the view instead of the window gives the fullscreen implementation more latitude
in how it implements the animation.

* UIProcess/ios/WebVideoFullscreenManagerProxy.mm:
(WebKit::WebVideoFullscreenManagerProxy::setupFullscreenWithID): Use view instead of window.
* WebProcess/ios/WebVideoFullscreenManager.mm:
(WebKit::clientRectForNode): Use client rect instead of screen rect.
(WebKit::WebVideoFullscreenManager::enterFullscreenForNode): ditto
(WebKit::WebVideoFullscreenManager::exitFullscreenForNode): ditto
(WebKit::screenRectForNode): Deleted.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@171973 268f45cc-cd09-0410-ab3c-d52691b4dbfc
<rdar://problem/17782529> REGRESSION: OS marketing version in iOS Simulator user-agent string is the host OS’s
https://bugs.webkit.org/show_bug.cgi?id=135549

Reviewed by Mark Rowe.

* platform/cocoa/SystemVersion.mm:
(WebCore::createSystemMarketingVersion): On the iOS Simulator, locate the system Library
directory relative to the Simulator root.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@171984 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EFL] Move DATA_INSTALL_DIR to ewebkit2-0
https://bugs.webkit.org/show_bug.cgi?id=135553

Reviewed by Gyuyoung Kim.

Since WebKit1/Efl is dropped, we don't need to use ewebkit-1 and ewebkit2-1.
And removed WebKit_OUTPUT_NAME variable which is not used anymore on the EFL port.

* Source/cmake/OptionsEfl.cmake:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@171985 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] Do not include JavaScriptCore stress tests in release tarballs
https://bugs.webkit.org/show_bug.cgi?id=135503

Reviewed by Martin Robinson.

* gtk/manifest.txt: Exclude Source/JavaScriptCore/tests dir.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@171986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CMake] Add FindWayland.cmake
https://bugs.webkit.org/show_bug.cgi?id=135540

Reviewed by Martin Robinson.

* Source/cmake/FindWayland.cmake: Added. Enables finding the Wayland
dependency. For now bundles the wayland-client, wayland-server and
wayland-egl pkg-config targets into one dependency, but these could
be split in the future if necessary.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@171987 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] Windowing target support should reflect the support in the GTK+ dependency
https://bugs.webkit.org/show_bug.cgi?id=134736

Reviewed by Martin Robinson.

* Source/cmake/FindGTK3.cmake: Don't error out if the GTK+ dependency doesn't
support the X11 or Wayland windowing targets -- instead, if there's no support
the specific target is disabled, and an error is thrown only if neither of the
backends is enabled at the end..
For now the X11 target remains enabled by default, and the Wayland target is
kept disabled. Once it's possible to have both targets enabled at runtime in
WebKit, the Wayland target will be enabled as well and we'll leave it to the
GTK+ dependency to determine which targets can be enabled.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@171988 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WinCairo] Compile error in OpenTypeMathData.cpp.
https://bugs.webkit.org/show_bug.cgi?id=135541

Patch by peavo@outlook.com <peavo@outlook.com> on 2014-08-04
Reviewed by Brent Fulgham.

The SharedBuffer class needs to be defined.
Also, the OpenTypeMathData constructor should be implemented when OPENTYPE_MATH is not enabled.

* platform/graphics/opentype/OpenTypeMathData.cpp:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@171989 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed EFL gardening

* platform/efl/TestExpectations: Add or update test expectations for failing tests.
* platform/efl/fast/text/international/cjk-segmentation-expected.txt: Added.
* platform/efl/js/dom/global-constructors-attributes-expected.txt: Rebaseline after r167632.
* platform/efl/sputnik/Unicode/Unicode_320/S7.6_A2.2_T2-expected.txt: Added.
* platform/efl/sputnik/Unicode/Unicode_320/S7.6_A5.2_T8-expected.txt: Added.
* platform/efl/svg/text/non-bmp-positioning-lists-expected.png: Rebaseline after r168350 and r168543.
* platform/efl/svg/text/non-bmp-positioning-lists-expected.txt: Ditto.
* platform/efl/transforms/2d/hindi-rotated-expected.txt: Fix baseline.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@171990 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] Install all unstable webkitdom headers
https://bugs.webkit.org/show_bug.cgi?id=135544

Reviewed by Gustavo Noronha Silva.

We were checking whether generated file existed before they had
been generated.

* PlatformGTK.cmake: Add Unstable.h header for all stable classes
to GObjectDOMBindingsUnstable_INSTALLED_HEADERS and split the
install command for stable and unstable headers making unstable
headers optional.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@171991 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[MSE] Seeking occasionally causes many frames to be displayed in "fast forward" mode
https://bugs.webkit.org/show_bug.cgi?id=135422

Reviewed by Eric Carlson.

When a seek is pending, but samples for the new time is not yet present in the SourceBuffer,
the SourceBufferPrivate may signal that it's ready for new samples through the
sourceBufferPrivateDidBecomeReadyForMoreSamples() method. In this situation, we should not
continue to provideMediaData(), as that will append samples from the prior-to-seeking media
timeline. Since the timeline may have moved forward due to the seek, a decoder may decide to
display those frames as quickly as possible (the "fast forward" behavior) in order to catch
up to the new current time.

If a re-enqueue is pending, don't provide media data in response to being notified that the
SourceBufferPrivate is ready for more samples. Wait until samples for the new current time
are appended.

* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::sourceBufferPrivateDidBecomeReadyForMoreSamples):
* dom/Document.cpp:
(WebCore::Document::unregisterCollection):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@171992 268f45cc-cd09-0410-ab3c-d52691b4dbfc
QuickLook resources are cache-replaced with their original binary data causing ASSERT(m_data->size() == newBuffer->size()) in CachedResource.cpp
https://bugs.webkit.org/show_bug.cgi?id=135548
<rdar://problem/17891321>

Reviewed by David Kilzer.

When loading QuickLook resources, the SharedBuffer in the CachedResource is actually a
converted representation of the real QuickLook resource. Replacing this with the actual
network resource (which is what tryReplaceEncodedData() tried to do) is wrong and triggered
asserts in the code.

Fix this by having CachedRawResource::mayTryReplaceEncodedData() return false if we are
loading a QuickLook resource.

No new tests because we don't have a way to test QuickLook documents.

* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::ResourceLoader):
(WebCore::ResourceLoader::didCreateQuickLookHandle):
    Set a flag to indicate that we are loading a QuickLook document.
* loader/ResourceLoader.h:
(WebCore::ResourceLoader::isQuickLookResource):
* loader/cache/CachedRawResource.cpp:
(WebCore::CachedRawResource::CachedRawResource):
(WebCore::CachedRawResource::finishLoading):
    Check if we were loading a QuickLook document and if so disable encoded data
    replacement.
* loader/cache/CachedRawResource.h:
    Add a new bool field returned by mayTryReplaceEncodedData(). Default is true but it is
    set to false in finishLoading() if we were loading QuickLook document.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@171993 268f45cc-cd09-0410-ab3c-d52691b4dbfc
AX: The Dictation command "Replace <phrase> with <phrase>" always capitalizes the replacement string
https://bugs.webkit.org/show_bug.cgi?id=135557

Reviewed by Mario Sanchez Prada.

Source/WebCore:
When replacing text, we should match the capitalization of the word being replaced
(unless the replacement looks like an abbreviation).

Test: platform/mac/accessibility/find-and-replace-match-capitalization.html

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::selectText):

LayoutTests:
* platform/mac/accessibility/find-and-replace-match-capitalization-expected.txt: Added.
* platform/mac/accessibility/find-and-replace-match-capitalization.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@171994 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[MSE] Re-enqueing due to overlapping appended samples can cause stuttering playback
https://bugs.webkit.org/show_bug.cgi?id=135424

Reviewed by Eric Carlson.

If it become necessary to re-enqueue samples (due to appending overlapping samples which cause
existing samples to be removed), the previous behavior was to flush and re-enqueue the new
samples dependencies; i.e., everything up to and including the previous sync sample. This causes
the decoder to visibly stall while it decodes those non-displaying samples, which could be
a second or more worth of encoded video samples, depending on the frequency of sync samples.

Instead, when we are asked to re-enqueue, we will look for the next occurring sync sample.
If found, we can switch over to the replacement samples at that point in the decode queue.
This limits the overhead of a stream switch, and should allow for a visually seamless switch,
at the cost of having to wait for the next sync sample to occur to affect the switch.

* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::seekToTime): Clear the decode queue when seeking.
(WebCore::SourceBuffer::sourceBufferPrivateAppendComplete): Call reenqueueMediaForCurrentTime.
(WebCore::SourceBuffer::reenqueueMediaForCurrentTime): Switch over to the new stream only
    at the next sync sample.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@171995 268f45cc-cd09-0410-ab3c-d52691b4dbfc
AX: AXSelectTextWithCriteriaParameterizedAttribute incorrectly selects the beginning letters of a word
https://bugs.webkit.org/show_bug.cgi?id=135547

Reviewed by Mario Sanchez Prada.

Source/WebCore:
Allow text search to specify that it wants to match end of words as well as start of words.
This allows select text criteria to match on whole words only.

Test: platform/mac/accessibility/select-text-should-match-whole-words.html

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::rangeOfStringClosestToRangeInDirection):
* editing/FindOptions.h:
* editing/TextIterator.cpp:
(WebCore::SearchBuffer::isWordEndMatch):
(WebCore::SearchBuffer::search):

LayoutTests:
* platform/mac/accessibility/select-text-should-match-whole-words-expected.txt: Added.
* platform/mac/accessibility/select-text-should-match-whole-words.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@171996 268f45cc-cd09-0410-ab3c-d52691b4dbfc
AX: SelectText functionality always selects text after current selection even if closer selection is behind it
https://bugs.webkit.org/show_bug.cgi?id=135546

Reviewed by Mario Sanchez Prada.

Source/WebCore:
Logic was incorrect for comparing ranges found before the current selection.
ASSERT was incorrect for allowed ranges. We need to allow ranges that are right at the boundaries of our found ranges.

Extended existing test: platform/mac/accessibility/select-text.html

* accessibility/AccessibilityObject.cpp:
(WebCore::rangeClosestToRange):

LayoutTests:
* platform/mac/accessibility/select-text-expected.txt:
* platform/mac/accessibility/select-text.html:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@171997 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: All-caps CSS properties are not shown in Computed pane
https://bugs.webkit.org/show_bug.cgi?id=133700

Patch by Matt Baker <mattbaker@apple.com> on 2014-08-04
Reviewed by Timothy Hatcher.

* inspector/InspectorStyleSheet.cpp:
(WebCore::InspectorStyle::styleWithProperties):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@171999 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[MSE] Further fixes for "fast forward" playback after seeking in YouTube behavior.
https://bugs.webkit.org/show_bug.cgi?id=135572

Reviewed by Eric Carlson.

Two related fixes:

In reenqueueMediaForTime(), update TrackBuffer.lastEnqueuedPresentationTime when we flush samples, so that
the next time samples are re-enqueued, the starting point for re-enqueueing is correct.

In sourceBufferPrivateDidReceiveSample(), do not add samples to the decode queue if they are before the
current media time.

* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
(WebCore::SourceBuffer::reenqueueMediaForTime):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@172000 268f45cc-cd09-0410-ab3c-d52691b4dbfc
AX: Secure text fields need to support Search parameterized attributes
https://bugs.webkit.org/show_bug.cgi?id=135568

Reviewed by Mario Sanchez Prada.

Source/WebCore: 
 
Secure text fields still need to support the fast searching that WebKit exposes, even though they don't support
other parameterized attributes.
  
Test: platform/mac/accessibility/secure-text-field-supports-fast-search.html

* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityParameterizedAttributeNames]):

LayoutTests: 

* platform/mac/accessibility/secure-text-field-supports-fast-search-expected.txt: Added.
* platform/mac/accessibility/secure-text-field-supports-fast-search.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@172002 268f45cc-cd09-0410-ab3c-d52691b4dbfc
AX: isWordEndMatch should allow for multiple word selections
https://bugs.webkit.org/show_bug.cgi?id=135573

Reviewed by Mario Sanchez Prada.


Source/WebCore: 
isWordEndMatch was searching from the beginning of the selected range, which meant
that if the result was multiple words, we'd reject the result. 
Instead, we should search from the end of the range, so that we encompass all words.

Modified existing test: platform/mac/accessibility/select-text-should-match-whole-words.html

* editing/TextIterator.cpp:
(WebCore::SearchBuffer::isWordEndMatch):

LayoutTests: 
* platform/mac/accessibility/select-text-should-match-whole-words-expected.txt:
* platform/mac/accessibility/select-text-should-match-whole-words.html:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@172005 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Always clear ConsoleClient when Page/WindowShell is destroyed
https://bugs.webkit.org/show_bug.cgi?id=135569

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2014-08-04
Reviewed by Mark Lam.

* bindings/js/ScriptController.cpp:
(WebCore::ScriptController::~ScriptController):
Whenever a window shell goes away, clear the console client.
We did this in clearWindowShell but not before destroying.

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