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