[CSS Shapes] Redefine the ShapeIntervals class as a template
https://bugs.webkit.org/show_bug.cgi?id=120381

Reviewed by Alexandru Chiculita.

No new tests, this was just an internal refactoring.

The existing ShapeIntervals class has been converted into a template whose
type specifies the type of the interval's x1 and x2 horizontal endpoints
(formerly float). There were several other minor changes, all in the realm
of refactoring:

- The original type was a struct with public x1 and x2 fields. It's now a class
with x1 and x2 accessors. ASSERTS are now used to maintain the x2 >= x1 invariant.
In the original code the invariant was not checked.

- The logical comparison operators have been overloaded for ShapeInterval.
This obviates the IntervalX1Comparator class which has been removed.

- The names of the global ShapeInterval Vector set operation methods have been
changed to reflect the fact that they're now members of the template class,
rather than globals.

PolygonShape.cpp depended on the ShapeInterval class. In the one or two places
where an interval's x1 or x1 fields had been set explicitly, ShapeInterval::set()
is now used to set both fields. This also enables the invariant check mentioned
earlier. The other changes to this class are syntatic, to account for the ShapeInterval
class's changes.

* CMakeLists.txt:
* GNUmakefile.list.am:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.xcodeproj/project.pbxproj:
* rendering/shapes/PolygonShape.cpp:
(WebCore::appendIntervalX):
(WebCore::computeXIntersections):
(WebCore::computeOverlappingEdgeXProjections):
(WebCore::PolygonShape::getExcludedIntervals):
(WebCore::PolygonShape::getIncludedIntervals):
* rendering/shapes/PolygonShape.h:
* rendering/shapes/ShapeInterval.cpp: Removed.
* rendering/shapes/ShapeInterval.h: The entire implementation is now here.
(WebCore::ShapeInterval::ShapeInterval):
(WebCore::ShapeInterval::x1):
(WebCore::ShapeInterval::x2):
(WebCore::ShapeInterval::set):
(WebCore::ShapeInterval::overlaps):
(WebCore::ShapeInterval::intersect):
(WebCore::ShapeInterval::sortVector):
(WebCore::ShapeInterval::uniteVectors):
(WebCore::ShapeInterval::intersectVectors):
(WebCore::ShapeInterval::subtractVectors):
(WebCore::operator==):
(WebCore::operator!=):
(WebCore::operator< ):
(WebCore::operator> ):
(WebCore::operator<=):
(WebCore::operator>=):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154904 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Make sure remove CachedResourceClient when destructing IconLoader
https://bugs.webkit.org/show_bug.cgi?id=120541

Patch by Leo Yang <leoyang@blackberry.com> on 2013-08-30
Reviewed by Darin Adler.

It's a good practice to call CachedResource::removeClient(client)
when the client is being destructed. We need to do this for InconLoader
to prevent m_resource from keeping dangling client in case m_resource
is referenced by someone else in the future.

Found by code inspection. Just a defensive enhancement no new tests.

* loader/icon/IconLoader.cpp:
(WebCore::IconLoader::~IconLoader):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154905 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Animate CSS Image filter() function
https://bugs.webkit.org/show_bug.cgi?id=119938

Reviewed by Simon Fraser.

Source/WebCore:

With this patch, the new introduced CSS Image function filter() can be
animated. According to the spec, just filter functions can be
interpolated.

The patch also prepares StyleImage blending for interpolation of other
generated images like gradients or cross-fade().

http://dev.w3.org/fxtf/filters/#interpolating-filter-image

Test: fast/filter-image/filter-image-animation.html

* css/CSSComputedStyleDeclaration.cpp: Reuse the code that creates a
    CSSValueList from ComputeStyle logic.
(WebCore::valueForPixel):
    For StyleRules we want to have not-adjusted length values.
(WebCore::ComputedStyleExtractor::valueForShadow):
    Add argument to switch between adjusted and not-adjusted length.
(WebCore::ComputedStyleExtractor::valueForFilter):
    Ditto.
(WebCore::ComputedStyleExtractor::propertyValue):
* css/CSSComputedStyleDeclaration.h:
* css/CSSFilterImageValue.h: Add helper functions
    for animating filters. We need to pass the FilterOperations for
    the image generation and the CSSValueList for StyleRule.
(WebCore::CSSFilterImageValue::filterOperations):
(WebCore::CSSFilterImageValue::setFilterOperations):
(WebCore::CSSFilterImageValue::cachedImage):
* page/animation/CSSPropertyAnimation.cpp:
    Add animation code to support animations between two filter()
    function values.
(WebCore::blendFilterOperations):
(WebCore::blendFunc):
(WebCore::filterBlend):
* rendering/style/StyleGeneratedImage.h: Add helper functions.
(WebCore::CSSFilterImageValue::imageValue):

LayoutTests:

Add tests to test animation between two filter() function values.
Furthermore, extended animation-test-helpers.js to parse all kind of CSS
image function where we support animations. CSS Image function can be
deeply nested as well now:

    -wekit-filter(-webkit-cross-fade(url(a.png), url(b.png), 50%), sepia(0.5))

Even the 50% can now be checked with a tolerance. If we should ever support
animations on nested CSS Images, the new code in animation-test-helpers.js
is prepared for it.

Fixed a bunch of tests that passed by accident or needed an update to the new
infrastructure.

* animations/resources/animation-test-helpers.js:
(parseCSSImage): For parsing of all kind of supported CSS Image functions.
    Currently supported: -webkit-cross-fade, -webkit-filter, url, none
    Still missing: linear and radial gradients (can not be animated yet).
    CSS Image functions are allowed to be nested as deep JS allows.
(parseCrossFade): Add parsing of input CSS images.
(parseFilterImage): Parse -webkit-filter image function as well as input images.
(parseFilterFunctionList): Parse filter function list. We now parse the
    function name as well. Added rudimentary support for drop-shadow and url.
(parseDeprecatedCustomFilterFunction): Special case old syntax of custom
    filter function. Shall be removed in the future.
(compareCSSImages): Compares all kind (even deep nested) CSS images.
(compareFilterFunctions): Now compare filter function names as well.
(comparePropertyValue): Use new compareCSSImages function.
* fast/filter-image/filter-image-animation-expected.txt: Added.
* fast/filter-image/filter-image-animation.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154906 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: inspector/storage-panel-dom-storage-update.html is flakey on the bots
https://bugs.webkit.org/show_bug.cgi?id=120544

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2013-08-30
Reviewed by Dean Jackson.

Explicitly listen for events instead of running callbacks after a delay.

* inspector/storage-panel-dom-storage-update.html:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154907 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore: [GStreamer] support in-band text tracks
https://bugs.webkit.org/show_bug.cgi?id=103771

Patch by Brendan Long <b.long@cablelabs.com> on 2013-08-30
Reviewed by Eric Carlson.

Tests: New tests added because existing tests were too specific.
   media/track/in-band/track-in-band-kate-ogg-cues-added-once.html
   media/track/in-band/track-in-band-kate-ogg-kind.html
   media/track/in-band/track-in-band-kate-ogg-language.html
   media/track/in-band/track-in-band-kate-ogg-mode.html
   media/track/in-band/track-in-band-kate-ogg-style.html
   media/track/in-band/track-in-band-kate-ogg-track-order.html
   media/track/in-band/track-in-band-srt-mkv-cues-added-once.html
   media/track/in-band/track-in-band-srt-mkv-kind.html
   media/track/in-band/track-in-band-srt-mkv-language.html
   media/track/in-band/track-in-band-srt-mkv-mode.html
   media/track/in-band/track-in-band-srt-mkv-style.html
   media/track/in-band/track-in-band-srt-mkv-track-order.html

* CMakeLists.txt: Add InbandTextTrackPrivateGStreamer, InbandGenericTextTrack, InbandWebVTTTextTrack, and TextCombinerGStreamer files.
* GNUmakefile.list.am: Same.
* PlatformEfl.cmake: Same.
* Target.pri: Same.
* WebCore.vcxproj/WebCore.vcxproj: Same.
* WebCore.vcxproj/WebCore.vcxproj.filters: Same.
* WebCore.xcodeproj/project.pbxproj: Same.
* html/track/InbandGenericTextTrack.cpp: Split out code for handling generic cues.
(WebCore::GenericTextTrackCueMap::GenericTextTrackCueMap): Move from InbandTextTrack.
(WebCore::GenericTextTrackCueMap::~GenericTextTrackCueMap): Same.
(WebCore::GenericTextTrackCueMap::add): Same.
(WebCore::GenericTextTrackCueMap::find): Same.
(WebCore::GenericTextTrackCueMap::remove): Same.
(WebCore::InbandGenericTextTrack::create): Same.
(WebCore::InbandGenericTextTrack::updateCueFromCueData): Same.
(WebCore::InbandGenericTextTrack::addGenericCue): Same.
(WebCore::InbandGenericTextTrack::updateGenericCue): Same.
(WebCore::InbandGenericTextTrack::removeGenericCue): Same.
(WebCore::InbandGenericTextTrack::removeCue): Same.
(WebCore::InbandGenericTextTrack::InbandGenericTextTrack): Empty.
(WebCore::InbandGenericTextTrack::~InbandGenericTextTrack): Empty.
* html/track/InbandGenericTextTrack.h: Copied from Source/WebCore/html/track/InbandTextTrack.h.
The only addition is the ASSERT_NOT_REACHED() for WebVTT cues.
* html/track/InbandTextTrack.cpp: Add label and language changed callbacks.
(WebCore::InbandTextTrack::create): Return a generic or WebVTT text track based on the private CueFormat.
(WebCore::InbandTextTrack::labelChanged): Added.
(WebCore::InbandTextTrack::languageChanged): Added.
* html/track/InbandTextTrack.h: Add label and language changed callbacks.
* html/track/InbandWebVTTTextTrack.cpp: Added, based on InbandTextTrack.
(WebCore::InbandWebVTTTextTrack::create): Same.
(WebCore::InbandWebVTTTextTrack::InbandWebVTTTextTrack): Empty.
(WebCore::InbandWebVTTTextTrack::~InbandWebVTTTextTrack): Empty.
(WebCore::InbandWebVTTTextTrack::parseWebVTTCueData): Sends data to a WebVTTParser.
(WebCore::InbandWebVTTTextTrack::newCuesParsed): Adds cues when WebVTTParser parses them.
(WebCore::InbandWebVTTTextTrack::fileFailedToParse): Prints a warning when WebVTTParser has a problem.
* html/track/InbandWebVTTTextTrack.h: Added.
* platform/graphics/InbandTextTrackPrivate.h:
(WebCore::InbandTextTrackPrivate::cueFormat): For determining if the track will have generic or WebVTT cues.
(WebCore::InbandTextTrackPrivate::InbandTextTrackPrivate): Pass CueFormat in the constructor.
* platform/graphics/InbandTextTrackPrivateClient.h: Same.
* platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
(WebCore::InbandTextTrackPrivateAVF::InbandTextTrackPrivateAVF): Pass CueFormat (Generic) to InbandTextTrackPrivate.
* platform/graphics/gstreamer/GRefPtrGStreamer.cpp: Add GRefPtr specializations for GstSample and GstEvent.
* platform/graphics/gstreamer/GRefPtrGStreamer.h: Same.
* platform/graphics/gstreamer/GStreamerUtilities.h: Add WARN_MEDIA_MESSAGE.
* platform/graphics/gstreamer/GStreamerVersioning.h: Add a function to check GStreamer version at runtime.
* platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp: Added.
(WebCore::textTrackPrivateEventCallback): Watches for tag and stream start events.
(WebCore::textTrackPrivateSampleTimeoutCallback): See notifyTrackOfSample();
(WebCore::textTrackPrivateStreamTimeoutCallback): See notifyTrackOfStreamChanged();
(WebCore::textTrackPrivateTagsChangeTimeoutCallback): See notifyTrackOfTagsChanged();
(WebCore::InbandTextTrackPrivateGStreamer::InbandTextTrackPrivateGStreamer): Initializes tags and stream and sets up event callback.
(WebCore::InbandTextTrackPrivateGStreamer::~InbandTextTrackPrivateGStreamer): Calls disconnect:
(WebCore::InbandTextTrackPrivateGStreamer::disconnect): Removes signal handlers and frees some memory.
(WebCore::InbandTextTrackPrivateGStreamer::handleSample): Adds samples to a list and sets up callback.
(WebCore::InbandTextTrackPrivateGStreamer::streamChanged): Sets up callback.
(WebCore::InbandTextTrackPrivateGStreamer::tagsChanged): Same.
(WebCore::InbandTextTrackPrivateGStreamer::notifyTrackOfSample): Parses all queued samples with WebVTTParser.
(WebCore::InbandTextTrackPrivateGStreamer::notifyTrackOfStreamChanged): Keeps track of current stream.
(WebCore::InbandTextTrackPrivateGStreamer::notifyTrackOfTagsChanged): Sets label and language from tags.
* platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.h: Added.
(WebCore::InbandTextTrackPrivateGStreamer::create): Basic RefPtr create function.
(WebCore::InbandTextTrackPrivateGStreamer::pad): Returns the pad this track is associated with (used
to determine if a playbin text stream has already been associated with a text track).
(WebCore::InbandTextTrackPrivateGStreamer::setIndex): Sets the track index (used for sorting).
(WebCore::InbandTextTrackPrivateGStreamer::streamId): Returns the stream ID (used to handle new samples).
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::mediaPlayerPrivateTextChangedCallback): Called for playbin "text-changed" event. See textChanged().
(WebCore::mediaPlayerPrivateTextChangeTimeoutCallback): See notifyPlayerOfText().
(WebCore::mediaPlayerPrivateNewTextSampleCallback): See newTextSample().
(WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer): Initialize m_textTimerHandler.
(WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer): Disconnect text tracks (they don't necessarily
get freed here, since a script could hold a reference).
(WebCore::MediaPlayerPrivateGStreamer::textChanged): Setup callback for notifyPlayerOfText.
(WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfText): Create text tracks.
(WebCore::MediaPlayerPrivateGStreamer::newTextSample): Handle new samples by giving them to a text track
with a matching stream. This method is syncryonous because we need to get the stream start sticky event
immediately.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
* platform/graphics/gstreamer/TextCombinerGStreamer.cpp: Added. This element forwards buffers from all
of its input pads, but also converts plain text to WebVTT as needed.
(webkit_text_combiner_init): Setup internal funnel.
(webkitTextCombinerPadEvent): If the caps are plain text make sure we have a webvttenv, otherwise connect
directly to the funnel.
(webkitTextCombinerRequestNewPad): Setup ghostpad and event callback.
(webkitTextCombinerReleasePad): Release pad and optional associated webvttenc.
(webkit_text_combiner_class_init): Setup pad templates and request/release pad functions.
(webkitTextCombinerNew): Returns a new WebKitTextCombiner.
* platform/graphics/gstreamer/TextCombinerGStreamer.h: Added.
* platform/graphics/gstreamer/TextSinkGStreamer.cpp: Added.
(webkit_text_sink_init): Set sync=false.
(webkitTextSinkGetProperty): Ignore sync property.
(webkitTextSinkSetProperty): Same.
(webkitTextSinkQuery): Ignore position and duration queries, forward everything else to appsink.
(webkit_text_sink_class_init): Setup property and query functions.
(webkitTextSinkNew): Return a new WebKitTextSink.
* platform/graphics/gstreamer/TextSinkGStreamer.h: Added.

LayoutTests: <https://webkit.org/b/103771> [GStreamer] support in-band text tracks

Patch by Brendan Long <b.long@cablelabs.com> on 2013-08-30
Reviewed by Eric Carlson.

* media/content/counting-subtitled-kate.ogv: Added.
* media/content/counting-subtitled-srt.mkv: Added.
* media/in-band-cues.js: Added.
* media/track/in-band/track-in-band-kate-ogg-cues-added-once-expected.txt: Added.
* media/track/in-band/track-in-band-kate-ogg-cues-added-once.html: Added.
* media/track/in-band/track-in-band-kate-ogg-kind-expected.txt: Added.
* media/track/in-band/track-in-band-kate-ogg-kind.html: Added.
* media/track/in-band/track-in-band-kate-ogg-language-expected.txt: Added.
* media/track/in-band/track-in-band-kate-ogg-language.html: Added.
* media/track/in-band/track-in-band-kate-ogg-mode-expected.txt: Added.
* media/track/in-band/track-in-band-kate-ogg-mode.html: Added.
* media/track/in-band/track-in-band-kate-ogg-style-expected.txt: Added.
* media/track/in-band/track-in-band-kate-ogg-style.html: Added.
* media/track/in-band/track-in-band-kate-ogg-track-order-expected.txt: Added.
* media/track/in-band/track-in-band-kate-ogg-track-order.html: Added.
* media/track/in-band/track-in-band-srt-mkv-cues-added-once-expected.txt: Added.
* media/track/in-band/track-in-band-srt-mkv-cues-added-once.html: Added.
* media/track/in-band/track-in-band-srt-mkv-kind-expected.txt: Added.
* media/track/in-band/track-in-band-srt-mkv-kind.html: Added.
* media/track/in-band/track-in-band-srt-mkv-language-expected.txt: Added.
* media/track/in-band/track-in-band-srt-mkv-language.html: Added.
* media/track/in-band/track-in-band-srt-mkv-mode-expected.txt: Added.
* media/track/in-band/track-in-band-srt-mkv-mode.html: Added.
* media/track/in-band/track-in-band-srt-mkv-style-expected.txt: Added.
* media/track/in-band/track-in-band-srt-mkv-style.html: Added.
* media/track/in-band/track-in-band-srt-mkv-track-order-expected.txt: Added.
* media/track/in-band/track-in-band-srt-mkv-track-order.html: Added.
* platform/mac/TestExpectations: Skip MKV and OGG tests.

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