[GTK] Crash of WebProcess on the last WebView disconnect
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2016-09-07  Carlos Garcia Campos  <cgarcia@igalia.com>
2
3         [GTK] Crash of WebProcess on the last WebView disconnect
4         https://bugs.webkit.org/show_bug.cgi?id=161605
5
6         Reviewed by Michael Catanzaro.
7
8         Stop tracking X11 GL contexts to be cleanered on an exit handler. This was added to work around bugs on drivers,
9         and it's assuming that all GLContext not deleted when the exit handler is called are leaked, which is no longer
10         true, because PlatformDisplay now owns a GLContext and is deleted after exit handlers.
11
12         * platform/graphics/GLContext.cpp:
13         (WebCore::GLContext::GLContext):
14         (WebCore::GLContext::~GLContext):
15         (WebCore::activeContextList): Deleted.
16         (WebCore::GLContext::addActiveContext): Deleted.
17         (WebCore::GLContext::removeActiveContext): Deleted.
18         (WebCore::GLContext::cleanupActiveContextsAtExit): Deleted.
19
20 2016-09-07  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
21
22         Templatize JS bindings code generator of functions with variadic parameters
23         https://bugs.webkit.org/show_bug.cgi?id=158835
24
25         Reviewed by Darin Adler.
26
27         Add template functions to handle function with variadic parameter for DOM objects.
28
29         * Modules/mediastream/RTCPeerConnection.cpp:
30         (WebCore::RTCPeerConnection::addTrack):
31         * Modules/mediastream/RTCPeerConnection.h:
32         * bindings/js/JSDOMBinding.h:
33         (WebCore::VariadicHelperBase::convert):
34         (WebCore::toArguments):
35         (WebCore::jsFrozenArray):
36         (WebCore::toRefPtrNativeArray):
37         (WebCore::toNativeArray):
38         * bindings/scripts/CodeGeneratorJS.pm:
39         (GenerateParametersCheck):
40         (GetVariadicType):
41         * bindings/scripts/test/JS/JSTestObj.cpp:
42         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod12):
43         (WebCore::jsTestObjPrototypeFunctionVariadicStringMethod):
44         (WebCore::jsTestObjPrototypeFunctionVariadicDoubleMethod):
45         (WebCore::jsTestObjPrototypeFunctionVariadicNodeMethod):
46         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod):
47         (WebCore::jsTestObjPrototypeFunctionAny):
48         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
49         (WebCore::constructJSTestOverloadedConstructors5):
50
51 2016-09-06  Commit Queue  <commit-queue@webkit.org>
52
53         Unreviewed, rolling out r205521, r205526, and r205532.
54         https://bugs.webkit.org/show_bug.cgi?id=161668
55
56         broke API tests (Requested by alexchristensen on #webkit).
57
58         Reverted changesets:
59
60         "Punycode encode non-ascii hosts in URLParser"
61         https://bugs.webkit.org/show_bug.cgi?id=161655
62         http://trac.webkit.org/changeset/205521
63
64         "Fix query-only and fragment-only relative URLs when using
65         URLParser"
66         https://bugs.webkit.org/show_bug.cgi?id=161657
67         http://trac.webkit.org/changeset/205526
68
69         "URLParser should parse / as a relative URL"
70         https://bugs.webkit.org/show_bug.cgi?id=161667
71         http://trac.webkit.org/changeset/205532
72
73 2016-09-06  Alex Christensen  <achristensen@webkit.org>
74
75         URLParser should parse / as a relative URL
76         https://bugs.webkit.org/show_bug.cgi?id=161667
77
78         Reviewed by Tim Horton.
79
80         Covered by a new API test.
81
82         * platform/URLParser.cpp:
83         (WebCore::URLParser::parse):
84
85 2016-09-06  Joseph Pecoraro  <pecoraro@apple.com>
86
87         Web Inspector: Avoid linkifying some schemes in console logs
88         https://bugs.webkit.org/show_bug.cgi?id=161648
89         <rdar://problem/16413270>
90
91         Reviewed by Brian Burg.
92
93         * inspector/InspectorFrontendHost.cpp:
94         (WebCore::InspectorFrontendHost::openInNewTab):
95         If a javascript: link is passed just ignore it.
96
97 2016-09-06  Alex Christensen  <achristensen@webkit.org>
98
99         Fix query-only and fragment-only relative URLs when using URLParser
100         https://bugs.webkit.org/show_bug.cgi?id=161657
101
102         Reviewed by Tim Horton.
103
104         Covered by new API tests and progress towards passing the web platform tests when using URLParser.
105
106         * platform/URLParser.cpp:
107         (WebCore::URLParser::parse):
108
109 2016-09-06  Chris Dumez  <cdumez@apple.com>
110
111         Add support for input.minLength / textArea.minLength
112         https://bugs.webkit.org/show_bug.cgi?id=161644
113
114         Reviewed by Darin Adler.
115
116         Add support for input.minLength / textArea.minLength:
117         - https://html.spec.whatwg.org/#dom-input-minlength
118         - https://html.spec.whatwg.org/#dom-textarea-minlength
119
120         Chrome implements this, Firefox does not yet.
121
122         No new tests, rebaselined existing tests.
123
124         * html/FormAssociatedElement.cpp:
125         (WebCore::FormAssociatedElement::tooShort):
126         (WebCore::FormAssociatedElement::valid):
127         (WebCore::FormAssociatedElement::typeMismatch): Deleted.
128         * html/FormAssociatedElement.h:
129         * html/HTMLAttributeNames.in:
130         * html/HTMLInputElement.cpp:
131         (WebCore::HTMLInputElement::HTMLInputElement):
132         (WebCore::HTMLInputElement::isValidValue):
133         (WebCore::HTMLInputElement::tooShort):
134         (WebCore::HTMLInputElement::tooLong):
135         (WebCore::HTMLInputElement::parseAttribute):
136         (WebCore::HTMLInputElement::effectiveMaxLength):
137         (WebCore::HTMLInputElement::maxLengthAttributeChanged):
138         (WebCore::HTMLInputElement::minLengthAttributeChanged):
139         (WebCore::HTMLInputElement::patternMismatch): Deleted.
140         (WebCore::parseAcceptAttribute): Deleted.
141         (WebCore::HTMLInputElement::isEnumeratable): Deleted.
142         (WebCore::HTMLInputElement::supportLabels): Deleted.
143         * html/HTMLInputElement.h:
144         (WebCore::HTMLInputElement::supportsMinLength):
145         (WebCore::HTMLInputElement::supportsMaxLength): Deleted.
146         * html/HTMLInputElement.idl:
147         * html/HTMLTextAreaElement.cpp:
148         (WebCore::HTMLTextAreaElement::parseAttribute):
149         (WebCore::HTMLTextAreaElement::maxLengthAttributeChanged):
150         (WebCore::HTMLTextAreaElement::minLengthAttributeChanged):
151         (WebCore::HTMLTextAreaElement::validationMessage):
152         (WebCore::HTMLTextAreaElement::tooShort):
153         (WebCore::HTMLTextAreaElement::tooLong):
154         (WebCore::HTMLTextAreaElement::isValidValue):
155         * html/HTMLTextAreaElement.h:
156         * html/HTMLTextAreaElement.idl:
157         * html/HTMLTextFormControlElement.cpp:
158         (WebCore::HTMLTextFormControlElement::setMaxLength):
159         (WebCore::HTMLTextFormControlElement::setMinLength):
160         * html/HTMLTextFormControlElement.h:
161         (WebCore::HTMLTextFormControlElement::maxLength):
162         (WebCore::HTMLTextFormControlElement::setMaxLength):
163         (WebCore::HTMLTextFormControlElement::minLength):
164         (WebCore::HTMLTextFormControlElement::setMinLength):
165         * html/InputType.cpp:
166         (WebCore::InputType::validationMessage):
167         * html/ValidityState.idl:
168         * platform/LocalizedStrings.cpp:
169         (WebCore::validationMessageTooShortText):
170         * platform/LocalizedStrings.h:
171
172 2016-09-06  Alex Christensen  <achristensen@webkit.org>
173
174         Punycode encode non-ascii hosts in URLParser
175         https://bugs.webkit.org/show_bug.cgi?id=161655
176
177         Reviewed by Tim Horton.
178
179         Covered by new API tests based on the web platform tests.
180
181         * platform/URLParser.cpp:
182         (WebCore::URLParser::parse):
183         (WebCore::containsOnlyASCII):
184         (WebCore::domainToASCII):
185
186 2016-09-06  Saam Barati  <sbarati@apple.com>
187
188         Make JSMap and JSSet faster
189         https://bugs.webkit.org/show_bug.cgi?id=160989
190
191         Reviewed by Filip Pizlo.
192
193         * ForwardingHeaders/runtime/HashMapImpl.h: Added.
194         * ForwardingHeaders/runtime/MapBase.h: Added.
195         * bindings/js/SerializedScriptValue.cpp:
196         (WebCore::CloneSerializer::serialize):
197         (WebCore::CloneDeserializer::deserialize):
198
199 2016-09-06  Myles C. Maxfield  <mmaxfield@apple.com>
200
201         Strikethrough positions are erroneously snapped twice
202         https://bugs.webkit.org/show_bug.cgi?id=161647
203         <rdar://problem/11542470>
204
205         Reviewed by Zalan Bujtas.
206
207         Because we're using an int for the position of the baseline, the math to calculate the
208         strikethrough position is snapped. Then, we snap it again inside GraphicsContext.
209
210         Test: fast/text/strikethrough-int.html
211
212         * rendering/InlineTextBox.cpp:
213         (WebCore::InlineTextBox::paintDecoration):
214         * rendering/TextDecorationPainter.h:
215         (WebCore::TextDecorationPainter::setBaseline):
216
217 2016-09-06  David Kilzer  <ddkilzer@apple.com>
218
219         [iOS] Remove soft linking of MobileCoreServices.framework
220         <https://webkit.org/b/161641>
221         <rdar://problem/10420118>
222
223         Reviewed by Darin Adler.
224
225         * Configurations/WebCore.xcconfig: Add hard link to
226         MobileCoreServices.framework.
227
228         * editing/ios/EditorIOS.mm: Change #include to #import.
229         * platform/graphics/cg/ImageSourceCGMac.mm:
230         * platform/graphics/mac/ImageMac.mm:
231         * platform/ios/PasteboardIOS.mm:
232         * platform/ios/PlatformPasteboardIOS.mm:
233         * platform/network/ios/WebCoreURLResponseIOS.mm:
234         * platform/network/mac/UTIUtilities.mm:
235         - Rearrange import statements as needed.
236         - Remove soft link to MobileCoreServices.framework.
237         - Add import of <MobileCoreServices/MobileCoreServices.h> as
238           needed.
239
240         * rendering/RenderThemeIOS.mm: Remove unused soft link to
241         MobileCoreServices.framework.
242
243 2016-09-06  Chris Dumez  <cdumez@apple.com>
244
245         Align srcset attribute parsing with the HTML specification
246         https://bugs.webkit.org/show_bug.cgi?id=161636
247
248         Reviewed by Darin Adler.
249
250         Align srcset attribute parsing with the HTML specification:
251         - https://html.spec.whatwg.org/#parse-a-srcset-attribute
252
253         The new behavior is also consistent with Firefox and Chrome
254         as all 3 browsers now pass 100% of the checks at:
255         - http://w3c-test.org/html/semantics/embedded-content/the-img-element/srcset/parse-a-srcset-attribute.html
256
257         No new tests, rebaselined existing tests.
258
259         * html/parser/HTMLParserIdioms.cpp:
260         (WebCore::parseValidHTMLNonNegativeIntegerInternal):
261         (WebCore::parseValidHTMLNonNegativeInteger):
262         (WebCore::parseValidHTMLFloatingPointNumberInternal):
263         (WebCore::parseValidHTMLFloatingPointNumber):
264         * html/parser/HTMLParserIdioms.h:
265         Add convenience for parsing *valid* HTML non-negative integers and
266         *valid* floating point number values.
267
268         * html/parser/HTMLSrcsetParser.cpp:
269         (WebCore::parseDescriptors):
270         - Use parseValidHTMLFloatingPointNumber() to parse density so that the value
271           is parsed as a valid HTML floating point number value, as per the spec.
272         - Use parseValidHTMLNonNegativeInteger() to parse width and height so that
273           the value is parsed as a valid HTML non-negative integer value, as per the
274           spec.
275         - Return false if descriptor does not have a h, w and x at the end as per:
276           https://html.spec.whatwg.org/#parse-a-srcset-attribute (step 13: Anything else)
277         - Return false if height is set but not width, as per:
278           https://html.spec.whatwg.org/#parse-a-srcset-attribute (step 14)
279
280         (WebCore::parseImageCandidatesFromSrcsetAttribute):
281         - Skip whitespace if URL does not end with a comma instead of assuming there is
282           a single space character, as per:
283           https://html.spec.whatwg.org/#parse-a-srcset-attribute (step 8. Otherwise 1.)
284
285 2016-09-06  Fujii Hironori  <Hironori.Fujii@sony.com>
286
287         [CMake] Decouple generating bindings of WebCore and WebCoreTestSupport
288         https://bugs.webkit.org/show_bug.cgi?id=161474
289
290         Generating bindings of WebCore and WebCoreTestSupport shares a
291         single supplementalDependencyFile.  But, nothing supplements any
292         IDL of WebCoreTestSupport.  This introduces unnecessary
293         dependencies.
294
295         Reviewed by Alex Christensen.
296
297         * CMakeLists.txt: Do not input any IDL of WebCoreTestSupport to
298         preprocess-idls.pl.  Do not use supplementalDependencyFile to
299         generate bindings of WebCoreTestSupport.  Add SettingsMacros.h as
300         a source file of WebCoreDerivedSources to ensure make_settings.pl
301         is finished before compiling WebCoreDerivedSources.
302
303 2016-09-06  Zalan Bujtas  <zalan@apple.com>
304
305         ASSERTION FAILED: !paintInfo.overlapTestRequests->contains(this) in WebCore::RenderWidget::paintContents
306         https://bugs.webkit.org/show_bug.cgi?id=135602
307         <rdar://problem/27701733>
308
309         Reviewed by Simon Fraser.
310
311         ASSERT is updated to support multiple fragments painting. We just have to ensure that the FrameView's rect
312         has not changed between the 2 paintContents calls.  
313
314         Test: fast/layers/assert-on-overlap-testing-with-frames-inside-columns.html
315
316         * rendering/RenderWidget.cpp:
317         (WebCore::RenderWidget::paintContents):
318
319 2016-09-06  Commit Queue  <commit-queue@webkit.org>
320
321         Unreviewed, rolling out r205504.
322         https://bugs.webkit.org/show_bug.cgi?id=161645
323
324         Broke the iOS device build (Requested by ryanhaddad on
325         #webkit).
326
327         Reverted changeset:
328
329         "Make JSMap and JSSet faster"
330         https://bugs.webkit.org/show_bug.cgi?id=160989
331         http://trac.webkit.org/changeset/205504
332
333 2016-09-06  Zalan Bujtas  <zalan@apple.com>
334
335         Remove unused overlap checking functions from FrameView.
336         https://bugs.webkit.org/show_bug.cgi?id=161635
337
338         Reviewed by Simon Fraser.
339
340         No change in functionality.
341
342         * page/FrameView.cpp:
343         (WebCore::FrameView::isOverlappedIncludingAncestors): Deleted.
344         * page/FrameView.h:
345
346 2016-09-06  Simon Fraser  <simon.fraser@apple.com>
347
348         Align element.scroll() / scrollTo() / scrollBy() with the CSSOM specification
349         https://bugs.webkit.org/show_bug.cgi?id=161610
350
351         Reviewed by Darin Adler, Chris Dumez.
352
353         Implement Element.scroll(), scrollBy() and scrollTo() with x,y and ScrollToOptions
354         on Element, according to <https://drafts.csswg.org/cssom-view/#element-scrolling-members>
355
356         WebKit's behavior of treating scrolls on the body element in both quirks and strict mode
357         is preserved.
358
359         Tests: fast/dom/Element/scrolling-funtions-on-body-quirks.html
360                fast/dom/Element/scrolling-funtions-on-body.html
361                fast/dom/Element/scrolling-funtions-on-element.html
362
363         * dom/Element.cpp:
364         (WebCore::Element::scrollBy):
365         (WebCore::normalizeNonFiniteValue):
366         (WebCore::Element::scrollTo):
367         * dom/Element.h:
368         * dom/Element.idl:
369         * html/HTMLBodyElement.cpp:
370         (WebCore::HTMLBodyElement::scrollTo):
371         * html/HTMLBodyElement.h:
372
373 2016-09-06  Saam Barati  <sbarati@apple.com>
374
375         Make JSMap and JSSet faster
376         https://bugs.webkit.org/show_bug.cgi?id=160989
377
378         Reviewed by Filip Pizlo.
379
380         * ForwardingHeaders/runtime/HashMapImpl.h: Added.
381         * ForwardingHeaders/runtime/MapBase.h: Added.
382         * bindings/js/SerializedScriptValue.cpp:
383         (WebCore::CloneSerializer::serialize):
384         (WebCore::CloneDeserializer::deserialize):
385
386 2016-09-05  Alex Christensen  <achristensen@webkit.org>
387
388         Implement relative file urls and begin implementing character encoding in URLParser
389         https://bugs.webkit.org/show_bug.cgi?id=161618
390
391         Reviewed by Tim Horton.
392
393         Covered by new API tests.
394         Also, this is a significant step towards passing the URL web platform tests when using the URLParser,
395         which is still off by default.
396
397         * platform/URLParser.cpp:
398         (WebCore::isInSimpleEncodeSet):
399         (WebCore::isInDefaultEncodeSet):
400         (WebCore::isInUserInfoEncodeSet):
401         (WebCore::isInvalidDomainCharacter):
402         (WebCore::shouldCopyFileURL):
403         (WebCore::percentEncode):
404         (WebCore::utf8PercentEncode):
405         (WebCore::encodeQuery):
406         (WebCore::isDefaultPort):
407         (WebCore::isPercentEncodedDot):
408         (WebCore::URLParser::parse):
409         (WebCore::percentDecode):
410         (WebCore::domainToASCII):
411         (WebCore::hasInvalidDomainCharacter):
412         (WebCore::URLParser::parsePort):
413         (WebCore::URLParser::parseHost):
414         (WebCore::isTabOrNewline): Deleted.
415         * platform/URLParser.h:
416
417 2016-09-06  Daniel Bates  <dabates@apple.com>
418
419         Fix the Apple-internal build following <https://trac.webkit.org/changeset/205488>
420         (https://bugs.webkit.org/show_bug.cgi?id=161090)
421
422         Use the default linkage for QuartzCore constants to match the linkage used for such constants
423         in the Apple-internal SDK.
424
425         * platform/spi/cocoa/QuartzCoreSPI.h:
426
427 2016-09-06  Daniel Bates  <dabates@apple.com>
428
429         <table> inside <div align="right"> with large content inside = no scrollbar
430         https://bugs.webkit.org/show_bug.cgi?id=3352
431
432         Reviewed by Brent Fulgham.
433
434         Respect "right" text-alignment only if the width of the child does not overflow the
435         width of its containing block. This makes our margin computation more closely conform
436         to section "Block-level, non-replaced elements in normal flow" of the CSS 2.1
437         spec., <http://www.w3.org/TR/CSS21/>, and to the behavior observed in Firefox, Chrome,
438         IE version 9 or later and Microsoft Edge.
439
440         Test: fast/block/align-overflow-child.html
441
442         * rendering/RenderBox.cpp:
443         (WebCore::RenderBox::computeInlineDirectionMargins):
444
445 2016-09-06  Daniel Bates  <dabates@apple.com>
446
447         Remove EXTERN_C from WTF
448         https://bugs.webkit.org/show_bug.cgi?id=161090
449
450         Reviewed by Brent Fulgham.
451
452         Guard external C declarations in WTF_EXTERN_C_BEGIN, WTF_EXTERN_C_END.
453
454         * platform/spi/cf/CFLocaleSPI.h:
455         * platform/spi/cf/CFNetworkConnectionCacheSPI.h:
456         * platform/spi/cf/CFNetworkSPI.h: Additionally, remove the workaround for <rdar://problem/18337182>
457         as this bug was fixed in El Capitan.
458         * platform/spi/cf/CFUtilitiesSPI.h:
459         * platform/spi/cocoa/CoreTextSPI.h:
460         * platform/spi/cocoa/DataDetectorsCoreSPI.h:
461         * platform/spi/cocoa/IOPMLibSPI.h:
462         * platform/spi/cocoa/MachVMSPI.h:
463         * platform/spi/cocoa/QuartzCoreSPI.h:
464         * platform/spi/ios/MobileGestaltSPI.h:
465         * platform/spi/ios/QuickLookSPI.h:
466         * platform/spi/win/CoreTextSPIWin.cpp:
467         * platform/spi/win/CoreTextSPIWin.h:
468
469 2016-09-06  Ryan Haddad  <ryanhaddad@apple.com>
470
471         Unreviewed, rolling out r205407.
472
473         Not the correct way to implement this functionality
474
475         Reverted changeset:
476
477         "Consult with the FrameLoaderClient about whether or not
478         content extensions should be enabled when loading this URL."
479         https://bugs.webkit.org/show_bug.cgi?id=161441
480         http://trac.webkit.org/changeset/205407
481
482 2016-09-06  Youenn Fablet  <youenn@apple.com>
483
484         http/tests/security/contentSecurityPolicy/worker-csp-blocks-xhr-redirect-cross-origin.html is flaky
485         https://bugs.webkit.org/show_bug.cgi?id=161627
486
487         Reviewed by Darin Adler.
488
489         Covered by changed expectation.
490
491         * loader/DocumentThreadableLoader.cpp:
492         (WebCore::DocumentThreadableLoader::redirectReceived): Clearing the resource in lieu of clearing the request. This will stop the resource load.
493         * loader/SubresourceLoader.cpp:
494         (WebCore::SubresourceLoader::didReceiveResponse): Adding an ASSERT to ensure that no valid redirect responses is mistakenly processed here.
495
496 2016-09-06  Zalan Bujtas  <zalan@apple.com>
497
498         ASSERTION FAILED: !currBox->needsLayout() in WebCore::RenderBlock::checkPositionedObjectsNeedLayout
499         https://bugs.webkit.org/show_bug.cgi?id=120291
500         <rdar://problem/27683456>
501
502         Reviewed by David Hyatt.
503
504         This patch ensures that we always set the 'positioned child needs layout' bit on the containing block
505         when a new positioned descendant gets inserted. It fixes cases for simplified layout when
506         we ended up not laying out the descendant element. 
507
508         Test: fast/block/positioning/assert-when-positioned-descendant-is-not-getting-laid-out.html
509
510         * rendering/RenderBlock.cpp:
511         (WebCore::RenderBlock::insertPositionedObject):
512
513 2016-09-06  Youenn Fablet  <youenn@apple.com>
514
515         CachedResourceLoader is not taking into account fetch options to use or not cached resources
516         https://bugs.webkit.org/show_bug.cgi?id=161389
517
518         Reviewed by Darin Adler.
519
520         Tests: http/tests/fetch/fetching-same-resource-with-diffferent-options.html
521                http/tests/security/cross-origin-cached-resource-parallel.html
522                http/tests/security/cross-origin-cached-resource.html
523                http/tests/security/load-image-after-redirection-2.html
524                http/tests/security/shape-outside-and-cached-resources.html
525
526         Adding CORS checks for the response in case of CORS fetch mode, in SubresourceLoader.
527         Removing the CORS checks in Image and DocumentThreadableLoader.
528
529         The direction of this patch is to make CachedResource origin-specific/fetch mode specific.
530
531         This will remove the need for CachedResource clients to do CORS checks when receiving the notifyFinished call.
532         This will also make the computation of whether a resource is clean or not much easier since the CachedResource knowd its origin and its response tainting.
533
534         Removing the CORS checks at ImageLoader creates the risk of using some cached resources loaded from previously no-cors mode without doing the actual CORS check.
535         Note that the risk was already there in case of a resource loaded through redirections.
536         Reusing a cached resource for a load with different options also leads to bad computation of the resource tainting.
537
538         As a first step, improvements are done but only for CachedImage resources.
539
540         This patch limits the direct reuse of cached resources as follow:
541         - If the request and existing resources have different origins.
542         - If the fetch mode is different between request and existing resource.
543
544         In those cases, a new CachedResource is created with the correct options and origin.
545         The data and response of the CachedResource found in the cache are copied efficiently in the new CachedResource, if the matching CachedResource finished loading (CachedImage specific).
546
547         If the matching CachedResource is still loading, we trigger a reload (with caching=false to not disturb the being loaded resource).
548         This should be made more efficient at some point, especially if the matching CachedResource already has its response set.
549
550         This triggers a change of behavior: previously, the CORS checks were done by the ImageLoader when the resource was finished loading.
551         The CORS checks were controlled by the crossOrigin attribute, which may be set or unset between the load start and the load end.
552
553         Now the crossOrigin attribute is checked at load start. If it is set, the CORS checks will happen even if the attribute is unset before the end of the load.
554         This is more consistent as the actual request was built with CORS enabled.
555
556         * loader/CrossOriginPreflightChecker.cpp:
557         (WebCore::CrossOriginPreflightChecker::startPreflight): Setting correctly the preflight options as per fetch spec.
558         * loader/DocumentThreadableLoader.cpp:
559         (WebCore::DocumentThreadableLoader::didReceiveResponse): Removing CORS check.
560         (WebCore::DocumentThreadableLoader::loadRequest): Adding CORS check in sync mode.
561         * loader/ImageLoader.cpp:
562         (WebCore::ImageLoader::updateFromElement):
563         (WebCore::ImageLoader::notifyFinished):
564         * loader/SubresourceLoader.cpp:
565         (WebCore::SubresourceLoader::didReceiveResponse): Adding CORS checks to the response
566         (WebCore::SubresourceLoader::checkResponseCrossOriginAccessControl): Helper routine to do CORS checks
567         * loader/SubresourceLoader.h:
568         * loader/cache/CachedImage.cpp:
569         (WebCore::CachedImage::cloneData): Responsible to set image content from another CachedImage.
570         * loader/cache/CachedImage.h:
571         * loader/cache/CachedResource.cpp:
572         (WebCore::CachedResource::computeOrigin): Helper routine to set the origin and whether the resource is cross-origin or not.
573         (WebCore::CachedResource::load): Using computeOrigin.
574         (WebCore::CachedResource::loadFrom): Loading from a CachedResource from the same type and which finished loading.
575         * loader/cache/CachedResource.h:
576         (WebCore::CachedResource::cloneData):
577         * loader/cache/CachedResourceLoader.cpp:
578         (WebCore::CachedResourceLoader::updateCachedResourceWithCurrentRequest): Helper routine responsible to adapt the CachedResource
579         that can be reused to the origin and options of a new request.
580         (WebCore::CachedResourceLoader::requestResource): Calling updateCachedResourceWithCurrentRequest before actually returning the resource.
581         (WebCore::CachedResourceLoader::determineRevalidationPolicy): Space clean-up.
582         * loader/cache/CachedResourceLoader.h:
583         * loader/cache/CachedResourceRequest.h:
584         (WebCore::CachedResourceRequest::setCachingPolicy):
585         * style/StylePendingResources.cpp:
586         (WebCore::Style::loadPendingImage): Allowing data URLs for ShapeOutside data.
587
588 2016-09-05  Darin Adler  <darin@apple.com>
589
590         More bindings improvements, particularly things not needed for JavaScript bindings
591         https://bugs.webkit.org/show_bug.cgi?id=161572
592
593         Reviewed by Sam Weinig.
594
595         * WebCore.xcodeproj/project.pbxproj: Export a couple of files needed for legacy bindings.
596
597         * bindings/js/JSDOMWindowCustom.cpp:
598         (WebCore::addCrossOriginWindowPropertyNames): Mark array const.
599         * bindings/js/JSLocationCustom.cpp:
600         (WebCore::addCrossOriginLocationPropertyNames): Ditto.
601
602         * dom/DOMImplementation.cpp:
603         (WebCore::addString): Deleted.
604         (WebCore::isSupportedSVG10Feature): Deleted.
605         (WebCore::isSupportedSVG11Feature): Deleted.
606         (WebCore::DOMImplementation::hasFeature): Deleted.
607
608         * dom/DOMImplementation.h: Changed hasFeature to take no arguments and to always
609         return true, as specified in the DOM spec.
610
611         * dom/DOMImplementation.idl: Removed the arguments to hasFeature.
612
613         * dom/Document.cpp:
614         (WebCore::Document::defaultCharsetForLegacyBindings): Renamed from
615         defaultCharsetForBindings, because this function is used only by the
616         non-JavaScript bindings.
617         * dom/Document.h: Updated for the above.
618
619         * dom/DocumentType.h: Removed entitiesForBindings,
620         notationsForBindings, and internalSubsetForBindings, all of which were
621         empty functions. The empty implementations are now in the legacy bindings.
622
623         * dom/Element.cpp:
624         (WebCore::Element::dispatchSimulatedClickForBindings): Deleted.
625         This code is now at the single call site, in HTMLElement.
626         * dom/Element.h: Updated for the above change.
627
628         * dom/Node.cpp:
629         (WebCore::Node::isSupportedForBindings): Deleted. This is only used in the
630         legacy bindings, and since it only returns a value other than "true" for
631         SVG features, it is now in the SVGTests class.
632         * dom/Node.h: Updated for the above change.
633
634         * html/HTMLElement.cpp:
635         (WebCore::HTMLElement::click): Call simulateClick with the appropriate
636         arguments rather than calling dispatchSimulatedClickForBindings.
637
638         * svg/SVGTests.cpp:
639         (WebCore::supportedSVGFeatures): Added. Moved here from DOMImplementation,
640         but also refactored.
641         (WebCore::SVGTests::isValid): Changed to use the function above, rather than
642         calling DOMImplementation::hasFeature. This change fixes a bug where feature names
643         that do not look like valid SVG feature names, names such as "xxx", were returning
644         true claiming that the feature was supported. This behavior was helpful in the
645         general DOMImplementation function, but harmful here. This bug was causing test
646         failures in some of our SVG tests.
647         (WebCore::SVGTests::hasFeatureForLegacyBindings): Added. Uses the set above to
648         implement the legacy behavior of hasFeature. It's better to have this in parallel
649         with the SVGTests::isValid function rather than having either depend on the other.
650
651         * svg/SVGTests.h: Added exported SVGTests::isValid function.
652
653 2016-09-05  Commit Queue  <commit-queue@webkit.org>
654
655         Unreviewed, rolling out r205450.
656         https://bugs.webkit.org/show_bug.cgi?id=161614
657
658         Made tests flaky, causing false positives on EWS (Requested by
659         ap on #webkit).
660
661         Reverted changeset:
662
663         "CachedResourceLoader is not taking into account fetch options
664         to use or not cached resources"
665         https://bugs.webkit.org/show_bug.cgi?id=161389
666         http://trac.webkit.org/changeset/205450
667
668 2016-08-31  Filip Pizlo  <fpizlo@apple.com>
669
670         Butterflies should be allocated in Auxiliary MarkedSpace instead of CopiedSpace and we should rewrite as much of the GC as needed to make this not a regression
671         https://bugs.webkit.org/show_bug.cgi?id=160125
672
673         Reviewed by Geoffrey Garen and Keith Miller.
674
675         No new tests because no new WebCore behavior.
676         
677         Just rewiring #includes.
678
679         * ForwardingHeaders/heap/HeapInlines.h: Added.
680         * ForwardingHeaders/interpreter/Interpreter.h: Removed.
681         * ForwardingHeaders/runtime/AuxiliaryBarrierInlines.h: Added.
682         * Modules/indexeddb/IDBCursorWithValue.cpp:
683         * Modules/indexeddb/client/TransactionOperation.cpp:
684         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
685         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
686         * bindings/js/JSApplePayPaymentAuthorizedEventCustom.cpp:
687         * bindings/js/JSApplePayPaymentMethodSelectedEventCustom.cpp:
688         * bindings/js/JSApplePayShippingContactSelectedEventCustom.cpp:
689         * bindings/js/JSApplePayShippingMethodSelectedEventCustom.cpp:
690         * bindings/js/JSClientRectCustom.cpp:
691         * bindings/js/JSDOMBinding.cpp:
692         * bindings/js/JSDOMBinding.h:
693         * bindings/js/JSDeviceMotionEventCustom.cpp:
694         * bindings/js/JSDeviceOrientationEventCustom.cpp:
695         * bindings/js/JSErrorEventCustom.cpp:
696         * bindings/js/JSIDBCursorWithValueCustom.cpp:
697         * bindings/js/JSIDBIndexCustom.cpp:
698         * bindings/js/JSPopStateEventCustom.cpp:
699         * bindings/js/JSWebGL2RenderingContextCustom.cpp:
700         * bindings/js/JSWorkerGlobalScopeCustom.cpp:
701         * bindings/js/WorkerScriptController.cpp:
702         * contentextensions/ContentExtensionParser.cpp:
703         * dom/ErrorEvent.cpp:
704         * html/HTMLCanvasElement.cpp:
705         * html/MediaDocument.cpp:
706         * inspector/CommandLineAPIModule.cpp:
707         * loader/EmptyClients.cpp:
708         * page/CaptionUserPreferences.cpp:
709         * page/Frame.cpp:
710         * page/PageGroup.cpp:
711         * page/UserContentController.cpp:
712         * platform/mock/mediasource/MockBox.cpp:
713         * testing/GCObservation.cpp:
714
715 2016-09-05  Fujii Hironori  <Hironori.Fujii@sony.com>
716
717         run-bindings-tests fails since r205422
718         https://bugs.webkit.org/show_bug.cgi?id=161595
719
720         Reviewed by Darin Adler.
721
722         Rebaseline binding tests after r205422.
723
724         * bindings/scripts/test/JS/JSInterfaceName.cpp:
725         * bindings/scripts/test/JS/JSInterfaceName.h:
726         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
727         * bindings/scripts/test/JS/JSTestActiveDOMObject.h:
728         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
729         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.h:
730         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
731         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.h:
732         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
733         * bindings/scripts/test/JS/JSTestCustomNamedGetter.h:
734         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
735         * bindings/scripts/test/JS/JSTestEventConstructor.h:
736         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
737         * bindings/scripts/test/JS/JSTestEventTarget.h:
738         * bindings/scripts/test/JS/JSTestException.cpp:
739         * bindings/scripts/test/JS/JSTestException.h:
740         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
741         * bindings/scripts/test/JS/JSTestGenerateIsReachable.h:
742         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
743         * bindings/scripts/test/JS/JSTestGlobalObject.h:
744         * bindings/scripts/test/JS/JSTestInterface.cpp:
745         * bindings/scripts/test/JS/JSTestInterface.h:
746         * bindings/scripts/test/JS/JSTestIterable.cpp:
747         * bindings/scripts/test/JS/JSTestIterable.h:
748         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
749         * bindings/scripts/test/JS/JSTestMediaQueryListListener.h:
750         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
751         * bindings/scripts/test/JS/JSTestNamedConstructor.h:
752         * bindings/scripts/test/JS/JSTestNode.cpp:
753         * bindings/scripts/test/JS/JSTestNode.h:
754         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
755         * bindings/scripts/test/JS/JSTestNondeterministic.h:
756         * bindings/scripts/test/JS/JSTestObj.cpp:
757         * bindings/scripts/test/JS/JSTestObj.h:
758         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
759         * bindings/scripts/test/JS/JSTestOverloadedConstructors.h:
760         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
761         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.h:
762         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
763         * bindings/scripts/test/JS/JSTestOverrideBuiltins.h:
764         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
765         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h:
766         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
767         * bindings/scripts/test/JS/JSTestTypedefs.h:
768         * bindings/scripts/test/JS/JSattribute.cpp:
769         * bindings/scripts/test/JS/JSattribute.h:
770         * bindings/scripts/test/JS/JSreadonly.cpp:
771         * bindings/scripts/test/JS/JSreadonly.h:
772
773 2016-09-05  Fujii Hironori  <Hironori.Fujii@sony.com>
774
775         [CMake] Duplicated IDL files in WebCore_IDL_FILES
776         https://bugs.webkit.org/show_bug.cgi?id=161592
777
778         Reviewed by Darin Adler.
779
780         * CMakeLists.txt: Removed duplicated IDL files.
781         * DerivedSources.cpp: Added #if ENABLE(USER_MESSAGE_HANDLERS)
782
783 2016-09-05  Joseph Pecoraro  <pecoraro@apple.com>
784
785         [Mac] Static Analyzer warnings about unused values in CDMSessionAVStreamSession.mm
786         https://bugs.webkit.org/show_bug.cgi?id=161598
787
788         Reviewed by Darin Adler.
789
790         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.h:
791         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
792         (WebCore::CDMSessionAVStreamSession::generateKeyReleaseMessage):
793         Make this parameter a reference again, accidentally lost in r195410.
794         Now assignments to the parameter make sense.
795
796 2016-09-05  Youenn Fablet  <youenn@apple.com>
797
798         Clean CSS stylesheets should be accessible from JavaScript
799         https://bugs.webkit.org/show_bug.cgi?id=158728
800
801         Reviewed by Darin Adler.
802
803         Covered by updated tests.
804
805         Making use of the resource response type to evaluate whether to make the CSS stylesheets visible
806         for stylesheet link elements and for stylesheet processing instructions.
807         Ideally, the origin flag should be a boolean.
808
809         To keep behavior consistent in cors-check-unaware cases, the flag might remain unset.
810         In that case, the behavior remains the same (checking of the stylesheet URL).
811         The origin flag is set to true or false only in case of fetch mode being set to cors using the crossorigin attribute.
812
813         Updated CSSStyleSheet::create to take a Node reference. Updated callers accordingly.
814
815         * contentextensions/ContentExtensionStyleSheet.cpp:
816         (WebCore::ContentExtensions::ContentExtensionStyleSheet::ContentExtensionStyleSheet): Updated to pass a Node reference and not pointer.
817         * css/CSSStyleSheet.cpp:
818         (WebCore::CSSStyleSheet::create): Makes origin flag undefined if boolean parameter is not passed.
819         Otherwise origin flag is set according given boolean value.
820         (WebCore::CSSStyleSheet::createInline): Makes origin flag set to true.
821         (WebCore::CSSStyleSheet::CSSStyleSheet): Adding origin flag initialization.
822         (WebCore::CSSStyleSheet::canAccessRules): Returning according the origin flag if set.
823         Returning as before in case the flag is not set.
824         * css/CSSStyleSheet.h: Adding origin clean flag.
825         * dom/ExtensionStyleSheets.cpp:
826         (WebCore::ExtensionStyleSheets::addUserStyleSheet):
827         (WebCore::ExtensionStyleSheets::addAuthorStyleSheetForTesting):
828         (WebCore::ExtensionStyleSheets::maybeAddContentExtensionSheet):
829         * html/HTMLLinkElement.cpp:
830         (WebCore::HTMLLinkElement::initializeStyleSheet): Helper routine used in setCSSStyleSheet.
831         Sets origin clean flag if the resource is clean.
832         (WebCore::HTMLLinkElement::setCSSStyleSheet): Making use of initializeStyleSheet.
833         * html/HTMLLinkElement.h:
834
835 2016-09-05  Youenn Fablet  <youenn@apple.com>
836
837         CachedResourceLoader is not taking into account fetch options to use or not cached resources
838         https://bugs.webkit.org/show_bug.cgi?id=161389
839
840         Reviewed by Darin Adler.
841
842         Tests: http/tests/fetch/fetching-same-resource-with-diffferent-options.html
843                http/tests/security/cross-origin-cached-resource-parallel.html
844                http/tests/security/cross-origin-cached-resource.html
845                http/tests/security/load-image-after-redirection-2.html
846                http/tests/security/shape-outside-and-cached-resources.html
847
848         Adding CORS checks for the response in case of CORS fetch mode, in SubresourceLoader.
849         Removing the CORS checks in Image and DocumentThreadableLoader.
850
851         The direction of this patch is to make CachedResource origin-specific/fetch mode specific.
852
853         This will remove the need for CachedResource clients to do CORS checks when receiving the notifyFinished call.
854         This will also make the computation of whether a resource is clean or not much easier since the CachedResource knowd its origin and its response tainting.
855
856         Removing the CORS checks at ImageLoader creates the risk of using some cached resources loaded from previously no-cors mode without doing the actual CORS check.
857         Note that the risk was already there in case of a resource loaded through redirections.
858         Reusing a cached resource for a load with different options also leads to bad computation of the resource tainting.
859
860         As a first step, improvements are done but only for CachedImage resources.
861
862         This patch limits the direct reuse of cached resources as follow:
863         - If the request and existing resources have different origins.
864         - If the fetch mode is different between request and existing resource.
865
866         In those cases, a new CachedResource is created with the correct options and origin.
867         The data and response of the CachedResource found in the cache are copied efficiently in the new CachedResource, if the matching CachedResource finished loading (CachedImage specific).
868
869         If the matching CachedResource is still loading, we trigger a reload (with caching=false to not disturb the being loaded resource).
870         This should be made more efficient at some point, especially if the matching CachedResource already has its response set.
871
872         This triggers a change of behavior: previously, the CORS checks were done by the ImageLoader when the resource was finished loading.
873         The CORS checks were controlled by the crossOrigin attribute, which may be set or unset between the load start and the load end.
874
875         Now the crossOrigin attribute is checked at load start. If it is set, the CORS checks will happen even if the attribute is unset before the end of the load.
876         This is more consistent as the actual request was built with CORS enabled.
877
878         * loader/CrossOriginPreflightChecker.cpp:
879         (WebCore::CrossOriginPreflightChecker::startPreflight): Setting correctly the preflight options as per fetch spec.
880         * loader/DocumentThreadableLoader.cpp:
881         (WebCore::DocumentThreadableLoader::didReceiveResponse): Removing CORS check.
882         (WebCore::DocumentThreadableLoader::loadRequest): Adding CORS check in sync mode.
883         * loader/ImageLoader.cpp:
884         (WebCore::ImageLoader::updateFromElement):
885         (WebCore::ImageLoader::notifyFinished):
886         * loader/SubresourceLoader.cpp:
887         (WebCore::SubresourceLoader::didReceiveResponse): Adding CORS checks to the response
888         (WebCore::SubresourceLoader::checkResponseCrossOriginAccessControl): Helper routine to do CORS checks
889         * loader/SubresourceLoader.h:
890         * loader/cache/CachedImage.cpp:
891         (WebCore::CachedImage::cloneData): Responsible to set image content from another CachedImage.
892         * loader/cache/CachedImage.h:
893         * loader/cache/CachedResource.cpp:
894         (WebCore::CachedResource::computeOrigin): Helper routine to set the origin and whether the resource is cross-origin or not.
895         (WebCore::CachedResource::load): Using computeOrigin.
896         (WebCore::CachedResource::loadFrom): Loading from a CachedResource from the same type and which finished loading.
897         * loader/cache/CachedResource.h:
898         (WebCore::CachedResource::cloneData):
899         * loader/cache/CachedResourceLoader.cpp:
900         (WebCore::CachedResourceLoader::updateCachedResourceWithCurrentRequest): Helper routine responsible to adapt the CachedResource
901         that can be reused to the origin and options of a new request.
902         (WebCore::CachedResourceLoader::requestResource): Calling updateCachedResourceWithCurrentRequest before actually returning the resource.
903         (WebCore::CachedResourceLoader::determineRevalidationPolicy): Space clean-up.
904         * loader/cache/CachedResourceLoader.h:
905         * loader/cache/CachedResourceRequest.h:
906         (WebCore::CachedResourceRequest::setCachingPolicy):
907         * style/StylePendingResources.cpp:
908         (WebCore::Style::loadPendingImage): Allowing data URLs for ShapeOutside data.
909
910 2016-09-05  Frederic Wang  <fwang@igalia.com>
911
912         More refactoring of RenderMathMLScripts
913         https://bugs.webkit.org/show_bug.cgi?id=161371
914
915         Reviewed by Darin Adler.
916
917         This is a follow-up of bug 161084. The function getScriptMetricsAndLayoutIfNeeded was quite
918         complicated and it was not obvious that we have to call it twice with the same reference
919         to a struture holding vertical metrics. We extract the part retrieving layout parameters
920         into verticalParameters and move its layoutIfNeeded calls into layoutBlock. Then it can
921         be reduced to a simple function that retrieve the vertical metrics in one call.
922         We also improve getBaseAndScripts to make clear that it is performing validation. It returns
923         a ReferenceChildren structure encapsulating pointers to important children so that we no
924         longer pass these pointers as function parameters. We continue to need them to browse the
925         list of prescripts & postscripts but we refactor a bit the loop to avoid explicit mention
926         of RenderBox*.
927
928         No new tests, already covered by existing tests.
929
930         * rendering/mathml/RenderMathMLScripts.cpp:
931         (WebCore::RenderMathMLScripts::validateAndGetReferenceChildren): We now store the pointers to
932         the base, firstPostScript and firstPreScript children in the ReferenceChildren structure. We
933         also add a pointer to the prescriptDelimiter for convenience.
934         (WebCore::RenderMathMLScripts::italicCorrection): Use the ReferenceChildren structure so that
935         we are sure the base has been validated before calling this function.
936         (WebCore::RenderMathMLScripts::computePreferredLogicalWidths): Retrieve the reference
937         children with validateAndGetReferenceChildren instead of calling getBaseAndScripts and use
938         ReferenceChildren to handle these children and to call italicCorrection. The loops for
939         SubSup, UnderOver, Multiscripts are also rewritten a bit to avoid declaring a null RenderBox*
940         outside of them and hence allow to use auto.
941         (WebCore::RenderMathMLScripts::verticalParameters): This part to extract the layout
942         parameters is extracted from getScriptMetricsAndLayoutIfNeeded. The parameters are returned
943         as a VerticalParameters struct.
944         (WebCore::RenderMathMLScripts::verticalMetrics): This is the remaining part of
945         getScriptMetricsAndLayoutIfNeeded It used to call layoutIfNeeded on children and to
946         calculate maximum vertical metrics. For Multiscripts it was called twice: We did a first
947         call to handle the prescripts and then pass the result again in the second call to handle
948         the postscripts. We modify a bit the loop so that all the scripts are handled in one call and
949         hence we can directly return a VerticalMetrics. Again, the reference children are now handled
950         using the ReferenceChildren structure passed as a parameter.
951         (WebCore::RenderMathMLScripts::layoutBlock): We retrieve the reference children with
952         validateAndGetReferenceChildren instead of calling getBaseAndScripts and use
953         ReferenceChildren to handle these children and to call italicCorrection. We layout all the
954         children if needed in one loop at the beginning instead of doing that when their vertical
955         metrics are needed. We can now also retrieve vertical metrics with a single call.
956         (WebCore::RenderMathMLScripts::getBaseAndScripts): Renamed validateAndGetReferenceChildren.
957         (WebCore::RenderMathMLScripts::getScriptMetricsAndLayoutIfNeeded): Deleted. Split into
958         verticalParameters and verticalMetrics.
959         * rendering/mathml/RenderMathMLScripts.h: New structure to handle the pointers to reference
960         children. Update the signature of getBaseAndScripts to use this struture and give a clearer
961         name. Update the signature of italicCorrection to use this structure too. Add a new structure
962         VerticalParameters and declare the helper function to retrieve them. Rename ScriptMetrics
963         to VerticalMetrics and update the signature of the function needed to retrieve it.
964
965 2016-09-05  Zan Dobersek  <zdobersek@igalia.com>
966
967         MediaPlayerPrivateGStreamerBase: improve build guards in nativeImageForCurrentTime()
968         https://bugs.webkit.org/show_bug.cgi?id=161594
969
970         Reviewed by Philippe Normand.
971
972         Guard the uses of cairo-gl API in nativeImageForCurrentTime() with the
973         USE(CAIRO) && ENABLE(ACCELERATED_2D_CANVAS) pair of build guards. This
974         API is only made available when the ACCELERATED_2D_CANVAS option is
975         enabled. Placing the guards this way thus avoids compilation errors
976         when compiling USE_GSTREAMER_GL code without the accelerated 2D canvas
977         support enabled.
978
979         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
980         (WebCore::MediaPlayerPrivateGStreamerBase::nativeImageForCurrentTime):
981
982 2016-09-04  Sam Weinig  <sam@webkit.org>
983
984         Remove the CREATE_DOM_WRAPPER macro
985         https://bugs.webkit.org/show_bug.cgi?id=161580
986
987         Reviewed by Dan Bernstein.
988
989         The CREATE_DOM_WRAPPER has irritated me for too long! Replace it
990         with direct calls to createWrapper<ImplementationType>, which has
991         been upgraded to not require specifying both the implementation type
992         and the wrapper type by way of the new JSDOMWrapperConverterTraits
993         struct which provides mapping from ImplementationType -> JSWrapper.
994         createWrapper<ImplementationType> has also been upgraded to have a
995         specialization for when the object being passed in needs to be casted.
996
997         * bindings/js/JSAnimationTimelineCustom.cpp:
998         (WebCore::toJSNewlyCreated):
999         * bindings/js/JSBlobCustom.cpp:
1000         (WebCore::toJSNewlyCreated):
1001         (WebCore::constructJSBlob):
1002         * bindings/js/JSCSSRuleCustom.cpp:
1003         (WebCore::toJSNewlyCreated):
1004         * bindings/js/JSCSSValueCustom.cpp:
1005         (WebCore::toJSNewlyCreated):
1006         * bindings/js/JSDataCueCustom.cpp:
1007         (WebCore::constructJSDataCue):
1008         * bindings/js/JSDocumentCustom.cpp:
1009         (WebCore::createNewDocumentWrapper):
1010         * bindings/js/JSDocumentFragmentCustom.cpp:
1011         (WebCore::toJSNewlyCreated):
1012         * bindings/js/JSElementCustom.cpp:
1013         (WebCore::createNewElementWrapper):
1014         * bindings/js/JSEventCustom.cpp:
1015         (WebCore::toJSNewlyCreated):
1016         * bindings/js/JSFileCustom.cpp:
1017         (WebCore::constructJSFile):
1018         * bindings/js/JSHTMLCollectionCustom.cpp:
1019         (WebCore::toJSNewlyCreated):
1020         * bindings/js/JSHTMLDocumentCustom.cpp:
1021         (WebCore::toJSNewlyCreated):
1022         * bindings/js/JSIDBCursorCustom.cpp:
1023         (WebCore::toJSNewlyCreated):
1024         * bindings/js/JSImageDataCustom.cpp:
1025         (WebCore::toJSNewlyCreated):
1026         * bindings/js/JSNodeCustom.cpp:
1027         (WebCore::createWrapperInline):
1028         * bindings/js/JSNodeListCustom.cpp:
1029         (WebCore::createWrapper):
1030         * bindings/js/JSPerformanceEntryCustom.cpp:
1031         (WebCore::toJSNewlyCreated):
1032         * bindings/js/JSSVGPathSegCustom.cpp:
1033         (WebCore::toJSNewlyCreated):
1034         * bindings/js/JSStyleSheetCustom.cpp:
1035         (WebCore::toJSNewlyCreated):
1036         * bindings/js/JSTextCustom.cpp:
1037         (WebCore::toJSNewlyCreated):
1038         * bindings/js/JSTextTrackCueCustom.cpp:
1039         (WebCore::toJSNewlyCreated):
1040         * bindings/js/JSWebGLRenderingContextBaseCustom.cpp:
1041         (WebCore::toJSNewlyCreated):
1042         * bindings/js/JSXMLDocumentCustom.cpp:
1043         (WebCore::toJSNewlyCreated):
1044         * dom/make_names.pl:
1045         (printWrapperFunctions):
1046         (printWrapperFactoryCppFile):
1047         Replace CREATE_DOM_WRAPPER with direct calls to createWrapper.
1048
1049         * bindings/js/JSWorkerGlobalScopeBase.h:
1050         Add #include of JSDOMWrapper.h to allow generated subclasses to use 
1051         JSDOMWrapperConverterTraits.
1052
1053         * bindings/js/JSDOMBinding.h:
1054         (WebCore::castDOMObjectForWrapperCreation): Deleted.
1055         Remove CREATE_DOM_WRAPPER and castDOMObjectForWrapperCreation and 
1056         specialize createWrapper.
1057
1058         * bindings/js/JSDOMWrapper.h:
1059         Forward declare JSDOMWrapperConverterTraits.
1060
1061         * bindings/scripts/CodeGeneratorJS.pm:
1062         (GenerateHeader):
1063         Add specialization of JSDOMWrapperConverterTraits for each header.
1064
1065         (GenerateImplementation):
1066         (GenerateConstructorDefinition):
1067         Replace CREATE_DOM_WRAPPER with direct calls to createWrapper.
1068
1069 2016-09-04  Antti Koivisto  <antti@apple.com>
1070
1071         Remove Style::PendingResources
1072         https://bugs.webkit.org/show_bug.cgi?id=161574
1073
1074         Reviewed by Andreas Kling.
1075
1076         RenderStyle contains all the information needed to initialize resource loads. There is no need for this side structure.
1077
1078         * css/CSSFilterImageValue.cpp:
1079         (WebCore::CSSFilterImageValue::loadSubimages):
1080
1081             Load external SVG resources along with any image resources.
1082
1083         * css/CSSToStyleMap.cpp:
1084         (WebCore::CSSToStyleMap::styleImage):
1085         (WebCore::CSSToStyleMap::mapFillImage):
1086         (WebCore::CSSToStyleMap::mapNinePieceImage):
1087         * css/CSSToStyleMap.h:
1088         * css/StyleBuilderConverter.h:
1089         (WebCore::StyleBuilderConverter::convertStyleImage):
1090         (WebCore::StyleBuilderConverter::convertShapeValue):
1091         * css/StyleBuilderCustom.h:
1092         (WebCore::StyleBuilderCustom::applyValueCursor):
1093         (WebCore::StyleBuilderCustom::applyValueContent):
1094         * css/StyleResolver.cpp:
1095         (WebCore::StyleResolver::State::clear):
1096         (WebCore::StyleResolver::styleImage):
1097         (WebCore::StyleResolver::createFilterOperations):
1098         (WebCore::StyleResolver::loadPendingResources):
1099         (WebCore::StyleResolver::State::ensurePendingResources): Deleted.
1100         (WebCore::StyleResolver::styleCachedImageFromValue): Deleted.
1101         (WebCore::StyleResolver::styleGeneratedImageFromValue): Deleted.
1102         * css/StyleResolver.h:
1103         (WebCore::StyleResolver::State::takePendingResources): Deleted.
1104         * platform/graphics/filters/FilterOperation.cpp:
1105         (WebCore::ReferenceFilterOperation::loadExternalDocumentIfNeeded):
1106         (WebCore::ReferenceFilterOperation::getOrCreateCachedSVGDocumentReference): Deleted.
1107         * platform/graphics/filters/FilterOperation.h:
1108         (WebCore::ReferenceFilterOperation::cachedSVGDocumentReference):
1109         * rendering/style/StyleCachedImage.cpp:
1110         (WebCore::StyleCachedImage::StyleCachedImage):
1111         * style/StylePendingResources.cpp:
1112         (WebCore::Style::loadPendingResources):
1113
1114             Trigger resource loads by checking pending resources in RenderStyle unconditionally. Keeping track of them
1115             separately wasn't necessary or a meaningful optimization.
1116
1117         (WebCore::Style::loadPendingImages): Deleted.
1118         (WebCore::Style::loadPendingSVGFilters): Deleted.
1119         * style/StylePendingResources.h:
1120
1121 2016-09-04  Antti Koivisto  <antti@apple.com>
1122
1123         Reverse ownership relation of StyleCachedImage and CSSImageValue
1124         https://bugs.webkit.org/show_bug.cgi?id=161447
1125
1126         Reviewed by Andreas Kling.
1127
1128         Currently StyleCachedImage (which represents an image in RenderStyle) has a weak ref to the
1129         underlying CSSImageValue/CSSImageSetValue which actually owns it. This is awkwards especially since
1130         StyleGeneratedImage, the other StyleImage subclass has reversed relationship where it refs
1131         the underlying CSSImageGeneratorValue.
1132
1133         This patch makes StyleCachedImage similar to StyleGeneratedImage. StyleCachedImage now refs the
1134         underlying CSSImageValue/CSSImageSetValue. CSSImageValues no longer need to know about StyleCachedImage.
1135         Instead they reference CachedImages (memory cache objects) directly. StyleCachedImage instances are now
1136         conceptually unique to RenderStyle instances. Actual resources are shared as before by sharing CachedImages.
1137
1138         * css/CSSCursorImageValue.cpp:
1139         (WebCore::CSSCursorImageValue::loadImage):
1140         (WebCore::CSSCursorImageValue::cachedImage):
1141         (WebCore::CSSCursorImageValue::styleImage): Deleted.
1142         * css/CSSCursorImageValue.h:
1143         * css/CSSImageGeneratorValue.cpp:
1144         (WebCore::CSSImageGeneratorValue::cachedImageForCSSValue):
1145         * css/CSSImageSetValue.cpp:
1146         (WebCore::CSSImageSetValue::~CSSImageSetValue):
1147         (WebCore::CSSImageSetValue::loadBestFitImage):
1148         (WebCore::CSSImageSetValue::traverseSubresources):
1149         (WebCore::CSSImageSetValue::styleImage): Deleted.
1150         * css/CSSImageSetValue.h:
1151         * css/CSSImageValue.cpp:
1152         (WebCore::CSSImageValue::CSSImageValue):
1153         (WebCore::CSSImageValue::~CSSImageValue):
1154         (WebCore::CSSImageValue::isPending):
1155         (WebCore::CSSImageValue::loadImage):
1156         (WebCore::CSSImageValue::traverseSubresources):
1157         (WebCore::CSSImageValue::knownToBeOpaque):
1158         (WebCore::CSSImageValue::styleImage): Deleted.
1159         * css/CSSImageValue.h:
1160         * css/StyleBuilderCustom.h:
1161         (WebCore::StyleBuilderCustom::applyValueContent):
1162         * css/StyleResolver.cpp:
1163         (WebCore::StyleResolver::styleImage):
1164         (WebCore::StyleResolver::styleCachedImageFromValue):
1165         (WebCore::StyleResolver::styleGeneratedImageFromValue):
1166         (WebCore::StyleResolver::cachedOrPendingFromValue): Deleted.
1167         (WebCore::StyleResolver::generatedOrPendingFromValue): Deleted.
1168         (WebCore::StyleResolver::setOrPendingFromValue): Deleted.
1169         (WebCore::StyleResolver::cursorOrPendingFromValue): Deleted.
1170         * css/StyleResolver.h:
1171         * editing/TextIterator.cpp:
1172         (WebCore::fullyClipsContents):
1173         * page/PageSerializer.cpp:
1174         (WebCore::PageSerializer::retrieveResourcesForProperties):
1175         * rendering/style/FillLayer.cpp:
1176         (WebCore::FillLayer::imagesIdentical):
1177
1178             Compare data equality instead of pointer equality for StyleImages (since StyleImages are no longer shared).
1179
1180         (WebCore::layerImagesIdentical): Deleted.
1181         * rendering/style/StyleCachedImage.cpp:
1182         (WebCore::StyleCachedImage::StyleCachedImage):
1183         (WebCore::StyleCachedImage::~StyleCachedImage):
1184         (WebCore::StyleCachedImage::cachedImage):
1185         (WebCore::StyleCachedImage::cssValue):
1186         (WebCore::StyleCachedImage::canRender):
1187         (WebCore::StyleCachedImage::isPending):
1188         (WebCore::StyleCachedImage::isLoaded):
1189         (WebCore::StyleCachedImage::errorOccurred):
1190         (WebCore::StyleCachedImage::imageSize):
1191         (WebCore::StyleCachedImage::imageHasRelativeWidth):
1192         (WebCore::StyleCachedImage::imageHasRelativeHeight):
1193         (WebCore::StyleCachedImage::computeIntrinsicDimensions):
1194         (WebCore::StyleCachedImage::usesImageContainerSize):
1195         (WebCore::StyleCachedImage::setContainerSizeForRenderer):
1196         (WebCore::StyleCachedImage::addClient):
1197         (WebCore::StyleCachedImage::removeClient):
1198         (WebCore::StyleCachedImage::image):
1199         (WebCore::StyleCachedImage::knownToBeOpaque):
1200         (WebCore::StyleCachedImage::setCachedImage): Deleted.
1201         * rendering/style/StyleCachedImage.h:
1202
1203 2016-09-03  Wenson Hsieh  <wenson_hsieh@apple.com>
1204
1205         Media controls behave strangely when videos mute from within a playing handler
1206         https://bugs.webkit.org/show_bug.cgi?id=161559
1207         <rdar://problem/28018438>
1208
1209         Reviewed by Darin Adler.
1210
1211         Defer showing media controls until after the media element has fired its onplaying handler. This handles cases
1212         where videos that autoplay may initially meet the criteria for main content, but once the video begins to play,
1213         the page may change the media in some way (e.g. muting) that makes the video no longer main content. This causes
1214         media controls to flicker in and out.
1215
1216         These changes are covered by existing unit tests, which have been refactored to check media controller state
1217         after all autoplaying videos have begun playing. Also adds an additional unit test.
1218
1219         * html/HTMLMediaElement.cpp:
1220         (WebCore::HTMLMediaElement::notifyAboutPlaying):
1221         (WebCore::HTMLMediaElement::hasEverNotifiedAboutPlaying):
1222         * html/HTMLMediaElement.h:
1223         * html/MediaElementSession.cpp:
1224         (WebCore::MediaElementSession::canShowControlsManager):
1225
1226 2016-09-03  Ryosuke Niwa  <rniwa@webkit.org>
1227
1228         Update the semantics of defined-ness of custom elements per spec changes
1229         https://bugs.webkit.org/show_bug.cgi?id=161570
1230
1231         Reviewed by Darin Adler.
1232
1233         This patch adds the notion of a custom element that failed to construct or upgrade so that :defined
1234         doesn't apply to such an element. We also set the defined flag inside the HTMLElement constructor in
1235         the case of synchronous construction instead of waiting for the custom element constructor to finish.
1236         https://dom.spec.whatwg.org/#concept-create-element
1237
1238         Conceptually, there are four distinct states for an element:
1239         1. The element is a built-in element
1240         2. The element is a custom element yet to be defined (an upgrade candidate).
1241         3. The element is a well-defined custom element (constructed or upgraded).
1242         4. The element has failed to construct or upgrade as a custom element (because the custom element
1243         constructor threw an exception or returned an unexpected object).
1244
1245         In the latest DOM/HTML specifications, these states are called as 1. "uncustomized", 2. "undefined",
1246         3. "custom", and 4. "failed": https://dom.spec.whatwg.org/#concept-element-defined
1247
1248         This patch refactors Node flags to introduce these distinct states as the following:
1249         1. Neither IsCustomElement nor IsEditingTextOrUnresolvedCustomElementFlag is set.
1250         2. IsCustomElement and IsEditingTextOrUnresolvedCustomElementFlag are set.
1251         isCustomElementUpgradeCandidate() and isUndefinedCustomElement() return true.
1252         3. IsCustomElement is set and IsEditingTextOrUnresolvedCustomElementFlag is unset.
1253         isDefinedCustomElement() returns true.
1254         4. IsCustomElement is unset and IsEditingTextOrUnresolvedCustomElementFlag is set.
1255         isFailedCustomElement() and isUndefinedCustomElement() return true.
1256
1257         Per a spec change, this patch also makes :defined applied to a synchronously constructed custom element
1258         immediately after super() call in the constructor. When the constructor throws an exception or fails to
1259         return the right element, the HTML parser marks the fallback element with setIsUndefinedCustomElement.
1260
1261         Tests: fast/custom-elements/defined-pseudo-class.html
1262                fast/custom-elements/defined-rule.html
1263                fast/custom-elements/upgrading/Node-cloneNode.html
1264
1265         * bindings/js/JSCustomElementInterface.cpp:
1266         (WebCore::JSCustomElementInterface::constructElement): Don't set :defined flag here since that's done
1267         in the HTMLElement constructor now.
1268         (WebCore::JSCustomElementInterface::upgradeElement): Mark the element as failed-to-upgrade as needed.
1269         * bindings/js/JSElementCustom.cpp:
1270         (WebCore::toJSNewlyCreated):
1271         * bindings/js/JSHTMLElementCustom.cpp:
1272         (WebCore::constructJSHTMLElement):
1273         * css/SelectorCheckerTestFunctions.h:
1274         (WebCore::isDefinedElement):
1275         * dom/CustomElementReactionQueue.cpp:
1276         (WebCore::CustomElementReactionQueue::enqueueElementUpgradeIfDefined): Enqueue custom element reactions
1277         only if the element is well defined (successfully constructed or upgraded).
1278         (WebCore::CustomElementReactionQueue::enqueueConnectedCallbackIfNeeded): Ditto.
1279         (WebCore::CustomElementReactionQueue::enqueueDisconnectedCallbackIfNeeded): Ditto.
1280         (WebCore::CustomElementReactionQueue::enqueueAdoptedCallbackIfNeeded): Ditto.
1281         (WebCore::CustomElementReactionQueue::enqueueAttributeChangedCallbackIfNeeded): Ditto.
1282         * dom/CustomElementRegistry.cpp:
1283         (WebCore::enqueueUpgradeInShadowIncludingTreeOrder):
1284         * dom/Document.cpp:
1285         (WebCore::createUpgradeCandidateElement):
1286         (WebCore::createFallbackHTMLElement):
1287         * dom/Element.cpp:
1288         (WebCore::Element::attributeChanged):
1289         (WebCore::Element::didMoveToNewDocument):
1290         (WebCore::Element::insertedInto):
1291         (WebCore::Element::removedFrom):
1292         (WebCore::Element::setCustomElementIsResolved): Deleted.
1293         (WebCore::Element::setIsDefinedCustomElement): Renamed from setCustomElementIsResolved.
1294         (WebCore::Element::setIsFailedCustomElement): Added.
1295         (WebCore::Element::setIsCustomElementUpgradeCandidate): Added.
1296         (WebCore::Element::customElementInterface):
1297         * dom/Element.h:
1298         * dom/Node.h:
1299         (WebCore::Node::setIsCustomElement): Deleted.
1300         (WebCore::Node::isUndefinedCustomElement): Renamed from isUnresolvedCustomElement.
1301         (WebCore::Node::setIsUnresolvedCustomElement): Deleted.
1302         (WebCore::Node::isCustomElementUpgradeCandidate): Added.
1303         (WebCore::Node::isDefinedCustomElement): Renamed from isCustomElement.
1304         (WebCore::Node::isFailedCustomElement): Added.
1305         * dom/make_names.pl:
1306         (printWrapperFactoryCppFile): Use the HTMLElement wrapper on upgrade candidates. When a custom element
1307         failed to upgrade, the HTMLElement constructor would have created the wrapper so we never run this code.
1308         * html/parser/HTMLConstructionSite.cpp:
1309         (WebCore::HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface): 
1310         * html/parser/HTMLDocumentParser.cpp:
1311         (WebCore::HTMLDocumentParser::runScriptsForPausedTreeBuilder): Mark the HTMLUnknownElement created when
1312         the custom element constructor failed to run successfully as a failed custom element so that :define
1313         wouldn't apply to this element.
1314
1315 2016-09-03  Wenson Hsieh  <wenson_hsieh@apple.com>
1316
1317         Refactor the heuristic for showing media controls to take all media sessions into account
1318         https://bugs.webkit.org/show_bug.cgi?id=161503
1319         <rdar://problem/28033783>
1320
1321         Reviewed by Darin Adler.
1322
1323         Currently, when selecting a media session to show playback controls for, we grab the first media session that
1324         passes our heuristic. Using this method, we are unable to take additional factors into account, such as whether
1325         another media session's element is scrolled in view, or if another media session has been interacted with more
1326         recently. To address this, we make the following changes:
1327
1328             1.  Consider the list of all MediaElementSessions.
1329
1330             2.  Select only the MediaElementSessions capable of showing media controls and sort the list by a special
1331                 heuristic that takes visibility and time of last user interaction into account. The first element on
1332                 this list is the strongest candidate for main content.
1333
1334             3.  If this strongest candidate is visible in the viewport, or it is playing with audio, we return this
1335                 as the chosen candidate. Otherwise, we return this session only if no other non-candidate video could be
1336                 confused as the main content (i.e. the non-candidate video is not only visible in the viewport, but also
1337                 large enough to be considered main content).
1338
1339         Using this new method of determining the video to show controls for, we retain previous behavior for pages with
1340         a single video. On pages with multiple videos, the above logic ensures that if the current controlled video is
1341         paused, scrolled out of view, and then a new video is scrolled into view, we will either hide media controls to
1342         avoid confusion if that video could be confused for main content (using the mechanism in step 3), or we
1343         hook up the media controls to the new video if it satisfies main content (using the mechanism in step 2).
1344
1345         This patch also adds 6 new TestWebKitAPI unit tests.
1346
1347         * html/HTMLMediaElement.cpp:
1348         (WebCore::mediaElementSessionInfoForSession):
1349         (WebCore::preferMediaControlsForCandidateSessionOverOtherCandidateSession):
1350         (WebCore::mediaSessionMayBeConfusedWithMainContent):
1351         (WebCore::bestMediaSessionForShowingPlaybackControlsManager):
1352         (WebCore::HTMLMediaElement::didAttachRenderers):
1353         (WebCore::HTMLMediaElement::layoutSizeChanged):
1354         (WebCore::HTMLMediaElement::isVisibleInViewportChanged):
1355         (WebCore::HTMLMediaElement::resetPlaybackSessionState):
1356         (WebCore::HTMLMediaElement::isVisibleInViewport):
1357         (WebCore::HTMLMediaElement::updatePlaybackControlsManager):
1358         * html/HTMLMediaElement.h:
1359         * html/MediaElementSession.cpp:
1360         (WebCore::MediaElementSession::removeBehaviorRestriction):
1361         (WebCore::MediaElementSession::canShowControlsManager):
1362         (WebCore::MediaElementSession::isLargeEnoughForMainContent):
1363         (WebCore::MediaElementSession::mostRecentUserInteractionTime):
1364         (WebCore::MediaElementSession::wantsToObserveViewportVisibilityForMediaControls):
1365         (WebCore::MediaElementSession::wantsToObserveViewportVisibilityForAutoplay):
1366         (WebCore::MediaElementSession::resetPlaybackSessionState):
1367         (WebCore::MediaElementSession::canControlControlsManager): Deleted.
1368         * html/MediaElementSession.h:
1369         * platform/audio/PlatformMediaSession.h:
1370         (WebCore::PlatformMediaSession::resetPlaybackSessionState):
1371         (WebCore::PlatformMediaSession::canControlControlsManager): Deleted.
1372         * platform/audio/PlatformMediaSessionManager.cpp:
1373         (WebCore::PlatformMediaSessionManager::currentSessionsMatching):
1374         (WebCore::PlatformMediaSessionManager::currentSessionMatching): Deleted.
1375         * platform/audio/PlatformMediaSessionManager.h:
1376         * platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
1377         (WebPlaybackSessionModelMediaElement::setMediaElement):
1378
1379 2016-09-03  Darin Adler  <darin@apple.com>
1380
1381         Streamline DOMImplementation, and move it to our new DOM exception system
1382         https://bugs.webkit.org/show_bug.cgi?id=161295
1383
1384         Reviewed by Ryosuke Niwa.
1385
1386         * WebCore.xcodeproj/project.pbxproj: Added new headers to project.
1387
1388         * bindings/js/JSDOMBinding.h:
1389         (WebCore::toJS): Added an overload for ExceptionOr<>; this handles the
1390         exception case here so it doesn't need to be handled in generated code
1391         for the binding. Implemented here so that ExceptionOr.h does not know
1392         about bindings. But since this is a template, it will only compile when
1393         instantiated and there is no need to include ExceptionOr.h and indirectly
1394         the Variant.h header in this header.
1395         (WebCore::toJSNewlyCreated): Ditto.
1396
1397         * bindings/scripts/CodeGeneratorJS.pm:
1398         (GenerateCallbackImplementation): Refer to JSC::Exception with explicit
1399         namespace to avoid ambiguity with WebCore::Exception.
1400
1401         * dom/DOMImplementation.cpp:
1402         (WebCore::DOMImplementation::createDocumentType): Changed to return
1403         ExceptionOr.
1404         (WebCore::createXMLDocument): Added. Helper used in createDocument.
1405         (WebCore::DOMImplementation::getInterface): Deleted. This was unused.
1406         (WebCore::DOMImplementation::createDocument): Changed to return
1407         ExceptionOr.
1408         (WebCore::DOMImplementation::createCSSStyleSheet): Removed the unused
1409         ExceptionCode out argument.
1410         (WebCore::isValidXMLMIMETypeChar): Deleted. Moved to MIMETypeRegistry.
1411         (WebCore::DOMImplementation::isXMLMIMEType): Ditto.
1412         (WebCore::DOMImplementation::isTextMIMEType): Ditto.
1413
1414         * dom/DOMImplementation.h: Changed functions as described above to
1415         return ExceptionOr values. Also removed unused getInterface function,
1416         and isXMLMIMEType and isTextMIMEType, which both moved to the
1417         MIMETypeRegistry class alongside all the other similar MIME type
1418         functions.
1419
1420         * dom/DOMImplementation.idl: Reorganized this to match the IDL files
1421         in the specifications a little better. Also removed [RaisesException]
1422         since that is only needed for the old legacy ExceptionCode& style.
1423
1424         * dom/Document.cpp:
1425         (WebCore::Document::setXMLVersion): Removed call to the
1426         DOMImplementation::hasFeature function since the values passed in
1427         unconditionally result in the return value "true". This is left over
1428         either from specification language, or from an ancient version of this
1429         code that worked in a "no XML supported" mode.
1430         (WebCore::Document::setXMLStandalone): Ditto.
1431
1432         * dom/Document.h: Removed the ExceptionCode& out argument from setXMLStandalone.
1433         * dom/Document.idl: Removed [SetterRaisesException] from xmlStandalone.
1434
1435         * dom/Exception.h: Added.
1436         * dom/ExceptionOr.h: Added.
1437
1438         * html/HTMLTemplateElement.cpp: Removed unneeded include of DOMImplementation.h.
1439
1440         * inspector/InspectorPageAgent.cpp:
1441         (WebCore::createXHRTextDecoder): Use isXMLMIMEType in its new location in
1442         MIMETypeRegistry.
1443         * inspector/NetworkResourcesData.cpp:
1444         (WebCore::createOtherResourceTextDecoder): Ditto.
1445
1446         * loader/FrameLoader.cpp: Removed unneeded include of DOMImplementation.h.
1447
1448         * loader/TextResourceDecoder.cpp:
1449         (WebCore::TextResourceDecoder::determineContentType): Use isXMLMIMEType in its
1450         new location in MIMETypeRegistry.
1451
1452         * platform/MIMETypeRegistry.cpp:
1453         (WebCore::MIMETypeRegistry::isTextMIMEType): Added. Moved here from
1454         DOMImplementation.
1455         (WebCore::isValidXMLMIMETypeChar): Ditto.
1456         (WebCore::MIMETypeRegistry::isXMLMIMEType): Ditto.
1457
1458         * platform/MIMETypeRegistry.h: Added isXMLMIMEType and isTextMIMEType.
1459         Made isUnsupportedTextMIMEType private.
1460
1461         * svg/SVGElement.cpp:
1462         (WebCore::SVGElement::isSupported): Deleted. This function was never called.
1463         * svg/SVGElement.h: Updated for the above change.
1464
1465         * xml/XMLHttpRequest.cpp:
1466         (WebCore::XMLHttpRequest::responseIsXML): Use isXMLMIMEType in its new
1467         location in MIMETypeRegistry.
1468
1469         * xml/parser/XMLDocumentParserLibxml2.cpp:
1470         (WebCore::XMLDocumentParser::startDocument): Updated since setXMLStandalone
1471         no longer can raise an exception.
1472
1473 2016-09-03  Ryosuke Niwa  <rniwa@webkit.org>
1474
1475         Unbreak customElements.whenDefined after r205383 with a crash fix
1476         https://bugs.webkit.org/show_bug.cgi?id=161562
1477
1478         Reviewed by Darin Adler.
1479
1480         The crash was caused by DeferredWrapper::contextDestroyed not calling ContextDestructionObserver::contextDestroyed.
1481
1482         This caused m_scriptExecutionContext to not being set to nullptr when the Document was destroyed before DOMWindow
1483         during a single GC sweeping, and resulted in a use-after-free in ContextDestructionObserver's destructor.
1484
1485         Fixed the crash and reverted r205383.
1486
1487         Tests: fast/custom-elements/CustomElementRegistry.html
1488
1489         * bindings/js/JSCustomElementRegistryCustom.cpp:
1490         (WebCore::whenDefinedPromise):
1491         * bindings/js/JSDOMPromise.cpp:
1492         (WebCore::DeferredWrapper::contextDestroyed): Fixed the crash.
1493         * dom/CustomElementRegistry.cpp:
1494         (WebCore::CustomElementRegistry::addElementDefinition):
1495         * dom/CustomElementRegistry.h:
1496         (WebCore::CustomElementRegistry::promiseMap):
1497
1498 2016-09-03  Chris Dumez  <cdumez@apple.com>
1499
1500         Align cross-Origin Object.getOwnPropertyNames() with the HTML specification
1501         https://bugs.webkit.org/show_bug.cgi?id=161457
1502
1503         Reviewed by Darin Adler.
1504
1505         Align cross-Origin Object.getOwnPropertyNames() with the HTML specification:
1506         - https://html.spec.whatwg.org/#windowproxy-ownpropertykeys
1507         - https://html.spec.whatwg.org/#location-ownpropertykeys
1508         - https://html.spec.whatwg.org/#crossoriginproperties-(-o-)
1509
1510         We should list cross origin properties.
1511
1512         Firefox complies with the specification. However, WebKit was returning an
1513         empty array and logs a security error message.
1514
1515         No new tests, updated existing test.
1516
1517         * bindings/js/JSDOMWindowCustom.cpp:
1518         (WebCore::addCrossOriginPropertyNames):
1519         (WebCore::JSDOMWindow::getOwnPropertyNames):
1520         * bindings/js/JSLocationCustom.cpp:
1521         (WebCore::addCrossOriginPropertyNames):
1522         (WebCore::JSLocation::getOwnPropertyNames):
1523
1524 2016-09-03  Frédéric Wang  <fwang@igalia.com>
1525
1526         Constructors of MathML renderers should only accept MathMLPresentationElement-derived classes
1527         https://bugs.webkit.org/show_bug.cgi?id=161378
1528
1529         Reviewed by Darin Adler.
1530
1531         We update constructors of RenderMathMLBlock, to only accept MathMLPresentationElement
1532         instances as a parameter. Similarly, we make the constructor of RenderMathMLToken only
1533         accept MathMLTokenElement instances.
1534
1535         No new tests, behavior is unchanged.
1536
1537         * rendering/mathml/RenderMathMLBlock.cpp:
1538         (WebCore::RenderMathMLBlock::RenderMathMLBlock):
1539         * rendering/mathml/RenderMathMLBlock.h:
1540         * rendering/mathml/RenderMathMLToken.cpp:
1541         (WebCore::RenderMathMLToken::RenderMathMLToken):
1542         * rendering/mathml/RenderMathMLToken.h:
1543
1544 2016-09-03  Brian Weinstein  <bweinstein@apple.com>
1545
1546         Consult with the FrameLoaderClient about whether or not content extensions should be enabled when loading this URL.
1547         https://bugs.webkit.org/show_bug.cgi?id=161441
1548
1549         Reviewed by Darin Adler.
1550
1551         * loader/DocumentLoader.cpp:
1552         (WebCore::DocumentLoader::startLoadingMainResource): If content extensions aren't already disabled, consult with the
1553         FrameLoaderClient about whether or not we should use content extensions for this URL.
1554         * loader/FrameLoaderClient.h: Add the FrameLoaderClient call to determine if we should use content extensions for a given
1555         URL...
1556         * loader/EmptyClients.h: ... And add a stub implementation.
1557
1558 2016-09-03  Michael Catanzaro  <mcatanzaro@igalia.com>
1559
1560         Silence -Wparentheses warning triggered by r205266
1561
1562         Unreviewed
1563
1564         * platform/URL.cpp:
1565         (WebCore::URL::URL):
1566
1567 2016-09-03  Joseph Pecoraro  <pecoraro@apple.com>
1568
1569         Use ASCIILiteral in some more places
1570         https://bugs.webkit.org/show_bug.cgi?id=161557
1571
1572         Reviewed by Darin Adler.
1573
1574         * Modules/indexeddb/IDBDatabaseException.cpp:
1575         (WebCore::IDBDatabaseException::getErrorName):
1576         (WebCore::IDBDatabaseException::getErrorDescription):
1577         * Modules/websockets/WebSocket.cpp:
1578         (WebCore::WebSocket::binaryType):
1579         * css/FontFace.cpp:
1580         (WebCore::FontFace::stretch):
1581         (WebCore::FontFace::unicodeRange):
1582         (WebCore::FontFace::featureSettings):
1583         * html/canvas/WebGLRenderingContextBase.cpp:
1584         * html/parser/HTMLPreloadScanner.cpp:
1585         (WebCore::TokenPreloadScanner::initiatorFor):
1586         * loader/FormSubmission.cpp:
1587         (WebCore::FormSubmission::Attributes::parseEncodingType):
1588         * page/SecurityOrigin.cpp:
1589         (WebCore::SecurityOrigin::toRawString):
1590         * platform/graphics/cg/ImageBufferCG.cpp:
1591         (WebCore::CGImageToDataURL):
1592         (WebCore::ImageBuffer::toDataURL):
1593         (WebCore::ImageDataToDataURL):
1594         * svg/graphics/SVGImage.cpp:
1595         (WebCore::SVGImage::filenameExtension):
1596
1597 2016-09-03  Chris Dumez  <cdumez@apple.com>
1598
1599         Object.preventExtensions(window) should throw a TypeError
1600         https://bugs.webkit.org/show_bug.cgi?id=161554
1601
1602         Reviewed by Darin Adler.
1603
1604         Object.preventExtensions(window) should throw a TypeError.
1605
1606         [[PreventExtensions]] should return false for Window:
1607         - https://html.spec.whatwg.org/#windowproxy-preventextensions
1608
1609         EcmaScript says that Object.preventExtensions() should throw a TypeError
1610         if [[PreventExtension]] returns false:
1611         - https://tc39.github.io/ecma262/#sec-object.preventextensions
1612
1613         No new tests, updated existing test.
1614
1615         * bindings/js/JSDOMWindowCustom.cpp:
1616         (WebCore::JSDOMWindow::preventExtensions):
1617
1618 2016-09-03  Chris Dumez  <cdumez@apple.com>
1619
1620         Align meta element http-equiv="refresh" parsing with the HTML specification
1621         https://bugs.webkit.org/show_bug.cgi?id=161543
1622
1623         Reviewed by Darin Adler.
1624
1625         Align meta element http-equiv="refresh" parsing with the HTML specification:
1626         - https://html.spec.whatwg.org/multipage/semantics.html#attr-meta-http-equiv-refresh
1627
1628         Tests: imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/parsing.html
1629
1630         * dom/Document.cpp:
1631         (WebCore::Document::processHttpEquiv):
1632         * html/parser/HTMLParserIdioms.cpp:
1633         (WebCore::parseHTTPRefreshInternal):
1634         (WebCore::parseMetaHTTPEquivRefresh):
1635         * html/parser/HTMLParserIdioms.h:
1636         * loader/FrameLoader.cpp:
1637         (WebCore::FrameLoader::receivedFirstData):
1638         * platform/network/HTTPParsers.cpp:
1639         (WebCore::skipWhiteSpace):
1640         (WebCore::skipEquals):
1641         (WebCore::parseHTTPRefresh):
1642         (WebCore::parseXSSProtectionHeader):
1643         (WebCore::skipValue): Deleted.
1644         * platform/network/HTTPParsers.h:
1645
1646 2016-09-02  Myles C. Maxfield  <mmaxfield@apple.com>
1647
1648         [Cocoa] Distinguish between paint advances and base advances
1649         https://bugs.webkit.org/show_bug.cgi?id=160892
1650
1651         Reviewed by Simon Fraser.
1652
1653         This patch introduces the concept of a layout (or "base") advance which is distinct
1654         from a painting advance. In extremely complicated scripts such as Urdu, it is common
1655         for a glyph advance to be negative in the horizontal direction, and have large advances
1656         in the vertical direction. In particular, in cursive scripts, the glyph placement is
1657         only indirectly related to where the actual characters lie. Conceptually, these glyph
1658         locations are correct for painting, but are not correct when performing width
1659         measurements.
1660
1661         In many text engines, glyph shaping actually can be split into two phases: adjusting
1662         advances, and then placing glyphs relative to those advances. The secondary glyph
1663         placement step is much more context-sensitive than the first step. In addition, when
1664         multiple glyphs combine to form a character, it is common for one glyph to own the
1665         full base advance for the character, and for the other glyphs in the character to
1666         have zero base advances. (Then, in the glyph placement phase, the other glyphs get
1667         placed all around.)
1668
1669         Because of the context-insensitivity of the base advances, it is valuable to use
1670         these for text measurement. Then, when we want to paint, we should add in the extra
1671         origins. This dramatically improves the layout of complex fonts like Noto Nastaliq.
1672
1673         This patch migrates WebKit to use this two-phase shaping.
1674
1675         No new tests just yet, because I have to create a font which exercises the
1676         advanced glyph placement support.
1677
1678         * platform/graphics/GlyphBuffer.h:
1679         (WebCore::GlyphBufferAdvance::setHeight):
1680         (WebCore::GlyphBufferAdvance::setWidth): Deleted.
1681         * platform/graphics/TextRun.h:
1682         (WebCore::TextRun::TextRun):
1683         (WebCore::TextRun::shouldDisableLayoutSpecificAdvances):
1684         (WebCore::TextRun::setShouldDisableLayoutSpecificAdvances):
1685         (WebCore::TextRun::spacingDisabled): Deleted.
1686         (WebCore::TextRun::setCharacterScanForCodePath): Deleted.
1687         * platform/graphics/cocoa/FontCascadeCocoa.mm:
1688         (WebCore::FontCascade::getGlyphsAndAdvancesForComplexText):
1689         * platform/graphics/mac/ComplexTextController.cpp:
1690         (WebCore::ComplexTextController::ComplexTextController):
1691         (WebCore::ComplexTextController::offsetForPosition):
1692         (WebCore::ComplexTextController::collectComplexTextRuns):
1693         (WebCore::ComplexTextController::ComplexTextRun::setIsNonMonotonic):
1694         (WebCore::ComplexTextController::runWidthSoFarFraction):
1695         (WebCore::ComplexTextController::advance):
1696         (WebCore::ComplexTextController::adjustGlyphsAndAdvances):
1697         * platform/graphics/mac/ComplexTextController.h:
1698         (WebCore::ComplexTextController::ComplexTextRun::create):
1699         (WebCore::ComplexTextController::ComplexTextRun::baseAdvances):
1700         (WebCore::ComplexTextController::ComplexTextRun::glyphOrigins):
1701         (WebCore::ComplexTextController::useLayoutSpecificAdvances):
1702         (WebCore::ComplexTextController::finalRoundingWidth): Deleted.
1703         (WebCore::ComplexTextController::ComplexTextRun::advances): Deleted.
1704         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
1705         (SOFT_LINK):
1706         (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun):
1707         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
1708         * platform/spi/cocoa/CoreTextSPI.h:
1709
1710 2016-09-02  Zalan Bujtas  <zalan@apple.com>
1711
1712         Should never be reached failure in WebCore::floatValueForLength
1713         https://bugs.webkit.org/show_bug.cgi?id=139397
1714         <rdar://problem/27704376>
1715
1716         Reviewed by Simon Fraser.
1717
1718         floatValueForLength can't resolve unspecified Length types. Filter them out and return 0 as if they were auto.
1719
1720         Test: svg/css/assert-on-non-resolvable-dimension.html
1721
1722         * svg/SVGLengthContext.cpp:
1723         (WebCore::SVGLengthContext::valueForLength):
1724
1725 2016-09-02  Joseph Pecoraro  <pecoraro@apple.com>
1726
1727         [Mac] Remove unnecessary RetainPtr in NeverDestroyed value
1728         https://bugs.webkit.org/show_bug.cgi?id=161553
1729
1730         Reviewed by Daniel Bates.
1731
1732         * platform/ios/WebCoreMotionManager.mm:
1733         (+[WebCoreMotionManager sharedManager]):
1734
1735 2016-09-02  Alex Christensen  <achristensen@webkit.org>
1736
1737         URLParser should parse file URLs
1738         https://bugs.webkit.org/show_bug.cgi?id=161556
1739
1740         Reviewed by Tim Horton.
1741
1742         Added new API tests.
1743
1744         * platform/URLParser.cpp:
1745         (WebCore::isWindowsDriveLetter):
1746         (WebCore::shouldCopyFileURL):
1747         (WebCore::URLParser::parse):
1748         (WebCore::URLParser::parseHost):
1749         * platform/URLParser.h:
1750
1751 2016-09-02  Ryosuke Niwa  <rniwa@webkit.org>
1752
1753         Add validations for a synchronously constructed custom element
1754         https://bugs.webkit.org/show_bug.cgi?id=161528
1755
1756         Reviewed by Yusuke Suzuki.
1757
1758         The latest DOM specification has sanity checks when creating an element with the synchronous custom elements flag set
1759         in 6.1.3 through 10:
1760         3. If result does not implement the HTMLElement interface, throw a TypeError.
1761         4. If result's attribute list is not empty, then throw a NotSupportedError.
1762         5. If result has children, then throw a NotSupportedError.
1763         6. If result's parent is not null, then throw a NotSupportedError.
1764         7. If result's node document is not document, then throw a NotSupportedError.
1765         8. If result's namespace is not the HTML namespace, then throw a NotSupportedError.
1766         9. If result's local name is not equal to localName, then throw a NotSupportedError.
1767
1768         Add all these checks to JSCustomElementInterface::constructElement.
1769
1770         Tests: fast/custom-elements/Document-createElement.html
1771
1772         * bindings/js/JSCustomElementInterface.cpp:
1773         (WebCore::JSCustomElementInterface::constructElement): Report the exception thrown during parsing instead of just
1774         clearing and ignoring it.
1775         (WebCore::constructCustomElementSynchronously): Extracted out of constructElement so that we can also catch TypeError
1776         and NotSupportedError we throw in constructElement for the parser.
1777
1778 2016-09-02  Zalan Bujtas  <zalan@apple.com>
1779
1780         ASSERT_NOT_REACHED() is touched in WebCore::valueForLength
1781         https://bugs.webkit.org/show_bug.cgi?id=123337
1782         <rdar://problem/27684121>
1783
1784         Reviewed by Simon Fraser.
1785
1786         Do not try to use unspecified height value while resolving logical height for table row.
1787
1788         Test: fast/table/assert-on-non-resolvable-row-dimension.html
1789
1790         * rendering/RenderTableCell.h:
1791         (WebCore::RenderTableCell::logicalHeightForRowSizing):
1792
1793 2016-09-02  Ryosuke Niwa  <rniwa@webkit.org>
1794
1795         Temporarily break customElements.whenDefined to remove flaky crashes
1796         https://bugs.webkit.org/show_bug.cgi?id=161555
1797
1798         Reviewed by Chris Dumez.
1799
1800         Remove HashMap of DeferredWrapper which causes a crash during destruction.
1801         This breaks the semantics of "whenDefined" for now.
1802
1803         * bindings/js/JSCustomElementRegistryCustom.cpp:
1804         (WebCore::whenDefinedPromise):
1805         * dom/CustomElementRegistry.cpp:
1806         (WebCore::CustomElementRegistry::addElementDefinition):
1807         * dom/CustomElementRegistry.h:
1808         (WebCore::CustomElementRegistry::promiseMap): Deleted.
1809
1810 2016-09-02  Ryan Haddad  <ryanhaddad@apple.com>
1811         Unreviewed, rolling out r205373.
1812
1813         This change causes LayoutTest crashes under GuardMalloc
1814
1815         Reverted changeset:
1816
1817         "[Cocoa] Distinguish between paint advances and base advances"
1818         https://bugs.webkit.org/show_bug.cgi?id=160892
1819         http://trac.webkit.org/changeset/205373
1820
1821 2016-09-02  Beth Dakin  <bdakin@apple.com>
1822
1823         Need to updateEditorState if an element change edit-ability without changing 
1824         selection
1825         https://bugs.webkit.org/show_bug.cgi?id=161546
1826         -and corresponding-
1827         rdar://problem/27806012
1828
1829         Reviewed by Ryosuke Niwa.
1830
1831         Call into the client in case edited state needs to be updated. 
1832         * editing/FrameSelection.cpp:
1833         (WebCore::FrameSelection::updateAppearanceAfterLayout):
1834         * loader/EmptyClients.h:
1835         * page/EditorClient.h:
1836
1837 2016-09-02  Zalan Bujtas  <zalan@apple.com>
1838
1839         ASSERTION FAILED: !m_committedWidth in WebCore::LineWidth::fitBelowFloats
1840         https://bugs.webkit.org/show_bug.cgi?id=149462
1841         <rdar://problem/27710841>
1842
1843         Reviewed by David Hyatt.
1844
1845         In certain cases (multiple spans on the same line with negativ marings), the LineWidth::m_committedWidth > 0
1846         check is not sufficient to decide if some content has already been committed to the current line.
1847         This patch adds a flag to indicate if we ever committed to the current line. 
1848
1849         Test: fast/text/assert-when-text-with-negative-margin-sibling-does-not-fit.html
1850
1851         * rendering/line/BreakingContext.h:
1852         (WebCore::BreakingContext::handleText):
1853         * rendering/line/LineWidth.h:
1854         (WebCore::LineWidth::hasCommitted):
1855
1856 2016-09-02  Myles C. Maxfield  <mmaxfield@apple.com>
1857
1858         [Cocoa] Distinguish between paint advances and base advances
1859         https://bugs.webkit.org/show_bug.cgi?id=160892
1860
1861         Reviewed by Simon Fraser.
1862
1863         This patch introduces the concept of a layout (or "base") advance which is distinct
1864         from a painting advance. In extremely complicated scripts such as Urdu, it is common
1865         for a glyph advance to be negative in the horizontal direction, and have large advances
1866         in the vertical direction. In particular, in cursive scripts, the glyph placement is
1867         only indirectly related to where the actual characters lie. Conceptually, these glyph
1868         locations are correct for painting, but are not correct when performing width
1869         measurements.
1870
1871         In many text engines, glyph shaping actually can be split into two phases: adjusting
1872         advances, and then placing glyphs relative to those advances. The secondary glyph
1873         placement step is much more context-sensitive than the first step. In addition, when
1874         multiple glyphs combine to form a character, it is common for one glyph to own the
1875         full base advance for the character, and for the other glyphs in the character to
1876         have zero base advances. (Then, in the glyph placement phase, the other glyphs get
1877         placed all around.)
1878
1879         Because of the context-insensitivity of the base advances, it is valuable to use
1880         these for text measurement. Then, when we want to paint, we should add in the extra
1881         origins. This dramatically improves the layout of complex fonts like Noto Nastaliq.
1882
1883         This patch migrates WebKit to use this two-phase shaping.
1884
1885         No new tests just yet, because I have to create a font which exercises the
1886         advanced glyph placement support.
1887
1888         * platform/graphics/GlyphBuffer.h:
1889         (WebCore::GlyphBufferAdvance::setHeight):
1890         (WebCore::GlyphBufferAdvance::setWidth): Deleted.
1891         * platform/graphics/TextRun.h:
1892         (WebCore::TextRun::TextRun):
1893         (WebCore::TextRun::shouldDisableLayoutSpecificAdvances):
1894         (WebCore::TextRun::setShouldDisableLayoutSpecificAdvances):
1895         (WebCore::TextRun::spacingDisabled): Deleted.
1896         (WebCore::TextRun::setCharacterScanForCodePath): Deleted.
1897         * platform/graphics/cocoa/FontCascadeCocoa.mm:
1898         (WebCore::FontCascade::getGlyphsAndAdvancesForComplexText):
1899         * platform/graphics/mac/ComplexTextController.cpp:
1900         (WebCore::ComplexTextController::ComplexTextController):
1901         (WebCore::ComplexTextController::offsetForPosition):
1902         (WebCore::ComplexTextController::collectComplexTextRuns):
1903         (WebCore::ComplexTextController::ComplexTextRun::setIsNonMonotonic):
1904         (WebCore::ComplexTextController::runWidthSoFarFraction):
1905         (WebCore::ComplexTextController::advance):
1906         (WebCore::ComplexTextController::adjustGlyphsAndAdvances):
1907         * platform/graphics/mac/ComplexTextController.h:
1908         (WebCore::ComplexTextController::ComplexTextRun::create):
1909         (WebCore::ComplexTextController::ComplexTextRun::baseAdvances):
1910         (WebCore::ComplexTextController::ComplexTextRun::glyphOrigins):
1911         (WebCore::ComplexTextController::useLayoutSpecificAdvances):
1912         (WebCore::ComplexTextController::finalRoundingWidth): Deleted.
1913         (WebCore::ComplexTextController::ComplexTextRun::advances): Deleted.
1914         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
1915         (SOFT_LINK):
1916         (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun):
1917         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
1918         * platform/spi/cocoa/CoreTextSPI.h:
1919
1920 2016-09-02  Chris Dumez  <cdumez@apple.com>
1921
1922         Unreviewed, roll out r205354 because it caused JSC test failures
1923
1924         * bindings/js/JSDOMWindowBase.cpp:
1925         (WebCore::shouldAllowAccessFrom):
1926         * bindings/js/JSDOMWindowCustom.cpp:
1927         (WebCore::JSDOMWindow::preventExtensions): Deleted.
1928         (WebCore::JSDOMWindow::setLocation): Deleted.
1929         * bindings/js/JSLocationCustom.cpp:
1930         (WebCore::JSLocation::preventExtensions): Deleted.
1931         (WebCore::JSLocationPrototype::putDelegate): Deleted.
1932         (WebCore::JSLocationPrototype::defineOwnProperty): Deleted.
1933         * bindings/js/JSWorkerGlobalScopeBase.cpp:
1934         (WebCore::JSWorkerGlobalScopeBase::allowsAccessFrom):
1935         * bindings/js/JSWorkerGlobalScopeBase.h:
1936         * bindings/scripts/CodeGeneratorJS.pm:
1937         (GenerateHeader):
1938         * bindings/scripts/IDLAttributes.txt:
1939         * page/DOMWindow.idl:
1940         * page/Location.idl:
1941
1942 2016-09-02  Joseph Pecoraro  <pecoraro@apple.com>
1943
1944         Web Inspector: Provide a way to open an inspector frontend for a remote target
1945         https://bugs.webkit.org/show_bug.cgi?id=161515
1946         <rdar://problem/13182127>
1947
1948         Reviewed by Brian Burg.
1949
1950         Previously WebKit inspector frontend clients could only
1951         create a frontend for a web page with the latest protocol.
1952         Now it may create a frontend for a "javascript" or "web"
1953         debuggable that may be current or an older protocol.
1954
1955         The frontend already supports these configurations by
1956         checking and calling InspectorFrontendHost methods
1957         that may or may not have existed previously:
1958
1959         - debuggableType was always "web" but frontend supports "javascript"
1960         - inspectorBackendCommandsURLs was absent so the frontend used the most current
1961             - rename this to backendCommandsURL
1962         
1963         Formalize the methods and have them delegate to the
1964         frontend client opening the frontend.
1965
1966         * inspector/InspectorFrontendClient.h:
1967         (WebCore::InspectorFrontendClient::backendCommandsURL):
1968         (WebCore::InspectorFrontendClient::debuggableType):
1969         * inspector/InspectorFrontendHost.cpp:
1970         (WebCore::InspectorFrontendHost::localizedStringsURL):
1971         (WebCore::InspectorFrontendHost::backendCommandsURL):
1972         (WebCore::InspectorFrontendHost::debuggableType):
1973         * inspector/InspectorFrontendHost.h:
1974         * inspector/InspectorFrontendHost.idl:
1975         Formalize and give default values to InspectorFrontentHost methods.
1976
1977 2016-09-02  Dave Hyatt  <hyatt@apple.com>
1978
1979         Add support for media query parsing using new CSS Parser
1980         https://bugs.webkit.org/show_bug.cgi?id=161537
1981
1982         Reviewed by Dean Jackson.
1983
1984         * CMakeLists.txt:
1985         * WebCore.xcodeproj/project.pbxproj:
1986         * css/MediaQueryExp.cpp:
1987         (WebCore::featureWithValidIdent):
1988         (WebCore::featureWithValidDensity):
1989         (WebCore::featureWithValidPositiveLength):
1990         (WebCore::featureWithPositiveInteger):
1991         (WebCore::featureWithPositiveNumber):
1992         (WebCore::featureWithZeroOrOne):
1993         (WebCore::isFeatureValidWithIdentifier):
1994         (WebCore::MediaQueryExpression::MediaQueryExpression):
1995         * css/MediaQueryExp.h:
1996         * css/parser/CSSParserIdioms.cpp: Added.
1997         (WebCore::convertToASCIILowercaseInPlace):
1998         * css/parser/CSSParserIdioms.h:
1999         * css/parser/CSSParserToken.cpp:
2000         (WebCore::convertToASCIILowercaseInPlace):
2001         * css/parser/MediaQueryBlockWatcher.cpp: Added.
2002         (WebCore::MediaQueryBlockWatcher::MediaQueryBlockWatcher):
2003         (WebCore::MediaQueryBlockWatcher::handleToken):
2004         * css/parser/MediaQueryBlockWatcher.h: Added.
2005         (WebCore::MediaQueryBlockWatcher::blockLevel):
2006         * css/parser/MediaQueryParser.cpp: Added.
2007         (WebCore::MediaQueryParser::parseMediaQuerySet):
2008         (WebCore::MediaQueryParser::parseMediaCondition):
2009         (WebCore::MediaQueryParser::MediaQueryParser):
2010         (WebCore::MediaQueryParser::~MediaQueryParser):
2011         (WebCore::MediaQueryParser::setStateAndRestrict):
2012         (WebCore::MediaQueryParser::readRestrictor):
2013         (WebCore::MediaQueryParser::readMediaNot):
2014         (WebCore::isRestrictorOrLogicalOperator):
2015         (WebCore::MediaQueryParser::readMediaType):
2016         (WebCore::MediaQueryParser::commitMediaQuery):
2017         (WebCore::MediaQueryParser::readAnd):
2018         (WebCore::MediaQueryParser::readFeatureStart):
2019         (WebCore::MediaQueryParser::readFeature):
2020         (WebCore::MediaQueryParser::readFeatureColon):
2021         (WebCore::MediaQueryParser::readFeatureValue):
2022         (WebCore::MediaQueryParser::readFeatureEnd):
2023         (WebCore::MediaQueryParser::skipUntilComma):
2024         (WebCore::MediaQueryParser::skipUntilBlockEnd):
2025         (WebCore::MediaQueryParser::done):
2026         (WebCore::MediaQueryParser::handleBlocks):
2027         (WebCore::MediaQueryParser::processToken):
2028         (WebCore::MediaQueryParser::parseInternal):
2029         (WebCore::MediaQueryData::MediaQueryData):
2030         (WebCore::MediaQueryData::clear):
2031         (WebCore::MediaQueryData::addExpression):
2032         (WebCore::MediaQueryData::tryAddParserToken):
2033         (WebCore::MediaQueryData::setMediaType):
2034         * css/parser/MediaQueryParser.h: Added.
2035         (WebCore::MediaQueryData::restrictor):
2036         (WebCore::MediaQueryData::expressions):
2037         (WebCore::MediaQueryData::mediaType):
2038         (WebCore::MediaQueryData::currentMediaQueryChanged):
2039         (WebCore::MediaQueryData::setRestrictor):
2040         (WebCore::MediaQueryData::setMediaFeature):
2041
2042 2016-07-08  Jer Noble  <jer.noble@apple.com>
2043
2044         Refactor WebPlaybackSessionModelMediaElement to be client based.
2045         https://bugs.webkit.org/show_bug.cgi?id=159580
2046
2047         Reviewed by Eric Carlson.
2048
2049         Add client callback interfaces to both WebPlaybackSessionModel and WebVideoFullscreenModel, where each object
2050         can have multiple clients, and so the object will both store current values and also notify those clients
2051         when the values change. After this change, there is no need to have the models know about their associated
2052         interfaces explicitly.
2053
2054         * platform/cocoa/WebPlaybackSessionInterface.h:
2055         * platform/cocoa/WebPlaybackSessionModel.h:
2056         (WebCore::WebPlaybackSessionModelClient::~WebPlaybackSessionModelClient):
2057         (WebCore::WebPlaybackSessionModelClient::durationChanged):
2058         (WebCore::WebPlaybackSessionModelClient::currentTimeChanged):
2059         (WebCore::WebPlaybackSessionModelClient::bufferedTimeChanged):
2060         (WebCore::WebPlaybackSessionModelClient::rateChanged):
2061         (WebCore::WebPlaybackSessionModelClient::seekableRangesChanged):
2062         (WebCore::WebPlaybackSessionModelClient::canPlayFastReverseChanged):
2063         (WebCore::WebPlaybackSessionModelClient::audioMediaSelectionOptionsChanged):
2064         (WebCore::WebPlaybackSessionModelClient::legibleMediaSelectionOptionsChanged):
2065         (WebCore::WebPlaybackSessionModelClient::externalPlaybackChanged):
2066         (WebCore::WebPlaybackSessionModelClient::wirelessVideoPlaybackDisabledChanged):
2067         * platform/cocoa/WebPlaybackSessionModelMediaElement.h:
2068         * platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
2069         (WebPlaybackSessionModelMediaElement::setMediaElement):
2070         (WebPlaybackSessionModelMediaElement::updateForEventName):
2071         (WebPlaybackSessionModelMediaElement::addClient):
2072         (WebPlaybackSessionModelMediaElement::removeClient):
2073         (WebPlaybackSessionModelMediaElement::updateLegibleOptions):
2074         (WebPlaybackSessionModelMediaElement::observedEventNames):
2075         (WebPlaybackSessionModelMediaElement::eventNameAll):
2076         (WebPlaybackSessionModelMediaElement::audioMediaSelectionOptions):
2077         (WebPlaybackSessionModelMediaElement::audioMediaSelectedIndex):
2078         (WebPlaybackSessionModelMediaElement::legibleMediaSelectedIndex):
2079         (WebPlaybackSessionModelMediaElement::externalPlaybackEnabled):
2080         (WebPlaybackSessionModelMediaElement::externalPlaybackTargetType):
2081         (WebPlaybackSessionModelMediaElement::externalPlaybackLocalizedDeviceName):
2082         (WebPlaybackSessionModelMediaElement::wirelessVideoPlaybackDisabled):
2083         (WebPlaybackSessionModelMediaElement::setWebPlaybackSessionInterface): Deleted.
2084         * platform/cocoa/WebVideoFullscreenInterface.h:
2085         * platform/cocoa/WebVideoFullscreenModel.h:
2086         (WebCore::WebVideoFullscreenModelClient::~WebVideoFullscreenModelClient):
2087         * platform/cocoa/WebVideoFullscreenModelVideoElement.h:
2088         (WebCore::WebVideoFullscreenModelVideoElement::create):
2089         (WebCore::WebVideoFullscreenModelVideoElement::playbackSessionModel): Deleted.
2090         * platform/cocoa/WebVideoFullscreenModelVideoElement.mm:
2091         (WebVideoFullscreenModelVideoElement::WebVideoFullscreenModelVideoElement):
2092         (WebVideoFullscreenModelVideoElement::setVideoElement):
2093         (WebVideoFullscreenModelVideoElement::updateForEventName):
2094         (WebVideoFullscreenModelVideoElement::addClient):
2095         (WebVideoFullscreenModelVideoElement::removeClient):
2096         (WebVideoFullscreenModelVideoElement::setHasVideo):
2097         (WebVideoFullscreenModelVideoElement::setVideoDimensions):
2098         (WebVideoFullscreenModelVideoElement::setWebVideoFullscreenInterface): Deleted.
2099         * platform/ios/WebAVPlayerController.h:
2100         * platform/ios/WebAVPlayerController.mm:
2101         (-[WebAVPlayerController resetState]): Deleted.
2102         * platform/ios/WebPlaybackSessionInterfaceAVKit.h:
2103         (WebCore::WebPlaybackSessionInterfaceAVKitClient::~WebPlaybackSessionInterfaceAVKitClient): Deleted.
2104         * platform/ios/WebPlaybackSessionInterfaceAVKit.mm:
2105         (WebCore::WebPlaybackSessionInterfaceAVKit::WebPlaybackSessionInterfaceAVKit):
2106         (WebCore::WebPlaybackSessionInterfaceAVKit::~WebPlaybackSessionInterfaceAVKit):
2107         (WebCore::WebPlaybackSessionInterfaceAVKit::resetMediaState):
2108         (WebCore::WebPlaybackSessionInterfaceAVKit::durationChanged):
2109         (WebCore::WebPlaybackSessionInterfaceAVKit::currentTimeChanged):
2110         (WebCore::WebPlaybackSessionInterfaceAVKit::bufferedTimeChanged):
2111         (WebCore::WebPlaybackSessionInterfaceAVKit::rateChanged):
2112         (WebCore::WebPlaybackSessionInterfaceAVKit::seekableRangesChanged):
2113         (WebCore::WebPlaybackSessionInterfaceAVKit::canPlayFastReverseChanged):
2114         (WebCore::WebPlaybackSessionInterfaceAVKit::audioMediaSelectionOptionsChanged):
2115         (WebCore::WebPlaybackSessionInterfaceAVKit::legibleMediaSelectionOptionsChanged):
2116         (WebCore::WebPlaybackSessionInterfaceAVKit::externalPlaybackChanged):
2117         (WebCore::WebPlaybackSessionInterfaceAVKit::wirelessVideoPlaybackDisabledChanged):
2118         (WebCore::WebPlaybackSessionInterfaceAVKit::invalidate):
2119         (WebCore::WebPlaybackSessionInterfaceAVKit::setWebPlaybackSessionModel): Deleted.
2120         (WebCore::WebPlaybackSessionInterfaceAVKit::setDuration): Deleted.
2121         (WebCore::WebPlaybackSessionInterfaceAVKit::setCurrentTime): Deleted.
2122         (WebCore::WebPlaybackSessionInterfaceAVKit::setBufferedTime): Deleted.
2123         (WebCore::WebPlaybackSessionInterfaceAVKit::setRate): Deleted.
2124         (WebCore::WebPlaybackSessionInterfaceAVKit::setSeekableRanges): Deleted.
2125         (WebCore::WebPlaybackSessionInterfaceAVKit::setCanPlayFastReverse): Deleted.
2126         (WebCore::WebPlaybackSessionInterfaceAVKit::setAudioMediaSelectionOptions): Deleted.
2127         (WebCore::WebPlaybackSessionInterfaceAVKit::setLegibleMediaSelectionOptions): Deleted.
2128         (WebCore::WebPlaybackSessionInterfaceAVKit::setExternalPlayback): Deleted.
2129         (WebCore::WebPlaybackSessionInterfaceAVKit::setWirelessVideoPlaybackDisabled): Deleted.
2130         (WebCore::WebPlaybackSessionInterfaceAVKit::wirelessVideoPlaybackDisabled): Deleted.
2131         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
2132         (WebVideoFullscreenControllerContext::didSetupFullscreen):
2133         (WebVideoFullscreenControllerContext::didExitFullscreen):
2134         (WebVideoFullscreenControllerContext::didCleanupFullscreen):
2135         (WebVideoFullscreenControllerContext::durationChanged):
2136         (WebVideoFullscreenControllerContext::currentTimeChanged):
2137         (WebVideoFullscreenControllerContext::bufferedTimeChanged):
2138         (WebVideoFullscreenControllerContext::rateChanged):
2139         (WebVideoFullscreenControllerContext::hasVideoChanged):
2140         (WebVideoFullscreenControllerContext::videoDimensionsChanged):
2141         (WebVideoFullscreenControllerContext::seekableRangesChanged):
2142         (WebVideoFullscreenControllerContext::canPlayFastReverseChanged):
2143         (WebVideoFullscreenControllerContext::audioMediaSelectionOptionsChanged):
2144         (WebVideoFullscreenControllerContext::legibleMediaSelectionOptionsChanged):
2145         (WebVideoFullscreenControllerContext::externalPlaybackChanged):
2146         (WebVideoFullscreenControllerContext::wirelessVideoPlaybackDisabledChanged):
2147         (WebVideoFullscreenControllerContext::addClient):
2148         (WebVideoFullscreenControllerContext::removeClient):
2149         (WebVideoFullscreenControllerContext::requestFullscreenMode):
2150         (WebVideoFullscreenControllerContext::setVideoLayerFrame):
2151         (WebVideoFullscreenControllerContext::setVideoLayerGravity):
2152         (WebVideoFullscreenControllerContext::fullscreenModeChanged):
2153         (WebVideoFullscreenControllerContext::isVisible):
2154         (WebVideoFullscreenControllerContext::hasVideo):
2155         (WebVideoFullscreenControllerContext::videoDimensions):
2156         (WebVideoFullscreenControllerContext::play):
2157         (WebVideoFullscreenControllerContext::pause):
2158         (WebVideoFullscreenControllerContext::togglePlayState):
2159         (WebVideoFullscreenControllerContext::beginScrubbing):
2160         (WebVideoFullscreenControllerContext::endScrubbing):
2161         (WebVideoFullscreenControllerContext::seekToTime):
2162         (WebVideoFullscreenControllerContext::fastSeek):
2163         (WebVideoFullscreenControllerContext::beginScanningForward):
2164         (WebVideoFullscreenControllerContext::beginScanningBackward):
2165         (WebVideoFullscreenControllerContext::endScanning):
2166         (WebVideoFullscreenControllerContext::selectAudioMediaOption):
2167         (WebVideoFullscreenControllerContext::selectLegibleMediaOption):
2168         (WebVideoFullscreenControllerContext::duration):
2169         (WebVideoFullscreenControllerContext::currentTime):
2170         (WebVideoFullscreenControllerContext::bufferedTime):
2171         (WebVideoFullscreenControllerContext::isPlaying):
2172         (WebVideoFullscreenControllerContext::playbackRate):
2173         (WebVideoFullscreenControllerContext::seekableRanges):
2174         (WebVideoFullscreenControllerContext::canPlayFastReverse):
2175         (WebVideoFullscreenControllerContext::audioMediaSelectionOptions):
2176         (WebVideoFullscreenControllerContext::audioMediaSelectedIndex):
2177         (WebVideoFullscreenControllerContext::legibleMediaSelectionOptions):
2178         (WebVideoFullscreenControllerContext::legibleMediaSelectedIndex):
2179         (WebVideoFullscreenControllerContext::externalPlaybackEnabled):
2180         (WebVideoFullscreenControllerContext::externalPlaybackTargetType):
2181         (WebVideoFullscreenControllerContext::externalPlaybackLocalizedDeviceName):
2182         (WebVideoFullscreenControllerContext::wirelessVideoPlaybackDisabled):
2183         (WebVideoFullscreenControllerContext::setUpFullscreen):
2184         (WebVideoFullscreenControllerContext::exitFullscreen):
2185         (WebVideoFullscreenControllerContext::requestHideAndExitFullscreen):
2186         (WebVideoFullscreenControllerContext::resetMediaState): Deleted.
2187         (WebVideoFullscreenControllerContext::setDuration): Deleted.
2188         (WebVideoFullscreenControllerContext::setCurrentTime): Deleted.
2189         (WebVideoFullscreenControllerContext::setBufferedTime): Deleted.
2190         (WebVideoFullscreenControllerContext::setRate): Deleted.
2191         (WebVideoFullscreenControllerContext::setVideoDimensions): Deleted.
2192         (WebVideoFullscreenControllerContext::setSeekableRanges): Deleted.
2193         (WebVideoFullscreenControllerContext::setCanPlayFastReverse): Deleted.
2194         (WebVideoFullscreenControllerContext::setAudioMediaSelectionOptions): Deleted.
2195         (WebVideoFullscreenControllerContext::setLegibleMediaSelectionOptions): Deleted.
2196         (WebVideoFullscreenControllerContext::setExternalPlayback): Deleted.
2197         (WebVideoFullscreenControllerContext::setWirelessVideoPlaybackDisabled): Deleted.
2198         (WebVideoFullscreenSessionModel::play): Deleted.
2199         (WebVideoFullscreenSessionModel::pause): Deleted.
2200         (WebVideoFullscreenSessionModel::togglePlayState): Deleted.
2201         (WebVideoFullscreenSessionModel::beginScrubbing): Deleted.
2202         (WebVideoFullscreenSessionModel::endScrubbing): Deleted.
2203         (WebVideoFullscreenSessionModel::seekToTime): Deleted.
2204         (WebVideoFullscreenSessionModel::fastSeek): Deleted.
2205         (WebVideoFullscreenSessionModel::beginScanningForward): Deleted.
2206         (WebVideoFullscreenSessionModel::beginScanningBackward): Deleted.
2207         (WebVideoFullscreenSessionModel::endScanning): Deleted.
2208         (WebVideoFullscreenSessionModel::selectAudioMediaOption): Deleted.
2209         (WebVideoFullscreenSessionModel::selectLegibleMediaOption): Deleted.
2210         * platform/ios/WebVideoFullscreenInterfaceAVKit.h:
2211         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
2212         (WebVideoFullscreenInterfaceAVKit::~WebVideoFullscreenInterfaceAVKit):
2213         (WebVideoFullscreenInterfaceAVKit::setWebVideoFullscreenModel):
2214         (WebVideoFullscreenInterfaceAVKit::setWebVideoFullscreenChangeObserver):
2215         (WebVideoFullscreenInterfaceAVKit::hasVideoChanged):
2216         (WebVideoFullscreenInterfaceAVKit::videoDimensionsChanged):
2217         (WebVideoFullscreenInterfaceAVKit::externalPlaybackChanged):
2218         (WebVideoFullscreenInterfaceAVKit::resetMediaState): Deleted.
2219         (WebVideoFullscreenInterfaceAVKit::setDuration): Deleted.
2220         (WebVideoFullscreenInterfaceAVKit::setCurrentTime): Deleted.
2221         (WebVideoFullscreenInterfaceAVKit::setBufferedTime): Deleted.
2222         (WebVideoFullscreenInterfaceAVKit::setRate): Deleted.
2223         (WebVideoFullscreenInterfaceAVKit::setVideoDimensions): Deleted.
2224         (WebVideoFullscreenInterfaceAVKit::setSeekableRanges): Deleted.
2225         (WebVideoFullscreenInterfaceAVKit::setCanPlayFastReverse): Deleted.
2226         (WebVideoFullscreenInterfaceAVKit::setAudioMediaSelectionOptions): Deleted.
2227         (WebVideoFullscreenInterfaceAVKit::setLegibleMediaSelectionOptions): Deleted.
2228         (WebVideoFullscreenInterfaceAVKit::setExternalPlayback): Deleted.
2229         (WebVideoFullscreenInterfaceAVKit::externalPlaybackEnabledChanged): Deleted.
2230         (WebVideoFullscreenInterfaceAVKit::setWirelessVideoPlaybackDisabled): Deleted.
2231         (WebVideoFullscreenInterfaceAVKit::wirelessVideoPlaybackDisabled): Deleted.
2232         * platform/mac/WebPlaybackSessionInterfaceMac.h:
2233         (WebCore::WebPlaybackSessionInterfaceMacClient::~WebPlaybackSessionInterfaceMacClient): Deleted.
2234         * platform/mac/WebPlaybackSessionInterfaceMac.mm:
2235         (WebCore::WebPlaybackSessionInterfaceMac::create):
2236         (WebCore::WebPlaybackSessionInterfaceMac::WebPlaybackSessionInterfaceMac):
2237         (WebCore::WebPlaybackSessionInterfaceMac::~WebPlaybackSessionInterfaceMac):
2238         (WebCore::WebPlaybackSessionInterfaceMac::durationChanged):
2239         (WebCore::WebPlaybackSessionInterfaceMac::currentTimeChanged):
2240         (WebCore::WebPlaybackSessionInterfaceMac::rateChanged):
2241         (WebCore::WebPlaybackSessionInterfaceMac::seekableRangesChanged):
2242         (WebCore::WebPlaybackSessionInterfaceMac::audioMediaSelectionOptionsChanged):
2243         (WebCore::WebPlaybackSessionInterfaceMac::legibleMediaSelectionOptionsChanged):
2244         (WebCore::WebPlaybackSessionInterfaceMac::invalidate):
2245         (WebCore::WebPlaybackSessionInterfaceMac::setWebPlaybackSessionModel): Deleted.
2246         (WebCore::WebPlaybackSessionInterfaceMac::setClient): Deleted.
2247         (WebCore::WebPlaybackSessionInterfaceMac::setDuration): Deleted.
2248         (WebCore::WebPlaybackSessionInterfaceMac::setCurrentTime): Deleted.
2249         (WebCore::WebPlaybackSessionInterfaceMac::setRate): Deleted.
2250         (WebCore::WebPlaybackSessionInterfaceMac::setSeekableRanges): Deleted.
2251         (WebCore::WebPlaybackSessionInterfaceMac::setAudioMediaSelectionOptions): Deleted.
2252         (WebCore::WebPlaybackSessionInterfaceMac::setLegibleMediaSelectionOptions): Deleted.
2253         * platform/mac/WebVideoFullscreenInterfaceMac.h:
2254         * platform/mac/WebVideoFullscreenInterfaceMac.mm:
2255         (WebCore::WebVideoFullscreenInterfaceMac::WebVideoFullscreenInterfaceMac):
2256         (WebCore::WebVideoFullscreenInterfaceMac::~WebVideoFullscreenInterfaceMac):
2257         (WebCore::WebVideoFullscreenInterfaceMac::setWebVideoFullscreenModel):
2258         (WebCore::WebVideoFullscreenInterfaceMac::externalPlaybackChanged):
2259         (WebCore::WebVideoFullscreenInterfaceMac::hasVideoChanged):
2260         (WebCore::WebVideoFullscreenInterfaceMac::videoDimensionsChanged):
2261         (WebCore::WebVideoFullscreenInterfaceMac::setDuration): Deleted.
2262         (WebCore::WebVideoFullscreenInterfaceMac::setCurrentTime): Deleted.
2263         (WebCore::WebVideoFullscreenInterfaceMac::setRate): Deleted.
2264         (WebCore::WebVideoFullscreenInterfaceMac::setSeekableRanges): Deleted.
2265         (WebCore::WebVideoFullscreenInterfaceMac::setAudioMediaSelectionOptions): Deleted.
2266         (WebCore::WebVideoFullscreenInterfaceMac::setLegibleMediaSelectionOptions): Deleted.
2267         (WebCore::WebVideoFullscreenInterfaceMac::setExternalPlayback): Deleted.
2268         (WebCore::WebVideoFullscreenInterfaceMac::setVideoDimensions): Deleted.
2269
2270 2016-09-02  Chris Dumez  <cdumez@apple.com>
2271
2272         REGRESSION (r204839): [mac-wk1] LayoutTest webgl/max-active-contexts-webglcontextlost-prevent-default.html is a flaky timeout
2273         https://bugs.webkit.org/show_bug.cgi?id=161205
2274
2275         Reviewed by Geoffrey Garen.
2276
2277         Fixes several issues:
2278         - Add missing isReachableFromOpaqueRoots() implementation for JSWebGLRenderingContextBase.
2279           It used to rely on the one from its JSCanvasRenderingContext base. However, that base
2280           was dropped in r204839.
2281         - Update JSWebGLRenderingContextBase::visitAdditionalChildren() to add its canvas
2282           object as opaque root as well. This used to be taken care of by
2283           JSCanvasRenderingContext::visitAdditionalChildren() but it got dropped in r204839.
2284
2285         This also refactors the code a bit for clarity.
2286
2287         No new tests, unskipped existing test.
2288
2289         * WebCore.xcodeproj/project.pbxproj:
2290         * bindings/js/JSCanvasRenderingContext.h: Removed.
2291         * bindings/js/JSDocumentCustom.cpp:
2292         (WebCore::JSDocument::getCSSCanvasContext):
2293         * bindings/js/JSHTMLCanvasElementCustom.cpp:
2294         (WebCore::JSHTMLCanvasElement::getContext):
2295         * bindings/js/JSWebGLRenderingContextBaseCustom.cpp:
2296         (WebCore::toJSNewlyCreated):
2297         (WebCore::toJS):
2298         (WebCore::JSWebGLRenderingContextBaseOwner::isReachableFromOpaqueRoots):
2299         (WebCore::JSWebGLRenderingContextBase::visitAdditionalChildren):
2300         * html/canvas/CanvasRenderingContext.h:
2301         (WebCore::CanvasRenderingContext::is3d):
2302         * html/canvas/WebGLRenderingContextBase.h:
2303         * html/canvas/WebGLRenderingContextBase.idl:
2304
2305 2016-09-02  Chris Dumez  <cdumez@apple.com>
2306
2307         Object.preventExtensions() should throw cross-origin
2308         https://bugs.webkit.org/show_bug.cgi?id=161486
2309
2310         Reviewed by Geoffrey Garen.
2311
2312         Object.preventExtensions() should throw cross-origin:
2313         - https://html.spec.whatwg.org/#windowproxy-preventextensions
2314         - https://html.spec.whatwg.org/#location-preventextensions
2315         - http://www.ecma-international.org/ecma-262/6.0/#sec-object.preventextensions
2316
2317         Firefox and Chrome both throw in the cross-origin case. Firefox also throws
2318         a TypeError in the same-origin case for Window, as per the specification.
2319         However, Firefox does not seem to throw yet in the same-origin case for
2320         Location yet.
2321
2322         Test: http/tests/security/preventExtensions-window-location.html
2323
2324         * bindings/js/JSDOMWindowCustom.cpp:
2325         (WebCore::JSDOMWindow::preventExtensions):
2326         * bindings/js/JSLocationCustom.cpp:
2327         (WebCore::JSLocation::preventExtensions):
2328         * bindings/scripts/CodeGeneratorJS.pm:
2329         (GenerateHeader):
2330         * bindings/scripts/IDLAttributes.txt:
2331         * page/DOMWindow.idl:
2332         * page/Location.idl:
2333
2334 2016-09-02  Chris Dumez  <cdumez@apple.com>
2335
2336         Object.defineProperty() should throw cross-origin
2337         https://bugs.webkit.org/show_bug.cgi?id=161460
2338
2339         Reviewed by Geoffrey Garen.
2340
2341         Object.defineProperty() should throw cross-origin to match Firefox and
2342         Chrome.
2343
2344         The specification is in the process of being updated to match the
2345         behavior of browsers.
2346
2347         Test: http/tests/security/window-defineProperty-crossOrigin.html
2348
2349         * bindings/js/JSDOMWindowCustom.cpp:
2350         (WebCore::JSDOMWindow::defineOwnProperty):
2351         * bindings/js/JSLocationCustom.cpp:
2352         (WebCore::JSLocation::defineOwnProperty):
2353
2354 2016-09-02  Brady Eidson  <beidson@apple.com>
2355
2356         Weak link the GameController.framework on macOS but differently than before.
2357
2358         Reviewed by Dan Bernstein.
2359         
2360         * Configurations/WebCore.xcconfig:
2361
2362 2016-09-02  Chris Dumez  <cdumez@apple.com>
2363
2364         Align proto getter / setter behavior with other browsers
2365         https://bugs.webkit.org/show_bug.cgi?id=161455
2366
2367         Reviewed by Mark Lam.
2368
2369         Align cross-origin __proto__ getter / setter behavior with other
2370         browsers and the specification:
2371
2372         [[SetPrototypeOf]] should throw a TypeError:
2373         - https://html.spec.whatwg.org/#windowproxy-setprototypeof
2374         - https://html.spec.whatwg.org/#location-setprototypeof
2375         - https://tc39.github.io/ecma262/#sec-object.setprototypeof (step 5)
2376
2377         [[GetPrototypeOf]] should return null cross-origin:
2378         - https://html.spec.whatwg.org/#windowproxy-getprototypeof
2379         - https://html.spec.whatwg.org/#location-getprototypeof
2380
2381         Test: js/dom/setPrototypeOf-location-window.html
2382
2383         * bindings/js/JSDOMWindowBase.cpp:
2384         (WebCore::JSDOMWindowBase::JSDOMWindowBase): Deleted.
2385         * bindings/js/JSDOMWindowCustom.cpp:
2386         (WebCore::JSDOMWindow::setPrototype):
2387         (WebCore::JSDOMWindow::getPrototype):
2388         * bindings/js/JSLocationCustom.cpp:
2389         (WebCore::JSLocation::setPrototype):
2390         (WebCore::JSLocation::getPrototype):
2391         * bindings/js/JSWorkerGlobalScopeBase.cpp:
2392         (WebCore::JSWorkerGlobalScopeBase::supportsRichSourceInfo): Deleted.
2393         * bindings/js/JSWorkerGlobalScopeBase.h:
2394         * bindings/scripts/CodeGeneratorJS.pm:
2395         (GenerateHeader):
2396         * bindings/scripts/IDLAttributes.txt:
2397         * page/DOMWindow.idl:
2398         * page/Location.idl:
2399
2400 2016-09-02  Eric Carlson  <eric.carlson@apple.com>
2401
2402         [MediaStream] applyConstraints pt. 1 - mandatory constraints
2403         https://bugs.webkit.org/show_bug.cgi?id=161469
2404         <rdar://problem/28109325>
2405
2406         Reviewed by Jer Noble.
2407
2408         Tests: fast/mediastream/apply-constraints-audio.html
2409                fast/mediastream/apply-constraints-video.html
2410
2411         * Modules/mediastream/MediaStreamTrack.cpp:
2412         (WebCore::MediaStreamTrack::MediaStreamTrack): Initialize the weak pointer factory.
2413         (WebCore::MediaStreamTrack::applyConstraints): Make it work.
2414         * Modules/mediastream/MediaStreamTrack.h:
2415         * Modules/mediastream/MediaStreamTrack.idl:
2416
2417         * WebCore.xcodeproj/project.pbxproj: Add JSMediaDevicesCustom.h.
2418
2419         * bindings/js/JSMediaDevicesCustom.cpp:
2420         (WebCore::createStringConstraint): Add name parameter.
2421         (WebCore::createBooleanConstraint): Ditto.
2422         (WebCore::createDoubleConstraint): Ditto.
2423         (WebCore::createIntConstraint): Ditto.
2424         (WebCore::parseMediaTrackConstraintSetForKey): Drop type parameter because we don't need to
2425           filter by source media type.
2426         (WebCore::parseAdvancedConstraints): Ditto.
2427         (WebCore::parseMediaConstraintsDictionary): Renamed from parseConstraints.
2428         (WebCore::JSMediaDevices::getUserMedia): Don't throw exceptions, always return a promise.
2429         (WebCore::parseConstraints): Deleted.
2430         * bindings/js/JSMediaDevicesCustom.h: Added.
2431
2432         * bindings/js/JSMediaStreamTrackCustom.cpp:
2433         (WebCore::JSMediaStreamTrack::getSettings): Don't include aspect ratio if the value is 0.
2434         (WebCore::capabilityValue): asULong -> asInt.
2435         (WebCore::JSMediaStreamTrack::applyConstraints): New.
2436         (WebCore::JSMediaStreamTrack::getConstraints): New.
2437
2438         * bindings/js/WebCoreBuiltinNames.h: Add "mediaStreamTrackConstraints".
2439
2440         * html/HTMLMediaElement.cpp:
2441         (WebCore::HTMLMediaElement::setSrcObject): Drive by fix: don't call DOMURL::createPublicURL(null).
2442
2443         * platform/mediastream/MediaConstraints.cpp:
2444         (WebCore::MediaConstraint::create): Pass name to constructors.
2445         (WebCore::StringConstraint::find): New.
2446         * platform/mediastream/MediaConstraints.h:
2447
2448         * platform/mediastream/MediaStreamTrackPrivate.cpp:
2449         (WebCore::MediaStreamTrackPrivate::applyConstraints): Add callback parameters.
2450         * platform/mediastream/MediaStreamTrackPrivate.h:
2451
2452         * platform/mediastream/RealtimeMediaSource.cpp:
2453         (WebCore::RealtimeMediaSource::RealtimeMediaSource): Initialize weak pointer factory.
2454         (WebCore::RealtimeMediaSource::settingsDidChange): Don't call observers immediately so we can
2455          coalesce multiple changes in the same runloop cycle.
2456         (WebCore::RealtimeMediaSource::supportsConstraint): New.
2457         (WebCore::value): Return the most appropriate value from a numeric constraint.
2458         (WebCore::RealtimeMediaSource::applyConstraint): New, apply one constraint.
2459         (WebCore::RealtimeMediaSource::applyConstraints): New, validate and apply constraints.
2460         (WebCore::RealtimeMediaSource::setWidth): New.
2461         (WebCore::RealtimeMediaSource::setHeight): New.
2462         (WebCore::RealtimeMediaSource::setFrameRate): New.
2463         (WebCore::RealtimeMediaSource::setAspectRatio): New.
2464         (WebCore::RealtimeMediaSource::setFacingMode): New.
2465         (WebCore::RealtimeMediaSource::setVolume): New.
2466         (WebCore::RealtimeMediaSource::setSampleRate): New.
2467         (WebCore::RealtimeMediaSource::setSampleSize): New.
2468         (WebCore::RealtimeMediaSource::setEchoCancellation) New.:
2469         (WebCore::RealtimeMediaSource::scheduleDeferredTask): New.
2470         * platform/mediastream/RealtimeMediaSource.h:
2471
2472         * platform/mediastream/RealtimeMediaSourceCapabilities.h:
2473         (WebCore::CapabilityValueOrRange::CapabilityValueOrRange): "unsigned long" -> "int"
2474
2475         * platform/mediastream/RealtimeMediaSourceSettings.cpp:
2476         (WebCore::userFacing): New.
2477         (WebCore::environmentFacing): New.
2478         (WebCore::leftFacing): New.
2479         (WebCore::rightFacing): New.
2480         (WebCore::RealtimeMediaSourceSettings::facingMode):
2481         (WebCore::RealtimeMediaSourceSettings::videoFacingModeEnum):
2482         * platform/mediastream/RealtimeMediaSourceSettings.h:
2483
2484         * platform/mediastream/mac/AVAudioCaptureSource.mm:
2485         (WebCore::AVAudioCaptureSource::initializeCapabilities): Volume range is 0.0 .. 1.0.
2486
2487         * platform/mediastream/mac/AVMediaCaptureSource.h:
2488         (WebCore::AVMediaCaptureSource::createWeakPtr): Deleted.
2489         * platform/mediastream/mac/AVMediaCaptureSource.mm:
2490         (WebCore::AVMediaCaptureSource::AVMediaCaptureSource): Don't need the weak ptr factory, it is
2491           in the base class.
2492         (WebCore::AVMediaCaptureSource::scheduleDeferredTask): Deleted.
2493
2494         * platform/mediastream/mac/AVVideoCaptureSource.h:
2495         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2496         (WebCore::AVVideoCaptureSource::applySize): New.
2497         (WebCore::AVVideoCaptureSource::applyFrameRate): New.
2498         (WebCore::AVVideoCaptureSource::setupCaptureSession):
2499         (WebCore::AVVideoCaptureSource::setFrameRateConstraint): Deleted.
2500         (WebCore::AVVideoCaptureSource::applyConstraints): Deleted.
2501
2502         * platform/mock/MockRealtimeAudioSource.cpp:
2503         (WebCore::MockRealtimeAudioSource::updateSettings): Set volume and echoCancellation to the
2504           current values.
2505         (WebCore::MockRealtimeAudioSource::initializeCapabilities): Volume takes a float, not an int.
2506         * platform/mock/MockRealtimeAudioSource.h:
2507
2508         * platform/mock/MockRealtimeMediaSource.cpp: Minor cleanup.
2509         * platform/mock/MockRealtimeMediaSource.h:
2510
2511         * platform/mock/MockRealtimeVideoSource.cpp:
2512         (WebCore::MockRealtimeVideoSource::MockRealtimeVideoSource): Initialize frame rate.
2513         (WebCore::MockRealtimeVideoSource::startProducingData): m_size -> size().
2514         (WebCore::MockRealtimeVideoSource::updateSettings): Use accessors because instance variables
2515           have been moved to the base class.
2516         (WebCore::MockRealtimeVideoSource::initializeCapabilities): Ditto.
2517         (WebCore::MockRealtimeVideoSource::applyFrameRate): New.
2518         (WebCore::MockRealtimeVideoSource::applySize):
2519         (WebCore::MockRealtimeVideoSource::drawAnimation):
2520         (WebCore::MockRealtimeVideoSource::drawBoxes):
2521         (WebCore::MockRealtimeVideoSource::drawText):
2522         (WebCore::MockRealtimeVideoSource::generateFrame):
2523         (WebCore::MockRealtimeVideoSource::imageBuffer):
2524         (WebCore::MockRealtimeVideoSource::setFrameRate): Deleted.
2525         (WebCore::MockRealtimeVideoSource::setSize): Deleted.
2526         * platform/mock/MockRealtimeVideoSource.h:
2527         (WebCore::MockRealtimeVideoSource::size): Deleted.
2528
2529 2016-09-02  Brady Eidson  <beidson@apple.com>
2530
2531         Weak link the GameController.framework on macOS.
2532
2533         Reviewed by Tim Horton.
2534         
2535         * Configurations/WebCore.xcconfig:
2536
2537 2016-09-02  Commit Queue  <commit-queue@webkit.org>
2538
2539         Unreviewed, rolling out r205344.
2540         https://bugs.webkit.org/show_bug.cgi?id=161533
2541
2542         Hitting assertions under CachedResource::removeClient in a few
2543         tests (Requested by anttik on #webkit).
2544
2545         Reverted changeset:
2546
2547         "Reverse ownership relation of StyleCachedImage and
2548         CSSImageValue"
2549         https://bugs.webkit.org/show_bug.cgi?id=161447
2550         http://trac.webkit.org/changeset/205344
2551
2552 2016-09-02  Antti Koivisto  <antti@apple.com>
2553
2554         Reverse ownership relation of StyleCachedImage and CSSImageValue
2555         https://bugs.webkit.org/show_bug.cgi?id=161447
2556
2557         Reviewed by Andreas Kling.
2558
2559         Currently StyleCachedImage (which represents an image in RenderStyle) has a weak ref to the
2560         underlying CSSImageValue/CSSImageSetValue which actually owns it. This is awkwards especially since
2561         StyleGeneratedImage, the other StyleImage subclass has reversed relationship where it refs
2562         the underlying CSSImageGeneratorValue.
2563
2564         This patch makes StyleCachedImage similar to StyleGeneratedImage. StyleCachedImage now refs the
2565         underlying CSSImageValue/CSSImageSetValue. CSSImageValues no longer need to know about StyleCachedImage.
2566         Instead they reference CachedImages (memory cache objects) directly. StyleCachedImage instances are now
2567         conceptually unique to RenderStyle instances. Actual resources are shared as before by sharing CachedImages.
2568
2569         * css/CSSCursorImageValue.cpp:
2570         (WebCore::CSSCursorImageValue::loadImage):
2571         (WebCore::CSSCursorImageValue::cachedImage):
2572         (WebCore::CSSCursorImageValue::styleImage): Deleted.
2573         * css/CSSCursorImageValue.h:
2574         * css/CSSImageGeneratorValue.cpp:
2575         (WebCore::CSSImageGeneratorValue::cachedImageForCSSValue):
2576         * css/CSSImageSetValue.cpp:
2577         (WebCore::CSSImageSetValue::~CSSImageSetValue):
2578         (WebCore::CSSImageSetValue::loadBestFitImage):
2579         (WebCore::CSSImageSetValue::traverseSubresources):
2580         (WebCore::CSSImageSetValue::styleImage): Deleted.
2581         * css/CSSImageSetValue.h:
2582         * css/CSSImageValue.cpp:
2583         (WebCore::CSSImageValue::CSSImageValue):
2584         (WebCore::CSSImageValue::~CSSImageValue):
2585         (WebCore::CSSImageValue::isPending):
2586         (WebCore::CSSImageValue::loadImage):
2587         (WebCore::CSSImageValue::traverseSubresources):
2588         (WebCore::CSSImageValue::knownToBeOpaque):
2589         (WebCore::CSSImageValue::styleImage): Deleted.
2590         * css/CSSImageValue.h:
2591         * css/StyleBuilderCustom.h:
2592         (WebCore::StyleBuilderCustom::applyValueContent):
2593         * css/StyleResolver.cpp:
2594         (WebCore::StyleResolver::styleImage):
2595         (WebCore::StyleResolver::styleCachedImageFromValue):
2596         (WebCore::StyleResolver::styleGeneratedImageFromValue):
2597         (WebCore::StyleResolver::cachedOrPendingFromValue): Deleted.
2598         (WebCore::StyleResolver::generatedOrPendingFromValue): Deleted.
2599         (WebCore::StyleResolver::setOrPendingFromValue): Deleted.
2600         (WebCore::StyleResolver::cursorOrPendingFromValue): Deleted.
2601         * css/StyleResolver.h:
2602         * editing/TextIterator.cpp:
2603         (WebCore::fullyClipsContents):
2604         * page/PageSerializer.cpp:
2605         (WebCore::PageSerializer::retrieveResourcesForProperties):
2606         * rendering/style/FillLayer.cpp:
2607         (WebCore::FillLayer::imagesIdentical):
2608
2609             Compare data equality instead of pointer equality for StyleImages (since StyleImages are no longer shared).
2610
2611         (WebCore::layerImagesIdentical): Deleted.
2612         * rendering/style/StyleCachedImage.cpp:
2613         (WebCore::StyleCachedImage::StyleCachedImage):
2614         (WebCore::StyleCachedImage::~StyleCachedImage):
2615         (WebCore::StyleCachedImage::cachedImage):
2616         (WebCore::StyleCachedImage::cssValue):
2617         (WebCore::StyleCachedImage::canRender):
2618         (WebCore::StyleCachedImage::isPending):
2619         (WebCore::StyleCachedImage::isLoaded):
2620         (WebCore::StyleCachedImage::errorOccurred):
2621         (WebCore::StyleCachedImage::imageSize):
2622         (WebCore::StyleCachedImage::imageHasRelativeWidth):
2623         (WebCore::StyleCachedImage::imageHasRelativeHeight):
2624         (WebCore::StyleCachedImage::computeIntrinsicDimensions):
2625         (WebCore::StyleCachedImage::usesImageContainerSize):
2626         (WebCore::StyleCachedImage::setContainerSizeForRenderer):
2627         (WebCore::StyleCachedImage::addClient):
2628         (WebCore::StyleCachedImage::removeClient):
2629         (WebCore::StyleCachedImage::image):
2630         (WebCore::StyleCachedImage::knownToBeOpaque):
2631         (WebCore::StyleCachedImage::setCachedImage): Deleted.
2632         * rendering/style/StyleCachedImage.h:
2633
2634 2016-09-01  Ryosuke Niwa  <rniwa@webkit.org>
2635
2636         Only update connected custom elements
2637         https://bugs.webkit.org/show_bug.cgi?id=161480
2638
2639         Reviewed by Yusuke Suzuki.
2640
2641         In the latest specs, creating an element only upgrades an element if the custom element had already been defined:
2642         https://dom.spec.whatwg.org/#concept-create-element
2643
2644         Otherwise, an element remains unresolved until it gets connected to the document associated with the global object:
2645         https://dom.spec.whatwg.org/#concept-node-insert
2646
2647         This patch removes the upgrade candidate map in CustomElementRegistry, and traverses the entire document associated
2648         with global object (DOMWindow) in addElementDefinition: https://html.spec.whatwg.org/#dom-customelementregistry-define
2649
2650         The traversal is done in the shadow-including tree order (different from depth-first preorder traversal of flat tree)
2651         since it doesn't enter slots and children of shadow hosts are always visited even if they are not assigned to a slot:
2652         https://dom.spec.whatwg.org/#concept-shadow-including-tree-order
2653
2654         Test: fast/custom-elements/enqueue-custom-element-upgrade-reaction.html
2655
2656         * bindings/js/JSCustomElementInterface.cpp:
2657         (WebCore::JSCustomElementInterface::upgradeElement): Assert that the element being upgraded as the same qualified name
2658         as the custom element interface.
2659         * bindings/js/JSCustomElementRegistryCustom.cpp:
2660         (WebCore::JSCustomElementRegistry::define): Moved the code to resolve the promise from here to addElementDefinition.
2661         Also cleaned up the code to extract callbacks a little.
2662         * dom/CustomElementReactionQueue.cpp:
2663         (WebCore::CustomElementReactionQueue::enqueueElementUpgrade): Added an assertion.
2664         (WebCore::CustomElementReactionQueue::enqueueElementUpgradeIfDefined): Added. Upgrade an element if the custom element
2665         had already been defined.
2666         * dom/CustomElementReactionQueue.h:
2667         * dom/CustomElementRegistry.cpp:
2668         (WebCore::CustomElementRegistry::create): Stores the reference to DOMWindow to find its document in addElementDefinition.
2669         (WebCore::CustomElementRegistry::CustomElementRegistry): Ditto.
2670         (WebCore::enqueueUpgradeInShadowIncludingTreeOrder): Added. Enqueue upgrade reactions in shadow-including tree order.
2671         (WebCore::CustomElementRegistry::addElementDefinition): Upgrade all unresolved elements that matches this definition and
2672         resolve the the promise returned by "whenDefined" if there is any.
2673         (WebCore::CustomElementRegistry::addUpgradeCandidate): Deleted.
2674         (WebCore::CustomElementRegistry::findInterface): Added a new variant that takes an element.
2675         * dom/CustomElementRegistry.h:
2676         * dom/Document.cpp:
2677         (WebCore::createUpgradeCandidateElement): No longer takes DOMWindow since we don't upgrade synchronously here. It's also
2678         wrong not to mark the element as unresolved custom element in a document without a browsing context per new semantics.
2679         (WebCore::createHTMLElementWithNameValidation): Ditto.
2680         (WebCore::createFallbackHTMLElement): Ditto.
2681         * dom/Element.cpp:
2682         (WebCore::Element::insertedInto): Enqueue an upgrade reaction if this is an unsolved custom element and there is now
2683         a definition for it (the latter condition is checked in enqueueElementUpgradeIfDefined).
2684         * html/parser/HTMLConstructionSite.cpp:
2685         (WebCore::HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface): Don't upgrade this element until it gets
2686         connected to a document in Element::insertedInto.
2687         * page/DOMWindow.cpp:
2688         (WebCore::DOMWindow::ensureCustomElementRegistry):
2689
2690 2016-09-01  Yusuke Suzuki  <utatane.tea@gmail.com>
2691
2692         Add toJS for JSC::PrivateName
2693         https://bugs.webkit.org/show_bug.cgi?id=161522
2694
2695         Reviewed by Ryosuke Niwa.
2696
2697         JSC::PrivateName is the wrapper to create and hold the ES6 Symbol instance.
2698         This patch adds toJS support for JSC::PrivateName.
2699         Later, the module integration patch will use this feature to call
2700         DeferredWrapper::{resolve,reject} with JSC::PrivateName.
2701
2702         * bindings/js/JSDOMBinding.h:
2703         (WebCore::toJS):
2704
2705 2016-09-01  Dan Bernstein  <mitz@apple.com>
2706
2707         Build fix.
2708
2709         * Configurations/FeatureDefines.xcconfig:
2710         * Configurations/WebCore.xcconfig:
2711         * WebCore.xcodeproj/project.pbxproj:
2712
2713 2016-09-01  Ricky Mondello  <rmondello@apple.com>
2714
2715         YouTube Flash plug-in replacement facility should not insert showinfo=0 into iframe URLs
2716         https://bugs.webkit.org/show_bug.cgi?id=161478
2717         <rdar://problem/28050847>
2718
2719         Reviewed by Eric Carlson.
2720
2721         * Modules/plugins/YouTubePluginReplacement.cpp:
2722         (WebCore::YouTubePluginReplacement::youTubeURLFromAbsoluteURL): Stop adding the query parameter.
2723
2724 2016-09-01  Mark Lam  <mark.lam@apple.com>
2725
2726         Move some JSObject and JSArray inline functions to their respective Inlines.h files.
2727         https://bugs.webkit.org/show_bug.cgi?id=161499
2728
2729         Reviewed by Saam Barati.
2730
2731         No new tests because there is no behavior change.
2732
2733         * ForwardingHeaders/runtime/JSObjectInlines.h: Added.
2734         * bindings/js/JSDOMBinding.h:
2735         * bindings/js/JSSQLTransactionCustom.cpp:
2736         * bindings/js/JSWebGLRenderingContextBaseCustom.cpp:
2737         * contentextensions/ContentExtensionParser.cpp:
2738
2739 2016-09-01  Michael Catanzaro  <mcatanzaro@igalia.com>
2740
2741         Fix ENABLE(CSS_GRID_LAYOUT) guards harder after r205102/r205292
2742
2743         Unreviewed. Silence unused function warning.
2744
2745         * css/CSSComputedStyleDeclaration.cpp:
2746
2747 2016-09-01  Alex Christensen  <achristensen@webkit.org>
2748
2749         Avoid unneeded string copy when parsing URL hosts
2750         https://bugs.webkit.org/show_bug.cgi?id=161511
2751
2752         Reviewed by Tim Horton.
2753
2754         No change in behavior.  Covered by existing API tests.
2755
2756         * platform/URLParser.cpp:
2757         (WebCore::URLParser::parse):
2758         (WebCore::URLParser::parseAuthority):
2759         (WebCore::URLParser::parseHost):
2760         (WebCore::URLParser::authorityEndReached): Deleted.
2761         (WebCore::URLParser::hostEndReached): Deleted.
2762         * platform/URLParser.h:
2763
2764 2016-09-01  Ryosuke Niwa  <rniwa@webkit.org>
2765
2766         Add "whenDefined" to CustomElementRegistry
2767         https://bugs.webkit.org/show_bug.cgi?id=161425
2768
2769         Reviewed by Yusuke Suzuki.
2770
2771         Add the support for "whenDefined" method on CustomElementRegistry: 
2772         https://html.spec.whatwg.org/#dom-customelementregistry-whendefined
2773
2774         Because it needs to store the newly created promise when the queried custom element has not been defined yet,
2775         we need to write custom binding code instead of relying on the binding generator.
2776
2777         Tests: fast/custom-elements/CustomElementRegistry.html
2778
2779         * bindings/js/JSCustomElementRegistryCustom.cpp:
2780         (WebCore::validateCustomElementNameAndThrowIfNeeded): Extracted out of JSCustomElementRegistry::define.
2781         (WebCore::JSCustomElementRegistry::define): Fulfill the "whenDefined" promise when the definition succeeds.
2782         (WebCore::whenDefinedPromise): Added. Return an existing promise if there is one, or create a new promise.
2783         We cache the created promise only if the custom element had not been defined yet since we'll indefinitely
2784         retain the resolved promise otherwise.
2785         (WebCore::JSCustomElementRegistry::whenDefined): Added. Calls whenDefinedPromise and returns a rejected
2786         promise when there was an exception.
2787         * dom/CustomElementRegistry.cpp:
2788         * dom/CustomElementRegistry.h:
2789         (WebCore::CustomElementRegistry::promiseMap): Added.
2790         * dom/CustomElementRegistry.idl:
2791
2792 2016-09-01  Alex Christensen  <achristensen@webkit.org>
2793
2794         URLParser should handle . and .. in URL paths
2795         https://bugs.webkit.org/show_bug.cgi?id=161443
2796
2797         Reviewed by Brady Eidson.
2798
2799         Covered by new API tests.
2800
2801         * platform/URLParser.cpp:
2802         (WebCore::isSingleDotPathSegment):
2803         (WebCore::isDoubleDotPathSegment):
2804         (WebCore::consumeSingleDotPathSegment):
2805         (WebCore::consumeDoubleDotPathSegment):
2806         (WebCore::URLParser::parse):
2807         (WebCore::URLParser::copyURLPartsUntil): Deleted.
2808
2809 2016-09-01  Alex Christensen  <achristensen@webkit.org>
2810
2811         Fix Mac CMake build.
2812
2813         * PlatformMac.cmake:
2814
2815 2016-09-01  Ricky Mondello  <rmondello@apple.com>
2816
2817         YouTube Flash plug-in replacement facility should more gracefully handle malformed queries
2818         https://bugs.webkit.org/show_bug.cgi?id=161476
2819         <rdar://problem/28050847>
2820
2821         Reviewed by Eric Carlson.
2822
2823         Some YouTube Flash embeds use '&' instead of '?' to start the query portion of the URL. Before this patch,
2824         our implementation discards all parts of the path after the '&', which could drop important query information
2825         like the start time for the video. This patch treats anything after that '&' as a "malformed query" and uses
2826         it as the query to restore to the transformed URL if there was no actual query in the original URL.
2827
2828         * Modules/plugins/YouTubePluginReplacement.cpp:
2829         (WebCore::processAndCreateYouTubeURL): Add an out-parameter for the path after the first ampersand.
2830         (WebCore::YouTubePluginReplacement::youTubeURLFromAbsoluteURL): If the input URL had no query, append
2831             the possibly malformed one found after the first ampersand to the replacement URL.
2832
2833 2016-09-01  Alex Christensen  <achristensen@webkit.org>
2834
2835         Fix Mac CMake build after r205266.
2836
2837         * PlatformMac.cmake:
2838         * platform/cocoa/URLParserCocoa.mm: Removed.
2839
2840 2016-09-01  Javier Fernandez  <jfernandez@igalia.com>
2841
2842         Unreviewed build fix after r205102.
2843
2844         The change made in r205102 caused compilation failures on
2845         builds with the CSS_GRID_LAYOUT compilation flag disabled.
2846
2847         * css/CSSComputedStyleDeclaration.cpp:
2848         (WebCore::ComputedStyleExtractor::propertyValue):
2849         (WebCore::resolveJustifySelfAuto): Deleted.
2850         * css/CSSPropertyNames.in:
2851         * css/parser/CSSParser.cpp:
2852         (WebCore::isKeywordPropertyID):
2853         (WebCore::CSSParser::parseValue):
2854
2855 2016-09-01  Fujii Hironori  <Hironori.Fujii@sony.com>
2856
2857         Fix the Mac cmake clean build issue
2858         https://bugs.webkit.org/show_bug.cgi?id=157261
2859
2860         Reviewed by Michael Catanzaro.
2861
2862         Building WebCoreDerivedSources target failed due to the race
2863         condition with building ForwardingHeaders of JavaScriptCore.
2864
2865         * CMakeLists.txt: Make WebCoreDerivedSources depends on JavaScriptCore.
2866
2867 2016-09-01  Andreas Kling  <akling@apple.com>
2868
2869         FocusController should pass KeyboardEvent around by reference.
2870         <https://webkit.org/b/161461>
2871
2872         Reviewed by Sam Weinig.
2873
2874         Clean up FocusController to pass KeyboardEvent& around internally.
2875
2876         Also make FocusController::setInitialFocus() synthesize a dummy KeyboardEvent
2877         if one isn't provided, just like nextFocusableElement()/previousFocusableElement() does.
2878         This way we can feel confident about dereferencing the formerly KeyboardEvent* everywhere.
2879
2880         * page/EventHandler.cpp:
2881         (WebCore::EventHandler::defaultArrowEventHandler):
2882         (WebCore::EventHandler::defaultTabEventHandler):
2883         * page/FocusController.cpp:
2884         (WebCore::isFocusableElementOrScopeOwner):
2885         (WebCore::isNonFocusableScopeOwner):
2886         (WebCore::isFocusableScopeOwner):
2887         (WebCore::shadowAdjustedTabIndex):
2888         (WebCore::FocusController::findFocusableElementDescendingDownIntoFrameDocument):
2889         (WebCore::FocusController::setInitialFocus):
2890         (WebCore::FocusController::advanceFocus):
2891         (WebCore::FocusController::advanceFocusInDocumentOrder):
2892         (WebCore::FocusController::findFocusableElementAcrossFocusScope):
2893         (WebCore::FocusController::findFocusableElementWithinScope):
2894         (WebCore::FocusController::nextFocusableElementWithinScope):
2895         (WebCore::FocusController::previousFocusableElementWithinScope):
2896         (WebCore::FocusController::findFocusableElementOrScopeOwner):
2897         (WebCore::FocusController::findElementWithExactTabIndex):
2898         (WebCore::nextElementWithGreaterTabIndex):
2899         (WebCore::previousElementWithLowerTabIndex):
2900         (WebCore::FocusController::nextFocusableElement):
2901         (WebCore::FocusController::previousFocusableElement):
2902         (WebCore::FocusController::nextFocusableElementOrScopeOwner):
2903         (WebCore::FocusController::previousFocusableElementOrScopeOwner):
2904         (WebCore::FocusController::findFocusCandidateInContainer):
2905         (WebCore::FocusController::advanceFocusDirectionallyInContainer):
2906         (WebCore::FocusController::advanceFocusDirectionally):
2907         * page/FocusController.h:
2908
2909 2016-09-01  Romain Bellessort  <romain.bellessort@crf.canon.fr>
2910
2911         [Streams API] Align internal structure of ReadableStream with spec
2912         https://bugs.webkit.org/show_bug.cgi?id=160299
2913
2914         Reviewed by Xabier Rodriguez-Calvar.
2915
2916         Aligned internal structure of ReadableStream with spec. Various
2917         internal properties have been moved to ReadableStreamDefaultController.
2918         In addition, various behaviors had to be updated. Several other changes
2919         will have to be performed in order to align with spec, e.g. changing
2920         functions names. This patch does not change them in order to make the
2921         structural changes easier to follow.
2922
2923         No change in functionality except support for 1 specific case where
2924         an error was not thrown while it should have been. Changed corresponding
2925         test expectation (now PASS instead of FAIL).
2926         Modified test expectation: web-platform-tests/streams/readable-streams/general.https-expected.txt
2927
2928         * Modules/fetch/FetchResponse.js:
2929         (initializeFetchResponse): Replaced reference to underlyingSource as no
2930         more a property of readableStream (use readableStreamController instead,
2931         as defined by spec).
2932         * Modules/streams/ReadableStream.js:
2933         (initializeReadableStream): Removed various properties now hanlded by
2934         ReadableStreamDefaultController.
2935         * Modules/streams/ReadableStreamDefaultController.js:
2936         (enqueue): Updated based on new properties repartition between reader and controller. 
2937         (error): Updated based on new properties repartition between reader and controller. 
2938         (close): Updated based on new properties repartition between reader and controller. 
2939         (desiredSize): Updated based on new properties repartition between reader and controller. 
2940         * Modules/streams/ReadableStreamInternals.js:
2941         (privateInitializeReadableStreamDefaultController): Added various properties now handled by
2942         ReadableStreamDefaultController, as well as an internal pull function defined by spec.
2943         (readableStreamDefaultControllerError): Added based on spec (error handling at controller level).
2944         (teeReadableStream): Fixed typo and use readableStreamDefaultControllerError instead of errorReadableStream.
2945         (doStructuredClone): Added "use strict";.
2946         (teeReadableStreamPullFunction): Use readableStreamDefaultControllerClose instead of closeReadableStream.
2947         (isReadableStream): Replaced check of underlyingSource by check that object is actually an instance of
2948         ReadableStream (spec requires checking that readableStreamController slot is present, but this cannot
2949         be checked).
2950         (isReadableStreamDefaultReader): Replaced check of ownerReadableStream presence by check of readRequests,
2951         in line with spec.
2952         (isReadableStreamDefaultController): Replaced check of controlledReadableStream presence by check of unerlyingSource,
2953         in line with spec.
2954         (errorReadableStream): Updated based on new properties repartition between reader and controller.
2955         (requestReadableStreamPull): Updated based on new properties repartition between reader and controller.
2956         (readableStreamDefaultControllerGetDesiredSize): Replaces getReadableStreamDesiredSize (size now depends
2957         on controller; new function name aligned with spec).
2958         (cancelReadableStream): Updated based on new properties repartition between reader and controller. 
2959         (readableStreamDefaultControllerClose): Added based on spec (closing controller).
2960         (closeReadableStream): Updated based on new properties repartition between reader and controller. 
2961         (enqueueInReadableStream): Updated based on new properties repartition between reader and controller. 
2962         (readFromReadableStreamDefaultReader): Updated based on new properties repartition between reader and controller. 
2963         * bindings/js/WebCoreBuiltinNames.h: Added pull (internal function of ReadableStreamDefaultController)
2964         and readableStreamController (defined by spec)
2965
2966 2016-09-01  Csaba Osztrogonác  <ossy@webkit.org>
2967
2968         Unreviewed, fix the !ENABLE(SVG_FONTS) and !ENABLE(XSLT) build after r205269.
2969
2970         * loader/LinkLoader.cpp:
2971         (WebCore::createLinkPreloadResourceClient):
2972
2973 2016-09-01  Csaba Osztrogonác  <ossy@webkit.org>
2974
2975         URTBF after r205161 to fix !ENABLE(WEB_TIMING) build.
2976
2977         * bindings/js/JSPerformanceTimingCustom.cpp:
2978
2979 2016-09-01  Myles C. Maxfield  <mmaxfield@apple.com>
2980
2981         Clean up TextRun-related code
2982         https://bugs.webkit.org/show_bug.cgi?id=161473
2983
2984         Reviewed by Simon Fraser.
2985
2986         Some assorted cleanup, including:
2987         - Renaming "AllowTrailingExpansion | ForbidLeadingExpansion" to "DefaultExpansion"
2988         - Migrating from pointers to references
2989         - Migrating from ints to unsigneds
2990         - Using proper character names from CharacterNames.h
2991         - Simplifying CoreTextSPI.h
2992
2993         No new tests because there is no behavior change.
2994
2995         * platform/graphics/TextRun.h:
2996         (WebCore::TextRun::TextRun):
2997         * platform/graphics/mac/ComplexTextController.cpp:
2998         (WebCore::TextLayout::isNeeded):
2999         (WebCore::TextLayout::constructTextRun):
3000         * platform/spi/cocoa/CoreTextSPI.h:
3001         * platform/text/TextFlags.h:
3002         * rendering/RenderBlock.cpp:
3003         (WebCore::RenderBlock::constructTextRun):
3004         * rendering/RenderBlock.h:
3005         * rendering/RenderListMarker.cpp:
3006         (WebCore::RenderListMarker::computePreferredLogicalWidths):
3007         (WebCore::RenderListMarker::getRelativeMarkerRect):
3008         * rendering/RenderMenuList.cpp:
3009         (RenderMenuList::updateOptionsWidth):
3010         * rendering/RenderText.cpp:
3011         (WebCore::RenderText::widthFromCache):
3012         (WebCore::RenderText::trimmedPrefWidths):
3013         (WebCore::hyphenWidth):
3014         (WebCore::maxWordFragmentWidth):
3015         (WebCore::RenderText::computePreferredLogicalWidths):
3016         (WebCore::RenderText::width):
3017         * rendering/RenderText.h:
3018         * rendering/RenderThemeIOS.mm:
3019         * rendering/line/BreakingContext.h:
3020         (WebCore::textWidth):
3021         (WebCore::tryHyphenating):
3022         * rendering/svg/SVGInlineTextBox.cpp:
3023         (WebCore::SVGInlineTextBox::offsetForPositionInFragment):
3024         (WebCore::SVGInlineTextBox::selectionRectForTextFragment):
3025         (WebCore::SVGInlineTextBox::localSelectionRect):
3026         (WebCore::SVGInlineTextBox::paintSelectionBackground):
3027         (WebCore::SVGInlineTextBox::paint):
3028         (WebCore::SVGInlineTextBox::acquirePaintingResource):
3029         (WebCore::SVGInlineTextBox::prepareGraphicsContextForTextPainting):
3030         (WebCore::SVGInlineTextBox::constructTextRun):
3031         (WebCore::SVGInlineTextBox::paintDecorationWithStyle):
3032         (WebCore::SVGInlineTextBox::paintTextWithShadows):
3033         (WebCore::SVGInlineTextBox::paintText):
3034         * rendering/svg/SVGInlineTextBox.h:
3035
3036 2016-08-31  Carlos Garcia Campos  <cgarcia@igalia.com>
3037
3038         [GTK] Move GObject DOM bindings to WebKit2 layer and stop auto generating them
3039         https://bugs.webkit.org/show_bug.cgi?id=161438
3040
3041         Reviewed by Michael Catanzaro.
3042
3043         Remove the scripts to generate GObject DOM bindings and the tests. Also remove all GObject ifdefs from the idl files.
3044
3045         * PlatformGTK.cmake:
3046         * bindings/gobject: Removed.
3047         * bindings/scripts/CodeGeneratorGObject.pm: Removed.
3048         * bindings/scripts/test/GObject: Removed.
3049         * css/CSSStyleSheet.idl:
3050         * css/RGBColor.idl:
3051         * dom/DOMCoreException.idl:
3052         * dom/DOMImplementation.idl:
3053         * dom/Document.idl:
3054         * dom/DocumentType.idl:
3055         * dom/Element.idl:
3056         * dom/Event.idl:
3057         * dom/EventTarget.idl:
3058         * dom/KeyboardEvent.idl:
3059         * dom/MessageEvent.idl:
3060         * dom/MessagePort.idl:
3061         * dom/MouseEvent.idl:
3062         * dom/NamedNodeMap.idl:
3063         * dom/Node.idl:
3064         * dom/Range.idl:
3065         * dom/Slotable.idl:
3066         * dom/WheelEvent.idl:
3067         * fileapi/FileException.idl:
3068         * html/HTMLAppletElement.idl:
3069         * html/HTMLCanvasElement.idl:
3070         * html/HTMLCollection.idl:
3071         * html/HTMLDocument.idl:
3072         * html/HTMLElement.idl:
3073         * html/HTMLEmbedElement.idl:
3074         * html/HTMLFieldSetElement.idl:
3075         * html/HTMLFormElement.idl:
3076         * html/HTMLIFrameElement.idl:
3077         * html/HTMLInputElement.idl:
3078         * html/HTMLMediaElement.idl:
3079         * html/HTMLOptionElement.idl:
3080         * html/HTMLOptionsCollection.idl:
3081         * html/HTMLSelectElement.idl:
3082         * html/HTMLTableCellElement.idl:
3083         * html/HTMLTableColElement.idl:
3084         * html/HTMLTextAreaElement.idl:
3085         * html/HTMLVideoElement.idl:
3086         * html/ImageData.idl:
3087         * html/URLUtils.idl:
3088         * html/track/TextTrack.idl:
3089         * page/DOMSelection.idl:
3090         * page/DOMWindow.idl:
3091         * svg/SVGDocument.idl:
3092         * svg/SVGElement.idl:
3093         * svg/SVGException.idl:
3094         * workers/DedicatedWorkerGlobalScope.idl:
3095         * workers/Worker.idl:
3096         * workers/WorkerGlobalScope.idl:
3097         * xml/XPathException.idl:
3098
3099 2016-08-31  Yusuke Suzuki  <utatane.tea@gmail.com>
3100
3101         [JSC] Add initiator parameter to module pipeline
3102         https://bugs.webkit.org/show_bug.cgi?id=161470
3103
3104         Reviewed by Saam Barati.
3105
3106         No user-observable behavior change.
3107
3108         We rename JSModuleLoader to ScriptModuleLoader.
3109         The name "JSModuleLoader" is misleading since it seems like this is a JS object.
3110         "ModuleLoader" is not good since there is CSS modules.
3111
3112         * CMakeLists.txt:
3113         * WebCore.xcodeproj/project.pbxproj:
3114         * bindings/js/JSBindingsAllInOne.cpp:
3115         * bindings/js/JSDOMWindowBase.cpp:
3116         (WebCore::JSDOMWindowBase::moduleLoaderResolve):
3117         (WebCore::JSDOMWindowBase::moduleLoaderFetch):
3118         (WebCore::JSDOMWindowBase::moduleLoaderEvaluate):
3119         * bindings/js/JSDOMWindowBase.h:
3120         * bindings/js/JSMainThreadExecState.h:
3121         (WebCore::JSMainThreadExecState::loadModule):
3122         (WebCore::JSMainThreadExecState::linkAndEvaluateModule):
3123         * bindings/js/JSModuleLoader.cpp:
3124         (WebCore::JSModuleLoader::JSModuleLoader): Deleted.
3125         (WebCore::JSModuleLoader::resolve): Deleted.
3126         (WebCore::JSModuleLoader::fetch): Deleted.
3127         (WebCore::JSModuleLoader::evaluate): Deleted.
3128         * bindings/js/JSModuleLoader.h:
3129         (WebCore::JSModuleLoader::document): Deleted.
3130         * bindings/js/ScriptModuleLoader.cpp: Renamed from Source/WebCore/bindings/js/JSModuleLoader.cpp.
3131         (WebCore::ScriptModuleLoader::ScriptModuleLoader):
3132         (WebCore::ScriptModuleLoader::resolve):
3133         (WebCore::ScriptModuleLoader::fetch):
3134         (WebCore::ScriptModuleLoader::evaluate):
3135         * bindings/js/ScriptModuleLoader.h: Renamed from Source/WebCore/bindings/js/JSModuleLoader.h.
3136         (WebCore::ScriptModuleLoader::document):
3137         * dom/Document.cpp:
3138         (WebCore::Document::Document):
3139         * dom/Document.h:
3140         (WebCore::Document::moduleLoader):
3141
3142 2016-08-31  Zalan Bujtas  <zalan@apple.com>
3143
3144         ASSERTION FAILED: !flow->layer() && !flow->isInlineElementContinuation() in WebCore::RenderBlock::addContinuationWithOutline
3145         https://bugs.webkit.org/show_bug.cgi?id=151022
3146         <rdar://problem/27710993>
3147
3148         Reviewed by Simon Fraser.
3149
3150         Certain CSS properties like opacity, mask etc (graphical group members) require the layer to be a non-normal flow,
3151         self painting layer so that we can manage painting properly. However in addition to those CSS properties, some of the will-change
3152         values (again, graphical group members) also require the layer to be non-normal flow, self painting.
3153         This patch ensures that when deciding whether a layer should be a normal flow layer, we take the will-change values into account as well.
3154
3155         Tests: compositing/layer-creation/assert-on-inline-element-with-will-change.html
3156                compositing/layer-creation/will-change-on-normal-flow-content.html
3157
3158         * rendering/RenderLayer.cpp:
3159         (WebCore::RenderLayer::calculateClipRects):
3160         * rendering/style/WillChangeData.cpp:
3161         (WebCore::propertyCreatesGraphicalGroup):
3162         (WebCore::WillChangeData::addFeature):
3163         * rendering/style/WillChangeData.h:
3164         (WebCore::WillChangeData::canCreateGraphicalGroup):
3165         (WebCore::WillChangeData::canTriggerCompositingOnInline): Deleted.
3166
3167 2016-08-31  Keith Rollin  <krollin@apple.com>
3168
3169         WebKit should set a subsystem for os_log so it's easier to filter for WebKit log messages
3170         https://bugs.webkit.org/show_bug.cgi?id=160969
3171         <rdar://problem/26068734>
3172
3173         Reviewed by Simon Fraser.
3174
3175         - Specify a channel when using RELEASE_LOG macros
3176         - Add a new channel so that we have something to pass to the
3177           RELEASE_LOG macros (Layers).
3178         - Enable subsystem- and channel-related data and functions when using
3179           RELEASE_LOG macros.
3180         - Use the DECLARE_LOG_CHANNEL, DEFINE_LOG_CHANNEL, and
3181           LOG_CHANNEL_ADDRESS macros that are now defined in WTF.
3182
3183         No new tests. There are no tests for logging.
3184
3185         * loader/FrameLoader.cpp:
3186         * platform/LogInitialization.h:
3187         * platform/LogMacros.h:
3188         * platform/Logging.cpp:
3189         * platform/Logging.h:
3190         * platform/MemoryPressureHandler.cpp:
3191         (WebCore::MemoryPressureHandler::ReliefLogger::logMemoryUsageChange):
3192         * platform/graphics/cg/GraphicsContextCG.cpp:
3193         (WebCore::GraphicsContext::drawNativeImage):
3194         * platform/graphics/cocoa/IOSurface.mm:
3195         (WebCore::IOSurface::IOSurface):
3196         * platform/mac/LoggingMac.mm:
3197         * platform/unix/LoggingUnix.cpp:
3198         * platform/win/LoggingWin.cpp:
3199         * testing/js/WebCoreTestSupport.cpp:
3200         (WebCoreTestSupport::initializeLogChannelsIfNecessary):
3201
3202 2016-08-31  Ricky Mondello  <rmondello@apple.com>
3203
3204         Enable the YouTube Flash plug-in replacement behavior on all Cocoa ports
3205         https://bugs.webkit.org/show_bug.cgi?id=161453
3206         <rdar://problem/28050847>
3207
3208         Reviewed by Eric Carlson.
3209
3210         Now that we have some tests for the URL transformation logic (r205212) and the ability to enable the YouTube
3211         Flash plug-in replacement behavior independently from the QuickTime plug-in replacement behavior (r205214 and
3212         r205271), enable the YouTube Flash plug-in replacement behavior for Cocoa ports. We can and will continue to
3213         improve it.
3214
3215         * page/Settings.cpp: Enable the feature for PLATFORM(COCOA), rather than just PLATFORM(IOS).
3216
3217 2016-08-31  Alex Christensen  <achristensen@webkit.org>
3218
3219         Implement IPv6 parsing in URLParser
3220         https://bugs.webkit.org/show_bug.cgi?id=161390
3221
3222         Reviewed by Darin Adler.
3223
3224         Covered by new API tests.
3225
3226         * platform/URLParser.cpp:
3227         (WebCore::zeroSequenceLength):
3228         (WebCore::findLongestZeroSequence):
3229         (WebCore::nibbleToHex):
3230         (WebCore::serializeIPv6Piece):
3231         (WebCore::serializeIPv6):
3232         (WebCore::parseIPv6Host):
3233         (WebCore::URLParser::hostEndReached):
3234
3235 2016-08-31  Ricky Mondello  <rmondello@apple.com>
3236
3237         Break pluginReplacementEnabled into youTubeFlashPluginReplacementEnabled and quickTimePluginReplacementEnabled
3238         https://bugs.webkit.org/show_bug.cgi?id=161424
3239         <rdar://problem/28050847>
3240
3241         Reviewed by Dean Jackson.
3242
3243         Replace the single pluginReplacementEnabled setting with individual settings for the YouTube Flash plug-in
3244         behavior and the QuickTime plug-in behavior. Unless otherwise noted, this change copies the existing plumbing
3245         for pluginReplacementEnabled and renames it twice. The default values for these settings remain the same.
3246
3247         * Modules/plugins/PluginReplacement.h:
3248         (WebCore::ReplacementPlugin::ReplacementPlugin): Augment the constructor.
3249         (WebCore::ReplacementPlugin::isEnabledBySettings): Added.
3250         * Modules/plugins/QuickTimePluginReplacement.h: Declare a static member function.
3251         * Modules/plugins/QuickTimePluginReplacement.mm:
3252         (WebCore::QuickTimePluginReplacement::registerPluginReplacement): Properly create a ReplacementPlugin instance.
3253         (WebCore::QuickTimePluginReplacement::isEnabledBySettings): Added.
3254         * Modules/plugins/YouTubePluginReplacement.cpp:
3255         (WebCore::YouTubePluginReplacement::registerPluginReplacement): Properly create a ReplacementPlugin instance.
3256         (WebCore::YouTubePluginReplacement::isEnabledBySettings): Added.
3257         * Modules/plugins/YouTubePluginReplacement.h: Declare a static member function.
3258         * html/HTMLPlugInElement.cpp:
3259         (WebCore::HTMLPlugInElement::requestObject): Ask the ReplacementPlugin whether it's enabled, rather than assume
3260             all plug-in replacement is guarded by a single run-time setting.
3261         * page/Settings.cpp: Declare values for defaults for both settings.
3262         * page/Settings.in: Declare two settings.
3263         * testing/InternalSettings.cpp:
3264         (WebCore::InternalSettings::Backup::Backup): Handle both settings.
3265         (WebCore::InternalSettings::Backup::restoreTo): Ditto.
3266         (WebCore::InternalSettings::setQuickTimePluginReplacementEnabled): Added.
3267         (WebCore::InternalSettings::setYouTubeFlashPluginReplacementEnabled): Added.
3268         (WebCore::InternalSettings::setPluginReplacementEnabled): Deleted.
3269         * testing/InternalSettings.h: Duplicate and rename.
3270         * testing/InternalSettings.idl: Ditto.
3271
3272 2016-08-31  Yoav Weiss  <yoav@yoav.ws>
3273
3274         Add event support for link preload.
3275         https://bugs.webkit.org/show_bug.cgi?id=158466
3276
3277         Reviewed by Alex Christensen.
3278
3279         Add onload/onerror support for link rel preload to align it with the spec
3280         and enable various resource loading use-cases.
3281         This patch also fixes XHR matching issues by replacing LinkPreload with RawResource.
3282
3283         Tests: http/tests/misc/script_onload_delays_window_onload.html
3284                http/tests/preload/delaying_onload_link_preload_after_discovery.html
3285                http/tests/preload/delaying_onload_link_preload_after_discovery_image.html
3286                http/tests/preload/not_delaying_window_onload_before_discovery.html
3287                http/tests/preload/onerror_event.html
3288                http/tests/preload/onload_event.html
3289
3290         * CMakeLists.txt: Add LinkPreloadResourceClients.{h,cpp}
3291         * WebCore.xcodeproj/project.pbxproj: Add LinkPreloadResourceClients.{h,cpp}.
3292         * html/HTMlLinkElement.cpp:
3293         (WebCore::linkErrorEventSender): Add an eventSender for the error event.
3294         (WebCore::HTMLLinkElement::HTMLLinkElement): s/m_loadedSheet/m_loadedResource/
3295         (WebCore::HTMLLinkElement::~HTMLLinkElement): Cancel the error event when the element gets destructed.
3296         (WebCore::HTMLLinkElement::linkLoaded): dispatch the event in an async manner.
3297         (WebCore::HTMLLinkElement::linkLoadingErrored): dispatch the event in an async manner.
3298         (WebCore::HTMLLinkElement::dispatchPendingEvent): Call dispatchEvent directly.
3299         (WebCore::HTMLLinkElement::notifyLoadedSheetAndAllCriticalSubresources): s/m_loadedSheet/m_loadedResource/
3300         * html/HTMLLinkElement.h: s/m_loadedSheet/m_loadedResource/
3301         * html/parser/HTMLResourcePreloader.cpp:
3302         (WebCore::HTMLResourcePreloader::preload): Call preload as ImplicitPreload, to distinguish it from declarative preload.
3303         * loader/LinkLoader.cpp:
3304         (WebCore::LinkLoader::LinkLoader): Get rid of unnecessary event timers and add a weakPtrFactory.
3305         (WebCore::LinkLoader::triggerEvents): Add a triggerEvents function that can be called from notifyFinished as well as the
3306         LinkPreloadResourceClients.
3307         (WebCore::LinkLoader::notifyFinished): Call the triggerEvents function.
3308         (WebCore::LinkLoader::resourceTypeFromAsAttribute): Replace LinkPreload with RawResource to avoid XHR resource matching issues.
3309         (WebCore::createLinkPreloadResourceClient): Create a resource client for link preload.
3310         (WebCore::LinkLoader::preloadIfNeeded): Trigger an error when `as` is unknown. Make sure that preload resources don't delay window.onload
3311         before discovery. Get the resource back from calling preload and create a client for that resource.
3312         (WebCore::LinkLoader::linkLoadTimerFired): Deleted.
3313         (WebCore::LinkLoader::linkLoadingErrorTimerFired): Deleted.
3314         (WebCore::preloadIfNeeded): Deleted.
3315         * loader/LinkLoader.h:
3316         (WebCore::LinkLoader::createWeakPtr):
3317         * loader/LinkPreloadResourceClients.cpp: Added.
3318         (WebCore::LinkPreloadResourceClient::LinkPreloadResourceClient): Create a LinkPreloadResourceClient and assign with with a weakPtr of
3319         LinkLoader.
3320         (WebCore::LinkPreloadResourceClient::triggerEvents): Call LinkLoader's triggerEvents.
3321         * loader/LinkPreloadResourceClients.h: Added.
3322         (WebCore::LinkPreloadResourceClient::~LinkPreloadResourceClient):
3323         (WebCore::LinkPreloadResourceClient::addResource): Add as resource's client.
3324         (WebCore::LinkPreloadResourceClient::clearResource): Remove as resource's client and clear ref to resource.
3325         (WebCore::LinkPreloadResourceClient::ownedResource): Return ref to resource.
3326         * loader/ResourceLoadInfo.cpp:
3327         (WebCore::toResourceType): Removed LinkPreload.
3328         * loader/SubresourceLoader.cpp:
3329         (WebCore::logResourceLoaded): Removed LinkPreload.
3330         * loader/cache/CachedResource.cpp:
3331         (WebCore::CachedResource::defaultPriorityForResourceType): Removed LinkPreload.
3332         * loader/cache/CachedResource.h: Removed LinkPreload.
3333         (WebCore::CachedResource::ignoreForRequestCount): Don't delay window.onload for requests that opted out of that.
3334         * loader/cache/CachedResourceLoader.cpp:
3335         (WebCore::CachedResourceLoader::checkInsecureContent): Removed LinkPreload.
3336         (WebCore::CachedResourceLoader::requestResource): Make sure that discovered preload resources do block window.onload.
3337         (WebCore::CachedResourceLoader::preload): Make sure that explicitly preloaded subresources can be fetched even if there are parser
3338         blocking resources still in flight. Return the preloaded resource.
3339         (WebCore::CachedResourceLoader::requestPreload): Make sure that preloaded fonts get requested. Return preloaded resource.
3340         (WebCore::createResource): Removed LinkPreload.
3341         (WebCore::contentTypeFromResourceType): Removed LinkPreload.
3342         (WebCore::CachedResourceLoader::canRequest): Removed LinkPreload.
3343         * loader/cache/CachedResourceLoader.h:
3344         * platform/network/ResourceRequestBase.h:
3345         (WebCore::ResourceRequestBase::ignoreForRequestCount): Get the flag saying if a resource should block window.onload.
3346         (WebCore::ResourceRequestBase::setIgnoreForRequestCount): Set the flag saying if a resource should block window.onload.
3347
3348 2016-08-31  Joseph Pecoraro  <pecoraro@apple.com>
3349
3350         Web Inspector: XHR with text but responseType = "blob" shows blank content
3351         https://bugs.webkit.org/show_bug.cgi?id=161422
3352         <rdar://problem/28066869>
3353
3354         Reviewed by Brian Burg.
3355
3356         Test: inspector/network/xhr-json-blob-has-content.html
3357
3358         When an XMLHttpRequest finished loading it was always setting the Inspector's
3359         content for that