Reduce allocations in URLParser
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2016-09-20  Alex Christensen  <achristensen@webkit.org>
2
3         Reduce allocations in URLParser
4         https://bugs.webkit.org/show_bug.cgi?id=162241
5
6         Reviewed by Chris Dumez.
7
8         Use Vectors instead of StringBuilders.  This allows us to use the inline capacity on the stack
9         for short URLs (<2KB) and also allows us to skip branches because we know whether the
10         contained type is UChar or LChar at compile time.  It also allows us to use uncheckedAppend.
11
12         Added new API tests for parts that were less tested, but there is
13         no change in behavior except for a performance improvement.
14
15         * platform/URLParser.cpp:
16         (WebCore::appendCodePoint):
17         (WebCore::encodeQuery):
18         (WebCore::URLParser::failure):
19         (WebCore::URLParser::parse):
20         (WebCore::percentDecode):
21         (WebCore::domainToASCII):
22         (WebCore::hasInvalidDomainCharacter):
23         (WebCore::URLParser::parseHost):
24         (WebCore::formURLDecode):
25         (WebCore::isC0Control): Deleted.
26         * platform/URLParser.h:
27
28 2016-09-20  Nan Wang  <n_wang@apple.com>
29
30         AX: voiceover does not read contents of input role="spinbutton"
31         https://bugs.webkit.org/show_bug.cgi?id=162137
32
33         Reviewed by Chris Fleizach.
34
35         The aria-valuenow attribute value on the spinbutton is not exposed
36         on iOS. We should expose aria-valuenow attribute for range controls
37         based on https://www.w3.org/TR/wai-aria/states_and_properties#aria-valuenow
38
39         Changes are covered in the modified test.
40
41         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
42         (-[WebAccessibilityObjectWrapper accessibilityValue]):
43
44 2016-09-20  Michael Catanzaro  <mcatanzaro@igalia.com>
45
46         URLParser: uidna_IDNToASCII_56 is deprecated
47         https://bugs.webkit.org/show_bug.cgi?id=161841
48
49         Reviewed by Alex Christensen.
50
51         Add pragmas to silence the warning, plus a FIXME.
52
53         * platform/URLParser.cpp:
54         (WebCore::domainToASCII):
55
56 2016-09-20  Alex Christensen  <achristensen@webkit.org>
57
58         Make URLSearchParams spec-compliant
59         https://bugs.webkit.org/show_bug.cgi?id=162247
60
61         Reviewed by Chris Dumez and Sam Weinig.
62
63         Covered by newly-passing web platform tests.
64
65         * html/DOMURL.cpp:
66         (WebCore::DOMURL::~DOMURL):
67         (WebCore::DOMURL::setHref):
68         (WebCore::DOMURL::setQuery):
69         Update any associated URLSearchParams object when the query could change.
70         (WebCore::DOMURL::searchParams):
71         The lifetime of the URLSearchParams was wrong.  We were creating a new URLSearchParams each time
72         URL.searchParams was called, and we should have been creating one the first time and returning the
73         same instance for subsequent calls.  This means the DOMURL must own the URLSearchParams if it is associated,
74         but if it is not associated, then a URLSearchParams can live on its own.
75         * html/DOMURL.h:
76         * html/URLSearchParams.h:
77         (WebCore::URLSearchParams::URLDestroyed):
78         (WebCore::URLSearchParams::setContents):
79
80 2016-09-20  Antti Koivisto  <antti@apple.com>
81
82         Remove AuthorStyleSheets::m_hadActiveLoadingStylesheet bit
83         https://bugs.webkit.org/show_bug.cgi?id=162312
84
85         Reviewed by Chris Dumez.
86
87         * dom/AuthorStyleSheets.cpp:
88         (WebCore::AuthorStyleSheets::analyzeStyleSheetChange):
89
90             We can handle loading sheets with the normal stylesheet change logic. Remove the special case.
91
92         (WebCore::filterEnabledNonemptyCSSStyleSheets):
93
94             Filter out loading stylesheets.
95
96         * dom/AuthorStyleSheets.h:
97
98 2016-09-20  Keith Rollin  <krollin@apple.com>
99
100         Adjust current networking logging
101         https://bugs.webkit.org/show_bug.cgi?id=162235
102
103         Reviewed by Antti Koivisto.
104
105         Update the "always on" network logging in order to better track the
106         loading of a particular resource and to better bind together the
107         resources downloaded for a particular page and frame. Do this by
108         consistently logging pageID, frameID, and resourceID.
109
110         No new tests -- there are no tests for logging.
111
112         * loader/FrameLoader.cpp:
113         (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
114         * loader/ResourceLoader.h:
115         (WebCore::ResourceLoader::frame):
116
117 2016-09-20  Alex Christensen  <achristensen@webkit.org>
118
119         Non-special URLs should have an opaque origin
120         https://bugs.webkit.org/show_bug.cgi?id=162254
121
122         Reviewed by Sam Weinig.
123
124         Covered by newly passing web platform tests.
125
126         * page/SecurityOrigin.cpp:
127         (WebCore::shouldTreatAsUniqueOrigin):
128         According to https://url.spec.whatwg.org/#origin all URLs with non-special protocols
129         should have a unique SecurityOrigin whose serialization is "null".
130
131 2016-09-20  Christopher Reid  <Christopher.Reid@am.sony.com>
132
133         [WinCairo]  Not building since 206044
134         https://bugs.webkit.org/show_bug.cgi?id=162246
135
136         Reviewed by Alex Christensen.
137
138         No new tests. No change in behaviour.
139
140         * bindings/js/JSWebGLRenderingContextCustom.cpp:
141         * platform/network/curl/CookieJarCurl.cpp:
142
143 2016-09-20  Alex Christensen  <achristensen@webkit.org>
144
145         Align URLParser with web platform tests when parsing non-special relative URLs ending in AuthorityOrHost state
146         https://bugs.webkit.org/show_bug.cgi?id=162251
147
148         Reviewed by Tim Horton.
149
150         Covered by new and updated API tests.
151
152         * platform/URLParser.cpp:
153         (WebCore::URLParser::parse):
154         Fix parsing of non-special URLs that end after scheme:// with no authority.
155         We used to assume that parsing non-special schemes would never end with just scheme:// but a string can indeed end right there.
156         When a non-special relative URL contains just scheme:// we need the resulting URL to be valid to conform with the web platform tests.
157         (WebCore::URLParser::parseHostAndPort):
158         Renamed to reflect what the function actually does.
159         (WebCore::URLParser::internalValuesConsistent):
160         Add utility function for testing.
161         (WebCore::URLParser::parseHost): Deleted.
162         * platform/URLParser.h:
163
164 2016-09-20  Javier Fernandez  <jfernandez@igalia.com>
165
166         [css-grid] The 'grid' shorthand has a new syntax.
167         https://bugs.webkit.org/show_bug.cgi?id=161954
168
169         Reviewed by Darin Adler.
170
171         Implementation of the new CSS syntax for the 'grid' shorthand, as
172         defined in the CSS Grid Layout specification:
173         - https://drafts.csswg.org/css-grid/#grid-shorthand
174
175         No new tests, just adapted the ones we already have and added a few additional test cases.
176
177         * css/CSSValueKeywords.in:
178         * css/parser/CSSParser.cpp:
179         (WebCore::CSSParser::parseImplicitAutoFlow): Added. Similar to parseGridAutoFlow, but using the new 'auto-flow' keyword.
180         (WebCore::CSSParser::parseGridShorthand): New syntax of the 'grid' shorthand.
181         * css/parser/CSSParser.h:
182
183 2016-09-20  Alex Christensen  <achristensen@webkit.org>
184
185         URLParser should allow '@' in user
186         https://bugs.webkit.org/show_bug.cgi?id=162272
187
188         Reviewed by Tim Horton.
189
190         Covered by a new API test.
191
192         * platform/URLParser.cpp:
193         (WebCore::URLParser::parse):
194         The spec describes using an "@ flag" and rewinding iterators.  I've implemented the authority parsing
195         and host parsing a little differently, but this makes it equivalent.
196
197 2016-09-20  Alex Christensen  <achristensen@webkit.org>
198
199         URLParser: Fix parsing relative URLs with one slash after the scheme:
200         https://bugs.webkit.org/show_bug.cgi?id=162294
201
202         Reviewed by Tim Horton.
203
204         This fixes the relatively-obscure case where a relative URL has the same special scheme as the base,
205         but there is only one slash after the scheme: at the beginning of the relative URL.  According to spec,
206         this should be interpreted the same as if the scheme: were not there.
207         For example, parsing "http:/example.com/" relative to "http://example.org/foo/bar" should be the same as
208         parsing "/example.com/" relative to "http://example.org/foo/bar".
209
210         Covered by a new API test.
211
212         * platform/URLParser.cpp:
213         (WebCore::URLParser::parse):
214
215 2016-09-20  Alex Christensen  <achristensen@webkit.org>
216
217         Fix Windows file URL quirks in URLParser
218         https://bugs.webkit.org/show_bug.cgi?id=162303
219
220         Reviewed by Tim Horton.
221
222         Windows file urls allow c:\ and c|\ to have the same meaning, but when serialized they should both be c:/.
223         This is now standardized to allow cross-platform uniform behavior of URLs.
224
225         Covered by new API tests and progress on web platform tests when URLParser is enabled.
226
227         * platform/URLParser.cpp:
228         (WebCore::incrementIteratorSkippingTabAndNewLine):
229         (WebCore::isWindowsDriveLetter):
230         (WebCore::checkWindowsDriveLetter):
231         (WebCore::shouldCopyFileURL):
232         (WebCore::URLParser::parseSerializedURL):
233         (WebCore::URLParser::parse):
234
235 2016-09-20  Said Abou-Hallawa  <sabouhallawa@apple.com>
236
237         Rename FrameData to ImageFrame, move it to a separate file and use it for all ports
238         https://bugs.webkit.org/show_bug.cgi?id=159819
239
240         Reviewed by Simon Fraser.
241
242         Rename FrameData to ImageFrame and move it to a separate file so caching
243         it can be managed outside the BitmapImage object. Make the data members
244         of FrameData be private and add getters to return their values. Add backing
245         store and disposalMethod members, getter and setters to ImageFrame so it can
246         replace the non-CG ImageFrame class.
247
248         * CMakeLists.txt:
249         * WebCore.xcodeproj/project.pbxproj:
250         Add ImageFrame class to WebCore project.
251         
252         * platform/graphics/BitmapImage.cpp:
253         (WebCore::BitmapImage::BitmapImage): The metadata for the non-decoder case is now calculated in the ImageFrame::initialize().
254         (WebCore::BitmapImage::haveFrameImageAtIndex): Call ImageFrame's getters instead of access private members.
255         (WebCore::BitmapImage::destroyDecodedData): Pass ImageFrame::Caching::Metadata to ImageFrame::clear() to clear the image only.
256         (WebCore::BitmapImage::destroyDecodedDataIfNecessary): ImageFrame::usedFrameBytes() is now renamed to ImageFrame::frameBytes().
257         (WebCore::BitmapImage::cacheFrame): Call ImageFrame::initialize() to set the image and cache the frame's metadata.
258         (WebCore::BitmapImage::dataChanged): Pass ImageFrame::Caching::Empty to ImageFrame::clear() to clear the frame's image and metadata.
259         (WebCore::BitmapImage::ensureFrameAtIndexIsCached): Call ImageFrame's getters instead of access private members.
260         (WebCore::BitmapImage::frameImageAtIndex): Call ImageFrame's getters instead of access private members.
261         (WebCore::BitmapImage::frameIsCompleteAtIndex): Pass ImageFrame::Caching::Metadata to ensureFrameAtIndexIsCached() to ensure the frame's metadata is cached.
262         (WebCore::BitmapImage::frameDurationAtIndex): Pass ImageFrame::Caching::Metadata to ensureFrameAtIndexIsCached() to ensure the frame's metadata is cached.
263         (WebCore::BitmapImage::frameHasAlphaAtIndex): Pass ImageFrame::Caching::Metadata to ensureFrameAtIndexIsCached() to ensure the frame's metadata is cached.
264         (WebCore::BitmapImage::frameOrientationAtIndex): Pass ImageFrame::Caching::Metadata to ensureFrameAtIndexIsCached() to ensure the frame's metadata is cached.
265         (WebCore::BitmapImage::singlePixelSolidColor): Call ImageFrame's getters instead of access private members.
266         (WebCore::BitmapImage::repetitionCount): Change the return type to be RepetitionCount instead of int.
267         (WebCore::BitmapImage::shouldAnimate): Use a simpler condition since RepetitionCountNone is equal to zero.
268         (WebCore::BitmapImage::startAnimation): Replace the cAnimation* constants by the new RepetitionCount* enum.
269         (WebCore::BitmapImage::internalAdvanceAnimation): Replace the cAnimation* constants by the new RepetitionCount* enum.
270
271         * platform/graphics/BitmapImage.h: FrameData is renamed to ImageFrame and moved to a separate file named ImageFrame.h.
272         (WebCore::FrameData::FrameData): Deleted.
273         (WebCore::FrameData::~FrameData): Deleted.
274         (WebCore::FrameData::clear): Deleted.
275         (WebCore::FrameData::usedFrameBytes): Deleted.
276
277         * platform/graphics/ImageBackingStore.h: 
278         (WebCore::ImageBackingStore::fillRect): Make it efficient to fill a rect in the ImageBackingStore with the same color.
279         (WebCore::ImageBackingStore::pixelAt): Asserts the point is in the bounds of the ImageBackingStore size.
280         (WebCore::ImageBackingStore::setPixel): Use pixelValue().
281         (WebCore::ImageBackingStore::inBounds): Private functions check whether a point or a rect is in the bounds of the ImageBackingStore size.
282         (WebCore::ImageBackingStore::pixelValue): Calculate the RGBA value form red, green, blue and alpha values.
283
284         * platform/graphics/ImageFrame.cpp: Added.
285         (WebCore::ImageFrame::ImageFrame): 
286         (WebCore::ImageFrame::~ImageFrame):
287         (WebCore::ImageFrame::operator=):
288         (WebCore::ImageFrame::fillMetaData): Caches the ImageFrame's metadata.
289         (WebCore::ImageFrame::clearImage): Deletes all the allocated memory by ImageFrame which can be the ImageBackingStore or the NativeImagePtr.
290         (WebCore::ImageFrame::clear): Deletes the allocated memory and may or may not clears the metadata also.
291         (WebCore::ImageFrame::initialize): Sets a new ImageBackingStore or a new NativeImagePtr in the ImageFrame.
292         (WebCore::ImageFrame::size): Returns the size of the ImageFrame which can be the size of ImageBackingStore or the size of NativeImagePtr.
293         (WebCore::ImageFrame::singlePixelSolidColor): Returns whether the ImageFrame can be drawn by filling the image rectangle with a solid color.
294         
295         * platform/graphics/ImageFrame.h: Added.
296         (WebCore::operator++): SubsamplingLevel is strongly typed but RepetitionCount is not since it can be any unsigned value in addition to -1.
297         (WebCore::ImageFrame::ImageFrame):
298         (WebCore::ImageFrame::setDecoding):
299         (WebCore::ImageFrame::decoding):
300         (WebCore::ImageFrame::isEmpty):
301         (WebCore::ImageFrame::isPartial):
302         (WebCore::ImageFrame::isComplete):
303         (WebCore::ImageFrame::sizeRespectingOrientation):
304         (WebCore::ImageFrame::frameBytes):
305         (WebCore::ImageFrame::subsamplingLevel):
306         (WebCore::ImageFrame::setDisposalMethod):
307         (WebCore::ImageFrame::disposalMethod):
308         (WebCore::ImageFrame::image):
309         (WebCore::ImageFrame::setOrientation):
310         (WebCore::ImageFrame::orientation):
311         (WebCore::ImageFrame::setDuration):
312         (WebCore::ImageFrame::duration):
313         (WebCore::ImageFrame::setHasAlpha):
314         (WebCore::ImageFrame::hasAlpha):
315         (WebCore::ImageFrame::hasImage):
316         (WebCore::ImageFrame::hasInvalidImage):
317         (WebCore::ImageFrame::hasMetadata):
318         (WebCore::ImageFrame::backingStore):
319         (WebCore::ImageFrame::hasBackingStore):
320         Setters and getters for the private members.
321
322         * platform/graphics/ImageSource.cpp:
323         (WebCore::ImageSource::calculateMaximumSubsamplingLevel): allowSubsamplingOfFrameAtIndex() is renamed to frameAllowSubsamplingAtIndex().
324         (WebCore::ImageSource::subsamplingLevelForScale): Use the values of the enum class SubsamplingLevel.
325         (WebCore::ImageSource::size): Use the values of the enum class SubsamplingLevel.
326         (WebCore::ImageSource::sizeRespectingOrientation): Use the values of the enum class SubsamplingLevel.
327         (WebCore::ImageSource::repetitionCount): Replace the constants cAnimation* by the enum RepetitionCount*.
328         (WebCore::ImageSource::frameAllowSubsamplingAtIndex): Rename allowSubsamplingOfFrameAtIndex() to frameAllowSubsamplingAtIndex().
329         (WebCore::ImageSource::frameSizeAtIndex): Replace the call to orientationAtIndex() by frameOrientationAtIndex().
330         (WebCore::ImageSource::frameOrientationAtIndex): Rename orientationAtIndex() to frameOrientationAtIndex().
331         (WebCore::ImageSource::dump): Replace the call to orientationAtIndex() by frameOrientationAtIndex().
332         (WebCore::ImageSource::allowSubsamplingOfFrameAtIndex): Deleted.
333         (WebCore::ImageSource::orientationAtIndex): Deleted.
334         
335         * platform/graphics/ImageSource.h:
336         (WebCore::ImageSource::decoder): We need this function temporarily till we move caching the frames outside BitmapImage. 
337
338         * platform/graphics/NativeImage.h: Change SubImages() to Subimages(). See Darin's comment in https://bugs.webkit.org/show_bug.cgi?id=159819#c6.
339         * platform/graphics/cairo/NativeImageCairo.cpp:
340         (WebCore::clearNativeImageSubimages):
341         (WebCore::clearNativeImageSubImages): Deleted.
342
343         * platform/graphics/cg/ImageDecoderCG.cpp:
344         (WebCore::createImageSourceOptions): Use the values of the enum class SubsamplingLevel.
345         (WebCore::imageSourceOptions): Use the values of the enum class SubsamplingLevel.
346         (WebCore::ImageDecoder::repetitionCount): Change the return type to be RepetitionCount instead of int.
347         (WebCore::ImageDecoder::frameOrientationAtIndex): orientationAtIndex() is renamed to frameOrientationAtIndex().
348         (WebCore::ImageDecoder::frameAllowSubsamplingAtIndex): allowSubsamplingOfFrameAtIndex() is renamed to frameAllowSubsamplingAtIndex().
349         (WebCore::ImageDecoder::orientationAtIndex): Deleted.
350         (WebCore::ImageDecoder::allowSubsamplingOfFrameAtIndex): Deleted.
351         * platform/graphics/cg/ImageDecoderCG.h:
352
353         * platform/graphics/cg/NativeImageCG.cpp:
354         (WebCore::clearNativeImageSubimages): Change SubImages() to Subimages().
355         (WebCore::clearNativeImageSubImages): Deleted.
356
357         * platform/image-decoders/ImageDecoder.cpp:
358         (WebCore::ImageDecoder::frameIsCompleteAtIndex): Use ImageFrame::isComplete() instead of checking the value of the decoding status().
359         (WebCore::ImageDecoder::frameHasAlphaAtIndex): Use ImageFrame::isComplete() instead of checking the value of the decoding status().
360         (WebCore::ImageDecoder::frameDurationAtIndex): Use ImageFrame::isEmpty() instead of checking the value of the decoding status().
361         (WebCore::ImageDecoder::createFrameImageAtIndex): Access the ImageBackingStore::image() function directly.
362         (WebCore::ImageFrame::ImageFrame): Deleted.
363         (WebCore::ImageFrame::operator=): Deleted.
364         (WebCore::ImageFrame::clearPixelData): Deleted.
365         (WebCore::ImageFrame::zeroFillPixelData): Deleted.
366         (WebCore::ImageFrame::zeroFillFrameRect): Deleted.
367         (WebCore::ImageFrame::initializeBackingStore): Deleted.
368         (WebCore::ImageFrame::hasAlpha): Deleted.
369         (WebCore::ImageFrame::setHasAlpha): Deleted.
370         (WebCore::ImageFrame::setOriginalFrameRect): Deleted.
371         (WebCore::ImageFrame::setStatus): Deleted.
372
373         * platform/image-decoders/ImageDecoder.h:
374         (WebCore::ImageDecoder::repetitionCount): Use the type RepetitionCount and the enum RepetitionCount* values.
375         (WebCore::ImageDecoder::frameOrientationAtIndex): Rename orientationAtIndex() to frameOrientationAtIndex().
376         (WebCore::ImageDecoder::frameAllowSubsamplingAtIndex): Rename allowSubsamplingOfFrameAtIndex() to frameAllowSubsamplingAtIndex().
377         (WebCore::ImageDecoder::subsamplingLevelForScale): Use the enum class SubsamplingLevel value instead of integer values.
378         (WebCore::ImageFrame::ImageFrame): Deleted.
379         (WebCore::ImageFrame::copyRowNTimes): Deleted.
380         (WebCore::ImageFrame::size): Deleted.
381         (WebCore::ImageFrame::asNewNativeImage): Deleted.
382         (WebCore::ImageFrame::backingStore): Deleted.
383         (WebCore::ImageFrame::hasBackingStore): Deleted.
384         (WebCore::ImageFrame::originalFrameRect): Deleted.
385         (WebCore::ImageFrame::status): Deleted.
386         (WebCore::ImageFrame::duration): Deleted.
387         (WebCore::ImageFrame::disposalMethod): Deleted.
388         (WebCore::ImageFrame::setDuration): Deleted.
389         (WebCore::ImageFrame::setDisposalMethod): Deleted.
390         (WebCore::ImageFrame::pixelAt): Deleted.
391         (WebCore::ImageFrame::setPixel): Deleted.
392         (WebCore::ImageFrame::blendPixel): Deleted.
393         (WebCore::ImageDecoder::orientationAtIndex): Deleted.
394         (WebCore::ImageDecoder::allowSubsamplingOfFrameAtIndex): Deleted.
395
396         * platform/image-decoders/bmp/BMPImageDecoder.cpp:
397         (WebCore::BMPImageDecoder::frameBufferAtIndex): Call ImageFrame::isComplete() instead of checking the value of the decoding status().
398         (WebCore::BMPImageDecoder::decode): Ditto.
399
400         * platform/image-decoders/bmp/BMPImageReader.cpp:
401         (WebCore::BMPImageReader::decodeBMP): Call ImageFrame::isEmpty(). ImageBuffer::initializeBackingStore() is renamed to initialize().
402         (WebCore::BMPImageReader::processNonRLEData): Replace ImageFrame::zeroFillPixelData() by ImageBackingStore::clear() and ImageFrame::setAlpha().
403
404         * platform/image-decoders/bmp/BMPImageReader.h:
405         (WebCore::BMPImageReader::setPixel): Call ImageBackingStore::setPixel() directly.
406         (WebCore::BMPImageReader::fillRGBA): Replace an efficient loop to call setPixel() by ImageBackingStore::fillRect().
407
408         * platform/image-decoders/gif/GIFImageDecoder.cpp:
409         (WebCore::GIFImageDecoder::GIFImageDecoder): Move the initialization of m_repetitionCount to the header file.
410         (WebCore::GIFImageDecoder::repetitionCount): Change the return type.
411         (WebCore::GIFImageDecoder::frameBufferAtIndex): Call ImageFrame::isComplete() instead of checking the value of the decoding status().
412         (WebCore::GIFImageDecoder::clearFrameBufferCache): Use the values of the new enum class ImageFrame::DisposalMethod.
413         (WebCore::GIFImageDecoder::haveDecodedRow): Call the ImageBackingStore API's directly.
414         (WebCore::GIFImageDecoder::frameComplete): Use the values of the new enum class ImageFrame::DisposalMethod.
415         (WebCore::GIFImageDecoder::initFrameBuffer): Move calling ImageBackingStore::setFrameRect() to be after initializing the ImageBackingStore itself.
416
417         * platform/image-decoders/gif/GIFImageDecoder.h: Make repetitionCount() returns RepetitionCount and use the new enum class ImageFrame::DisposalMethod.
418         
419         * platform/image-decoders/gif/GIFImageReader.cpp:
420         (GIFImageReader::parse):
421
422         * platform/image-decoders/gif/GIFImageReader.h:
423         (GIFFrameContext::GIFFrameContext): Use new enum class ImageFrame::DisposalMethod.
424         
425         * platform/image-decoders/ico/ICOImageDecoder.cpp:
426         (WebCore::ICOImageDecoder::frameBufferAtIndex): Call ImageFrame::isComplete() instead of checking the value of the decoding status().
427         (WebCore::ICOImageDecoder::decode): Ditto.
428
429         * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
430         (WebCore::JPEGImageDecoder::frameBufferAtIndex): Call ImageFrame::isComplete() instead of checking the value of the decoding status().
431         (WebCore::setPixel): Call ImageBackingStore::setPixel() directly.
432         (WebCore::JPEGImageDecoder::outputScanlines): ImageFrame::initializeBackingStore() is renamed to initialize().
433         (WebCore::JPEGImageDecoder::jpegComplete): ImageFrame::setStatus() is renamed to ImageFrame::setDecoding().
434         (WebCore::JPEGImageDecoder::decode): Call ImageFrame::isComplete() instead of checking the value of the decoding status().
435
436         * platform/image-decoders/png/PNGImageDecoder.cpp:
437         (WebCore::PNGImageDecoder::frameBufferAtIndex): Call ImageFrame::isComplete() instead of checking the value of the decoding status().
438         (WebCore::PNGImageDecoder::rowAvailable): Call the ImageBackingStore APIs directly.
439         (WebCore::PNGImageDecoder::pngComplete): ImageFrame::setStatus() is renamed to setDecoding().
440         (WebCore::PNGImageDecoder::readChunks): Use the values of the new enum class ImageFrame::DisposalMethod.
441         (WebCore::PNGImageDecoder::clearFrameBufferCache): Replace the call to ImageFrame::clearPixelData() by  ImageFrame::clear().
442         (WebCore::PNGImageDecoder::initFrameBuffer): Move calling ImageBackingStore::setFrameRect() to be after initializing the ImageBackingStore itself.
443         (WebCore::PNGImageDecoder::frameComplete): Call the ImageBackingStore APIs directly.
444
445         * platform/image-decoders/png/PNGImageDecoder.h: Call ImageFrame::isComplete() instead of checking the value of the decoding status().
446
447         * platform/image-decoders/webp/WEBPImageDecoder.cpp:
448         (WebCore::WEBPImageDecoder::frameBufferAtIndex): Call ImageFrame::isComplete() instead of checking the value of the decoding status().
449         (WebCore::WEBPImageDecoder::decode): ImageFrame::setStatus() is renamed to setDecoding(). And initializeBackingStore() is renamed to initialize().
450
451 2016-09-20  Don Olmstead  <don.olmstead@am.sony.com>
452
453         [WinCairo] Use find_package cairo in build
454         https://bugs.webkit.org/show_bug.cgi?id=162239
455
456         Reviewed by Alex Christensen.
457
458         No new tests. No change in behavior.
459
460         * PlatformWinCairo.cmake:
461
462 2016-09-20  Jer Noble  <jer.noble@apple.com>
463
464         [media-source] Support MediaSource.setLiveSeekableRanges()
465         https://bugs.webkit.org/show_bug.cgi?id=162252
466
467         Reviewed by Sam Weinig.
468
469         Fixes tests: imported/w3c/web-platform-tests/media-source/interfaces.html
470                      imported/w3c/web-platform-tests/media-source/mediasource-liveseekable.html
471
472         Add support for a new part of the Media Source specification, the ability for clients to
473         specify the seekable ranges for a MediaSource-backed HTMLMediaElement.
474
475         Adding the live-seekable methods to MediaSource fixes a large number of the interfaces.html
476         tests, and the rest are fixed by adding on<event> handlers to MediaSource, SourceBuffer,
477         and SourceBufferList.
478
479         * Modules/mediasource/MediaSource.cpp:
480         (WebCore::MediaSource::seekable):
481         (WebCore::MediaSource::setLiveSeekableRange):
482         (WebCore::MediaSource::clearLiveSeekableRange):
483         * Modules/mediasource/MediaSource.h:
484         * Modules/mediasource/MediaSource.idl:
485         * Modules/mediasource/SourceBuffer.idl:
486         * Modules/mediasource/SourceBufferList.idl:
487         * Modules/mediasource/VideoPlaybackQuality.idl:
488         * html/HTMLMediaElement.cpp:
489         (WebCore::HTMLMediaElement::seekable):
490
491 2016-09-20  Per Arne Vollan  <pvollan@apple.com>
492
493         [Win] Unreviewed warning fix.
494
495         * page/CaptionUserPreferencesMediaAF.cpp:
496
497 2016-09-19  Chris Dumez  <cdumez@apple.com>
498
499         Add support for HTMLSourceElement.prototype.sizes / HTMLSourceElement.prototype.srcset
500         https://bugs.webkit.org/show_bug.cgi?id=162244
501
502         Reviewed by Alex Christensen.
503
504         Add support for HTMLPrototype.prototype.sizes / HTMLPrototype.prototype.srcset:
505         - https://html.spec.whatwg.org/#the-source-element
506
507         We already support the corresponding content attributes internally. However, we
508         are missing the corresponding IDL attributes that are supposed to reflect them.
509
510         Chrome and Firefox support them. We already had those IDL attributes on
511         HTMLImageElement.
512
513         No new tests, rebaselined existing test.
514
515         * html/HTMLSourceElement.idl:
516
517 2016-09-19  Anders Carlsson  <andersca@apple.com>
518
519         Suppress JavaScript prompts early on in certain cases
520         https://bugs.webkit.org/show_bug.cgi?id=162243
521         rdar://problem/27661602
522
523         Reviewed by Geoffrey Garen.
524
525         Export symbols needed by WebKit2.
526
527         * loader/FrameLoader.h:
528         * loader/FrameLoaderStateMachine.h:
529
530 2016-09-19  Chris Dumez  <cdumez@apple.com>
531
532         Align HTMLAppletElement with the specification
533         https://bugs.webkit.org/show_bug.cgi?id=162240
534
535         Reviewed by Alex Christensen.
536
537         Align HTMLAppletElement with the specification:
538         - https://html.spec.whatwg.org/#htmlappletelement
539
540         In particular:
541         - space / vspace should be of type "unsigned long", not DOMString
542         - codeBase and object should reflect as URLs
543
544         Firefox agree with the specification. Chrome does not have
545         HTMLAppletElement anymore.
546
547         No new tests, rebaselined existing test.
548
549         * html/HTMLAppletElement.cpp:
550         (WebCore::HTMLAppletElement::isURLAttribute):
551         * html/HTMLAppletElement.h:
552         * html/HTMLAppletElement.idl:
553
554 2016-09-16  Jer Noble  <jer.noble@apple.com>
555
556         [media-source] Fix imported/w3c/web-platform-tests/media-source/mediasource-avtracks.html
557         https://bugs.webkit.org/show_bug.cgi?id=162104
558
559         Reviewed by Eric Carlson.
560
561         Fixes test: imported/w3c/web-platform-tests/media-source/mediasource-avtracks.html
562
563         Multiple overlapping issues are causing this test to fail:
564
565         - When a MediaSource object is not attached from a HTMLMediaElement, it's SourceBuffer
566           objects will return `null` from .videoTracks and .audioTracks, foiling the tests ability
567           to assert that sourceBuffer.videoTracks.length == 0.
568
569         - When a MediaSource object is detached from a HTMLMediaElement, it's tracks are removed
570           but do not generate 'removedtrack' events.
571
572         When these bugs were fixed, a few more popped up:
573
574         - The HTMLMediaElement removes its tracks before it closes the MediaSource, which causes an
575           assertion when the MediaSource tells the HTMLMediaElement to remove its copy of the 
576           source's tracks (which have already been removed).
577
578         - When the HTMLMediaElement is stop()-ed due to its ScriptExecutionContext being destroyed,
579           it tries to close its MediaSource, which has itself already been stop()-ed and thus asserts.
580
581         To eliminate all these bugs and make the code more self explanatory, we will rename the 
582         HTMLMediaElement's closeMediaSource() method to detachMediaSource(), and the MediaSource's
583         close() method to detachFromElement(). The only way to close a MediaSource is now by calling
584         detachMediaSource() from the HTMLMediaElement.  The parts of the "Detaching from a media
585         element" algorithm which were previously spread across setReadyState() and onReadyStateChange()
586         are now unified in the newly renamed detachFromElement() method. The HTMLMediaElement will
587         first detach its MediaSource, and only after that remove all its tracks.
588
589         * Modules/mediasource/MediaSource.cpp:
590         (WebCore::MediaSource::setReadyState): Move steps into detachFromElement().
591         (WebCore::MediaSource::onReadyStateChange): Ditto.
592         (WebCore::MediaSource::detachFromElement): Perform the steps as specified.
593         (WebCore::MediaSource::attachToElement): Takes a reference rather than a bare pointer.
594         (WebCore::MediaSource::stop): Ask the media elemnet to detach.
595         (WebCore::MediaSource::close): Renamed to detachFromElement().
596         * Modules/mediasource/MediaSource.h:
597         * Modules/mediasource/SourceBuffer.cpp:
598         (WebCore::SourceBuffer::videoTracks): Always return a valid TrackList object.
599         (WebCore::SourceBuffer::audioTracks): Ditto.
600         (WebCore::SourceBuffer::textTracks): Ditto.
601         * html/HTMLMediaElement.cpp:
602         (WebCore::HTMLMediaElement::~HTMLMediaElement): Renamed closeMediaSource() -> detachMediaSource().
603         (WebCore::HTMLMediaElement::prepareForLoad): Ditto.
604         (WebCore::HTMLMediaElement::loadResource): Ditto.
605         (WebCore::HTMLMediaElement::noneSupported): Ditto.
606         (WebCore::HTMLMediaElement::mediaLoadingFailedFatally): Ditto.
607         (WebCore::HTMLMediaElement::detachMediaSource): Ditto.
608         (WebCore::HTMLMediaElement::userCancelledLoad): Ditto.
609         (WebCore::HTMLMediaElement::createMediaPlayer): Ditto.
610         (WebCore::HTMLMediaElement::clearMediaPlayer): Ditto. Also, detach from the MediaSource before
611             removing tracks.
612         (WebCore::HTMLMediaElement::closeMediaSource): Deleted.
613         * html/HTMLMediaElement.h:
614         * html/track/TrackListBase.cpp:
615         (TrackListBase::remove): Only try to clear the media element from Tracks that have one.
616
617 2016-09-19  Alex Christensen  <achristensen@webkit.org>
618
619         URLParser can read memory out of bounds
620         https://bugs.webkit.org/show_bug.cgi?id=162206
621
622         Reviewed by Geoff Garen.
623
624         Covered by new API tests.
625         URLParser is disabled by default still.
626
627         * platform/URLParser.cpp:
628         (WebCore::parseIPv4Host):
629         If there are fewer than two numbers in an ipv4 address, we would subtract two from the Vector's size, 
630         causing us to read memory up to std::numeric_limits<size_t>::max() - 2.  Added a bounds check and many tests.
631
632 2016-09-19  Alex Christensen  <achristensen@webkit.org>
633
634         URLParser should parse serialized valid URLs faster than unknown input
635         https://bugs.webkit.org/show_bug.cgi?id=162228
636
637         Reviewed by Chris Dumez.
638
639         The URL constructor with ParsedURLStringTag is almost twice as fast as the other URL constructors.
640         Assuming there are no tabs or newlines, and assuming characters are already encoded decreases the URLParser
641         runtime by over 25% and adds infrastructure for more optimizations.
642
643         No new tests. No change in behaviour.
644
645         * platform/URL.cpp:
646         (WebCore::URL::URL):
647         * platform/URLParser.cpp:
648         (WebCore::utf8PercentEncode):
649         (WebCore::utf8PercentEncodeQuery):
650         (WebCore::URLParser::parse):
651         (WebCore::URLParser::parseSerializedURL):
652         (WebCore::incrementIterator):
653         (WebCore::URLParser::parseAuthority):
654         (WebCore::URLParser::parsePort):
655         (WebCore::URLParser::parseHost):
656         * platform/URLParser.h:
657         (WebCore::URLParser::parse): Deleted.
658
659 2016-09-19  Daniel Bates  <dabates@apple.com>
660
661         Cleanup: Remove an extraneous copy of SecurityOrigin
662         https://bugs.webkit.org/show_bug.cgi?id=162118
663
664         Reviewed by Youenn Fablet.
665
666         Share one isolated copy of the SecurityOrigin between the ContentSecurityPolicy and
667         LoaderTaskOptions objects instead of creating two isolated copies of the SecurityOrigin.
668         This is safe because both ContentSecurityPolicy and LoaderTaskOptions are instantiated
669         in WorkerThreadableLoader::MainThreadBridge for use on the main thread only.
670
671         * loader/WorkerThreadableLoader.cpp:
672         (WebCore::LoaderTaskOptions::LoaderTaskOptions):
673         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
674
675 2016-09-19  Antti Koivisto  <antti@apple.com>
676
677         Add size assert for RenderElement
678         https://bugs.webkit.org/show_bug.cgi?id=162096
679
680         Reviewed by Simon Fraser.
681
682         Also remove the unused m_visibleInViewportState field.
683
684         * rendering/RenderElement.cpp:
685         (WebCore::RenderElement::unregisterForVisibleInViewportCallback):
686         * rendering/RenderElement.h:
687
688 2016-09-19  Keith Rollin  <krollin@apple.com>
689
690         REGRESSION (r205275): LOG_WITH_STREAM() macros are all compiled in release builds now
691         https://bugs.webkit.org/show_bug.cgi?id=162180
692
693         Reviewed by Simon Fraser.
694
695         Disable LOG_WITH_STREAM in release mode. Along with this, remove a
696         local variable in GraphcsContextCG.cpp in release mode that's no
697         longer referenced. And adjust logFunctionResult so that it gets
698         defined only in debug mode, too, to match its declaration in
699         LogMacros.h.
700
701         No new tests -- there are no tests for logging.
702
703         * platform/LogMacros.h:
704         * platform/Logging.cpp:
705         * platform/graphics/cg/GraphicsContextCG.cpp:
706         (WebCore::GraphicsContext::drawNativeImage):
707
708 2016-09-19  Daniel Bates  <dabates@apple.com>
709
710         Remove ENABLE(TEXT_AUTOSIZING) automatic text size adjustment code
711         https://bugs.webkit.org/show_bug.cgi?id=162167
712
713         Reviewed by Simon Fraser.
714
715         Remove the automatic text size adjustment code guarded by ENABLE(TEXT_AUTOSIZING)
716         because it is not used by any port. On Mac and iOS, analogous code guarded by
717         ENABLE(IOS_TEXT_AUTOSIZING) is used.
718
719         * CMakeLists.txt:
720         * Configurations/FeatureDefines.xcconfig:
721         * dom/Document.cpp:
722         (WebCore::Document::Document):
723         * dom/Document.h:
724         (WebCore::Document::textAutosizer): Deleted.
725         * page/FrameView.cpp:
726         (WebCore::FrameView::setFrameRect):
727         (WebCore::FrameView::layout):
728         * page/Settings.cpp:
729         (WebCore::Settings::Settings):
730         (WebCore::Settings::setTextAutosizingFontScaleFactor): Deleted.
731         * page/Settings.h:
732         (WebCore::Settings::textAutosizingFontScaleFactor): Deleted.
733         * page/animation/CSSPropertyAnimation.cpp:
734         (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
735         * rendering/RenderingAllInOne.cpp:
736         * rendering/TextAutosizer.cpp: Removed.
737         * rendering/TextAutosizer.h: Removed.
738         * rendering/style/RenderStyle.cpp:
739         (WebCore::RenderStyle::changeRequiresLayout):
740         (WebCore::RenderStyle::lineHeight):
741         (WebCore::RenderStyle::setFontSize):
742         * rendering/style/RenderStyle.h:
743         (WebCore::RenderStyle::textAutosizingMultiplier): Deleted.
744         (WebCore::RenderStyle::setTextAutosizingMultiplier): Deleted.
745         * rendering/style/StyleVisualData.cpp:
746         (WebCore::StyleVisualData::StyleVisualData):
747         * rendering/style/StyleVisualData.h:
748         * testing/InternalSettings.cpp:
749         (WebCore::InternalSettings::Backup::Backup):
750         (WebCore::InternalSettings::Backup::restoreTo):
751         (WebCore::InternalSettings::setTextAutosizingEnabled):
752         (WebCore::InternalSettings::setTextAutosizingWindowSizeOverride):
753         (WebCore::InternalSettings::setTextAutosizingFontScaleFactor): Deleted.
754         * testing/InternalSettings.h:
755         * testing/InternalSettings.idl:
756
757 2016-09-19  Chris Dumez  <cdumez@apple.com>
758
759         Update XHTMLParser to recognize "-//W3C//DTD MathML 2.0//EN" public identifier
760         https://bugs.webkit.org/show_bug.cgi?id=162166
761
762         Reviewed by Alex Christensen.
763
764         Update XHTMLParser to recognize "-//W3C//DTD MathML 2.0//EN" public identifier as
765         per the latest HTML specification.
766         - https://html.spec.whatwg.org/#parsing-xhtml-documents
767
768         Firefox already recognizes it properly.
769
770         Test: imported/w3c/web-platform-tests/html/the-xhtml-syntax/parsing-xhtml-documents/xhtml-mathml-dtd-entity-support.htm
771
772         * xml/parser/XMLDocumentParserLibxml2.cpp:
773         (WebCore::convertUTF16EntityToUTF8):
774         Fix assertion that was causing the new test to crash in debug. The input '\u0026'
775         gets converted to '&' which is only 1 character. However, the assertion wrongly
776         expected WTF::Unicode::convertUTF16ToUTF8() to generate more than 1 character.
777
778         (WebCore::externalSubsetHandler):
779         Add "-//W3C//DTD MathML 2.0//EN" to the list.
780
781 2016-09-19  Chris Dumez  <cdumez@apple.com>
782
783         Window's pageXOffset / pageYOffset attributes should be replaceable
784         https://bugs.webkit.org/show_bug.cgi?id=162046
785
786         Reviewed by Darin Adler.
787
788         Window's pageXOffset / pageYOffset attributes should be replaceable as per:
789         - https://drafts.csswg.org/cssom-view/#extensions-to-the-window-interface
790
791         Firefox agrees with the specification.
792
793         No new tests, rebaselined existing test.
794
795         * page/DOMWindow.h:
796         * page/DOMWindow.idl:
797
798 2016-09-19  Commit Queue  <commit-queue@webkit.org>
799
800         Unreviewed, rolling out r206107.
801         https://bugs.webkit.org/show_bug.cgi?id=162229
802
803         still failing on armv7 for some reason (Requested by anttik on
804         #webkit).
805
806         Reverted changeset:
807
808         "Add size assert for RenderElement"
809         https://bugs.webkit.org/show_bug.cgi?id=162096
810         http://trac.webkit.org/changeset/206107
811
812 2016-09-19  Antti Koivisto  <antti@apple.com>
813
814         Add size assert for RenderElement
815         https://bugs.webkit.org/show_bug.cgi?id=162096
816
817         Reviewed by Simon Fraser.
818
819         Also remove the unused m_visibleInViewportState field.
820
821         * rendering/RenderElement.cpp:
822         (WebCore::RenderElement::unregisterForVisibleInViewportCallback):
823         * rendering/RenderElement.h:
824
825 2016-09-19  Nan Wang  <n_wang@apple.com>
826
827         AX: Add accessibility support for details element on iOS
828         https://bugs.webkit.org/show_bug.cgi?id=162041
829
830         Reviewed by Chris Fleizach.
831
832         The details and summary elements are poorly supported on iOS.
833         Two major issues:
834             1. Assistive technologies taking focus onto details/summary elements will cause unexpected behavior.
835             2. VoiceOver is not speaking the expanded status of the details element.
836         Fixed them by not setting focus onto elements inside details and exposing the details element's expanded
837         status to its summary's accessible children.
838
839         Test: accessibility/ios-simulator/detail-summary-ios.html
840
841         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
842         (matchedParent):
843         (-[WebAccessibilityObjectWrapper _accessibilityListAncestor]):
844         (-[WebAccessibilityObjectWrapper _accessibilityLandmarkAncestor]):
845         (-[WebAccessibilityObjectWrapper _accessibilityTableAncestor]):
846         (-[WebAccessibilityObjectWrapper _accessibilityFieldsetAncestor]):
847         (-[WebAccessibilityObjectWrapper tableCellParent]):
848         (-[WebAccessibilityObjectWrapper tableParent]):
849         (-[WebAccessibilityObjectWrapper convertPointToScreenSpace:]):
850         (-[WebAccessibilityObjectWrapper convertRectToScreenSpace:]):
851         (-[WebAccessibilityObjectWrapper detailParentForSummaryObject:]):
852         (-[WebAccessibilityObjectWrapper detailParentForObject:]):
853         (-[WebAccessibilityObjectWrapper accessibilityElementDidBecomeFocused]):
854         (-[WebAccessibilityObjectWrapper accessibilitySupportsARIAExpanded]):
855         (-[WebAccessibilityObjectWrapper accessibilityIsExpanded]):
856
857 2016-09-19  Zalan Bujtas  <zalan@apple.com>
858
859         ASSERTION FAILED: clipRectsContext.rootLayer == m_clipRectsCache->m_clipRectsRoot[clipRectsType] while loading guardian.co.uk
860         https://bugs.webkit.org/show_bug.cgi?id=162129
861         <rdar://problem/28353350>
862
863         Reviewed by Antti Koivisto.
864
865         Neither ::localClipRect() nor ::selfClipRect() accounts for paginated context while computing the cliprects (See FIXMEs).
866         This patch ensures that we don't end up caching these invalid cliprects.
867
868         Test: fast/multicol/assert-on-cliprect-caching-when-paginated.html
869
870         * rendering/RenderLayer.cpp:
871         (WebCore::RenderLayer::calculateClipRects):
872
873 2016-09-19  Youenn Fablet  <youenn@apple.com>
874
875         Clean-up after r206014
876         https://bugs.webkit.org/show_bug.cgi?id=162140
877
878         Reviewed by Sam Weinig.
879
880         Covered by existing tests.
881
882         * platform/network/HTTPHeaderMap.cpp:
883         (WebCore::HTTPHeaderMap::add):
884
885 2016-09-19  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
886
887         If a host object is only used as a variadic argument, its bindings header isn't properly included
888         https://bugs.webkit.org/show_bug.cgi?id=150121
889
890         Reviewed by Youenn Fablet.
891
892         Modify JS binding generator to include binding headers of objects passed
893         as variadic argument.
894
895         * Modules/mediastream/RTCPeerConnection.h: Remove workaround.
896         * bindings/scripts/CodeGeneratorJS.pm:
897         (AddVariadicToImplIncludes):
898         (GenerateParametersCheck):
899         * bindings/scripts/test/JS/JSTestObj.cpp:
900
901 2016-09-19  Joseph Pecoraro  <pecoraro@apple.com>
902
903         Web Inspector: ⇧⌘C should highlight node under cursor without re-moving mouse
904         https://bugs.webkit.org/show_bug.cgi?id=162128
905
906         Reviewed by Brian Burg.
907
908         * inspector/InspectorDOMAgent.h:
909         * inspector/InspectorDOMAgent.cpp:
910         (WebCore::InspectorDOMAgent::willDestroyFrontendAndBackend):
911         (WebCore::InspectorDOMAgent::mouseDidMoveOverElement):
912         (WebCore::InspectorDOMAgent::highlightMousedOverNode):
913         (WebCore::InspectorDOMAgent::setSearchingForNode):
914         When the inspector is connected, remember the last moused over node.
915         This produces far more consistent results of highlighting under
916         the cursor when pressing and releasing the keyboard shortcut keys,
917         without having to move the mouse. Even when using the shortcut to
918         first connect the inspector this produces far more consistent
919         results because releasing the keys for the shortcut produce new
920         mouseDidMoveOverElement events.
921
922 2016-09-19  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
923
924         JSDOMBindings' toArguments() should return a more descriptive object
925         https://bugs.webkit.org/show_bug.cgi?id=161793
926
927         Reviewed by Youenn Fablet.
928
929         Replace std::pair with new VariadicHelperResult class with more
930         readable members names.
931
932         No additional tests required.
933
934         * bindings/js/JSDOMBinding.h:
935         (WebCore::VariadicHelper::Result::Result):
936         * bindings/scripts/CodeGeneratorJS.pm:
937         (GenerateParametersCheck):
938         * bindings/scripts/test/JS/JSTestObj.cpp:
939         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod12):
940         (WebCore::jsTestObjPrototypeFunctionVariadicStringMethod):
941         (WebCore::jsTestObjPrototypeFunctionVariadicDoubleMethod):
942         (WebCore::jsTestObjPrototypeFunctionVariadicNodeMethod):
943
944 2016-09-18  Alex Christensen  <achristensen@webkit.org>
945
946         Remove unnecessary String allocations in URLParser
947         https://bugs.webkit.org/show_bug.cgi?id=162089
948
949         Reviewed by Chris Dumez.
950
951         No change in behavior except a performance improvement.
952
953         * platform/URL.cpp:
954         (WebCore::assertProtocolIsGood):
955         (WebCore::URL::protocolIs):
956         (WebCore::protocolIs):
957         * platform/URL.h:
958         Added a new protocolIs for non-null-terminated strings from user input.
959         * platform/URLParser.cpp:
960         (WebCore::URLParser::parse):
961         Don't make a String to compare protocols.
962
963 2016-09-17  Alex Christensen  <achristensen@webkit.org>
964
965         Inline functions in URLParser
966         https://bugs.webkit.org/show_bug.cgi?id=162106
967
968         Reviewed by Antti Koivisto.
969
970         No change in behavior. Just make URLParser faster.
971
972         * platform/URLParser.cpp:
973         (WebCore::isC0Control):
974         (WebCore::isC0ControlOrSpace):
975         (WebCore::isTabOrNewline):
976         (WebCore::isInSimpleEncodeSet):
977         (WebCore::isInDefaultEncodeSet):
978         (WebCore::isInUserInfoEncodeSet):
979         (WebCore::isInvalidDomainCharacter):
980         (WebCore::isPercentOrNonASCII):
981         (WebCore::isSlashQuestionOrHash):
982         (WebCore::isWindowsDriveLetter):
983         (WebCore::shouldCopyFileURL):
984         (WebCore::percentEncode):
985         (WebCore::utf8PercentEncode):
986         (WebCore::utf8PercentEncodeQuery):
987         (WebCore::encodeQuery):
988         (WebCore::isDefaultPort):
989         (WebCore::isSpecialScheme):
990         (WebCore::copyASCIIStringUntil):
991         (WebCore::isPercentEncodedDot):
992         (WebCore::isSingleDotPathSegment):
993         (WebCore::isDoubleDotPathSegment):
994         (WebCore::consumeSingleDotPathSegment):
995         (WebCore::consumeDoubleDotPathSegment):
996         (WebCore::serializeIPv4):
997         (WebCore::zeroSequenceLength):
998         (WebCore::findLongestZeroSequence):
999         (WebCore::serializeIPv6Piece):
1000         (WebCore::serializeIPv6):
1001         (WebCore::parseIPv4Number):
1002         (WebCore::pow256):
1003         (WebCore::parseIPv4Host):
1004         (WebCore::parseIPv6Host):
1005         (WebCore::percentDecode):
1006         (WebCore::containsOnlyASCII):
1007         (WebCore::domainToASCII):
1008         (WebCore::hasInvalidDomainCharacter):
1009         (WebCore::formURLDecode):
1010         (WebCore::serializeURLEncodedForm):
1011
1012 2016-09-17  David Kilzer  <ddkilzer@apple.com>
1013
1014         MainThreadBridge needs an isolatedCopy() of SecurityOrigin
1015         <https://webkit.org/b/162116>
1016         <rdar://problem/27525870>
1017
1018         Reviewed by Carlos Garcia Campos.
1019
1020         Covered by existing tests.
1021
1022         * loader/WorkerThreadableLoader.cpp:
1023         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
1024         Make an isolatedCopy() of SecurityOrigin here since that's the
1025         correct idiom to use when the object is passed from a worker
1026         thread back to the main thread.  Fix suggested by Daniel Bates.
1027
1028 2016-09-16  Yusuke Suzuki  <utatane.tea@gmail.com>
1029
1030         [DFG] Introduce IsCellWithType node and unify IsJSArray, IsRegExpObject and newly added IsProxyObject
1031         https://bugs.webkit.org/show_bug.cgi?id=162000
1032
1033         Reviewed by Filip Pizlo.
1034
1035         * bridge/runtime_array.h:
1036         (JSC::RuntimeArray::createStructure):
1037
1038 2016-09-16  Chris Dumez  <cdumez@apple.com>
1039
1040         Cancelling one frame's load cancels load in other frames that have the same URL as well
1041         https://bugs.webkit.org/show_bug.cgi?id=162094
1042
1043         Reviewed by Antti Koivisto.
1044
1045         Cancelling one frame's load cancels load in other frames that have the same URL as well.
1046
1047         So if you have several frames that are loading URL X and you navigate one of the frames
1048         to Y, then the load of X will be cancelled and this frame will navigate to Y. All other
1049         frames will not load URL X even though they should.
1050
1051         The issue is that all the DocumentLoaders share the same CachedResource because of the
1052         memoryCache. When we call DocumentLoader::stopLoading(), it will cancel the
1053         CachedResource's load even though there are several clients for this CachedResource
1054         and other clients still want the load.
1055
1056         The approach chosen in this patch is to not reuse CachedResources that are still
1057         loading when trying to load a main resource. This is not the most efficient approach.
1058         I still chose this approach because:
1059         - It is very unlikely to introduce new bugs.
1060         - The change is very simple.
1061         - This is a corner case (several iframes having the same URL and cancelling the load in
1062           one of them).
1063
1064         Test: http/tests/navigation/frames-same-url-cancel-load.html
1065
1066         * loader/cache/CachedResourceLoader.cpp:
1067         (WebCore::CachedResourceLoader::determineRevalidationPolicy):
1068
1069 2016-09-16  Michael Catanzaro  <mcatanzaro@igalia.com>
1070
1071         ASSERTION FAILED: The string being removed is atomic in the string table of an other thread! iterator != atomicStringTable.end() at Source/WTF/wtf/text/AtomicStringImpl.cpp(453)
1072         https://bugs.webkit.org/show_bug.cgi?id=161800
1073
1074         Reviewed by Žan Doberšek.
1075
1076         Speculative fix. These strings are created as static objects on a secondary thread, but all
1077         static objects are destroyed in exit handlers on the main thread, and AtomicStrings must
1078         always be destroyed on the same thread they are created.
1079
1080         * platform/graphics/texmap/TextureMapperShaderProgram.h:
1081
1082 2016-09-16  Commit Queue  <commit-queue@webkit.org>
1083
1084         Unreviewed, rolling out r206055.
1085         https://bugs.webkit.org/show_bug.cgi?id=162110
1086
1087         broke 32bit ARM build (Requested by anttik on #webkit).
1088
1089         Reverted changeset:
1090
1091         "Add size assert for RenderElement"
1092         https://bugs.webkit.org/show_bug.cgi?id=162096
1093         http://trac.webkit.org/changeset/206055
1094
1095 2016-09-16  Brent Fulgham  <bfulgham@apple.com>
1096
1097         [Win][Direct2D] Provide Color support for Direct2D
1098         https://bugs.webkit.org/show_bug.cgi?id=162090
1099
1100         Reviewed by Dean Jackson.
1101
1102         Add casting operations to the Color class to allow easy interoption with
1103         native Direct2D operations.
1104
1105         No new tests. No change in behavior.
1106
1107         * PlatformWin.cmake: Add new Windows implementation file.
1108         * platform/graphics/Color.h:
1109         * platform/graphics/win/ColorDirect2D.cpp: Added.
1110         (WebCore::Color::Color):
1111         (WebCore::Color::operator D2D1_COLOR_F):
1112
1113 2016-09-16  Antti Koivisto  <antti@apple.com>
1114
1115         Add size assert for RenderElement
1116         https://bugs.webkit.org/show_bug.cgi?id=162096
1117
1118         Reviewed by Simon Fraser.
1119
1120         Also remove the unused m_visibleInViewportState field.
1121
1122         * rendering/RenderElement.cpp:
1123         (WebCore::RenderElement::unregisterForVisibleInViewportCallback):
1124         * rendering/RenderElement.h:
1125
1126 2016-09-16  Antti Koivisto  <antti@apple.com>
1127
1128         Tighten region style map to use RenderElement instead of RenderObject
1129         https://bugs.webkit.org/show_bug.cgi?id=162064
1130
1131         Reviewed by Zalan Bujtas.
1132
1133         RenderTexts don't have styles of their own so the map can operate on RenderElements.
1134
1135         * rendering/RenderElement.cpp:
1136         (WebCore::RenderElement::willBeRemovedFromTree):
1137         (WebCore::RenderElement::removeFromRenderFlowThread):
1138         (WebCore::RenderElement::removeFromRenderFlowThreadIncludingDescendants):
1139         (WebCore::RenderElement::invalidateFlowThreadContainingBlockIncludingDescendants):
1140         * rendering/RenderElement.h:
1141         * rendering/RenderFlowThread.cpp:
1142         (WebCore::RenderFlowThread::removeFlowChildInfo):
1143         * rendering/RenderFlowThread.h:
1144         * rendering/RenderNamedFlowFragment.cpp:
1145         (WebCore::RenderNamedFlowFragment::computeChildrenStyleInRegion):
1146         (WebCore::RenderNamedFlowFragment::setRendererStyleInRegion):
1147         (WebCore::RenderNamedFlowFragment::clearObjectStyleInRegion):
1148         (WebCore::RenderNamedFlowFragment::setRegionObjectsRegionStyle):
1149         (WebCore::RenderNamedFlowFragment::restoreRegionObjectsOriginalStyle):
1150         (WebCore::RenderNamedFlowFragment::setObjectStyleInRegion): Deleted.
1151         * rendering/RenderNamedFlowFragment.h:
1152         * rendering/RenderNamedFlowThread.cpp:
1153         (WebCore::RenderNamedFlowThread::clearRenderObjectCustomStyle):
1154         (WebCore::RenderNamedFlowThread::removeFlowChildInfo):
1155         * rendering/RenderNamedFlowThread.h:
1156         * rendering/RenderObject.cpp:
1157         (WebCore::RenderObject::willBeRemovedFromTree):
1158         (WebCore::RenderObject::removeFromRenderFlowThread): Deleted.
1159         (WebCore::RenderObject::removeFromRenderFlowThreadIncludingDescendants): Deleted.
1160         (WebCore::RenderObject::invalidateFlowThreadContainingBlockIncludingDescendants): Deleted.
1161
1162             These can now move to RenderElement.
1163
1164         * rendering/RenderObject.h:
1165
1166 2016-09-16  Brent Fulgham  <bfulgham@apple.com>
1167
1168         CaptionUserPreferences's use of the PageGroup's page map is incorrect
1169         https://bugs.webkit.org/show_bug.cgi?id=122194
1170         <rdar://problem/27332004>
1171
1172         Reviewed by Zalan Bujtas.
1173
1174         Avoid the possibility of dereferencing an unsafe iterator by checking
1175         for an empty HashSet before using the result of 'begin()'.
1176
1177         No new tests because there is no change in behavior.
1178
1179         * page/CaptionUserPreferences.cpp:
1180         (WebCore::CaptionUserPreferences::CaptionUserPreferences): Use new safer
1181         accessor to retrieve the current page.
1182         (WebCore::CaptionUserPreferences::setCaptionDisplayMode): Ditto.
1183         (WebCore::CaptionUserPreferences::currentPage): Added.
1184         (WebCore::CaptionUserPreferences::userPrefersCaptions): Use new safer
1185         accessor to retrieve the current page.
1186         (WebCore::CaptionUserPreferences::setUserPrefersCaptions): Ditto.
1187         (WebCore::CaptionUserPreferences::userPrefersSubtitles): Ditto.
1188         (WebCore::CaptionUserPreferences::setUserPrefersSubtitles): Ditto.
1189         (WebCore::CaptionUserPreferences::userPrefersTextDescriptions): Ditto.
1190         (WebCore::CaptionUserPreferences::setUserPrefersTextDescriptions): Ditto.
1191         * page/CaptionUserPreferences.h:
1192
1193 2016-09-16  Alex Christensen  <achristensen@webkit.org>
1194
1195         Use Vector<LChar> instead of StringBuilder for the ASCII parts of URLParser
1196         https://bugs.webkit.org/show_bug.cgi?id=162035
1197
1198         Reviewed by Chris Dumez.
1199
1200         StringBuilder::append checks to see whether its StringBuffer is 8-bit or 16-bit each time it is called.
1201         When parsing URLs, almost all of the parsed URL is guaranteed to be 8-bit ASCII.
1202         Using a Vector<LChar> for this allows us to use uncheckedAppend in some places, and it always eliminates the 8-bit check.
1203         This is a ~20% speedup in url parsing.
1204
1205         Covered by existing API tests.
1206
1207         * platform/URLParser.cpp:
1208         (WebCore::isWindowsDriveLetter):
1209         (WebCore::percentEncode):
1210         (WebCore::utf8PercentEncode):
1211         (WebCore::utf8PercentEncodeQuery):
1212         (WebCore::encodeQuery):
1213         (WebCore::URLParser::copyURLPartsUntil):
1214         (WebCore::URLParser::popPath):
1215         (WebCore::URLParser::parse):
1216         (WebCore::URLParser::parseAuthority):
1217         (WebCore::appendNumber):
1218         (WebCore::serializeIPv4):
1219         (WebCore::serializeIPv6Piece):
1220         (WebCore::serializeIPv6):
1221         (WebCore::URLParser::parsePort):
1222         (WebCore::URLParser::parseHost):
1223         (WebCore::serializeURLEncodedForm):
1224         (WebCore::URLParser::serialize):
1225         (WebCore::bufferView): Deleted.
1226         * platform/URLParser.h:
1227
1228 2016-09-16  Dave Hyatt  <hyatt@apple.com>
1229
1230         [CSS Parser] Get CSSPropertyParserHelpers.cpp compiling
1231         https://bugs.webkit.org/show_bug.cgi?id=162078
1232
1233         Reviewed by Dean Jackson.
1234
1235         * css/CSSCalculationValue.cpp:
1236         (WebCore::hasDoubleValue):
1237         (WebCore::checkDepthAndIndex):
1238         (WebCore::CSSCalcExpressionNodeParser::parseCalc):
1239         (WebCore::CSSCalcExpressionNodeParser::operatorValue):
1240         (WebCore::CSSCalcExpressionNodeParser::parseValue):
1241         (WebCore::CSSCalcExpressionNodeParser::parseValueTerm):
1242         (WebCore::CSSCalcExpressionNodeParser::parseValueMultiplicativeExpression):
1243         (WebCore::CSSCalcExpressionNodeParser::parseAdditiveValueExpression):
1244         (WebCore::CSSCalcExpressionNodeParser::parseValueExpression):
1245         (WebCore::checkDepthAndIndexDeprecated):
1246         (WebCore::CSSCalcExpressionNodeParserDeprecated::parseValueTerm):
1247         (WebCore::CSSCalcExpressionNodeParserDeprecated::parseValueMultiplicativeExpression):
1248         (WebCore::CSSCalcExpressionNodeParserDeprecated::parseAdditiveValueExpression):
1249         (WebCore::CSSCalcValue::create):
1250         * css/CSSCalculationValue.h:
1251         (WebCore::CSSCalcValue::createCalculationValue):
1252         (WebCore::CSSCalcValue::setPermittedValueRange):
1253         Switch off the permitted calc value range enum, since we can just use the identical ValueRange enum.
1254         Deprecate the CSSParserValueList-based parser by renaming it, and add a new parser that operates
1255         on tokens.
1256
1257         * css/CSSPrimitiveValue.cpp:
1258         (WebCore::isValidCSSUnitTypeForDoubleConversion):
1259         (WebCore::isStringType):
1260         (WebCore::CSSPrimitiveValue::cleanup):
1261         (WebCore::CSSPrimitiveValue::computeNonCalcLengthDouble):
1262         (WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText):
1263         (WebCore::CSSPrimitiveValue::cloneForCSSOM):
1264         (WebCore::CSSPrimitiveValue::equals):
1265         (WebCore::CSSPrimitiveValue::buildParserValue):
1266         * css/CSSPrimitiveValue.h:
1267         Add support for CSS_QUIRKY_EMS as a unit type. This will let us eliminate the extra m_isQuirkValue boolean
1268         eventually.
1269
1270         * css/parser/CSSParser.cpp:
1271         (WebCore::CSSParser::validateCalculationUnit):
1272         (WebCore::CSSParser::parseCalculation):
1273         * css/parser/CSSParser.h:
1274         Switch to ValueRange.
1275
1276         * css/parser/CSSParserIdioms.cpp:
1277         (WebCore::completeURL):
1278         * css/parser/CSSParserIdioms.h:
1279         Make the URL completion function from CSSParser.cpp available to all.
1280
1281         * css/parser/CSSParserMode.h:
1282         (WebCore::isUnitLessValueParsingEnabledForMode):
1283         (WebCore::isUnitLessLengthParsingEnabledForMode): Deleted.
1284         Rename this to value, since for now we're not supporting Blink's UserUnits. This means we need to support
1285         unitless parsing for times and angles in addition to lengths, making the name of the function inappropriate.
1286
1287         * css/parser/CSSParserToken.cpp:
1288         (WebCore::cssPrimitiveValueUnitFromTrie):
1289         Turn quirky ems support back on.
1290
1291         * css/parser/CSSParserValues.cpp:
1292         (WebCore::CSSParserValue::createCSSValue):
1293         Support quirky ems.
1294
1295         * css/parser/CSSPropertyParserHelpers.cpp:
1296         (WebCore::CSSPropertyParserHelpers::CalcParser::consumeValue):
1297         (WebCore::CSSPropertyParserHelpers::CalcParser::consumeNumber):
1298         (WebCore::CSSPropertyParserHelpers::consumeInteger):
1299         (WebCore::CSSPropertyParserHelpers::consumePositiveInteger):
1300         (WebCore::CSSPropertyParserHelpers::consumeNumber):
1301         (WebCore::CSSPropertyParserHelpers::shouldAcceptUnitlessValue):
1302         (WebCore::CSSPropertyParserHelpers::consumeLength):
1303         (WebCore::CSSPropertyParserHelpers::consumePercent):
1304         (WebCore::CSSPropertyParserHelpers::canConsumeCalcValue):
1305         (WebCore::CSSPropertyParserHelpers::consumeLengthOrPercent):
1306         (WebCore::CSSPropertyParserHelpers::consumeAngle):
1307         (WebCore::CSSPropertyParserHelpers::consumeTime):
1308         (WebCore::CSSPropertyParserHelpers::consumeIdent):
1309         (WebCore::CSSPropertyParserHelpers::consumeIdentRange):
1310         (WebCore::CSSPropertyParserHelpers::consumeCustomIdent):
1311         (WebCore::CSSPropertyParserHelpers::consumeString):
1312         (WebCore::CSSPropertyParserHelpers::consumeUrl):
1313         (WebCore::CSSPropertyParserHelpers::parseRGBParameters):
1314         (WebCore::CSSPropertyParserHelpers::parseHSLParameters):
1315         (WebCore::CSSPropertyParserHelpers::consumeColor):
1316         (WebCore::CSSPropertyParserHelpers::consumePositionComponent):
1317         (WebCore::CSSPropertyParserHelpers::positionFromOneValue):
1318         (WebCore::CSSPropertyParserHelpers::positionFromTwoValues):
1319         (WebCore::CSSPropertyParserHelpers::createPrimitiveValuePair):
1320         (WebCore::CSSPropertyParserHelpers::positionFromThreeOrFourValues):
1321         (WebCore::CSSPropertyParserHelpers::consumePosition):
1322         (WebCore::CSSPropertyParserHelpers::consumeOneOrTwoValuedPosition):
1323         (WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradientPoint):
1324         (WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradientStopColor):
1325         (WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradientColorStop):
1326         (WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradient):
1327         (WebCore::CSSPropertyParserHelpers::consumeDeprecatedRadialGradient):
1328         (WebCore::CSSPropertyParserHelpers::consumeRadialGradient):
1329         (WebCore::CSSPropertyParserHelpers::consumeLinearGradient):
1330         (WebCore::CSSPropertyParserHelpers::consumeImageOrNone):
1331         (WebCore::CSSPropertyParserHelpers::consumeCrossFade):
1332         (WebCore::CSSPropertyParserHelpers::consumeGeneratedImage):
1333         (WebCore::CSSPropertyParserHelpers::consumeImageSet):
1334         (WebCore::CSSPropertyParserHelpers::consumeImage):
1335         * css/parser/CSSPropertyParserHelpers.h:
1336         (WebCore::CSSPropertyParserHelpers::isCSSWideKeyword):
1337         Lots of changes here. The most important is switching over to RefPtrs and Refs where appropriate, with the
1338         requisite WTFMoves. Unit types also have to be converted back to our values, and unitless parsing has
1339         to work with consumeTime and consumeAngle.
1340
1341         * platform/CalculationValue.cpp:
1342         (WebCore::CalculationValue::create):
1343         * platform/CalculationValue.h:
1344         (WebCore::CalculationValue::CalculationValue):
1345         Use ValueRange.
1346
1347         * platform/graphics/Color.cpp:
1348         (WebCore::Color::parseHexColor):
1349         (WebCore::Color::Color):
1350         * platform/graphics/Color.h:
1351         Add a StringView-based parseHexColor function.
1352
1353         * rendering/style/BasicShapes.cpp:
1354         (WebCore::BasicShapeCenterCoordinate::updateComputedLength):
1355         Use ValueRange
1356
1357 2016-09-16  Jer Noble  <jer.noble@apple.com>
1358
1359         [media-source] Fix imported/w3c/web-platform-tests/media-source/mediasource-config-change-mp4-av-audio-bitrate.html
1360         https://bugs.webkit.org/show_bug.cgi?id=162052
1361
1362         Reviewed by Brent Fulgham.
1363
1364         Fixes tests: imported/w3c/web-platform-tests/media-source/mediasource-config-change-mp4-av-audio-bitrate.html
1365                      imported/w3c/web-platform-tests/media-source/mediasource-config-change-mp4-av-video-bitrate.html
1366
1367         The above tests would throw an assertion while trying to invert a range with an invalid end time. Check the
1368         validity of trackBuffer.lastEnqueuedPresentationTime before comparing it and assigning it to a range.
1369
1370         * Modules/mediasource/SourceBuffer.cpp:
1371         (WebCore::SourceBuffer::removeCodedFrames):
1372
1373 2016-09-16  Alex Christensen  <achristensen@webkit.org>
1374
1375         URLParser should percent encode the user and password according to spec
1376         https://bugs.webkit.org/show_bug.cgi?id=162049
1377
1378         Reviewed by Tim Horton.
1379
1380         Covered by new API tests based on the web platform tests.
1381
1382         * platform/URLParser.cpp:
1383         (WebCore::URLParser::parseAuthority):
1384
1385 2016-09-16  Alex Christensen  <achristensen@webkit.org>
1386
1387         Fix more edge cases in URLParser
1388         https://bugs.webkit.org/show_bug.cgi?id=162051
1389
1390         Reviewed by Tim Horton.
1391
1392         Added new API tests.
1393
1394         * platform/URLParser.cpp:
1395         (WebCore::URLParser::parse):
1396         Some edge case handling was wrong. Also, some of the terminal states are not possible
1397         to reach because we transition to those states without incrementing the iterator.
1398
1399 2016-09-16  Alex Christensen  <achristensen@webkit.org>
1400
1401         Fix Windows clean build after r205929
1402
1403         * DerivedSources.cpp:
1404
1405 2016-09-16  Jer Noble  <jer.noble@apple.com>
1406
1407         [media-source] Fix imported/w3c/web-platform-tests/media-source/mediasource-timestamp-offset.html
1408         https://bugs.webkit.org/show_bug.cgi?id=162038
1409
1410         Reviewed by Eric Carlson.
1411
1412         The timestampOffset property is no longer specified as an 'unrestricted' double.
1413
1414         * Modules/mediasource/SourceBuffer.idl:
1415
1416 2016-09-16  Per Arne Vollan  <pvollan@apple.com>
1417
1418         [Win] Compile fix.
1419         https://bugs.webkit.org/show_bug.cgi?id=162059
1420
1421         Reviewed by Alex Christensen.
1422
1423         If an include file exists in two places in the include paths, we can end up including the file twice,
1424         since #pragma once will not protect us against this.
1425
1426         * PlatformWin.cmake: Put WebCore forwarding folder first in include list.
1427
1428 2016-09-16  Chris Dumez  <cdumez@apple.com>
1429
1430         Cloning a textarea does not clone the textarea's value
1431         https://bugs.webkit.org/show_bug.cgi?id=156637
1432
1433         Reviewed by Ryosuke Niwa.
1434
1435         Update WebKit so that cloning a textarea element also clones its value.
1436         This matches the HTML specification after:
1437         - https://github.com/whatwg/html/pull/1784
1438
1439         The new behavior also matches Chrome and Edge.
1440
1441         Test: imported/w3c/web-platform-tests/html/semantics/forms/the-textarea-element/cloning-steps.html
1442
1443         * html/HTMLInputElement.cpp:
1444         (WebCore::HTMLInputElement::copyNonAttributePropertiesFromElement):
1445         * html/HTMLTextAreaElement.cpp:
1446         (WebCore::HTMLTextAreaElement::copyNonAttributePropertiesFromElement):
1447         * html/HTMLTextAreaElement.h:
1448
1449 2016-09-16  Jer Noble  <jer.noble@apple.com>
1450
1451         [media-source] Only fire 'resize' events when new sized frame is displayed, not parsed.
1452         https://bugs.webkit.org/show_bug.cgi?id=162039
1453
1454         Reviewed by Eric Carlson.
1455
1456         Fixes tests: imported/w3c/web-platform-tests/media-source/mediasource-config-change-mp4-av-framesize.html
1457                      imported/w3c/web-platform-tests/media-source/mediasource-config-change-mp4-v-framesize.html
1458
1459         Currently, the SourceBufferPrivateAVFObjC will signal a size change as soon as the sample is
1460         parsed during appendData(). This is incorrect, as the intrinsic size of the video element
1461         should be based on when the sample is displayed, and it causes some W3C test cases to fail.
1462         Set a boundary time observer on the player's synchronizer at each sample's presentation time
1463         where that sample signals a change in intrinsic size. Flush those observers whenever the
1464         samples are flushed un-displayed (typically, during a seek). Because the observer callback
1465         may have already been issued (but not executed) at a flush, use a separate weak pointer
1466         factory, and invalidate all outstanding size change observer weak pointers when flushing.
1467
1468         * Modules/mediasource/SourceBuffer.cpp:
1469         (WebCore::SourceBuffer::reenqueueMediaForTime): When re-enqueing, enqueue the next decodable
1470             sample, even if it doesn't include the current time. This handles cases where the current
1471             time is 0, and the first video sample starts at 0.033.
1472         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
1473         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
1474         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
1475         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::~MediaPlayerPrivateMediaSourceAVFObjC):
1476         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::naturalSize):
1477         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::sizeWillChangeAtTime):
1478         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::flushPendingSizeChanges):
1479         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::sizeChanged): Deleted.
1480         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
1481         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1482         (WebCore::SourceBufferPrivateAVFObjC::processCodedFrame):
1483         (WebCore::SourceBufferPrivateAVFObjC::flushAndEnqueueNonDisplayingSamples):
1484         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
1485
1486 2016-09-16  Alex Christensen  <achristensen@webkit.org>
1487
1488         Fix Windows clean build after r205929
1489
1490         * DerivedSources.cpp:
1491
1492 2016-09-16  Jer Noble  <jer.noble@apple.com>
1493
1494         [media-source] ASAN crash running imported/w3c/web-platform-tests/media-source/mediasource-remove.html
1495         https://bugs.webkit.org/show_bug.cgi?id=162050
1496
1497         Reviewed by Brent Fulgham.
1498
1499         SampleMap::removeSample() was accessing the passed-in sample after removing it from its own storage. If
1500         the SampleMap held the last reference to the sample, it would end up acessing freed memory. Fix the
1501         post-removal access, but also ensure that the caller, SourceBuffer::removeCodedFrames(), retains the
1502         sample it passes into removeSample().
1503
1504         * Modules/mediasource/SampleMap.cpp:
1505         (WebCore::SampleMap::removeSample):
1506         * Modules/mediasource/SourceBuffer.cpp:
1507         (WebCore::SourceBuffer::removeCodedFrames):
1508
1509 2016-09-16  Javier Fernandez  <jfernandez@igalia.com>
1510
1511         [GTK] Unreviewed build fix after r206007.
1512         https://bugs.webkit.org/show_bug.cgi?id=162058
1513
1514         * css/parser/CSSParserFastPaths.cpp:
1515         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
1516
1517 2016-09-16  Carlos Garcia Campos  <cgarcia@igalia.com>
1518
1519         [TextureMapper] Scrolling through 01.org/dleyna crashes WebKitWebProcess
1520         https://bugs.webkit.org/show_bug.cgi?id=162020
1521
1522         Reviewed by Žan Doberšek.
1523
1524         The problem is that we are trying to clone a ReferenceFilterOperation, which is not expected to be cloned, from
1525         FilterAnimationValue copy constructor, and FilterOperations are never expected to be nullptr, so we end up
1526         crashing. We just need to validate the filters before setting then and before creating a TextureMapperAnimation
1527         for them.
1528
1529         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
1530         (WebCore::GraphicsLayerTextureMapper::filtersCanBeComposited): Return false if there are reference filters or no
1531         filters at all. I don't know if we really support other filters, but at least we won't crash for the others.
1532         (WebCore::GraphicsLayerTextureMapper::addAnimation): Check if filters can be composited before creating a
1533         TextureMapperAnimation.
1534         (WebCore::GraphicsLayerTextureMapper::setFilters): Check if filters can be composited before setting them.
1535         * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
1536         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
1537         (WebCore::CoordinatedGraphicsLayer::filtersCanBeComposited): Return false if there are reference filters or no
1538         filters at all. I don't know if we really support other filters, but at least we won't crash for the others.
1539         (WebCore::CoordinatedGraphicsLayer::setFilters): Check if filters can be composited before setting them.
1540         (WebCore::CoordinatedGraphicsLayer::addAnimation): Check if filters can be composited before creating a
1541         TextureMapperAnimation.
1542         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
1543
1544 2016-09-16  Youenn Fablet  <youenn@apple.com>
1545
1546         CachedFont do not need to be updated according Origin/Fetch mode
1547         https://bugs.webkit.org/show_bug.cgi?id=161909
1548
1549         Reviewed by Sam Weinig.
1550
1551         No change of behavior.
1552
1553         * loader/cache/CachedFont.h: Ensuring CachedFont is not reused.
1554         * loader/cache/CachedResourceLoader.cpp:
1555         (WebCore::CachedResourceLoader::updateCachedResourceWithCurrentRequest): Doing direct reuse for CachedFont as WebKit is ignoring CORS for all fonts related stuff.
1556
1557 2016-09-16  Youenn Fablet  <youenn@apple.com>
1558
1559         CachedResource should efficiently construct its ResourceRequest
1560         https://bugs.webkit.org/show_bug.cgi?id=161609
1561
1562         Reviewed by Sam Weinig.
1563
1564         Covered by existing tests.
1565
1566         Making CachedResourceLoader take a CachedResourceRequest&& when being asked to load resources.
1567         Making CachedResource et al take a CachedResourceRequest&& as constructor parameter.
1568
1569         CachedResource now sets its options at construction time instead of load time.
1570         This may change some specific behaviors, for instance when loading manually images.
1571
1572         Made some refactoring when both the resource and request are needed, for ResourceTimingInformation.
1573         Made local copies of some CachedResourceRequest fields so that we do not need it after being WTFMoved.
1574         Some of these properties may be put outside CachedResourceRequest in a later refactoring step.
1575
1576         * css/CSSFontFaceSrcValue.cpp:
1577         (WebCore::CSSFontFaceSrcValue::cachedFont):
1578         * css/CSSImageSetValue.cpp:
1579         (WebCore::CSSImageSetValue::loadBestFitImage):
1580         * css/CSSImageValue.cpp:
1581         (WebCore::CSSImageValue::loadImage):
1582         * css/StyleRuleImport.cpp:
1583         (WebCore::StyleRuleImport::requestStyleSheet):
1584         * dom/ProcessingInstruction.cpp:
1585         (WebCore::ProcessingInstruction::checkStyleSheet):
1586         * dom/ScriptElement.cpp:
1587         (WebCore::ScriptElement::requestScriptWithCache):
1588         * html/HTMLLinkElement.cpp:
1589         (WebCore::HTMLLinkElement::process):
1590         * html/parser/HTMLResourcePreloader.cpp:
1591         (WebCore::HTMLResourcePreloader::preload):
1592         * loader/CrossOriginPreflightChecker.cpp:
1593         (WebCore::CrossOriginPreflightChecker::startPreflight):
1594         * loader/DocumentLoader.cpp:
1595         (WebCore::DocumentLoader::startLoadingMainResource):
1596         * loader/DocumentThreadableLoader.cpp:
1597         (WebCore::DocumentThreadableLoader::loadRequest):
1598         * loader/ImageLoader.cpp:
1599         (WebCore::ImageLoader::updateFromElement):
1600         * loader/LinkLoader.cpp:
1601         (WebCore::LinkLoader::preloadIfNeeded):
1602         (WebCore::LinkLoader::loadLink):
1603         * loader/MediaResourceLoader.cpp:
1604         (WebCore::MediaResourceLoader::requestResource):
1605         * loader/ResourceTimingInformation.cpp:
1606         (WebCore::ResourceTimingInformation::storeResourceTimingInitiatorInformation):
1607         * loader/ResourceTimingInformation.h:
1608         * loader/TextTrackLoader.cpp:
1609         (WebCore::TextTrackLoader::load):
1610         * loader/cache/CachedCSSStyleSheet.cpp:
1611         (WebCore::CachedCSSStyleSheet::CachedCSSStyleSheet):
1612         * loader/cache/CachedCSSStyleSheet.h:
1613         * loader/cache/CachedFont.cpp:
1614         (WebCore::CachedFont::CachedFont):
1615         (WebCore::CachedFont::load):
1616         (WebCore::CachedFont::beginLoadIfNeeded):
1617         * loader/cache/CachedFont.h:
1618         * loader/cache/CachedImage.cpp:
1619         (WebCore::CachedImage::CachedImage):
1620         (WebCore::CachedImage::load):
1621         * loader/cache/CachedImage.h:
1622         * loader/cache/CachedRawResource.cpp:
1623         (WebCore::CachedRawResource::CachedRawResource):
1624         * loader/cache/CachedRawResource.h:
1625         * loader/cache/CachedResource.cpp:
1626         (WebCore::CachedResource::CachedResource):
1627         (WebCore::CachedResource::load):
1628         (WebCore::CachedResource::loadFrom):
1629         * loader/cache/CachedResource.h:
1630         (WebCore::CachedResource::resourceRequest):
1631         * loader/cache/CachedResourceLoader.cpp:
1632         (WebCore::createResource):
1633         (WebCore::CachedResourceLoader::requestImage):
1634         (WebCore::CachedResourceLoader::requestFont):
1635         (WebCore::CachedResourceLoader::requestTextTrack):
1636         (WebCore::CachedResourceLoader::requestCSSStyleSheet):
1637         (WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
1638         (WebCore::CachedResourceLoader::requestScript):
1639         (WebCore::CachedResourceLoader::requestXSLStyleSheet):
1640         (WebCore::CachedResourceLoader::requestSVGDocument):
1641         (WebCore::CachedResourceLoader::requestLinkResource):
1642         (WebCore::CachedResourceLoader::requestMedia):
1643         (WebCore::CachedResourceLoader::requestRawResource):
1644         (WebCore::CachedResourceLoader::requestMainResource):
1645         (WebCore::CachedResourceLoader::shouldUpdateCachedResourceWithCurrentRequest):
1646         (WebCore::CachedResourceLoader::updateCachedResourceWithCurrentRequest):
1647         (WebCore::CachedResourceLoader::requestResource):
1648         (WebCore::CachedResourceLoader::revalidateResource):
1649         (WebCore::CachedResourceLoader::loadResource):
1650         (WebCore::CachedResourceLoader::reloadImagesIfNotDeferred):
1651         (WebCore::CachedResourceLoader::preload):
1652         (WebCore::CachedResourceLoader::checkForPendingPreloads):
1653         (WebCore::CachedResourceLoader::requestPreload):
1654         * loader/cache/CachedResourceLoader.h:
1655         * loader/cache/CachedSVGDocument.cpp:
1656         (WebCore::CachedSVGDocument::CachedSVGDocument):
1657         * loader/cache/CachedSVGDocument.h:
1658         * loader/cache/CachedSVGDocumentReference.cpp:
1659         (WebCore::CachedSVGDocumentReference::load):
1660         * loader/cache/CachedSVGFont.cpp:
1661         (WebCore::CachedSVGFont::CachedSVGFont):
1662         * loader/cache/CachedSVGFont.h:
1663         * loader/cache/CachedScript.cpp:
1664         (WebCore::CachedScript::CachedScript):
1665         * loader/cache/CachedScript.h:
1666         * loader/cache/CachedTextTrack.cpp:
1667         (WebCore::CachedTextTrack::CachedTextTrack):
1668         * loader/cache/CachedTextTrack.h:
1669         * loader/cache/CachedXSLStyleSheet.cpp:
1670         (WebCore::CachedXSLStyleSheet::CachedXSLStyleSheet):
1671         (WebCore::CachedXSLStyleSheet::didAddClient):
1672         * loader/cache/CachedXSLStyleSheet.h:
1673         * loader/icon/IconLoader.cpp:
1674         (WebCore::IconLoader::startLoading):
1675         * platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp:
1676         (WebCore::WebCoreAVCFResourceLoader::startLoading):
1677         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
1678         (WebCore::WebCoreAVFResourceLoader::startLoading):
1679         * svg/SVGFEImageElement.cpp:
1680         (WebCore::SVGFEImageElement::requestImageResource):
1681         * svg/SVGFontFaceUriElement.cpp:
1682         (WebCore::SVGFontFaceUriElement::loadFont):
1683         * svg/SVGUseElement.cpp:
1684         (WebCore::SVGUseElement::updateExternalDocument):
1685         * xml/XSLImportRule.cpp:
1686         (WebCore::XSLImportRule::loadSheet):
1687
1688 2016-09-16  Youenn Fablet  <youenn@apple.com>
1689
1690         [Fetch API] Headers should be combine with ',' and not ', '
1691         https://bugs.webkit.org/show_bug.cgi?id=161736
1692
1693         Reviewed by Sam Weinig.
1694
1695         Covered by updated tests and http/tests/xmlhttprequest/check-combining-headers.html.
1696
1697         * loader/CrossOriginAccessControl.cpp:
1698         (WebCore::createAccessControlPreflightRequest): Combining with ',' for Access-Control-Request-Headers
1699         * platform/network/HTTPHeaderMap.cpp:
1700         (HTTPHeaderMap::add): Combining with ','
1701
1702 2016-09-16  Youenn Fablet  <youenn@apple.com>
1703
1704         Custom promise-returning functions should not throw if callee has not the expected type
1705         https://bugs.webkit.org/show_bug.cgi?id=162011
1706
1707         Reviewed by Sam Weinig.
1708
1709         Covered by added test.
1710
1711         Updating code generator to handle this case.
1712         Cleaning related getUserMedia implementation.
1713
1714         * CMakeLists.txt: Removing Modules/mediastream/MediaDevices.js.
1715         * DerivedSources.make: Removing Modules/mediastream/MediaDevices.js.
1716         * Modules/mediastream/MediaDevices.idl: Cleaning IDL definition
1717         * Modules/mediastream/MediaDevices.js: Removing error throwing and so removing file.
1718         * Modules/mediastream/NavigatorUserMedia.js: getUsermMediaFromJS to getUserMedia.
1719         * WebCore.xcodeproj/project.pbxproj: Removing Modules/mediastream/MediaDevices.js.
1720         * bindings/js/JSDOMPromise.cpp:
1721         (WebCore::createRejectedPromiseWithTypeError): Helper routine.
1722         * bindings/js/JSDOMPromise.h:
1723         * bindings/js/WebCoreBuiltinNames.h: getUsermMediaFromJS to getUserMedia.
1724         * bindings/scripts/CodeGeneratorJS.pm:
1725         (GenerateImplementation): Rejecting promise in case of failing castedThis, but only for custom functions since
1726         they are handled differently for non custom methods.
1727         (GenerateFunctionCastedThis):
1728         * bindings/scripts/test/JS/JSTestObj.cpp:
1729         * bindings/scripts/test/JS/JSTestObj.h:
1730         * bindings/scripts/test/TestObj.idl: Adding custom promise test.
1731
1732 2016-09-16  Youenn Fablet  <youenn@apple.com>
1733
1734         Link loader should use FetchOptions::mode according its crossOrigin attribute
1735         https://bugs.webkit.org/show_bug.cgi?id=161859
1736
1737         Reviewed by Sam Weinig.
1738
1739         Tests: http/tests/security/cached-cross-origin-preloaded-css-stylesheet.html
1740                http/tests/security/cached-cross-origin-preloading-css-stylesheet.html
1741
1742         Setting fetch mode according crossorigin attribute for link preload elements.
1743         This allows calling onerror callback for CORS failures, which was not the case before the patch.
1744
1745         Making cached CSS stylesheet reusable accross origins and fetch modes.
1746
1747         * loader/LinkLoader.cpp:
1748         (WebCore::LinkLoader::preloadIfNeeded): Using CachedResourceRequest::setAsPotentiallyCrossOrigin to set fetch mode.
1749         * loader/cache/CachedCSSStyleSheet.cpp:
1750         (WebCore::CachedCSSStyleSheet::sheetText): clean-up.
1751         (WebCore::CachedCSSStyleSheet::setBodyDataFrom): Implementing data init for cached css stylesheets.
1752         * loader/cache/CachedCSSStyleSheet.h:
1753         * loader/cache/CachedResourceLoader.cpp:
1754         (WebCore::CachedResourceLoader::updateCachedResourceWithCurrentRequest): Activating update support for stylesheets.
1755         (WebCore::CachedResourceLoader::requestResource): Fixing for matching cached resources that need being reloaded due to different origin/fetch mode.
1756
1757 2016-09-16  Youenn Fablet  <youenn@apple.com>
1758
1759         [Fetch API] Referrer and Origin header should not be considered as safe request headers
1760         https://bugs.webkit.org/show_bug.cgi?id=161902
1761
1762         Reviewed by Sam Weinig.
1763
1764         Test: http/tests/fetch/fetch-cors-with-referrer.html and updated WPT tests.
1765
1766         Removing Origin and Referrer from safe request headers.
1767         Making referrer header setting after preflight for fetch API code path.
1768
1769         Ensuring that no ThreadableLoader client sets Origin or Referrer headers of the ResourceRequest, as they should use the proper mechanisms for that.
1770
1771         Handling no-referrer referrer special value by setting the referrer-policy to NoReferrer in FetchLoader.
1772
1773         * Modules/fetch/FetchLoader.cpp:
1774         (WebCore::FetchLoader::start): Computing referrer value and handling special "client"and "no-referrer" cases.
1775         Passing the value directly to ThreadableLoader.
1776         * Modules/fetch/FetchRequest.cpp:
1777         (WebCore::FetchRequest::internalRequest): Removing setting of ResourceRequest referrer header.
1778         (WebCore::FetchRequest::clone): Removing obsolete FIXME.
1779         * Modules/fetch/FetchRequest.h:
1780         * loader/CrossOriginAccessControl.cpp:
1781         (WebCore::isOnAccessControlSimpleRequestHeaderWhitelist): Removing Origin and Referrer headers.
1782         * loader/DocumentThreadableLoader.cpp:
1783         (WebCore::DocumentThreadableLoader::create): Updated to take a referrer as parameter.
1784         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader): Ditto.
1785         * loader/DocumentThreadableLoader.h: Ditto.
1786         * loader/ThreadableLoader.cpp: Ditto.
1787         (WebCore::ThreadableLoader::create): Ditto.
1788         * loader/ThreadableLoader.h: Ditto.
1789         * loader/WorkerThreadableLoader.cpp: Ditto.
1790         (WebCore::WorkerThreadableLoader::WorkerThreadableLoader): Ditto.
1791         (WebCore::WorkerThreadableLoader::loadResourceSynchronously): Ditto.
1792         * loader/WorkerThreadableLoader.h: Ditto.
1793         (WebCore::WorkerThreadableLoader::create): Ditto.
1794         * platform/network/ResourceRequestBase.cpp:
1795         (WebCore::ResourceRequestBase::hasHTTPReferrer): Added to enable asserting that no threadable loader client sets the referrer in the request.
1796         * platform/network/ResourceRequestBase.h:
1797
1798 2016-09-15  Dave Hyatt  <hyatt@apple.com>
1799
1800         [CSS Parser] Get CSSParserFastPaths.cpp compiling
1801         https://bugs.webkit.org/show_bug.cgi?id=162033
1802
1803         Reviewed by Dean Jackson.
1804
1805         * CMakeLists.txt:
1806         * WebCore.xcodeproj/project.pbxproj:
1807         Add new StyleColor.h/.cpp files to the projecty
1808
1809         * css/CSSFunctionValue.cpp:
1810         (WebCore::CSSFunctionValue::CSSFunctionValue):
1811         (WebCore::CSSFunctionValue::customCSSText):
1812         (WebCore::CSSFunctionValue::append):
1813         (WebCore::CSSFunctionValue::buildParserValueSubstitutingVariables):
1814         * css/CSSFunctionValue.h:
1815         Tweak CSSFunctionValue so that the name can be represented as a keyword ID instead of a String. Eventually we also
1816         want to make CSSFunctionValue subclass CSSValueList rather than referencing a separate CSSValueList as a member. For now
1817         I left that alone though in order to not change too much in the old parser.
1818
1819         * css/CSSProperty.cpp:
1820         (WebCore::CSSProperty::isDescriptorOnly):
1821         Whether or not a property is only a descriptor, e.g., used in viewport and font face stuff.
1822
1823         * css/CSSProperty.h:
1824         * css/CSSValueKeywords.in:
1825         Added new keywords for functions that can be used as values. The new parser uses keywords to represent function names.
1826
1827         * css/StyleColor.cpp: Added.
1828         (WebCore::StyleColor::colorFromKeyword):
1829         (WebCore::StyleColor::isColorKeyword):
1830         (WebCore::StyleColor::isSystemColor):
1831         * css/StyleColor.h: Added.
1832         (WebCore::StyleColor::StyleColor):
1833         (WebCore::StyleColor::currentColor):
1834         (WebCore::StyleColor::isCurrentColor):
1835         (WebCore::StyleColor::getColor):
1836         (WebCore::StyleColor::resolve):
1837         (WebCore::operator==):
1838         (WebCore::operator!=):
1839         New color helper that contains code for checking and looking up colors. This code is similar to some code we already
1840         had in the old CSSParser.cpp file, but this way it can be used outside the parser and/or in different files.
1841
1842         * css/parser/CSSParserFastPaths.cpp:
1843         (WebCore::parseSimpleLengthValue):
1844         (WebCore::isColorPropertyID):
1845         (WebCore::parseColorIntOrPercentage):
1846         (WebCore::fastParseColorInternal):
1847         (WebCore::CSSParserFastPaths::parseColor):
1848         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
1849         (WebCore::isUniversalKeyword):
1850         (WebCore::parseKeywordValue):
1851         (WebCore::parseTransformTranslateArguments):
1852         (WebCore::parseTransformNumberArguments):
1853         (WebCore::parseSimpleTransformValue):
1854         (WebCore::transformCanLikelyUseFastPath):
1855         (WebCore::parseSimpleTransformList):
1856         (WebCore::parseSimpleTransform):
1857         (WebCore::CSSParserFastPaths::maybeParseValue):
1858         * css/parser/CSSParserFastPaths.h:
1859         Get everything compiling in this file. Key changes included reverting to our old unit names, making CSSFunctionValue compatible,
1860         adding support for StyleColor, adding support for mode checking of keywords, and fixing up the memory management model so that
1861         RefPtrs are used on returns from parsing functions.
1862
1863         * css/parser/CSSParserIdioms.cpp:
1864         (WebCore::isValueAllowedInMode):
1865         * css/parser/CSSParserIdioms.h:
1866         New helper function for restricting keywords to certain modes only. The -webkit-text color quirk has been moved to this function.
1867
1868 2016-09-15  Brady Eidson  <beidson@apple.com>
1869
1870         WKWebView.hasOnlySecureContent always returns "YES" after going back to a CachedPage (even if it has http resources).
1871         <rdar://problem/27681261> and https://bugs.webkit.org/show_bug.cgi?id=162043
1872
1873         Reviewed by Brent Fulgham. 
1874
1875         No new tests (Not possible with current testing infrastructure).
1876
1877         This adds the infrastructure for WebCore to track whether or not a CachedFrame had insecure content at the time
1878         it was cached, and then to report that back to the client when a CachedPage is restored.
1879
1880         Since "has insecure content" is currently only tracked in the WK2 UI process, that is the only client of this code.
1881
1882         * history/CachedFrame.cpp:
1883         (WebCore::CachedFrame::setHasInsecureContent):
1884         * history/CachedFrame.h:
1885         (WebCore::CachedFrame::hasInsecureContent):
1886
1887         * loader/EmptyClients.h:
1888
1889         * loader/FrameLoader.cpp:
1890         (WebCore::FrameLoader::receivedFirstData):
1891         (WebCore::FrameLoader::commitProvisionalLoad):
1892         (WebCore::FrameLoader::dispatchDidCommitLoad):
1893         * loader/FrameLoader.h:
1894
1895         * loader/FrameLoaderClient.h:
1896
1897         * loader/FrameLoaderTypes.h:
1898
1899 2016-09-13  Jer Noble  <jer.noble@apple.com>
1900
1901         [media-source] web-platform-test/media-source/mediasource-remove.html test failing
1902         https://bugs.webkit.org/show_bug.cgi?id=161950
1903
1904         Reviewed by Eric Carlson.
1905
1906         Fixes test: web-platform-test/media-source/mediasource-remove.html
1907
1908         The mediasource-remove.html test was failing in a number of ways:
1909
1910         - Tests with invalid start or end times were not throwing the correct exception
1911           code, or not throwing exception codes at all
1912
1913         - Tests were showing an incorrect start buffered range at the beginning of each test.
1914
1915         - Tests which removed samples were not getting the expected buffered values at the end
1916           each test.
1917
1918         For the exception failures, update the implementation of abort() and remove() to throw
1919         the correct exceptions at the correct times.
1920
1921         For the incorrect initial buffered range, update our buffered calculations to store
1922         individual PlatformTimeRanges on each TrackBuffer, and coalesce them into a single
1923         value when an append operation completes, a remove operation completes, or when the
1924         MediaSource's ready state changes.
1925
1926         For the incorrect buffered ranges after removal, this is caused because the "samples"
1927         that make up an audio track are actually a collection of a large number of individual
1928         samples.  So when we are asked to remove media data in a given range, break these audio
1929         meta-samples into two pieces at the removal points. This allows the removal algorithm
1930         to operate on a individual audio sample basis. (We should look into using this technique
1931         when audio samples are evicted during an append operation.) This requires adding some
1932         methods to MediaSample and it's concrete subclasses to "divide" a sample into two at
1933         a given presentation time.
1934
1935         Fixing these behaviors, however, breaks the media-source-end-of-stream-buffered.html
1936         test, which expects the buffered range for the entire element to expand to the maximum
1937         buffered time of any of the element's MediaSource's active sourceBuffers. To fix this,
1938         update the MediaSource's monitorSourceBuffer() implementation to match the current
1939         specification. The new spec no longer queries the individual SourceBuffers, but rather
1940         queries the already coalesced buffered ranges. So move the helper methods hasCurrentTime()
1941         hasFutureTime(), and canPlayThrough() up into MediaSource from SourceBuffer. Also, update
1942         seekToTime, since it has the same problem as monitorSourceBuffer().
1943
1944         However, this breaks the media-source-monitor-source-buffers.html test, which appends
1945         10s of movie data instantaneously, then never appends again. The SourceBuffer's
1946         monitorBufferingRate() method only re-evaluates the rate after data has been appended,
1947         so the SourceBuffer thinks it's buffered data at a prodigious rate forever. Instead,
1948         allow the SourceBuffer to continuously re-evalute it's buffering rate by modifying the
1949         exponential moving average so that the co-efficient scales based on how frequently the
1950         method is called. Call the method more often, and the moving average changes less quickly,
1951         and it means that when media is stalled out at the end of a buffered range, the readyState
1952         of a video element will eventually drop to HAVE_CURRENT_DATA when the average buffering
1953         rate falls below the level where playback would continue uninterrupted.
1954
1955         * Modules/mediasource/MediaSource.cpp:
1956         (WebCore::MediaSource::seekToTime):
1957         (WebCore::MediaSource::currentTimeFudgeFactor):
1958         (WebCore::MediaSource::hasBufferedTime):
1959         (WebCore::MediaSource::hasCurrentTime):
1960         (WebCore::MediaSource::hasFutureTime):
1961         (WebCore::MediaSource::monitorSourceBuffers):
1962         * Modules/mediasource/MediaSource.h:
1963         * Modules/mediasource/SourceBuffer.cpp:
1964         (WebCore::SourceBuffer::abort):
1965         (WebCore::SourceBuffer::remove):
1966         (WebCore::SourceBuffer::abortIfUpdating):
1967         (WebCore::SourceBuffer::removeCodedFrames):
1968         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
1969         (WebCore::SourceBuffer::updateBufferedFromTrackBuffers):
1970         (WebCore::SourceBuffer::canPlayThroughRange):
1971         (WebCore::SourceBuffer::monitorBufferingRate):
1972         (WebCore::currentTimeFudgeFactor): Deleted.
1973         (WebCore::SourceBuffer::hasCurrentTime): Deleted.
1974         (WebCore::SourceBuffer::hasFutureTime): Deleted.
1975         (WebCore::SourceBuffer::canPlayThrough): Deleted.
1976         * platform/MediaSample.h:
1977         * platform/cf/CoreMediaSoftLink.cpp:
1978         * platform/cf/CoreMediaSoftLink.h:
1979         * platform/graphics/avfoundation/MediaSampleAVFObjC.h:
1980         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
1981         (WebCore::MediaSampleAVFObjC::isDivisable):
1982         (WebCore::MediaSampleAVFObjC::divide):
1983         * platform/mock/mediasource/MockSourceBufferPrivate.cpp:
1984
1985 2016-09-15  Zalan Bujtas  <zalan@apple.com>
1986
1987         ASSERTION FAILED: willBeComposited == needsToBeComposited(layer) in WebCore::RenderLayerCompositor::computeCompositingRequirements
1988         https://bugs.webkit.org/show_bug.cgi?id=151097
1989         <rdar://problem/27711678>
1990
1991         Reviewed by Simon Fraser.
1992
1993         This patch ensures that when will-change property triggers stacking context, we make the associated layer a non-normal flow layer.
1994         (This is similar to what any other stacking context-triggering CSS property does.)  
1995
1996         Test: compositing/assert-on-will-change-transform-with-composited-descendant.html
1997
1998         * rendering/RenderLayer.cpp:
1999         (WebCore::RenderLayer::calculateClipRects):
2000
2001 2016-09-15  Zalan Bujtas  <zalan@apple.com>
2002
2003         Move RenderObject::shouldRespectImageOrientation to RenderElement.
2004         https://bugs.webkit.org/show_bug.cgi?id=162028
2005
2006         Reviewed by Antti Koivisto.
2007
2008         Tighten the type for imageSizeForRenderer/canRender so that RenderObject::shouldRespectImageOrientation could
2009         be moved to RenderElement.
2010
2011         No change in functionality.
2012
2013         * loader/cache/CachedImage.cpp:
2014         (WebCore::CachedImage::imageSizeForRenderer):
2015         * loader/cache/CachedImage.h:
2016         * rendering/RenderElement.cpp:
2017         (WebCore::RenderElement::shouldRespectImageOrientation):
2018         * rendering/RenderElement.h:
2019         * rendering/RenderObject.cpp:
2020         (WebCore::RenderObject::shouldRespectImageOrientation): Deleted.
2021         * rendering/RenderObject.h:
2022         * rendering/style/StyleCachedImage.cpp:
2023         (WebCore::StyleCachedImage::canRender):
2024         * rendering/style/StyleCachedImage.h:
2025         * rendering/style/StyleImage.h:
2026         (WebCore::StyleImage::canRender):
2027
2028 2016-09-15  Anders Carlsson  <andersca@apple.com>
2029
2030         Fix build.
2031
2032         * platform/spi/cocoa/PassKitSPI.h:
2033
2034 2016-09-15  Alex Christensen  <achristensen@webkit.org>
2035
2036         Use character class table in URLParser
2037         https://bugs.webkit.org/show_bug.cgi?id=161997
2038
2039         Reviewed by Chris Dumez.
2040
2041         No change in behavior except a performance improvement.
2042         
2043         Before this change, URLParser took 1.514x as long to run my URL Parsing benchmark as URL::parse
2044         with a standard deviation of the ration of the runtimes of 0.063 after 8 runs with each parser.
2045         After this change, URLParser took 1.328x as long with a standard deviation of 0.037.
2046         This isn't the cleanest data, but it's enough to convince me that this is a significant improvement.
2047
2048         * platform/URLParser.cpp:
2049         (WebCore::isC0Control):
2050         (WebCore::isC0ControlOrSpace):
2051         (WebCore::isTabOrNewline):
2052         (WebCore::isInSimpleEncodeSet):
2053         (WebCore::isInDefaultEncodeSet):
2054         (WebCore::isInUserInfoEncodeSet):
2055         (WebCore::isInvalidDomainCharacter):
2056         (WebCore::isSlashQuestionOrHash):
2057         (WebCore::shouldPercentEncodeQueryByte):
2058         (WebCore::shouldCopyFileURL):
2059         (WebCore::isSingleDotPathSegment):
2060         (WebCore::URLParser::parse):
2061
2062 2016-09-15  Keith Miller  <keith_miller@apple.com>
2063
2064         Pragma out undefined-var-template warnings in JSC for JSObjects that are templatized
2065         https://bugs.webkit.org/show_bug.cgi?id=161985
2066
2067         Reviewed by Alex Christensen.
2068
2069         Delete unneeded using, which broke the build on newer versions of clang.
2070
2071         * bridge/objc/WebScriptObject.mm:
2072
2073 2016-09-15  Alex Christensen  <achristensen@webkit.org>
2074
2075         URLParser: Check for invalid characters in the host
2076         https://bugs.webkit.org/show_bug.cgi?id=162023
2077
2078         Reviewed by Tim Horton.
2079
2080         Covered by new API tests.
2081
2082         * platform/URLParser.cpp:
2083         (WebCore::URLParser::failure):
2084         (WebCore::URLParser::parseHost):
2085
2086 2016-09-15  Antti Koivisto  <antti@apple.com>
2087
2088         Remove some extra spaces.
2089
2090         * rendering/TextDecorationPainter.cpp:
2091         (WebCore::collectStylesForRenderer):
2092
2093 2016-09-15  Alex Christensen  <achristensen@webkit.org>
2094
2095         Use efficient iterators in URLParser
2096         https://bugs.webkit.org/show_bug.cgi?id=162007
2097
2098         Reviewed by Tim Horton.
2099
2100         URLParser used to use StringView::CodePoints::Iterator, which needs to check if
2101         the StringView is 8-bit or 16-bit every time it does anything.
2102         I wrote a new CodePointIterator template which already knows whether it is iterating
2103         8-bit or 16-bit characters, so it does not need to do the checks each time it gets a
2104         code point or advances to the next code point.
2105
2106         No change in behavior except a performance increase.
2107         Covered by existing tests.
2108
2109         * platform/URLParser.cpp:
2110         (WebCore::CodePointIterator::CodePointIterator):
2111         (WebCore::CodePointIterator::operator==):
2112         (WebCore::CodePointIterator::operator!=):
2113         (WebCore::CodePointIterator::operator=):
2114         (WebCore::CodePointIterator::atEnd):
2115         (WebCore::CodePointIterator<LChar>::operator):
2116         (WebCore::CodePointIterator<UChar>::operator):
2117         (WebCore::isWindowsDriveLetter):
2118         (WebCore::shouldCopyFileURL):
2119         (WebCore::isPercentEncodedDot):
2120         (WebCore::isSingleDotPathSegment):
2121         (WebCore::isDoubleDotPathSegment):
2122         (WebCore::consumeSingleDotPathSegment):
2123         (WebCore::consumeDoubleDotPathSegment):
2124         (WebCore::URLParser::failure):
2125         (WebCore::URLParser::parse):
2126         (WebCore::URLParser::parseAuthority):
2127         (WebCore::parseIPv4Number):
2128         (WebCore::parseIPv4Host):
2129         (WebCore::parseIPv6Host):
2130         (WebCore::URLParser::parsePort):
2131         (WebCore::URLParser::parseHost):
2132         * platform/URLParser.h:
2133
2134 2016-09-14  Antti Koivisto  <antti@apple.com>
2135
2136         Move text decoration style computation from RenderObject to TextDecorationPainter
2137         https://bugs.webkit.org/show_bug.cgi?id=162004
2138
2139         Reviewed by Zalan Bujtas.
2140
2141         It is mostly an implementation detail of TextDecorationPainter.
2142
2143         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2144         (AXAttributeStringSetStyle):
2145         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2146         (AXAttributeStringSetStyle):
2147         * rendering/RenderObject.cpp:
2148         (WebCore::decorationColor): Deleted.
2149         (WebCore::RenderObject::getTextDecorationColorsAndStyles): Deleted.
2150         * rendering/RenderObject.h:
2151         * rendering/TextDecorationPainter.cpp:
2152         (WebCore::TextDecorationPainter::TextDecorationPainter):
2153         (WebCore::TextDecorationPainter::paintTextDecoration):
2154         (WebCore::decorationColor):
2155         * rendering/TextDecorationPainter.h:
2156
2157 2016-09-15  Dave Hyatt  <hyatt@apple.com>
2158
2159         [CSS Parser] Make stylesheets parse using the new parser if the setting is enabled
2160         https://bugs.webkit.org/show_bug.cgi?id=162018
2161
2162         Reviewed by Zalan Bujtas.
2163
2164         * css/parser/CSSParser.cpp:
2165         (WebCore::CSSParserContext::CSSParserContext):
2166         (WebCore::CSSParser::parseSheet):
2167         * css/parser/CSSParserMode.h:
2168
2169 2016-09-15  Fujii Hironori  <Hironori.Fujii@sony.com>
2170
2171         [CMake] Refactor GENERATE_BINDINGS
2172         https://bugs.webkit.org/show_bug.cgi?id=161854
2173
2174         Reviewed by Gyuyoung Kim.
2175
2176         * CMakeLists.txt: Changed the arguments of GENERATE_BINDINGS to
2177         new style.  Removed add_custom_command of preprocess-idls.pl which
2178         is moved to GENERATE_BINDINGS.  Moved IDL_ATTRIBUTES_FILE into
2179         GENERATE_BINDINGS.
2180
2181 2016-09-14  Anders Carlsson  <andersca@apple.com>
2182
2183         Add CSS -webkit-appearance property for Apple Pay buttons
2184         https://bugs.webkit.org/show_bug.cgi?id=161986
2185         rdar://problem/27459216
2186
2187         Reviewed by Dean Jackson.
2188
2189         Add a new -webkit-appearance property, "-apple-pay-button".
2190         Also, add two properties, "-apple-pay-button-type" and "-apple-pay-button-style".
2191
2192         * WebCore.xcodeproj/project.pbxproj:
2193         Add RenderThemeCocoa.h and RenderThemeCocoa.mm.
2194
2195         * css/CSSComputedStyleDeclaration.cpp:
2196         (WebCore::ComputedStyleExtractor::propertyValue):
2197         Handle CSSPropertyApplePayButtonStyle and CSSPropertyApplePayButtonType.
2198
2199         * css/CSSPrimitiveValueMappings.h:
2200         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
2201         (WebCore::CSSPrimitiveValue::operator ApplePayButtonStyle):
2202         (WebCore::CSSPrimitiveValue::operator ApplePayButtonType):
2203         Add ApplePayButtonStyle and ApplePayButtonType conversion routines.
2204
2205         * css/CSSPropertyNames.in:
2206         Add -apple-pay-button-style and -apple-pay-button-type.
2207
2208         * css/CSSValueKeywords.in:
2209         Add CSS values.
2210
2211         * css/parser/CSSParser.cpp:
2212         (WebCore::isValidKeywordPropertyAndValue):
2213         Handle CSSPropertyApplePayButtonStyle and CSSPropertyApplePayButtonType.
2214
2215         * css/parser/CSSParserFastPaths.cpp:
2216         (WebCore::CSSParserFastPaths::isKeywordPropertyID):
2217         Handle CSSPropertyApplePayButtonStyle and CSSPropertyApplePayButtonType.
2218
2219         (WebCore::isAppleLegacyCSSPropertyKeyword):
2220         New function that returns whether the CSS property should be rewritten to -webkit-.
2221         We want to rewrite -apple- but not -apple-pay-.
2222
2223         (WebCore::cssPropertyID):
2224         Use the newly added isAppleLegacyCSSPropertyKeyword.
2225
2226         (WebCore::isAppleLegacyCSSValueKeyword):
2227         Check for "-apple-pay-" in addition to "-apple-system-".
2228
2229         * platform/ThemeTypes.h:
2230         Add ApplePayButtonPart.
2231
2232         * platform/spi/cocoa/PassKitSPI.h:
2233         Add PKDrawApplePayButton declaration.
2234
2235         * rendering/RenderTheme.cpp:
2236         (WebCore::RenderTheme::adjustStyle):
2237         Handle ApplePayButtonPart.
2238
2239         (WebCore::RenderTheme::paint):
2240         Handle ApplePayButtonPart.
2241
2242         * rendering/RenderTheme.h:
2243         (WebCore::RenderTheme::adjustApplePayButtonStyle):
2244         (WebCore::RenderTheme::paintApplePayButton):
2245         Add new functions.
2246
2247         * rendering/RenderThemeCocoa.h: Added.
2248         * rendering/RenderThemeCocoa.mm: Added.
2249         (WebCore::RenderThemeCocoa::adjustApplePayButtonStyle):
2250         Adjust the minimum width and minimum height accordingly.
2251
2252         (WebCore::toPKPaymentButtonStyle):
2253         (WebCore::toPKPaymentButtonType):
2254         Helper functions that convert our WebCore types to PK types.
2255
2256         (WebCore::RenderThemeCocoa::paintApplePayButton):
2257         Call PKDrawApplePayButton.
2258
2259         * rendering/RenderThemeIOS.h:
2260         * rendering/RenderThemeMac.h:
2261         Inherit from RenderThemeCocoa.
2262
2263         * rendering/style/RenderStyle.h:
2264         (WebCore::RenderStyle::applePayButtonStyle):
2265         (WebCore::RenderStyle::applePayButtonType):
2266         (WebCore::RenderStyle::setApplePayButtonStyle):
2267         (WebCore::RenderStyle::setApplePayButtonType):
2268         (WebCore::RenderStyle::initialApplePayButtonStyle):
2269         (WebCore::RenderStyle::initialApplePayButtonType):
2270         * rendering/style/RenderStyleConstants.h:
2271         * rendering/style/StyleRareInheritedData.cpp:
2272         (WebCore::StyleRareInheritedData::StyleRareInheritedData):
2273         (WebCore::StyleRareInheritedData::operator==):
2274         * rendering/style/StyleRareInheritedData.h:
2275         Add new style members for the button style and button type properties.
2276
2277 2016-09-15  Sergio Villar Senin  <svillar@igalia.com>
2278
2279         [css-grid] Implement fit-content track size
2280         https://bugs.webkit.org/show_bug.cgi?id=161379
2281
2282         Reviewed by Manuel Rego Casasnovas.
2283
2284         This implements the new <fit-content> track size which is defined as follows: "Represents
2285         the formula min(max-content, max(auto, argument)), which is calculated similar to auto
2286         (i.e. minmax(auto, max-content)), except that the track size is clamped at argument if it is
2287         greater than the auto minimum."
2288
2289         From the parsing POV fit-content was implemented as a new type of function which only takes
2290         one argument. That forced us to refactor some code because minmax() was the only allowed
2291         function for <track-size>s so far.
2292
2293         The implementation key is a new attribute in GridTrack called growthLimitCap which is
2294         precisely the single attribute of fit-content(). Some parts of the track sizing algorithm
2295         were adapted to this change like for example the sorting of tracks by growth potential (we
2296         need to consider the caps).
2297
2298         Tests: fast/css-grid-layout/fit-content-columns.html
2299         fast/css-grid-layout/fit-content-rows.html
2300
2301         * css/CSSComputedStyleDeclaration.cpp:
2302         (WebCore::specifiedValueForGridTrackSize): Added support for fit-content sizes.
2303         * css/StyleBuilderConverter.h:
2304         (WebCore::StyleBuilderConverter::createGridTrackSize): Added support for fit-content sizes.
2305         * css/parser/CSSParser.cpp:
2306         (WebCore::isGridTrackFixedSized): Added support for fit-content sizes.
2307         (WebCore::CSSParser::parseGridTrackSize): Added support for parsing fit-content() functions.
2308         * css/parser/CSSPropertyParser.cpp: Added support for parsing fit-content() functions so
2309         it'll be available once we switch to the new parser.
2310         * rendering/RenderGrid.cpp:
2311         (WebCore::GridTrack::baseSize): Just return a LayoutUnit, the return value optimization will
2312         keep it fast in any case.
2313         (WebCore::GridTrack::growthLimit): Ditto.
2314         (WebCore::GridTrack::setGrowthLimit): Added an ASSERT to check that the growth limit is
2315         never higher than the cap.
2316         (WebCore::GridTrack::infiniteGrowthPotential):
2317         (WebCore::GridTrack::plannedSize): Just return a LayoutUnit, the return value optimization will
2318         keep it fast in any case.
2319         (WebCore::GridTrack::tempSize): Just return a LayoutUnit, the return value optimization will
2320         keep it fast in any case.
2321         (WebCore::GridTrack::setTempSize): Added as we no longer return a reference in tempSize().
2322         (WebCore::GridTrack::growTempSize): New utility function which increases the tempSize.
2323         (WebCore::GridTrack::setInfinitelyGrowable):
2324         (WebCore::GridTrack::setGrowthLimitCap): Added.
2325         (WebCore::GridTrack::growthLimitCap): Ditto.
2326         (WebCore::GridTrack::growthLimitIsInfinite): Made private.
2327         (WebCore::RenderGrid::GridSizingData::freeSpace): Renamed from freeSpaceForDirection.
2328         (WebCore::RenderGrid::GridSizingData::availableSpace): We now cache the available space as
2329         it is used to compute relative (percentage) sizes.
2330         (WebCore::RenderGrid::GridSizingData::setAvailableSpace): Ditto.
2331         (WebCore::RenderGrid::GridSizingData::setFreeSpace): Renamed from setFreeSpaceForDirection.
2332         (WebCore::RenderGrid::computeTrackSizesForDirection): Receives the available space instead
2333         of the free space.
2334         (WebCore::RenderGrid::computeIntrinsicLogicalWidths): Properly initialize free and available
2335         spaces.
2336         (WebCore::RenderGrid::computeIntrinsicLogicalHeight): Ditto.
2337         (WebCore::RenderGrid::computeUsedBreadthOfGridTracks): Use available space to initialize the
2338         track sizes. Also use sizingOperation to decide whether or not sizes are indefinite. Last
2339         but not least, added support for fit-content tracks.
2340         (WebCore::RenderGrid::computeUsedBreadthOfMinLength): Pass a GridTrackSize instead of a GridLength.
2341         (WebCore::RenderGrid::computeUsedBreadthOfMaxLength): Ditto.
2342         (WebCore::RenderGrid::gridTrackSize): Added support for fit-content.
2343         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctions): Ditto.
2344         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctionsForNonSpanningItems): Ditto.
2345         (WebCore::trackSizeForTrackSizeComputationPhase):
2346         (WebCore::sortByGridTrackGrowthPotential): Reworked the function so it properly sorts tracks
2347         with growth limit caps to support fit-content().
2348         (WebCore::clampGrowthShareIfNeeded): Clamps the given growthShare passed as argument to the
2349         track growth limit cap.
2350         (WebCore::RenderGrid::distributeSpaceToTracks): Use the new setTempSize() method. Also sort
2351         the selected tracks to grow over growth limits in order to respect the track caps eventually
2352         set by fit-content (otherwise those tracks could indefinitely grow over the specified value).
2353         (WebCore::RenderGrid::tracksAreWiderThanMinTrackBreadth): Use the new defined functions.
2354         (WebCore::RenderGrid::applyStretchAlignmentToTracksIfNeeded): Use freeSpace().
2355         (WebCore::RenderGrid::populateGridPositionsForDirection): Ditto.
2356         (WebCore::GridTrack::infinitelyGrowable): Deleted.
2357         (WebCore::RenderGrid::GridSizingData::freeSpaceForDirection): Deleted.
2358         (WebCore::RenderGrid::GridSizingData::setFreeSpaceForDirection): Deleted.
2359         (WebCore::RenderGrid::trackSizeForTrackSizeComputationPhase): Deleted.
2360         * rendering/RenderGrid.h: Changed the signature of some methods. Moved
2361         TrackSizeComputationPhase out of the RenderGrid class.
2362         * rendering/style/GridTrackSize.h:
2363         (WebCore::GridTrackSize::GridTrackSize): Added some extra documentation. Added a new
2364         attribute to the constructor to support fit-content GridTrackSizes.
2365         (WebCore::GridTrackSize::fitContentTrackBreadth): New method which returns the growth limit
2366         cap set by fit-content().
2367         (WebCore::GridTrackSize::minTrackBreadth):
2368         (WebCore::GridTrackSize::isFitContent): Added.
2369         (WebCore::GridTrackSize::length): Deleted.
2370         (WebCore::GridTrackSize::isPercentage): Deleted.
2371
2372 2016-09-15  Sergio Villar Senin  <svillar@igalia.com>
2373
2374         [css-grid] Fix a dangling reference
2375         https://bugs.webkit.org/show_bug.cgi?id=161739
2376
2377         Reviewed by Alexey Proskuryakov.
2378
2379         The code was trying to get a reference to a private attribute of a temporary object returned
2380         by gridTrackSize().
2381
2382         * rendering/RenderGrid.cpp:
2383         (WebCore::RenderGrid::assumedRowsSizeForOrthogonalChild):
2384
2385 2016-09-15  Sergio Villar Senin  <svillar@igalia.com>
2386
2387         Unreviewed, rolling out r205966.
2388
2389         Triggered some assertions
2390
2391         Reverted changeset:
2392
2393         "[css-grid] Implement fit-content track size"
2394         https://bugs.webkit.org/show_bug.cgi?id=161379
2395         http://trac.webkit.org/changeset/205966
2396
2397 2016-09-15  Zalan Bujtas  <zalan@apple.com>
2398
2399         Cleanup RenderLayer::shouldBeNormalFlowOnly
2400         https://bugs.webkit.org/show_bug.cgi?id=161981
2401
2402         Reviewed by Simon Fraser.
2403
2404         This patch changes the logic of figuring about if a particular layer is normal flow only by simply checking
2405         if the layer creates a stacking context. If it does, we assume that it can't be a normal flow layer anymore.
2406         This patch slightly changes behaviour by making layers with isolation and reflection to be non normal flow layers anymore.    
2407
2408         Covered by existing testcases.
2409
2410         * rendering/RenderLayer.cpp:
2411         (WebCore::RenderLayer::calculateClipRects):
2412
2413 2016-09-07  Sergio Villar Senin  <svillar@igalia.com>
2414
2415         [css-grid] Implement fit-content track size
2416         https://bugs.webkit.org/show_bug.cgi?id=161379
2417
2418         Reviewed by Manuel Rego Casasnovas.
2419
2420         This implements the new <fit-content> track size which is defined as follows: "Represents
2421         the formula min(max-content, max(auto, argument)), which is calculated similar to auto
2422         (i.e. minmax(auto, max-content)), except that the track size is clamped at argument if it is
2423         greater than the auto minimum."
2424
2425         From the parsing POV fit-content was implemented as a new type of function which only takes
2426         one argument. That forced us to refactor some code because minmax() was the only allowed
2427         function for <track-size>s so far.
2428
2429         The implementation key is a new attribute in GridTrack called growthLimitCap which is
2430         precisely the single attribute of fit-content(). Some parts of the track sizing algorithm
2431         were adapted to this change like for example the sorting of tracks by growth potential (we
2432         need to consider the caps).
2433
2434         Tests: fast/css-grid-layout/fit-content-columns.html
2435         fast/css-grid-layout/fit-content-rows.html
2436
2437         * css/CSSComputedStyleDeclaration.cpp:
2438         (WebCore::specifiedValueForGridTrackSize): Added support for fit-content sizes.
2439         * css/StyleBuilderConverter.h:
2440         (WebCore::StyleBuilderConverter::createGridTrackSize): Added support for fit-content sizes.
2441         * css/parser/CSSParser.cpp:
2442         (WebCore::isGridTrackFixedSized): Added support for fit-content sizes.
2443         (WebCore::CSSParser::parseGridTrackSize): Added support for parsing fit-content() functions.
2444         * css/parser/CSSPropertyParser.cpp: Added support for parsing fit-content() functions so
2445         it'll be available once we switch to the new parser.
2446         * rendering/RenderGrid.cpp:
2447         (WebCore::GridTrack::baseSize): Just return a LayoutUnit, the return value optimization will
2448         keep it fast in any case.
2449         (WebCore::GridTrack::growthLimit): Ditto.
2450         (WebCore::GridTrack::setGrowthLimit): Added an ASSERT to check that the growth limit is
2451         never higher than the cap.
2452         (WebCore::GridTrack::infiniteGrowthPotential):
2453         (WebCore::GridTrack::plannedSize): Just return a LayoutUnit, the return value optimization will
2454         keep it fast in any case.
2455         (WebCore::GridTrack::tempSize): Just return a LayoutUnit, the return value optimization will
2456         keep it fast in any case.
2457         (WebCore::GridTrack::setTempSize): Added as we no longer return a reference in tempSize().
2458         (WebCore::GridTrack::growTempSize): New utility function which increases the tempSize.
2459         (WebCore::GridTrack::setInfinitelyGrowable):
2460         (WebCore::GridTrack::setGrowthLimitCap): Added.
2461         (WebCore::GridTrack::growthLimitCap): Ditto.
2462         (WebCore::GridTrack::growthLimitIsInfinite): Made private.
2463         (WebCore::RenderGrid::GridSizingData::freeSpace): Renamed from freeSpaceForDirection.
2464         (WebCore::RenderGrid::GridSizingData::availableSpace): We now cache the available space as
2465         it is used to compute relative (percentage) sizes.
2466         (WebCore::RenderGrid::GridSizingData::setAvailableSpace): Ditto.
2467         (WebCore::RenderGrid::GridSizingData::setFreeSpace): Renamed from setFreeSpaceForDirection.
2468         (WebCore::RenderGrid::computeTrackSizesForDirection): Receives the available space instead
2469         of the free space.
2470         (WebCore::RenderGrid::computeIntrinsicLogicalWidths): Properly initialize free and available
2471         spaces.
2472         (WebCore::RenderGrid::computeIntrinsicLogicalHeight): Ditto.
2473         (WebCore::RenderGrid::computeUsedBreadthOfGridTracks): Use available space to initialize the
2474         track sizes. Also use sizingOperation to decide whether or not sizes are indefinite. Last
2475         but not least, added support for fit-content tracks.
2476         (WebCore::RenderGrid::computeUsedBreadthOfMinLength): Pass a GridTrackSize instead of a GridLength.
2477         (WebCore::RenderGrid::computeUsedBreadthOfMaxLength): Ditto.
2478         (WebCore::RenderGrid::gridTrackSize): Added support for fit-content.
2479         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctions): Ditto.
2480         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctionsForNonSpanningItems): Ditto.
2481         (WebCore::trackSizeForTrackSizeComputationPhase):
2482         (WebCore::sortByGridTrackGrowthPotential): Reworked the function so it properly sorts tracks
2483         with growth limit caps to support fit-content().
2484         (WebCore::clampGrowthShareIfNeeded): Clamps the given growthShare passed as argument to the
2485         track growth limit cap.
2486         (WebCore::RenderGrid::distributeSpaceToTracks): Use the new setTempSize() method. Also sort
2487         the selected tracks to grow over growth limits in order to respect the track caps eventually
2488         set by fit-content (otherwise those tracks could indefinitely grow over the specified value).
2489         (WebCore::RenderGrid::tracksAreWiderThanMinTrackBreadth): Use the new defined functions.
2490         (WebCore::RenderGrid::applyStretchAlignmentToTracksIfNeeded): Use freeSpace().
2491         (WebCore::RenderGrid::populateGridPositionsForDirection): Ditto.
2492         (WebCore::GridTrack::infinitelyGrowable): Deleted.
2493         (WebCore::RenderGrid::GridSizingData::freeSpaceForDirection): Deleted.
2494         (WebCore::RenderGrid::GridSizingData::setFreeSpaceForDirection): Deleted.
2495         (WebCore::RenderGrid::trackSizeForTrackSizeComputationPhase): Deleted.
2496         * rendering/RenderGrid.h: Changed the signature of some methods. Moved
2497         TrackSizeComputationPhase out of the RenderGrid class.
2498         * rendering/style/GridTrackSize.h:
2499         (WebCore::GridTrackSize::GridTrackSize): Added some extra documentation. Added a new
2500         attribute to the constructor to support fit-content GridTrackSizes.
2501         (WebCore::GridTrackSize::fitContentTrackBreadth): New method which returns the growth limit
2502         cap set by fit-content().
2503         (WebCore::GridTrackSize::minTrackBreadth):
2504         (WebCore::GridTrackSize::isFitContent): Added.
2505         (WebCore::GridTrackSize::length): Deleted.
2506         (WebCore::GridTrackSize::isPercentage): Deleted.
2507
2508 2016-09-15  Alejandro G. Castro  <alex@igalia.com>
2509
2510         Fix build warnings in the mediastream code
2511         https://bugs.webkit.org/show_bug.cgi?id=161957
2512
2513         Reviewed by Philippe Normand.
2514
2515         * platform/mediastream/MediaConstraints.cpp:
2516         (WebCore::MediaConstraint::create): Added assertion and mock return.
2517         * platform/mediastream/RealtimeMediaSourceSupportedConstraints.cpp:
2518         (WebCore::RealtimeMediaSourceSupportedConstraints::nameForConstraint):
2519         Added assertion and mock return.
2520         (WebCore::RealtimeMediaSourceSupportedConstraints::supportsConstraint):
2521         Added assertion and mock return.
2522
2523 2016-09-15  Youenn Fablet  <youenn@apple.com>
2524
2525         Rebase binding tests after r205953
2526         https://bugs.webkit.org/show_bug.cgi?id=162012
2527
2528         Unreviewed.
2529
2530         * bindings/scripts/test/JS/JSTestNode.cpp:
2531         (WebCore::jsTestNodePrototypeFunctionTestWorkerPromise):
2532         (WebCore::jsTestNodePrototypeFunctionTestWorkerPromisePromise):
2533         * bindings/scripts/test/JS/JSTestObj.cpp:
2534         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunction):
2535         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionPromise):
2536         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgument):
2537         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgumentPromise):
2538         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithException):
2539         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithExceptionPromise):
2540         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgument):
2541         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgumentPromise):
2542         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1):
2543         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1Promise):
2544         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2):
2545         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2Promise):
2546         (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunction):
2547         (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionPromise):
2548         (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionWithException):
2549         (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionWithExceptionPromise):
2550
2551 2016-09-15  Alejandro G. Castro  <alex@igalia.com>
2552
2553         [WebRTC][OpenWebRTC] crash in maybeHandleChangeMutedState
2554         https://bugs.webkit.org/show_bug.cgi?id=161619
2555
2556         Added OpenWebRTC support to the RealtimeMediaSource mock class.
2557
2558         Reviewed by Eric Carlson.
2559
2560         Fixed tests.
2561
2562         * platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.h:
2563         (WebCore::RealtimeMediaSourceOwr::RealtimeMediaSourceOwr): Allowed
2564         inheritance of the class, required to use it when creating the
2565         mock class. Added a new constructor to create the class with null
2566         mediastream.
2567         * platform/mock/MockRealtimeMediaSource.cpp:
2568         (WebCore::MockRealtimeMediaSource::MockRealtimeMediaSource): Use
2569         the new BaseRealtimeMediaSourceClass in the constructor.
2570         * platform/mock/MockRealtimeMediaSource.h: Added a new
2571         BaseRealtimeMediaSourceClass defined using the
2572         RealtimeMediaSourceOwr class for OpenWebRTC platform.
2573
2574 2016-09-15  Sergio Villar Senin  <svillar@igalia.com>
2575
2576         [css-grid] Fix intrinsic size computation with flexible sized tracks
2577         https://bugs.webkit.org/show_bug.cgi?id=161903
2578
2579         Reviewed by Manuel Rego Casasnovas.
2580
2581         This is fixing a regression added in r192154. When computing the min content size of a grid
2582         container (min preferred logical width) we should not take into account the fr tracks. As
2583         stated in the early versions of the spec that size is the sum of the tracks' base sizes
2584         before running the maximize tracks step.
2585
2586         That regression was causing sizing issues in grids with fr tracks both when under
2587         min|max-content constrains and also when used as grid items (in nested grids).
2588
2589         * rendering/RenderGrid.cpp:
2590         (WebCore::RenderGrid::computeUsedBreadthOfGridTracks):
2591
2592 2016-09-13  Sergio Villar Senin  <svillar@igalia.com>
2593
2594         [css-grid] Too many gaps with trailing collapsing tracks
2595         https://bugs.webkit.org/show_bug.cgi?id=161905
2596
2597         Reviewed by Darin Adler.
2598
2599         The total number and size of gaps were incorrectly computed whenever there were trailing
2600         collapsed tracks (with collapsed gaps). The problem was that we were trying to optimize too
2601         much the amount of hash table queries required to know the gaps between two lines. We were
2602         considering that a gap always exist between 2 consecutive tracks if the first one is not
2603         empty. That's generally true (for both NOTEMPTY|NOTEMPTY and NOTEMPTY|EMPTY+|NOTEMPTY
2604         sequences) but not for all the cases (NOTEMPTY|EMPTY+).
2605
2606         * rendering/RenderGrid.cpp:
2607         (WebCore::RenderGrid::guttersSize):
2608
2609 2016-09-15  Youenn Fablet  <youenn@apple.com>
2610
2611         callPromiseFunction should be made usable for custom binding code
2612         https://bugs.webkit.org/show_bug.cgi?id=161961
2613
2614         Reviewed by Darin Adler.
2615
2616         Covered by updated test.
2617
2618         * bindings/js/JSDOMBinding.h:
2619         (WebCore::castThisValue): Utility function to cast this value to a specific type.
2620         * bindings/js/JSDOMPromise.h:
2621         (WebCore::callPromiseFunction): Updated to take real promise function as a template parameter
2622         for improved efficiency. Added workerMode template parameter.
2623         (WebCore::bindingPromiseFunctionAdapter): Function signature adaptor.
2624         * bindings/js/JSMediaDevicesCustom.cpp:
2625         (WebCore::JSMediaDevicesGetUserMediaPromiseFunction):
2626         (WebCore::JSMediaDevices::getUserMedia): Making use of callPromiseFunction to properly handle exceptions.
2627         * bindings/scripts/CodeGeneratorJS.pm:
2628         (GenerateImplementation): Updated to use template parameter.
2629         * bindings/scripts/test/JS/JSTestNode.cpp:
2630         (WebCore::jsTestNodePrototypeFunctionTestWorkerPromise):
2631         (WebCore::jsTestNodePrototypeFunctionTestWorkerPromisePromise):
2632         * bindings/scripts/test/JS/JSTestObj.cpp:
2633         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunction):
2634         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgument):
2635         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithException):
2636         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgument):
2637         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1):
2638         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2):
2639         (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunction):
2640         (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionWithException):
2641         * bindings/scripts/test/TestNode.idl: Adding Worker promise binding test.
2642
2643 2016-09-14  Jiewen Tan  <jiewen_tan@apple.com>
2644
2645         WebCrypto algorithms should be exposed via KeyAlgorithm dictionary
2646         https://bugs.webkit.org/show_bug.cgi?id=128748
2647         <rdar://problem/27359438>
2648
2649         Reviewed by Brent Fulgham and Chris Dumez.
2650
2651         Replace custom CryptoAlgorithmBuilder/buildAlgorithmDescription with KeyAlgorithm dictionary which is
2652         defined by the spec: https://www.w3.org/TR/WebCryptoAPI/#key-algorithm-dictionary. Moreover, mark
2653         CryptoKey.usages as CachedAttribute.
2654
2655         Tests: crypto/subtle/crypto-key-algorithm-gc.html
2656                crypto/subtle/crypto-key-usages-gc.html
2657
2658         * PlatformEfl.cmake:
2659         * PlatformGTK.cmake:
2660         * PlatformMac.cmake:
2661         Remove CryptoAlgorithmDescriptionBuilder.cpp.
2662         * WebCore.xcodeproj/project.pbxproj:
2663         * bindings/js/JSCryptoAlgorithmBuilder.cpp:
2664         (WebCore::JSCryptoAlgorithmBuilder::add):
2665         (WebCore::JSCryptoAlgorithmBuilder::createEmptyClone): Deleted.
2666         * bindings/js/JSCryptoAlgorithmBuilder.h:
2667         * bindings/js/JSCryptoKeyCustom.cpp:
2668         (WebCore::JSCryptoKey::algorithm):
2669         Get rid of dependency on CryptoAlgorithmDescriptionBuilder.
2670         * crypto/CryptoAlgorithmDescriptionBuilder.cpp: Removed.
2671         * crypto/CryptoAlgorithmDescriptionBuilder.h: Removed.
2672         Replace it with KeyAlgorithm.
2673         * crypto/CryptoKey.cpp:
2674         (WebCore::CryptoKey::CryptoKey):
2675         (WebCore::CryptoKey::buildAlgorithmDescription): Deleted.
2676         * crypto/CryptoKey.h:
2677         (WebCore::KeyAlgorithm::KeyAlgorithm):
2678         (WebCore::KeyAlgorithm::~KeyAlgorithm):
2679         (WebCore::CryptoKey::algorithmIdentifier):
2680         * crypto/CryptoKey.idl:
2681         Add KeyAlgorithm dictionary which is returned via CryptoKey.buildAlgorithm() method,
2682         and rename m_algorithm to m_algorithmIdentifier to distingush it with newly
2683         added KeyAlgorithm dictionary.
2684         * crypto/gnutls/CryptoKeyRSAGnuTLS.cpp:
2685         (WebCore::buildAlgorithm):
2686         (WebCore::CryptoKeyRSA::buildAlgorithmDescription): Deleted.
2687         * crypto/keys/CryptoKeyAES.cpp:
2688         (WebCore::CryptoKeyAES::buildAlgorithm):
2689         (WebCore::CryptoKeyAES::buildAlgorithmDescription): Deleted.
2690         * crypto/keys/CryptoKeyAES.h:
2691         (WebCore::AesKeyAlgorithm::AesKeyAlgorithm):
2692         (WebCore::AesKeyAlgorithm::~AesKeyAlgorithm):
2693         * crypto/keys/CryptoKeyHMAC.cpp:
2694         (WebCore::CryptoKeyHMAC::buildAlgorithm):
2695         (WebCore::CryptoKeyHMAC::buildAlgorithmDescription): Deleted.
2696         * crypto/keys/CryptoKeyHMAC.h:
2697         (WebCore::HmacKeyAlgorithm::HmacKeyAlgorithm):
2698         (WebCore::HmacKeyAlgorithm::~HmacKeyAlgorithm):
2699         * crypto/keys/CryptoKeyRSA.h:
2700         (WebCore::RsaKeyAlgorithm::RsaKeyAlgorithm):
2701         (WebCore::RsaKeyAlgorithm::~RsaKeyAlgorithm):
2702         (WebCore::RsaHashedKeyAlgorithm::RsaHashedKeyAlgorithm):
2703         (WebCore::RsaHashedKeyAlgorithm::~RsaHashedKeyAlgorithm):
2704         * crypto/mac/CryptoKeyRSAMac.cpp:
2705         (WebCore::CryptoKeyRSA::buildAlgorithm):
2706         (WebCore::CryptoKeyRSA::buildAlgorithmDescription): Deleted.
2707
2708 2016-09-14  Chris Dumez  <cdumez@apple.com>
2709
2710         REGRESSION (r205670): ASSERTION FAILED: methodTable(vm)->toThis(this, exec, NotStrictMode) == this
2711         https://bugs.webkit.org/show_bug.cgi?id=161982
2712
2713         Reviewed by Saam Barati.
2714
2715         We no longer need a custom [[SetPrototypeOf]] anymore as JSProxy::setPrototypeOf()
2716         no longer forwards the call to its target.
2717
2718         No new layout tests because the behavior only changes in the context of the JSC
2719         tests (which were updated in this patch).
2720
2721         * bindings/js/JSDOMWindowCustom.cpp:
2722         (WebCore::JSDOMWindow::setPrototype): Deleted.
2723         * page/DOMWindow.idl:
2724
2725 2016-09-14  Wenson Hsieh  <wenson_hsieh@apple.com>
2726
2727         Media controls behave strangely when changing media sources
2728         https://bugs.webkit.org/show_bug.cgi?id=161914
2729         <rdar://problem/28227805>
2730
2731         Reviewed by Tim Horton.
2732
2733         Addresses media controls flickering while changing the source of a media element. To accomplish this, we make
2734         the following changes to the media controls main content heuristic:
2735
2736         - Prevent elements that are not mostly within the mainframe rect (or elements with empty rects) from showing
2737           media controls. Many websites that rely on same document navigation will move videos offscreen when navigating
2738           to a section of their site that does not play media. Without this check, we would not know to hide a video
2739           element on certain popular websites that use this technique, since the video has been interacted with in the
2740           past.
2741
2742         - Rather than check whether a media element currently has video/audio sources, check whether it has ever had
2743           audio. Many websites will use the same media element across different videos and change only the source, and
2744           we should not prevent a media element from having media controls on grounds of having no audio or video in
2745           this case.
2746
2747         - Rather than add user gesture and playback behavior restrictions before dispatching an ended event, add only
2748           the gesture restriction immediately, and add the playback restriction after waiting for a grace period only if
2749           the user has not interacted with the video since ending, and the video is not currently playing or about to
2750           play. This gives the user a chance to interact with the controls when a video ends, but also allows the page
2751           to load or begin playing a new video with the same media element without thrashing media control state.
2752
2753         Adds 3 new API tests.
2754
2755         * html/HTMLMediaElement.cpp:
2756         (WebCore::HTMLMediaElement::HTMLMediaElement):
2757         (WebCore::HTMLMediaElement::~HTMLMediaElement):
2758         (WebCore::HTMLMediaElement::mediaPlayerActiveSourceBuffersChanged):
2759         (WebCore::HTMLMediaElement::seekWithTolerance):
2760         (WebCore::HTMLMediaElement::beginScrubbing):
2761         (WebCore::HTMLMediaElement::addBehaviorRestrictionsOnEndIfNecessary):
2762         (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged):
2763         (WebCore::HTMLMediaElement::playbackControlsManagerBehaviorRestrictionsTimerFired):
2764         * html/HTMLMediaElement.h:
2765         (WebCore::HTMLMediaElement::hasEverHadAudio):
2766         (WebCore::HTMLMediaElement::hasEverHadVideo):
2767         * html/MediaElementSession.cpp:
2768         (WebCore::MediaElementSession::canShowControlsManager):
2769         (WebCore::isElementRectMostlyInMainFrame):
2770         * platform/graphics/MediaPlayer.h:
2771         (WebCore::MediaPlayerClient::mediaPlayerActiveSourceBuffersChanged):
2772         * platform/graphics/MediaPlayerPrivate.h:
2773         (WebCore::MediaPlayerPrivateInterface::notifyActiveSourceBuffersChanged):
2774         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
2775         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2776         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::notifyActiveSourceBuffersChanged):
2777         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
2778         (WebCore::MediaSourcePrivateAVFObjC::removeSourceBuffer):
2779         (WebCore::MediaSourcePrivateAVFObjC::sourceBufferPrivateDidChangeActiveState):
2780
2781 2016-09-14  Eric Carlson  <eric.carlson@apple.com>
2782
2783         [MediaStream] Minor cleanup
2784         https://bugs.webkit.org/show_bug.cgi?id=161976
2785
2786         Reviewed by Youenn Fablet and Dean Jackson.
2787
2788         No new tests, no behavior change.
2789
2790         * CMakeLists.txt:
2791         * DerivedSources.make:
2792         * Modules/mediastream/CaptureDeviceInfo.h: Removed.
2793         * Modules/mediastream/CaptureDeviceManager.cpp: Removed.
2794         * Modules/mediastream/CaptureDeviceManager.h: Removed.
2795         * Modules/mediastream/MediaDevicesRequest.cpp:
2796         (WebCore::MediaDevicesRequest::didCompletePermissionCheck):
2797         (WebCore::MediaDevicesRequest::didCompleteTrackSourceInfoRequest): Deleted.
2798         (WebCore::MediaDevicesRequest::requestOrigin): Deleted.
2799         * Modules/mediastream/MediaDevicesRequest.h:
2800         * Modules/mediastream/MediaStreamTrackSourcesCallback.h: Removed.
2801         * Modules/mediastream/MediaStreamTrackSourcesCallback.idl: Removed.
2802         * Modules/mediastream/SourceInfo.cpp: Removed.
2803         * Modules/mediastream/SourceInfo.h: Removed.
2804         * Modules/mediastream/SourceInfo.idl: Removed.
2805         * WebCore.xcodeproj/project.pbxproj:
2806         * platform/mediastream/CaptureDevice.h: Copied from Source/WebCore/Modules/mediastream/CaptureDeviceInfo.h.
2807         (WebCore::CaptureDevice::CaptureDevice):
2808         (WebCore::CaptureDevice::persistentId):
2809         (WebCore::CaptureDevice::label):
2810         (WebCore::CaptureDevice::groupId):
2811         (WebCore::CaptureDevice::kind):
2812         (WebCore::CaptureSessionInfo::~CaptureSessionInfo): Deleted.
2813         (WebCore::CaptureSessionInfo::supportsVideoSize): Deleted.
2814         (WebCore::CaptureSessionInfo::bestSessionPresetForVideoDimensions): Deleted.
2815         * platform/mediastream/CaptureDeviceManager.cpp: Copied from Source/WebCore/Modules/mediastream/CaptureDeviceManager.cpp.
2816         (CaptureDeviceManager::getSourcesInfo):
2817         * platform/mediastream/CaptureDeviceManager.h: Copied from Source/WebCore/Modules/mediastream/CaptureDeviceManager.h.
2818         (WebCore::CaptureSessionInfo::~CaptureSessionInfo):
2819         (WebCore::CaptureSessionInfo::supportsVideoSize):
2820         (WebCore::CaptureSessionInfo::bestSessionPresetForVideoDimensions):
2821         * platform/mediastream/MediaStreamTrackSourcesRequestClient.h: Removed.
2822         * platform/mediastream/RealtimeMediaSourceCenter.h:
2823         * platform/mediastream/mac/AVCaptureDeviceManager.h:
2824         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
2825         (WebCore::AVCaptureDeviceManager::getSourcesInfo):
2826         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
2827         (WebCore::RealtimeMediaSourceCenterMac::getMediaStreamDevices):
2828         (WebCore::RealtimeMediaSourceCenterMac::getMediaStreamTrackSources): Deleted.
2829         (WebCore::RealtimeMediaSourceCenterMac::sourceWithUID): Deleted.
2830         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
2831         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
2832         (WebCore::RealtimeMediaSourceCenterOwr::getMediaStreamDevices):
2833         (WebCore::RealtimeMediaSourceCenterOwr::getMediaStreamTrackSources): Deleted.
2834         (WebCore::RealtimeMediaSourceCenterOwr::sourceWithUID): Deleted.
2835         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.h:
2836         * platform/mock/MockRealtimeMediaSource.cpp:
2837         (WebCore::MockRealtimeMediaSource::audioDeviceInfo):
2838         (WebCore::MockRealtimeMediaSource::videoDeviceInfo):
2839         (WebCore::MockRealtimeMediaSource::trackSourceWithUID): Deleted.
2840         * platform/mock/MockRealtimeMediaSource.h:
2841         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
2842         (WebCore::MockRealtimeMediaSourceCenter::getMediaStreamDevices):
2843         (WebCore::MockRealtimeMediaSourceCenter::getMediaStreamTrackSources): Deleted.
2844         (WebCore::MockRealtimeMediaSourceCenter::sourceWithUID): Deleted.
2845         * platform/mock/MockRealtimeMediaSourceCenter.h:
2846
2847 2016-09-14  Antti Koivisto  <antti@apple.com>
2848
2849         Move more code out from RenderObject
2850         https://bugs.webkit.org/show_bug.cgi?id=161980
2851
2852         Reviewed by Zalan Bujtas.
2853
2854         Move some functions that are only needed for RenderElement there.
2855         Move collapsing anonymous table rows to RenderTableRow.
2856
2857         * rendering/RenderElement.cpp:
2858         (WebCore::RenderElement::hasOutlineAnnotation):
2859         (WebCore::RenderElement::hasSelfPaintingLayer):
2860         (WebCore::RenderElement::checkForRepaintDuringLayout):
2861         * rendering/RenderElement.h:
2862         (WebCore::RenderElement::hasOutline):
2863         (WebCore::RenderElement::hasHiddenBackface): Deleted.
2864         * rendering/RenderLayerCompositor.cpp:
2865         (WebCore::RenderLayerCompositor::rootOrBodyStyleChanged):
2866         * rendering/RenderObject.cpp:
2867         (WebCore::RenderObject::pixelSnappedAbsoluteClippedOverflowRect):
2868         (WebCore::RenderObject::destroyAndCleanupAnonymousWrappers):
2869         (WebCore::RenderObject::hasSelfPaintingLayer): Deleted.
2870         (WebCore::RenderObject::checkForRepaintDuringLayout): Deleted.
2871         (WebCore::RenderObject::hasOutlineAnnotation): Deleted.
2872         (WebCore::RenderObject::hasEntirelyFixedBackground): Deleted.
2873         (WebCore::collapseAnonymousTableRowsIfNeeded): Deleted.
2874         * rendering/RenderObject.h:
2875         (WebCore::RenderObject::hasLayer):
2876         (WebCore::RenderObject::canBeSelectionLeaf):
2877         (WebCore::RenderObject::hasOutline): Deleted.
2878         (WebCore::RenderObject::hasSelectedChildren): Deleted.
2879         * rendering/RenderTableRow.cpp:
2880         (WebCore::RenderTableRow::destroyAndCollapseAnonymousSiblingRows):
2881         * rendering/RenderTableRow.h:
2882         * rendering/RenderView.cpp:
2883         (WebCore::RenderView::rootBackgroundIsEntirelyFixed):
2884
2885 2016-09-14  Daniel Bates  <dabates@apple.com>
2886
2887         Switch CSSParser to use CSSParserFastPaths::isKeywordPropertyID()
2888         https://bugs.webkit.org/show_bug.cgi?id=161983
2889
2890         Reviewed by David Hyatt.
2891
2892         Towards switching to the new CSS parser keyword properties validation logic,
2893         switch over the old CSS parser logic for determining a keyword property to
2894         use the analogous logic in the new CSS parser.
2895
2896         A side benefit of this change is that it is a step towards unifying CSS- and
2897         SVG CSS- keyword properties. The new CSS parser does not make a distinction
2898         between these kinds of properties and will allow us to have a shared code path
2899         for validating a keyword property.
2900
2901         No functionality was changed. So, no new tests.
2902
2903         * css/parser/CSSParser.cpp: Include header CSSParserFastPaths.h.
2904         (WebCore::isValidKeywordPropertyAndValue): Validate SVG CSS keyword properties. This
2905         logic was moved from CSSParser::parseSVGValue(). In subsequent patches we will switch
2906         the old CSS parser from this function to CSSParserFastPaths::isValidKeywordPropertyAndValue().
2907         (WebCore::parseKeywordValue): Modified to call CSSParserFastPaths::isKeywordPropertyID().
2908         (WebCore::CSSParser::parseValue): Ditto.
2909         (WebCore::isKeywordPropertyID): Deleted. Incorporated its functionality into
2910         CSSParserFastPaths::isKeywordPropertyID().
2911         * css/parser/CSSParserFastPaths.cpp:
2912         (WebCore::CSSParserFastPaths::isKeywordPropertyID): Incorporates the functionality
2913         of WebCore::isKeywordPropertyID().
2914         * css/parser/SVGCSSParser.cpp:
2915         (WebCore::CSSParser::parseSVGValue): Move properties that can be processed as
2916         keyword properties from here to WebCore::isValidKeywordPropertyAndValue().
2917
2918 2016-09-13  Dean Jackson  <dino@apple.com>
2919
2920         Rename parseColorParameters and clean up conditional
2921         https://bugs.webkit.org/show_bug.cgi?id=161941
2922         <rdar://problem/28292750>
2923
2924         Reviewed by Dan Bates.
2925
2926         In preparation for adding color() support, rename the existing
2927         parseColorParameters to parseRGBParameters.
2928
2929         Also clean up the logic in the parseColorFromValue function.
2930
2931         * css/parser/CSSParser.cpp:
2932         (WebCore::CSSParser::parseRGBParameters):
2933         (WebCore::CSSParser::parseColorFromValue):
2934         (WebCore::CSSParser::parseColorParameters): Deleted.
2935         * css/parser/CSSParser.h:
2936
2937 2016-09-14  Chris Dumez  <cdumez@apple.com>
2938
2939         Add support hr.color IDL attribute
2940         https://bugs.webkit.org/show_bug.cgi?id=161977
2941
2942         Reviewed by Darin Adler.
2943
2944         Add support hr.color IDL attribute as per:
2945         - https://html.spec.whatwg.org/#HTMLHRElement-partial
2946
2947         Even though this is a legacy attribute, it is still part of the HTML specification
2948         and it is still supported by Firefox and Chrome.
2949
2950         Also note that even though WebKit does not currently support the 'color' IDL
2951         attribute on <hr>, it does support the 'color' content attribute on <hr>.
2952         Therefore, we only need to reflect the 'color' content attribute.
2953
2954         No new tests, rebaselined existing test.
2955
2956         * html/HTMLHRElement.idl:
2957
2958 2016-09-14  Alex Christensen  <achristensen@webkit.org>
2959
2960         URLParser: Add fast path for hosts containing no non-ASCII or percent characters
2961         https://bugs.webkit.org/show_bug.cgi?id=161970
2962
2963         Reviewed by Daniel Bates.
2964
2965         Covered by existing tests.
2966
2967         * platform/URLParser.cpp:
2968         (WebCore::URLParser::parse):
2969         (WebCore::URLParser::parseHost):
2970         * platform/URLParser.h:
2971         When parsing the host of a URL, if it contains non-ASCII characters or percent-encoded values,
2972         we need to do additional encoding.  Many URLs, including all already-parsed URLs, do not have
2973         such characters in their host, and therefore do not need the additional encoding.  Skipping
2974         the additional encoding significantly speeds up my URL parsing benchmark.
2975
2976 2016-09-14  Zalan Bujtas  <zalan@apple.com>
2977
2978         ShowRenderTree should take position offset into account when printing inflow positioned renderers.
2979         https://bugs.webkit.org/show_bug.cgi?id=161978
2980
2981         Reviewed by Simon Fraser.
2982
2983         Adjust (x, y) with the inflow positioned renderer's offset.  
2984
2985         Not testable.
2986
2987         * rendering/RenderObject.cpp:
2988         (WebCore::RenderObject::showRenderObject):
2989
2990 2016-09-14  Alex Christensen  <achristensen@webkit.org>
2991
2992         URLParser: Add fast path for utf8 encoding queries
2993         https://bugs.webkit.org/show_bug.cgi?id=161968
2994
2995         Reviewed by Daniel Bates.
2996
2997         No change in behavior.  Covered by existing tests.
2998
2999         * platform/URLParser.cpp:
3000         (WebCore::utf8PercentEncodeQuery):
3001         (WebCore::URLParser::parse):
3002         If the text encoding is UTF-8 (which is quite common), then we can encode the query
3003         as we iterate its code points. This reduces memory allocation and significantly speeds
3004         up my URL parsing benchmark.
3005
3006 2016-09-14  Chris Dumez  <cdumez@apple.com>
3007
3008         Regression(r152725): generate-bindings.pl --write-dependencies does not work
3009         https://bugs.webkit.org/show_bug.cgi?id=161897
3010
3011         Reviewed by Darin Adler.
3012
3013         r152725 inadvertently dropped the code generating the JS*.dep files when
3014         --write-dependencies is passed to the bindings generator. As a result,
3015         our dependency tracking was broken. This patch restores the code that
3016         was dropped in r152725.
3017
3018         * bindings/scripts/CodeGeneratorJS.pm:
3019         (new):
3020         (GenerateHeader):
3021
3022 2016-09-14  Chris Dumez  <cdumez@apple.com>
3023
3024         input.type cannot be set to "file" after being set to another type
3025         https://bugs.webkit.org/show_bug.cgi?id=161943
3026
3027         Reviewed by Daniel Bates.
3028
3029         input.type cannot be set to "file" after being set to another type.
3030         This behavior does not match the HTML specification or the behavior
3031         of Firefox and Chrome. This patch drops this restriction and aligns
3032         our behavior with other browsers.
3033
3034         Test: fast/dom/HTMLInputElement/input-type-change-to-file.html
3035
3036         * html/FileInputType.cpp:
3037         (WebCore::FileInputType::canChangeFromAnotherType): Deleted.
3038         * html/FileInputType.h:
3039         * html/HTMLInputElement.cpp:
3040         (WebCore::HTMLInputElement::updateType):
3041         * html/InputType.cpp:
3042         (WebCore::InputType::canChangeFromAnotherType): Deleted.
3043         * html/InputType.h:
3044
3045 2016-09-14  Carlos Garnacho <carlosg@gnome.org>
3046
3047         [GTK][Wayland] Implement clipboard support
3048         https://bugs.webkit.org/show_bug.cgi?id=146574
3049
3050         Reviewed by Carlos Garcia Campos.
3051
3052         Implement PlatformPasteboard in the GTK+ platform, and move Pasteboard
3053         to using PasteboardStrategy so clipboard management is left to the
3054         UIProcess.
3055
3056         DataObjectGtk is still used in the Pasteboard GTK implementation, it's
3057         now just never backed by a GtkClipboard, this object is instead
3058         serialized through PasteboardStrategy, so the UIProcess side can mirror
3059         the content in a GtkClipboard-backed DataObjectGtk, which is then
3060         exposed to the windowing through PlatformPasteboard/PasteboardHelper.
3061
3062         When requesting clipboard content, it works similarly, the UIProcess
3063         side first updates its DataObjectGtk, which is then mirrored by the
3064         WebProcess through the PasteboardStrategy requests.
3065
3066         * PlatformGTK.cmake: Added PlatformPasteboardGtk.cpp
3067         * editing/gtk/EditorGtk.cpp:
3068         (WebCore::Editor::writeSelectionToPasteboard): Eliminate usage of
3069         PasteboardWebContent callback argument. This is done differently as
3070         we have to signal back the WebProcess.
3071         * platform/Pasteboard.h: Cleaned up of direct GTK+ dependency.
3072         * platform/PasteboardStrategy.h: Added plumbing towards the pasteboard
3073         proxy.
3074         * platform/PlatformPasteboard.h:
3075         * platform/gtk/DataObjectGtk.cpp:
3076         (WebCore::DataObjectGtk::clearAllExceptFilenames): Clear the "smart
3077         paste" flag if set, now that this is DataObjectGtk data.
3078         * platform/gtk/DataObjectGtk.h:
3079         (WebCore::DataObjectGtk::canSmartReplace):
3080         (WebCore::DataObjectGtk::setCanSmartReplace): Added functions, in order
3081         to flag whether a DataObjectGtk has the "smart paste" feature enabled
3082         or not.
3083         * platform/gtk/PasteboardGtk.cpp:
3084         (WebCore::Pasteboard::createForCopyAndPaste):
3085         (WebCore::Pasteboard::createForGlobalSelection):
3086         (WebCore::Pasteboard::Pasteboard):
3087         (WebCore::Pasteboard::writeToClipboard):
3088         (WebCore::Pasteboard::readFromClipboard):
3089         (WebCore::Pasteboard::writePlainText):
3090         (WebCore::Pasteboard::write):
3091         (WebCore::Pasteboard::writePasteboard):
3092         (WebCore::Pasteboard::clear):
3093         (WebCore::Pasteboard::canSmartReplace):
3094         (WebCore::Pasteboard::read):
3095         (WebCore::Pasteboard::hasData):
3096         (WebCore::Pasteboard::types):
3097         (WebCore::Pasteboard::readString):
3098         (WebCore::Pasteboard::readFilenames): Made to use the
3099         PasteboardStrategy instead of PasteboardHelper/GTK+ API.
3100         * platform/gtk/PasteboardHelper.cpp:
3101         (WebCore::PasteboardHelper::~PasteboardHelper):
3102         (WebCore::ClipboardSetData::ClipboardSetData):
3103         (WebCore::clearClipboardContentsCallback):
3104         (WebCore::PasteboardHelper::writeClipboardContents): Remove the GClosure
3105         to notify whether the global selection has been replaced. Use std:function
3106         instead. Remove SmartPasteInclusion argument, now figured out through
3107         DataObjectGtk canSmartPaste() member.
3108         * platform/gtk/PasteboardHelper.h:
3109         * platform/gtk/PlatformPasteboardGtk.cpp: Added.
3110         (WebCore::PlatformPasteboard::PlatformPasteboard):
3111         (WebCore::PlatformPasteboard::writeToClipboard):
3112         (WebCore::PlatformPasteboard::readFromClipboard): Implemented
3113         PlatformPasteboard using PasteboardHelper/GTK+ API.
3114
3115 2016-09-13  Dave Hyatt  <hyatt@apple.com>
3116
3117         [CSS Parser] Enable the new sizes parser by default
3118         https://bugs.webkit.org/show_bug.cgi?id=161931
3119
3120         Reviewed by Zalan Bujtas.
3121
3122         Added new tests in fast/dom/HTMLImageElement/sizes.
3123
3124         * CMakeLists.txt:
3125         * WebCore.xcodeproj/project.pbxproj:
3126         * css/CSSGrammar.y.in:
3127         Remove the old code that parsed source size lists.
3128
3129         * css/MediaQueryEvaluator.cpp:
3130         (WebCore::MediaQueryEvaluator::MediaQueryEvaluator):
3131         * css/MediaQueryEvaluator.h:
3132         Change to take a const Document&, since the Document is not modified.
3133
3134         * css/SourceSizeList.cpp: Removed.
3135         * css/SourceSizeList.h: Removed.
3136         * css/parser/CSSParser.cpp:
3137         (WebCore::CSSParser::parseSizesAttribute): Deleted.
3138         (WebCore::CSSParser::SourceSize::SourceSize): Deleted.
3139         (WebCore::CSSParser::sourceSize): Deleted.
3140         * css/parser/CSSParser.h:
3141         Remove the old sizes processing code.
3142
3143         * css/parser/MediaQueryParser.cpp:
3144         (WebCore::MediaQueryParser::skipUntilComma):
3145         (WebCore::MediaQueryParser::parseInternal):
3146         Fix a bug I introduced when modifying this code from Blink. The Nones should have been Nots.
3147
3148         * css/parser/SizesAttributeParser.cpp:
3149         (WebCore::SizesAttributeParser::computeLength):
3150         (WebCore::SizesAttributeParser::SizesAttributeParser):
3151         (WebCore::SizesAttributeParser::calculateLengthInPixels):
3152         (WebCore::SizesAttributeParser::mediaConditionMatches):
3153         (WebCore::SizesAttributeParser::effectiveSizeDefaultValue):
3154         * css/parser/SizesAttributeParser.h:
3155         * css/parser/SizesCalcParser.cpp:
3156         (WebCore::SizesCalcParser::SizesCalcParser):
3157         (WebCore::SizesCalcParser::appendLength):
3158         * css/parser/SizesCalcParser.h:
3159         Make the sizes parsers take a Document, since having separate style and view arguments made
3160         no sense, given that the style used is always the view's.
3161
3162         * html/HTMLImageElement.cpp:
3163         (WebCore::HTMLImageElement::bestFitSourceFromPictureElement):
3164         (WebCore::HTMLImageElement::selectImageSource):
3165         * html/parser/HTMLPreloadScanner.cpp:
3166         (WebCore::TokenPreloadScanner::StartTagScanner::processAttributes):
3167         Switch image elements and the preload scanner over to the new code.
3168
3169 2016-09-13  Chris Dumez  <cdumez@apple.com>
3170
3171         Unreviewed, rolling out r205887.
3172
3173         Broke the Windows build
3174
3175         Reverted changeset:
3176
3177         "Merge Element::ScrollToOptions and
3178         DOMWindow::ScrollToOptions"
3179         https://bugs.webkit.org/show_bug.cgi?id=161932
3180         http://trac.webkit.org/changeset/205887
3181
3182 2016-09-13  Dean Jackson  <dino@apple.com>
3183
3184         Remove a .rej file.
3185
3186         * animation/DocumentTimeline.h.rej: Removed.
3187
3188 2016-09-13  Alex Christensen  <achristensen@webkit.org>
3189
3190         Implement URLSearchParams
3191         https://bugs.webkit.org/show_bug.cgi?id=161920
3192
3193         Reviewed by Chris Dumez.
3194
3195         Covered by newly passing web platform tests.
3196
3197         * CMakeLists.txt:
3198         * DerivedSources.make:
3199         * WebCore.xcodeproj/project.pbxproj:
3200         * html/DOMURL.cpp:
3201         (WebCore::DOMURL::setQuery):
3202         (WebCore::DOMURL::searchParams):
3203         * html/DOMURL.h:
3204         * html/URLSearchParams.cpp: Added.
3205         (WebCore::URLSearchParams::URLSearchParams):
3206         (WebCore::URLSearchParams::get):
3207         (WebCore::URLSearchParams::has):
3208         (WebCore::URLSearchParams::set):
3209         (WebCore::URLSearchParams::append):
3210         (WebCore::URLSearchParams::getAll):
3211         (WebCore::URLSearchParams::remove):
3212         (WebCore::URLSearchParams::toString):
3213         (WebCore::URLSearchParams::updateURL):
3214         (WebCore::URLSearchParams::Iterator::Iterator):
3215         * html/URLSearchParams.h: Added.
3216         (WebCore::URLSearchParams::create):
3217         (WebCore::URLSearchParams::createIterator):
3218         * html/URLSearchParams.idl: Added.
3219         * html/URLUtils.idl:
3220         * platform/URLParser.cpp:
3221         (WebCore::percentDecode):
3222         (WebCore::URLParser::parseHost):
3223         (WebCore::formURLDecode):
3224         (WebCore::serializeURLEncodedForm):
3225         (WebCore::URLParser::serialize):
3226         * platform/URLParser.h:
3227
3228 2016-09-12  Dean Jackson  <dino@apple.com>
3229
3230         Replace RGBA32 with Color in member variables
3231         https://bugs.webkit.org/show_bug.cgi?id=161856
3232         <rdar://problem/28254324>
3233
3234         Reviewed by Simon Fraser.
3235
3236         In preparation for the Color class to become more than
3237         just a 4-byte RGBA value, I went through a few places
3238         that were using the RGBA32 type directly, and replaced
3239         them with Color. This will make some objects a little
3240         bigger e.g. BorderValue and its friends.
3241
3242         I mostly looked at the places that were using RGBA32 as
3243         a member variable. There is still a lot of RGBA32 use
3244         around the project, in particular the CSS parser.
3245
3246         There should be no behaviour change.
3247
3248         * html/canvas/CanvasRenderingContext2D.cpp: Shadows now use Color.
3249         (WebCore::CanvasRenderingContext2D::setShadow):
3250         (WebCore::CanvasRenderingContext2D::shouldDrawShadows):
3251         (WebCore::CanvasRenderingContext2D::didDraw):
3252         * html/canvas/CanvasRenderingContext2D.h:
3253         * html/canvas/CanvasStyle.cpp: Canvas style uses Color for fills and strokes.
3254         (WebCore::CanvasStyle::CanvasStyle):
3255         (WebCore::CanvasStyle::isEquivalentColor):
3256         (WebCore::CanvasStyle::isEquivalentRGBA):
3257         (WebCore::CanvasStyle::applyStrokeColor):
3258         (WebCore::CanvasStyle::applyFillColor):
3259         * html/canvas/CanvasStyle.h:
3260         (WebCore::CanvasStyle::CMYKAValues::CMYKAValues):
3261         (WebCore::CanvasStyle::color):
3262
3263         * html/track/TextTrackCueGeneric.h: Foreground, background and
3264         highlight colors.
3265         * platform/graphics/InbandTextTrackPrivateClient.h:
3266         (WebCore::GenericCueData::setForegroundColor):
3267         (WebCore::GenericCueData::setBackgroundColor):
3268         (WebCore::GenericCueData::setHighlightColor):
3269
3270         * page/PageOverlay.cpp: Background color.
3271         (WebCore::PageOverlay::setBackgroundColor):
3272         * page/PageOverlay.h:
3273
3274         * platform/graphics/mac/ColorMac.h: Random function that returned RGBA32.
3275         * platform/graphics/mac/ColorMac.mm:
3276         (WebCore::oldAquaFocusRingColor):
3277
3278         * rendering/RenderTableCell.cpp: Update the size of CollapsedBorderValue.
3279
3280         * rendering/RenderTheme.h: Use a NeverDestroyed Color rather than a static RGBA32.
3281
3282         * rendering/style/BorderValue.h: Use a Color.
3283         (WebCore::BorderValue::BorderValue):
3284         (WebCore::BorderValue::isTransparent):
3285         (WebCore::BorderValue::operator==):
3286         (WebCore::BorderValue::setColor):
3287         (WebCore::BorderValue::color):
3288         * rendering/style/CollapsedBorderValue.h:
3289         (WebCore::CollapsedBorderValue::CollapsedBorderValue):
3290         (WebCore::CollapsedBorderValue::color):
3291         * rendering/style/OutlineValue.h:
3292         (WebCore::OutlineValue::operator==):
3293
3294         * rendering/style/RenderStyle.cpp: Update to match new BorderValue.
3295
3296 2016-09-13  Jer Noble  <jer.noble@apple.com>
3297
3298         [media-source] MediaSource.addSourceBuffer(null) should throw an exception
3299         https://bugs.webkit.org/show_bug.cgi?id=161884
3300
3301         Reviewed by Eric Carlson.
3302
3303         Fixes test: imported/w3c/web-platform-tests/media-source/mediasource-addsourcebuffer.html
3304
3305         * Modules/mediasource/MediaSource.idl: The addSourceBuffer() parameter is not optional
3306             and not nullable.
3307
3308 2016-09-13  Daniel Bates  <dabates@apple.com>
3309
3310         Remove Chrome app-specific CSS property -webkit-app-region
3311         https://bugs.webkit.org/show_bug.cgi?id=161935
3312
3313         Reviewed by Simon Fraser.
3314
3315         * css/parser/CSSParserFastPaths.cpp:
3316
3317 2016-09-13  Daniel Bates  <dabates@apple.com>
3318
3319         Treat some CSS properties as keyword properties
3320         https://bugs.webkit.org/show_bug.cgi?id=161934
3321
3322         Reviewed by Simon Fraser.
3323
3324         Move validation of the following CSS keyword properties from CSSParser::parseValue() to
3325         WebCore::isValidKeywordPropertyAndValue():
3326
3327         CSSPropertyColumnProgression
3328         CSSPropertyFontStretch
3329         CSSPropertyTextAlign
3330         CSSPropertyUnicodeBidi
3331         CSSPropertyWebkitColumnAxis
3332         CSSPropertyWebkitCursorVisibility
3333         CSSPropertyWebkitTextDecorationStyle
3334         CSSPropertyWebkitTextOrientation
3335         CSSPropertyWebkitTextZoom
3336         CSSPropertyWebkitTouchCallout
3337
3338         Among other benefits, this will make it more straightforward to migrate from CSSParser::is{KeywordPropertyID, ValidKeywordPropertyAndValue}()
3339         to CSSParserFastPaths::is{KeywordPropertyID, ValidKeywordPropertyAndValue}(), respectively.
3340
3341         * css/parser/CSSParser.cpp:
3342         (WebCore::isValidKeywordPropertyAndValue):
3343         (WebCore::isKeywordPropertyID):
3344         (WebCore::CSSParser::parseValue):
3345
3346 2016-09-13  Chris Dumez  <cdumez@apple.com>
3347
3348         Merge Element::ScrollToOptions and DOMWindow::ScrollToOptions
3349         https://bugs.webkit.org/show_bug.cgi?id=161932
3350
3351         Reviewed by Simon Fraser.
3352
3353         Merge Element::ScrollToOptions and DOMWindow::ScrollToOptions.
3354         Ideally we would merge them on IDL side as well but this is for
3355         another patch.
3356
3357         * WebCore.xcodeproj/project.pbxproj:
3358         * bindings/scripts/CodeGeneratorJS.pm:
3359         (GenerateDictionaryImplementationContent):
3360         * bindings/scripts/test/JS/JSTestObj.cpp:
3361         (WebCore::convertDictionary<TestObj::Dictionary>):
3362         (WebCore::convertDictionary<TestObj::DictionaryThatShouldNotTolerateNull>):
3363         (WebCore::convertDictionary<TestObj::DictionaryThatShouldTolerateNull>):
3364         (WebCore::convertDictionary<AlternateDictionaryName>):
3365         * dom/Element.h:
3366         * dom/Element.idl:
3367         * dom/ScrollToOptions.h: Added.
3368         * html/HTMLBodyElement.cpp:
3369         (WebCore::HTMLBodyElement::scrollTo):
3370         * page/DOMWindow.h:
3371         * page/DOMWindow.idl:
3372
3373 2016-09-13  Myles C. Maxfield  <mmaxfield@apple.com>
3374
3375         [Cocoa] Unify font's ascent, descent, and x-height between macOS and iOS
3376         https://bugs.webkit.org/show_bug.cgi?id=161877
3377
3378         Reviewed by Simon Fraser.
3379
3380         macOS and iOS have slightly different handling of ascent, descent, and x-height.
3381         This patch migrates them to have the same handling of them.
3382
3383         There are slight behavior changes here because our previous code converted between
3384         floats and doubles in unnecessary places, and does not handle rounding in
3385         consistent ways. The differences are all miniscule, but nevertheless lead to test
3386         results needing to be updated.
3387
3388         Coincidentally, by performing this unification, there are no longer any places
3389         on macOS Sierra which are using the CGFontRef member of PlatformFontData. This
3390         patch removes the member on that operating system for memory savings as well as
3391         clarity.
3392
3393         Covered by existing tests.
3394