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