getBBox() returns (0,0) when width or height is zero.
https://bugs.webkit.org/show_bug.cgi?id=93290

Patch by Nikos Andronikos <nikos.andronikos-webkit@cisra.canon.com.au> on 2014-06-01
Reviewed by Philip Rogers.

Source/WebCore:

The SVG spec states that a width or height of zero for  rects, circles and
ellipses is valid but disables rendering of that shape.
In this case, getBBox() should return the actual bounding box of the element.
Previously, WebKit always returned (0,0,0,0) rather than the
correct bounding box. This patch fixes that.

Rects and ellipses both now follow the same behaviour where
the fall-back code path is only used when the shape will render (e.g. not
when a dimension <= 0).

This necessitates calling calculateRadiiAndCenter for ellipses even
when the calculated values will be discarded in the fall back code path.
But calculateRadiiAndCenter is cheap and this avoids making changes
elsewhere to stop CG drawing a zero width (or height) ellipse.

Tests: svg/custom/getBBox-js-circle-zerodimension.html
       svg/custom/getBBox-js-ellipse-zerodimension.html
       svg/custom/getBBox-js-rect-zerodimension.html

* rendering/svg/RenderSVGEllipse.cpp:
(WebCore::RenderSVGEllipse::updateShapeFromElement):
Only follow fall-back code path when shape renders.
width||height==0 is not an error case so calculate bounding box.

* rendering/svg/RenderSVGRect.cpp:
(WebCore::RenderSVGRect::updateShapeFromElement):
Only follow fall-back code path when shape renders.
rx||ry==0 is not an error case so calculate bounding box.

LayoutTests:

* platform/mac/svg/W3C-SVG-1.1/shapes-circle-02-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/shapes-ellipse-02-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/shapes-intro-01-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/shapes-rect-02-t-expected.txt:
* svg/W3C-SVG-1.1/animate-elem-32-t-expected.txt:
* svg/W3C-SVG-1.1/shapes-circle-02-t-expected.txt:
* svg/W3C-SVG-1.1/shapes-ellipse-02-t-expected.txt:
* svg/W3C-SVG-1.1/shapes-intro-01-t-expected.txt:
* svg/W3C-SVG-1.1/shapes-rect-02-t-expected.txt:
* svg/custom/getBBox-js-circle-zerodimension-expected.txt: Added.
* svg/custom/getBBox-js-circle-zerodimension.html: Added.
* svg/custom/getBBox-js-ellipse-zerodimension-expected.txt: Added.
* svg/custom/getBBox-js-ellipse-zerodimension.html: Added.
* svg/custom/getBBox-js-rect-zerodimension-expected.txt: Added.
* svg/custom/getBBox-js-rect-zerodimension.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@169522 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[MSE] Appends of overlapping sample data do not clear existing samples properly.
https://bugs.webkit.org/show_bug.cgi?id=133435

Reviewed by Darin Adler.

Source/WebCore:
Test: media/media-source/media-source-overlapping-append.html

The MSE spec has a spec error in how it removes overlapping frames. The intention seems to be
to check for overlapping samples only when the incoming sample increases the highest presentation time
field. But due to a mismatch in the range of a sample, defined as [start, end), and the check, which
treats the end as inclusive, the overlapping check is almost never run.

Add the sample comparison logic to match [start, end) ranges, and rename the existing check to differentiate
it from the new one:
* Modules/mediasource/SampleMap.cpp:
(WebCore::SamplePresentationTimeIsInsideRangeComparator::operator()):
(WebCore::SamplePresentationTimeIsWithinRangeComparator::operator()):
(WebCore::SampleMap::findSamplesBetweenPresentationTimes):
(WebCore::SampleMap::findSamplesWithinPresentationRange):
* Modules/mediasource/SampleMap.h:

Update the overlapping check to occur whenever the highest presentation time increases, and update the
logic within that check to catch all overlapping frames.
* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::sourceBufferPrivateDidReceiveInitializationSegment):
(WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
(WebCore::SourceBuffer::bufferedSamplesForTrackID):
* Modules/mediasource/SourceBuffer.h:
* WebCore.exp.in:

Add a dump method to MediaSample so that samples can be easily converted to a string for testing.
* platform/MediaSample.h:
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(WebCore::MediaSampleAVFObjC::presentationSize):
(WebCore::MediaSampleAVFObjC::dump):

Update the Mock MSE implementation to pass along a "generation" field, to aid in testing.
* platform/mock/mediasource/MockBox.cpp:
(WebCore::MockSampleBox::MockSampleBox):
* platform/mock/mediasource/MockBox.h:
* platform/mock/mediasource/MockSourceBufferPrivate.cpp:
(WebCore::MockMediaSample::dump):

Add a method to internals to dump the buffered samples to string.
* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::bufferedSamplesForTrackID):
* Modules/mediasource/SourceBuffer.h:
* testing/Internals.cpp:
(WebCore::Internals::bufferedSamplesForTrackID):
* testing/Internals.h:
* testing/Internals.idl:

Source/WTF:
Add a dump method to MediaTime, so that MediaTimes can be easily converted to strings (for logging purposes).

* wtf/MediaTime.cpp:
(WTF::MediaTime::dump):
* wtf/MediaTime.h:

LayoutTests:
* media/media-source/media-source-overlapping-append-expected.txt: Added.
* media/media-source/media-source-overlapping-append.html: Added.
* media/media-source/mock-media-source.js:

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