Make sure that begin time cannot be greater than SMILTime::indefiniteValue unintentionally.
https://bugs.webkit.org/show_bug.cgi?id=135838

Patch by Renata Hodovan <rhodovan.u-szeged@partner.samsung.com> on 2014-08-12
Reviewed by Darin Adler.

Source/WebCore:

When WebCore::SVGSMILElement::resolveInterval creates a SMILTime begin
node for a SMILInterval, then it only checks if the value of begin is
indefinite or unresolved but misses the case if it is between these two
reference values.

This is a backport of my fix in Blink: https://codereview.chromium.org/406263002/.

Test: svg/animations/animateMotion-crash-with-large-begin-time.html

* svg/animation/SVGSMILElement.cpp:
(WebCore::SVGSMILElement::parseOffsetValue):
(WebCore::SVGSMILElement::parseClockValue):

LayoutTests:

* svg/animations/animateMotion-crash-with-large-begin-time-expected.txt: Added.
* svg/animations/animateMotion-crash-with-large-begin-time.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@172496 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Crash at com.apple.WebKit.WebContent at com.apple.WebKit: WebKit::expandForGap
https://bugs.webkit.org/show_bug.cgi?id=135859
<rdar://problem/17994679>

Reviewed by Tim Horton.

expandForGap made the assumption that the selection rects were always three.
This was not true even before http://trac.webkit.org/changeset/172395 but
was more likely to happen after that change.
        
* WebProcess/WebPage/mac/ServicesOverlayController.mm:
(WebKit::expandForGap):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@172497 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION (r172424): Extra menu header in combined telephone number menu when no phone paired
https://bugs.webkit.org/show_bug.cgi?id=135854
<rdar://problem/17996339>

Reviewed by Enrica Casucci.

* UIProcess/mac/WebContextMenuProxyMac.mm:
(WebKit::WebContextMenuProxyMac::setupServicesMenu):
Get all the menu items ahead of time, and only add the shared header
if there are any telephone number menu items.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@172498 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Generate header detection headers for CMake on Windows.
https://bugs.webkit.org/show_bug.cgi?id=135807

Reviewed by Brent Fulgham.

Source/JavaScriptCore:

* CMakeLists.txt:
Include the derived sources directory to find WTF/WTFHeaderDetection.h.

Source/WebCore:

* CMakeLists.txt:
* PlatformWin.cmake:
Generate and include a stub WebCoreHeaderDetection.h.

Source/WTF:

* wtf/CMakeLists.txt:
* wtf/PlatformWin.cmake:
Generate and include a stub WTFHeaderDetection.h.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@172499 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION: WebContent process has a sandbox extension for the entirety of user's temp directory
https://bugs.webkit.org/show_bug.cgi?id=135853
<rdar://problem/17986556>

Reviewed by Oliver hunt.

Move extensions recently added for iOS benefit under PLATFORM(IOS). Removed some
dead code while at it (child processes don't need actual paths, they only need
sandbox extensions in most cases).

* NetworkProcess/cocoa/NetworkProcessCocoa.mm:
(WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
* Shared/Network/NetworkProcessCreationParameters.cpp:
(WebKit::NetworkProcessCreationParameters::encode):
(WebKit::NetworkProcessCreationParameters::decode):
* Shared/Network/NetworkProcessCreationParameters.h:
* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode):
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.h:
* UIProcess/WebContext.cpp:
(WebKit::WebContext::ensureNetworkProcess):
(WebKit::WebContext::createNewWebProcess):
(WebKit::WebContext::openGLCacheDirectory): Deleted.
(WebKit::WebContext::networkingHSTSDatabasePath): Deleted.
* UIProcess/WebContext.h:
* UIProcess/efl/WebContextEfl.cpp:
(WebKit::WebContext::containerTemporaryDirectory): Deleted.
(WebKit::WebContext::platformDefaultNetworkingHSTSDatabasePath): Deleted.
* UIProcess/gtk/WebContextGtk.cpp:
(WebKit::WebContext::containerTemporaryDirectory): Deleted.
(WebKit::WebContext::platformDefaultNetworkingHSTSDatabasePath): Deleted.
* UIProcess/mac/WebContextMac.mm:
(WebKit::WebContext::openGLCacheDirectory):
(WebKit::WebContext::parentBundleDirectory):
(WebKit::WebContext::networkingHSTSDatabasePath):
(WebKit::WebContext::platformDefaultOpenGLCacheDirectory): Deleted.
(WebKit::WebContext::platformDefaultNetworkingHSTSDatabasePath): Deleted.
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@172500 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Small region (~1px tall) where you get the selection button instead of the phone number overlay
https://bugs.webkit.org/show_bug.cgi?id=135852
<rdar://problem/17992795>

Reviewed by Enrica Casucci.

* WebProcess/WebPage/ServicesOverlayController.h:
* WebProcess/WebPage/mac/ServicesOverlayController.mm:
(WebKit::ServicesOverlayController::findTelephoneNumberHighlightContainingSelectionHighlight):
(WebKit::ServicesOverlayController::determineActiveHighlight):
If our new active highlight is a selection highlight that is completely contained
by one of the phone number highlights, we'll make the phone number highlight active
even if it's not hovered. This fixes the case where the selection highlight
(a subset of a telephone number) is slightly taller than the telephone number
highlight, and can be hovered without hovering the phone number highlight

* WebCore.exp.in:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@172501 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Cached file backed resources don't make it to the Web Process when NETWORK_CFDATA_ARRAY_CALLBACK is enabled
https://bugs.webkit.org/show_bug.cgi?id=135727
<rdar://problem/17947880>

Reviewed by Darin Adler.

Source/WebCore:

Add SharedBuffer::existingCFData() which returns CFDataRef if it has one. Refactor
this code out of createCFData().

* WebCore.exp.in:
* platform/SharedBuffer.h:
* platform/mac/SharedBufferMac.mm:
(WebCore::SharedBuffer::existingCFData): Added.
(WebCore::SharedBuffer::createCFData):

Source/WebKit2:

tryGetShareableHandleFromSharedBuffer() assumed that we have a file backed resource only if
we had a CFDataRef (platformData()) in SharedBuffer. This is wrong when we use the data
array callbacks since the file backed buffer could be in the data array. Instead of relying
on hasPlatformData(), explicitly ask the SharedBuffer to give us a CFDataRef if it has one
so that SharedBuffer can take care of the data array case.

* NetworkProcess/mac/NetworkResourceLoaderMac.mm:
(WebKit::NetworkResourceLoader::tryGetShareableHandleFromSharedBuffer):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@172502 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore:
Runtime switch for long mouse press gesture. Part of 135257 - Add long mouse press gesture.
https://bugs.webkit.org/show_bug.cgi?id=135682

Patch by Peyton Randolph <prandolph@apple.com> on 2014-08-12
Reviewed by Tim Horton.

* Configurations/FeatureDefines.xcconfig:
Remove ENABLE_LONG_MOUSE_PRESS feature flag.

Source/WebCore:
Runtime switch for long mouse press gesture. Part of 135257 - Add long mouse press gesture.
https://bugs.webkit.org/show_bug.cgi?id=135682

Patch by Peyton Randolph <prandolph@apple.com> on 2014-08-12
Reviewed by Tim Horton.

This patch adds a runtime switch for the Long Mouse Press Gesture and initially sets the feature flag
to false. It also removes the ENABLE_LONG_MOUSE_PRESS feature flag as the runtime switch now guards
its functionality.

* Configurations/FeatureDefines.xcconfig: Remove LONG_MOUSE_PRESS feature flag.
* page/EventHandler.cpp:
(WebCore::EventHandler::EventHandler):
(WebCore::EventHandler::clear): Remove feature flag.
(WebCore::EventHandler::handleMousePressEvent): Ditto.
(WebCore::EventHandler::eventMayStartDrag): Ditto.
(WebCore::EventHandler::handleMouseReleaseEvent):
Perform event iff long mouse presses are enabled.
(WebCore::EventHandler::beginTrackingPotentialLongMousePress): Ditto.
(WebCore::EventHandler::recognizeLongMousePress): Ditto.
(WebCore::EventHandler::cancelTrackingPotentialLongMousePress): Ditto.
(WebCore::EventHandler::handleMouseMoveEvent): Remove feature flag.
(WebCore::EventHandler::handleDrag): Ditto.
(WebCore::EventHandler::mouseMovementExceedsThreshold): Ditto.
* page/EventHandler.h:
* page/Settings.in: Add longMousePressEnabled setting, initially false.

Source/WebKit/mac:
Runtime switch for long mouse press gesture. Part of 135257 - Add long mouse press gesture.
https://bugs.webkit.org/show_bug.cgi?id=135682

Patch by Peyton Randolph <prandolph@apple.com> on 2014-08-12
Reviewed by Tim Horton.

* Configurations/FeatureDefines.xcconfig:
Remove LONG_MOUSE_PRESS feature flag.

Source/WebKit2:
Runtime switch for long mouse press gesture. Part of 135257 - Add long mouse press gesture
https://bugs.webkit.org/show_bug.cgi?id=135682

Patch by Peyton Randolph <prandolph@apple.com> on 2014-08-12
Reviewed by Tim Horton.

* Configurations/FeatureDefines.xcconfig: Remove LONG_MOUSE_PRESS feature flag.
* Shared/WebPreferencesDefinitions.h:
Add LongMousePressEnabled preference, initially false.
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetLongMousePressEnabled): Added.
(WKPreferencesGetLongMousePressEnabled): Added.
* UIProcess/API/C/WKPreferencesRefPrivate.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):
Reflect the WebKit long mouse press setting in WebCore.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@172503 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fonts forced to use non synthetic italics might be laid out with the incorrect baseline
https://bugs.webkit.org/show_bug.cgi?id=135403

Reviewed by Darin Adler.

Source/WebCore:

When italics is specified on a font, and the font isn't coming from the cache, we ask
the SimpleFontData to provide a non-synthetic-italic version of itself. Our current
implementation doesn't preserve whether or not the SimpleFontData includes vertical
glyphs (glyphs that are not rotated when drawn in the vertical writing mode), which
determines which baseline we use to lay out the text. By passing "false" to
the isTextOrientationFallback argument to SimpleFontData::create(), we preserve this
hasVerticalGlyphs flag.

Test: fast/text/international/synthesized-italic-vertical-latin-double.html

* platform/graphics/SimpleFontData.cpp:
(WebCore::SimpleFontData::nonSyntheticItalicFontData):
* testing/Internals.cpp:
(WebCore::Internals::invalidateFontCache): Add "invalidateFontCache" to window.internals.
* testing/Internals.h: Ditto.
* testing/Internals.idl: Ditto.

LayoutTests:

Laying out the same string twice (where there is a cache collision) should be rendered
the same as laying out similar strings (where there is no cache collision).

* fast/text/international/synthesized-italic-vertical-latin-double-expected.html: Added.
* fast/text/international/synthesized-italic-vertical-latin-double.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@172504 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed, rolling out r172494.
https://bugs.webkit.org/show_bug.cgi?id=135864

asserting on bots (Requested by kling on #webkit).

Reverted changeset:

"Don't recurse into non-rendered subtrees when computing
style"
https://bugs.webkit.org/show_bug.cgi?id=135844
http://trac.webkit.org/changeset/172494

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@172505 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[MSE] YouTube will lose audio, video after seeking backwards to an unbuffered range.
https://bugs.webkit.org/show_bug.cgi?id=135855

Reviewed by Eric Carlson.

When seeking into an unbuffered or partially buffered range, we will unconditionally pass samples to the
decode queue even if there exist large gaps between those samples. Subsequently, the decoder will not
notify us that it has become ready for new samples until playback reaches those later samples and the samples
are discarded.

When sending samples to be decoded in provideMediaData(), stop if there exists a large gap in the sample timeline.
Do this by tracking the last enqueued decode end time, and look to see if the next sample's decode time indicates
a gap of greater than 1 second.

* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::TrackBuffer::TrackBuffer): Initialize lastEnqueuedDecodeEndTime.
(WebCore::SourceBuffer::seekToTime): Set needsReenqueueing, in case samples do not yet exist in the trackBuffer
    sufficient to re-enqueue for the destination time, so that re-enqueueing will occur after the next append.
(WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample): Check against lastEnqueuedDecodeEndTime, rather than
    lastEnqueuedPresentationTime before adding samples to the decodeQueue.
(WebCore::SourceBuffer::provideMediaData): Stop when we reach a large gap between samples.
(WebCore::SourceBuffer::reenqueueMediaForTime): Set or clear lastEnqueuedDecodeEndTime based on whether we
    have appended any non-displaying samples after flushing.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@172506 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[MSE][Mac] Seeking to the very beginning of a buffered range stalls video playback
https://bugs.webkit.org/show_bug.cgi?id=135865

Reviewed by Eric Carlson.

AVSampleBufferRenderSynchronizer will report a current time of about 100ms or so before
the destination seek time when seeking. It does this in order to pre-roll the synchronized
audio renderer, but this can lead to playback stalling when MediaSource::monitorSourceBuffers()
looks at the media element's current time and determines that the current time is 100ms before
any buffered samples.

Clamp the value of currentMediaTime() to, at a minimum, the last requested seek time. This was
the suggested course of action from <rdar://problem/17789374>.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::durationDouble):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::currentMediaTime):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekInternal):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@172507 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Enable didReceiveDataArray callback on Mac
https://bugs.webkit.org/show_bug.cgi?id=135554
<rdar://problem/9170731>

Reviewed by Andreas Kling.

Enable WTF_USE_NETWORK_CFDATA_ARRAY_CALLBACK for all Cocoa platforms so that we use the same
code path for Mac and iOS.

* wtf/Platform.h:

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