FormDataElement::lengthInBytes should use ThreadableBlobRegistry
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-01-12  Youenn Fablet  <youenn@apple.com>
2
3         FormDataElement::lengthInBytes should use ThreadableBlobRegistry
4         https://bugs.webkit.org/show_bug.cgi?id=181554
5
6         Reviewed by Chris Dumez.
7
8         Covered by updated test.
9
10         Fix blobRegistry() use and add support for creating a response that may trigger the issue.
11
12
13         * platform/network/FormData.cpp:
14         (WebCore::FormDataElement::lengthInBytes const): Was using directly blobRegistry() while ThreadableBlobRegistry is more appropriate
15         in case this is called from workers.
16         * Modules/fetch/FetchBody.h:
17         * Modules/fetch/FetchResponse.h:
18         * fileapi/Blob.h:
19         * testing/ServiceWorkerInternals.cpp:
20         (WebCore::ServiceWorkerInternals::createOpaqueWithBlobBodyResponse):
21         * testing/ServiceWorkerInternals.h:
22         * testing/ServiceWorkerInternals.idl:
23
24 2018-01-12  Jer Noble  <jer.noble@apple.com>
25
26         Wrap CDMFairPlayStreaming and related classes in ENABLE(ENCRYPTED_MEDIA) checks
27         https://bugs.webkit.org/show_bug.cgi?id=181602
28
29         Reviewed by Maciej Stachowiak.
30
31         * platform/graphics/avfoundation/CDMFairPlayStreaming.h:
32         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
33         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
34
35 2018-01-12  Youenn Fablet  <youenn@apple.com>
36
37         WebProcess should pass the registration identifier and not the worker identifier for fetch events
38         https://bugs.webkit.org/show_bug.cgi?id=181591
39
40         Reviewed by Chris Dumez.
41
42         Test: http/wpt/service-workers/update-service-worker.https.html
43
44         Store service worker registration identifier in ResourceLoaderOptions instead of service worker identifier.
45
46         * loader/DocumentThreadableLoader.cpp:
47         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
48         (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest):
49         * loader/ResourceLoaderOptions.h:
50         * loader/WorkerThreadableLoader.cpp:
51         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
52         * loader/cache/CachedResourceLoader.cpp:
53         (WebCore::CachedResourceLoader::prepareFetch):
54         (WebCore::CachedResourceLoader::determineRevalidationPolicy const):
55         * loader/cache/CachedResourceRequest.cpp:
56         (WebCore::CachedResourceRequest::setSelectedServiceWorkerRegistrationIdentifierIfNeeded):
57         (WebCore::CachedResourceRequest::setNavigationServiceWorkerRegistrationData):
58         (WebCore::CachedResourceRequest::setSelectedServiceWorkerIdentifierIfNeeded): Deleted.
59         * loader/cache/CachedResourceRequest.h:
60         * workers/WorkerScriptLoader.cpp:
61         (WebCore::WorkerScriptLoader::loadSynchronously):
62         (WebCore::WorkerScriptLoader::loadAsynchronously):
63         * workers/service/server/SWServer.cpp:
64         (WebCore::SWServer::activeWorkerFromRegistrationID):
65         * workers/service/server/SWServer.h:
66
67 2018-01-12  Fujii Hironori  <Hironori.Fujii@sony.com>
68
69         [Win][CMake] Remove all-in-one file for WebCore DerivedSources
70         https://bugs.webkit.org/show_bug.cgi?id=181582
71
72         Reviewed by Alex Christensen.
73
74         Those source files are compiled in unified source build nowadays.
75
76         No new tests (No behavior change)
77
78         * CMakeLists.txt: Removed calling PROCESS_ALLINONE_FILE.
79         * DerivedSources.cpp: Removed.
80         * WebCoreMacros.cmake: Removed a macro PROCESS_ALLINONE_FILE.
81
82 2018-01-12  Fujii Hironori  <Hironori.Fujii@sony.com>
83
84         [WinCairo][CMake] Use ${CURL_LIBRARY} instead of specifying the library name libcurl_imp explicitly
85         https://bugs.webkit.org/show_bug.cgi?id=181578
86
87         Reviewed by Alex Christensen.
88
89         vcpkg has libcurl.lib, not libcurl_imp.lib.
90
91         No new tests because no behavior change.
92
93         * PlatformWinCairo.cmake: Link ${CURL_LIBRARY} instead of libcurl_imp.
94
95 2018-01-12  Jer Noble  <jer.noble@apple.com>
96
97         WebGL video texture black in Safari 11.0.2 and wrong colored in Safari Preview 11.1
98         https://bugs.webkit.org/show_bug.cgi?id=181445
99         <rdar://problem/36383183>
100
101         Reviewed by Dean Jackson.
102
103         Tests: added compile-time correctness tests for YCbCrMatrix values.
104
105         Perform the derivation from YCbCr coefficients into matrices in constexpr expressions
106         at compile-time. This allows us to also perform compile-time correctness checks to catch
107         regressions which may cause incorrect color conversions.
108
109         Since we now have general-purpose derivation of matrix values from coefficients,
110         adding missing specificed matrices is trivial, so add support for SMPTE 240M and BT.2020
111         matrices.
112
113         * platform/graphics/cv/VideoTextureCopierCV.cpp:
114         (WebCore::GLfloatColor::GLfloatColor):
115         (WebCore::GLfloatColor::abs):
116         (WebCore::GLfloatColor::isApproximatelyEqualTo const):
117         (WebCore::YCbCrMatrix::operator Vector<GLfloat> const):
118         (WebCore::YCbCrMatrix::YCbCrMatrix):
119         (WebCore::YCbCrMatrix::operator* const):
120         (WebCore::YCbCrToRGBMatrixForRangeAndTransferFunction):
121
122 2018-01-12  Antoine Quint  <graouts@apple.com>
123
124         Add support for the frames() timing function
125         https://bugs.webkit.org/show_bug.cgi?id=181585
126         <rdar://problem/36463317>
127
128         Reviewed by Dean.
129
130         Implement the frames() timing function as specified in the CSS Timing Functions Level 1
131         specification, specifically https://www.w3.org/TR/css-timing-1/#frames-timing-functions.
132         A frames timing function is a type of timing function that divides the input time into a
133         specified number of intervals of equal length.
134
135         Test: transitions/frames-timing-function.html
136
137         * css/CSSComputedStyleDeclaration.cpp:
138         (WebCore::createTimingFunctionValue):
139         * css/CSSTimingFunctionValue.cpp:
140         (WebCore::CSSFramesTimingFunctionValue::customCSSText const):
141         (WebCore::CSSFramesTimingFunctionValue::equals const):
142         * css/CSSTimingFunctionValue.h:
143         * css/CSSToStyleMap.cpp:
144         (WebCore::CSSToStyleMap::mapAnimationTimingFunction):
145         * css/CSSValue.cpp:
146         (WebCore::CSSValue::equals const):
147         (WebCore::CSSValue::cssText const):
148         (WebCore::CSSValue::destroy):
149         * css/CSSValue.h:
150         (WebCore::CSSValue::isFramesTimingFunctionValue const):
151         * css/CSSValueKeywords.in:
152         * css/parser/CSSPropertyParser.cpp:
153         (WebCore::consumeSteps):
154         (WebCore::consumeFrames):
155         (WebCore::consumeAnimationTimingFunction):
156         * platform/animation/TimingFunction.cpp:
157         (WebCore::operator<<):
158         (WebCore::TimingFunction::transformTime const):
159         * platform/animation/TimingFunction.h:
160         (WebCore::TimingFunction::isFramesTimingFunction const):
161         * platform/graphics/ca/GraphicsLayerCA.cpp:
162         (WebCore::animationHasFramesTimingFunction):
163         (WebCore::GraphicsLayerCA::animationCanBeAccelerated const):
164
165 2018-01-12  Commit Queue  <commit-queue@webkit.org>
166
167         Unreviewed, rolling out r226721.
168         https://bugs.webkit.org/show_bug.cgi?id=181583
169
170         Lets do a slightly different fix (Requested by anttik on
171         #webkit).
172
173         Reverted changeset:
174
175         "REGRESSION(r225650): The scores of MotionMark tests Multiply
176         and Leaves dropped by 8%"
177         https://bugs.webkit.org/show_bug.cgi?id=181460
178         https://trac.webkit.org/changeset/226721
179
180 2018-01-11  Keith Miller  <keith_miller@apple.com>
181
182         Rename ENABLE_ASYNC_ITERATION to ENABLE_JS_ASYNC_ITERATION
183         https://bugs.webkit.org/show_bug.cgi?id=181573
184
185         Reviewed by Simon Fraser.
186
187         * Configurations/FeatureDefines.xcconfig:
188
189 2018-01-11  Jiewen Tan  <jiewen_tan@apple.com>
190
191         [WebAuthN] Import a CBOR coder from Chromium
192         https://bugs.webkit.org/show_bug.cgi?id=181522
193         <rdar://problem/36055729>
194
195         Reviewed by Brent Fulgham.
196
197         This patch imports a CBOR coder including encoder and decoder from Chromium. CBOR encoder
198         is needed for WebAuthN to encode attestation object into binaries. When supporting extensions
199         in the future, CBOR encoder/decoder will be needed as well. Implementating and maintaining
200         a fully-fledged CBOR coder doesn't seem to align with WebKit's best interests. Therefore,
201         importing a most suitable third party implementation will be wise.
202
203         In this patch, it fully integrate the whole coder into our codebase. Those changes includes:
204             1. Substitute data structures that enjoy a better WTF version.
205             2. Replacing marcos.
206             3. Implementating workarounds for some functionalities that we lack fundamental types' support.
207             4. Changing the coding style to match ours.
208
209         This patch doesn't intend to improve the logic of the original codebase. Hence some of the
210         coding logic might not match what WebKit ususally has.
211
212         Here is a full list of Chromium changes that constructed this CBOR coder in chronological order:
213         6efcf495521d18d060027762f48bb292d6979136,
214         9eb43fd347890b4c6cf54c4bd7ec1bbb88e381e1,
215         31c85e74fd567772f18e0a41be468d04af721f21,
216         68672fdcad280a8ff69b91927d38d0eabf2c87f2,
217         0ca8667c0584fb21c0748ebd7468d32889759a07,
218         df763d790d7e45d70116bdefacbfd4f9faa8995e,
219         6d30c4a621c65314db63eb56e87c19ab75627b26,
220         50fe92953f4739f17a62303fedbf8db9234317c8,
221         47be22c3603424d1832d046a348ff3f982500288,
222         98a59e46948b2c71608926004fac8192b0ff2208,
223         07540c6d850ed6e0fa508d63c20a8ce96d751de6,
224         06ae32d640c8e4b86ea8914a80ee419ea16e56d8.
225
226         Covered by API tests.
227
228         * Modules/webauthn/cbor/CBORBinary.h: Added.
229         * Modules/webauthn/cbor/CBORReader.cpp: Added.
230         (cbor::CBORReader::CBORReader):
231         (cbor::CBORReader::~CBORReader):
232         (cbor::CBORReader::read):
233         (cbor::CBORReader::decodeCBOR):
234         (cbor::CBORReader::readVariadicLengthInteger):
235         (cbor::CBORReader::decodeValueToNegative):
236         (cbor::CBORReader::decodeValueToUnsigned):
237         (cbor::CBORReader::readSimpleValue):
238         (cbor::CBORReader::readString):
239         Workarounds applied.
240         (cbor::CBORReader::readBytes):
241         (cbor::CBORReader::readCBORArray):
242         (cbor::CBORReader::readCBORMap):
243         (cbor::CBORReader::canConsume):
244         (cbor::CBORReader::checkMinimalEncoding):
245         (cbor::CBORReader::checkExtraneousData):
246         (cbor::CBORReader::checkDuplicateKey):
247         (cbor::CBORReader::hasValidUTF8Format):
248         Workarounds applied.
249         (cbor::CBORReader::checkOutOfOrderKey):
250         (cbor::CBORReader::getErrorCode):
251         (cbor::CBORReader::errorCodeToString):
252         * Modules/webauthn/cbor/CBORReader.h: Added.
253         * Modules/webauthn/cbor/CBORValue.cpp: Added.
254         (cbor::CBORValue::CBORValue):
255         (cbor::CBORValue::operator=):
256         (cbor::CBORValue::~CBORValue):
257         (cbor::CBORValue::clone const):
258         (cbor::CBORValue::getInteger const):
259         (cbor::CBORValue::getUnsigned const):
260         (cbor::CBORValue::getNegative const):
261         (cbor::CBORValue::getString const):
262         (cbor::CBORValue::getByteString const):
263         (cbor::CBORValue::getArray const):
264         (cbor::CBORValue::getMap const):
265         (cbor::CBORValue::getSimpleValue const):
266         (cbor::CBORValue::internalMoveConstructFrom):
267         (cbor::CBORValue::internalCleanup):
268         * Modules/webauthn/cbor/CBORValue.h: Added.
269         * Modules/webauthn/cbor/CBORWriter.cpp: Added.
270         (cbor::CBORWriter::~CBORWriter):
271         (cbor::CBORWriter::write):
272         (cbor::CBORWriter::CBORWriter):
273         (cbor::CBORWriter::encodeCBOR):
274         Workarounds applied.
275         (cbor::CBORWriter::startItem):
276         (cbor::CBORWriter::setAdditionalInformation):
277         (cbor::CBORWriter::setUint):
278         (cbor::CBORWriter::getNumUintBytes):
279         * Modules/webauthn/cbor/CBORWriter.h: Added.
280         * Sources.txt:
281         * WebCore.xcodeproj/project.pbxproj:
282
283 2018-01-11  Chris Dumez  <cdumez@apple.com>
284
285         Setting Window.opener to null should disown its opener
286         https://bugs.webkit.org/show_bug.cgi?id=181505
287         <rdar://problem/36443151>
288
289         Reviewed by Ryosuke Niwa.
290
291         Setting Window.opener to null should disown its opener as per:
292         - https://html.spec.whatwg.org/#dom-opener
293
294         With this change, tabs opened by clicking link inside Gmail no
295         longer have the Gmail window as opener.
296
297         Tests: fast/dom/Window/window-opener-set-to-null.html
298                fast/dom/Window/window-opener-shadowing.html
299
300         * bindings/js/JSDOMWindowCustom.cpp:
301         (WebCore::JSDOMWindow::setOpener):
302         * page/DOMWindow.cpp:
303         (WebCore::DOMWindow::disownOpener):
304         * page/DOMWindow.h:
305         * page/DOMWindow.idl:
306
307 2018-01-11  Myles C. Maxfield  <mmaxfield@apple.com>
308
309         [Cocoa] Star character disappears when bolded
310         https://bugs.webkit.org/show_bug.cgi?id=181568
311         <rdar://problem/18755569>
312
313         Reviewed by Simon Fraser.
314
315         We had some code in ComplexTextController to ask the FontCache for a font, given the name
316         of a particular font CoreText used inside a CTRun. This is wrong for two reasons: fonts
317         are not identifiable by PostScript name (in the general case), and because the lookup
318         procedure requires a FontDescription, the result may yield a font that is not the one
319         looked up. The goal of this code was simply to preserve the rendering mode of the font,
320         but we removed support for these rendering modes years ago. So the solution is to skip
321         that lookup and use the CoreText font directly.
322
323         Test: fast/text/unknown-font.html
324
325         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
326         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
327
328 2018-01-11  Keith Rollin  <krollin@apple.com>
329
330         Add optional logging of ITP-related user interaction information
331         https://bugs.webkit.org/show_bug.cgi?id=181556
332
333         Reviewed by Brent Fulgham.
334
335         In order to support the tracking of the efficacy of Intelligent
336         Tracking Protection, add some logging indicating when the user
337         interacts with a page in a way that affects cookie partitioning. This
338         logging is off by default, and is enabled with `defaults write -g
339         WebKitLogCookieInformation -bool true`.
340
341         No new tests -- no changed functionality.
342
343         * loader/ResourceLoadObserver.cpp:
344         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
345         * loader/ResourceLoadObserver.h:
346         (WebCore::ResourceLoadObserver::shouldLogUserInteraction const):
347         (WebCore::ResourceLoadObserver::setShouldLogUserInteraction):
348
349 2018-01-11  James Craig  <jcraig@apple.com>
350
351         AX: when invert colors is on, double-invert video elements in UserAgentStyleSheet
352         https://bugs.webkit.org/show_bug.cgi?id=168447
353         <rdar://problem/30559874>
354
355         Reviewed by Simon Fraser.
356
357         Double-invert video when platform "invert colors" setting is enabled. Behavior matches 
358         current "Smart Invert" feature of Safari Reader on macOS/iOS and other iOS native apps.
359
360         Tests: accessibility/smart-invert-reference.html
361                accessibility/smart-invert.html
362
363         * Modules/modern-media-controls/controls/media-controls.css:
364         (@media (inverted-colors)):
365         (:host):
366         (picture):
367         * css/html.css:
368         (@media (inverted-colors)):
369         (video):
370
371 2018-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
372
373         Don't load inline data when requesting info for an attachment element backed by a file path
374         https://bugs.webkit.org/show_bug.cgi?id=181550
375
376         Reviewed by Tim Horton.
377
378         When requesting data for an attachment element that is backed by a file path, we currently trigger a load in the
379         web process to fetch contents of the attachment data as inline data in the AttachmentInfo. This is unnecessary,
380         since the file path of the attachment element must have come from the UI process anyways, so it is sufficient to
381         simply send the file path to the UI process and have the UI process read the contents of the path as a memory-
382         mapped NSData.
383
384         This patch lets HTMLAttachmentElement skip over resource loading codepaths when creating an AttachmentInfo for
385         the client, and also teaches _WKAttachment to read a AttachmentInfo's filepath as memory-mapped data if a file
386         path is present, and no inline data was specified.
387
388         Covered by existing API tests.
389
390         * html/HTMLAttachmentElement.cpp:
391         (WebCore::HTMLAttachmentElement::requestInfo):
392
393 2018-01-10  Ryosuke Niwa  <rniwa@webkit.org>
394
395         Make elements of zero width or height focusable
396         https://bugs.webkit.org/show_bug.cgi?id=181516
397
398         Reviewed by Chris Dumez.
399
400         Don't check render box's size or bounding rect when deciding whether an element is focusable.
401         New behavior matches that of Firefox and Chrome.
402
403         Test: fast/events/focus-zero-size-element.html
404
405         * dom/Element.cpp:
406         (WebCore::Element::isFocusable): Only update the style.
407         * html/HTMLFormControlElement.cpp:
408         (WebCore::HTMLFormControlElement::isFocusable const): Deleted.
409         * html/HTMLFormControlElement.h:
410         * mathml/MathMLElement.cpp:
411         (WebCore::MathMLElement::isFocusable const): Deleted. As far as I can tell, no math ml element is focusable.
412         * mathml/MathMLElement.h:
413         * svg/SVGAElement.cpp:
414         (WebCore::SVGAElement::isFocusable const): Deleted.
415         * svg/SVGAElement.h:
416
417 2018-01-11  Filip Pizlo  <fpizlo@apple.com>
418
419         Rename MarkedAllocator to BlockDirectory and AllocatorAttributes to CellAttributes
420         https://bugs.webkit.org/show_bug.cgi?id=181543
421
422         Rubber stamped by Michael Saboff.
423
424         No new tests because I'm just renaming things.
425
426         * ForwardingHeaders/heap/BlockDirectoryInlines.h: Copied from Source/WebCore/ForwardingHeaders/heap/MarkedAllocatorInlines.h.
427         * ForwardingHeaders/heap/MarkedAllocatorInlines.h: Removed.
428         * bindings/js/DOMGCOutputConstraint.cpp:
429
430 2018-01-11  Alex Christensen  <achristensen@webkit.org>
431
432         REGRESSION(r225003): Loading hangs in environments where dispatch_async does not work
433         https://bugs.webkit.org/show_bug.cgi?id=181553
434         <rdar://problem/35733938>
435
436         Reviewed by Eric Carlson.
437
438         There is an environment where dispatch_async does not work, but performSelectorOnMainThread works.
439         r225003 broke loading in this environment.  This fixes it and updates the test that r225003 fixed.
440         It failed sometimes because loading was happening in a different order than html parsing, so I made
441         the test not depend on html parsing timing by updating media/video-src-remove.html.
442
443         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
444         (-[WebCoreResourceHandleAsOperationQueueDelegate callFunctionOnMainThread:]):
445
446 2018-01-11  Dean Jackson  <dino@apple.com>
447
448         Rolling out 226814. It crashes on some bots.
449
450 2018-01-11  Dean Jackson  <dino@apple.com>
451
452         [WebGL] Simulated vertexAttrib0 can sometimes cause OUT_OF_MEMORY errors
453         https://bugs.webkit.org/show_bug.cgi?id=181558
454         <rdar://problem/36189833>
455
456         Reviewed by Eric Carlson.
457
458         Very large element indices in the ELEMENT_ARRAY_BUFFER meant that
459         our simulated vertexAttrib0 buffer might be too large. We need
460         to check for out-of-memory, but we can also detect some of the issues
461         earlier in our validation code. Additionally, make sure that we don't
462         accidentally cast an unsigned to a signed.
463
464         Test: fast/canvas/webgl/simulated-vertexAttrib0-invalid-indicies.html
465
466         * html/canvas/WebGL2RenderingContext.cpp:
467         (WebCore::WebGL2RenderingContext::validateIndexArrayConservative): Update validation
468         code to look for overflow, rather than relying on looking for sign changes.
469         * html/canvas/WebGLRenderingContext.cpp:
470         (WebCore::WebGLRenderingContext::validateIndexArrayConservative): Ditto.
471         * html/canvas/WebGLRenderingContextBase.cpp:
472         (WebCore::WebGLRenderingContextBase::validateIndexArrayPrecise):
473         (WebCore::WebGLRenderingContextBase::drawArrays): Check that we were able to simulate.
474         (WebCore::WebGLRenderingContextBase::drawElements):
475         (WebCore::WebGLRenderingContextBase::validateSimulatedVertexAttrib0): Update validation code, and
476         use GC3Duint, since that's what the indicies are.
477         (WebCore::WebGLRenderingContextBase::simulateVertexAttrib0): Ditto.
478         (WebCore::WebGLRenderingContextBase::drawArraysInstanced): Check that we were able to simulate.
479         (WebCore::WebGLRenderingContextBase::drawElementsInstanced):
480         * html/canvas/WebGLRenderingContextBase.h:
481
482 2018-01-11  Chris Dumez  <cdumez@apple.com>
483
484         ASSERTION FAILED: registration in WebCore::SWServerWorker::skipWaiting()
485         https://bugs.webkit.org/show_bug.cgi?id=181222
486         <rdar://problem/36332686>
487
488         Reviewed by Youenn Fablet.
489
490         Replace assertion in SWServerWorker::skipWaiting() that assumes the worker
491         has a registration. Nowadays, a SWServerWorker can stay alive for a short
492         period without having a registration, while it is terminating.
493
494         No new tests, unskipped existing test.
495
496         * workers/service/server/SWServerWorker.cpp:
497         (WebCore::SWServerWorker::skipWaiting):
498
499 2018-01-11  Antti Koivisto  <antti@apple.com>
500
501         Don't call RenderElement::setStyle when nothing changes
502         https://bugs.webkit.org/show_bug.cgi?id=181530
503
504         Reviewed by Zalan Bujtas.
505
506         * style/StyleChange.h:
507
508         Remove 'Force' value. This essentially meant 'compute style for all descendants and call setStyle unconditionally'.
509         Using this value lost information about whether anything actually changed in a particular style as it was automatically
510         inherited by all descendants. The 'compute all descendants' part of the behavior is what is actually needed.
511
512         Instead add separate DescendantsToResolve enum for communicating what else to compute.
513
514         * style/StyleTreeResolver.cpp:
515         (WebCore::Style::TreeResolver::Parent::Parent):
516         (WebCore::Style::computeDescendantsToResolve):
517
518             Figure out which descendants will need resolving based on how the current elements style changed.
519
520         (WebCore::Style::TreeResolver::resolveElement):
521         (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
522         (WebCore::Style::TreeResolver::pushParent):
523         (WebCore::Style::shouldResolveElement):
524
525             Use DescendantsToResolve as input.
526
527         (WebCore::Style::TreeResolver::resolveComposedTree):
528         * style/StyleTreeResolver.h:
529         * style/StyleUpdate.h:
530         (WebCore::Style::ElementUpdates::ElementUpdates):
531
532             Add DescendantsToResolve.
533
534 2018-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
535
536         Send PromisedBlobInfo to the client through DragItem instead of DragClient::prepareToDragPromisedBlob
537         https://bugs.webkit.org/show_bug.cgi?id=181497
538
539         Reviewed by Tim Horton.
540
541         Refactor drag initiation with DOMFile-backed attachment elements. See WebKit ChangeLog for more information. No
542         change in behavior; promised blob dragging covered by WKAttachment API tests.
543
544         * loader/EmptyClients.cpp:
545         * page/DragClient.h:
546         (WebCore::DragClient::prepareToDragPromisedBlob): Deleted.
547         * page/DragController.cpp:
548         (WebCore::DragController::startDrag):
549         (WebCore::DragController::doImageDrag):
550         (WebCore::DragController::doSystemDrag):
551         (WebCore::DragController::promisedBlobInfo):
552         (WebCore::DragController::dragAttachmentElement): Deleted.
553         * page/DragController.h:
554         * platform/DragItem.h:
555         (WebCore::DragItem::encode const):
556         (WebCore::DragItem::decode):
557
558 2018-01-11  Youenn Fablet  <youenn@apple.com>
559
560         RTCController should disable ICE candidate filtering in case of getUserMedia based on the RTCPerrConnection origin
561         https://bugs.webkit.org/show_bug.cgi?id=180851
562
563         Reviewed by Eric Carlson.
564
565         Test: http/wpt/webrtc/third-party-frame-ice-candidate-filtering.html
566
567         RTCController now stores all the client origins (top+frame origins) of frames that got access to camera/microphone access.
568         For any such client origin, PeerConnection objects ICE candidate filtering is disabled.
569         ICE candidate filtering is reset whenever navigating/reloading the page.
570
571         * Modules/mediastream/RTCController.cpp:
572         (WebCore::RTCController::reset):
573         (WebCore::matchDocumentOrigin):
574         (WebCore::RTCController::shouldDisableICECandidateFiltering):
575         (WebCore::RTCController::add):
576         (WebCore::RTCController::disableICECandidateFilteringForAllOrigins):
577         (WebCore::RTCController::disableICECandidateFiltering):
578         (WebCore::RTCController::enableICECandidateFiltering):
579         * Modules/mediastream/RTCController.h:
580         * Modules/mediastream/RTCPeerConnection.cpp:
581         (WebCore::RTCPeerConnection::create):
582         * Modules/mediastream/UserMediaRequest.cpp:
583         (WebCore::UserMediaRequest::allow):
584         * page/Page.cpp:
585         (WebCore::Page::disableICECandidateFiltering):
586         * testing/Internals.cpp:
587         (WebCore::Internals::setICECandidateFiltering):
588
589 2018-01-11  Ali Juma  <ajuma@chromium.org>
590
591         window.visualViewport should behave as [SameObject]
592         https://bugs.webkit.org/show_bug.cgi?id=181548
593
594         Reviewed by Chris Dumez.
595
596         Add 'GenerateIsReachable' to VisualViewport so that window.visualViewport's
597         JS wrapper object doesn't get garbage collected too soon.
598
599         Test: fast/visual-viewport/visual-viewport-same-object.html
600
601         * page/VisualViewport.idl:
602
603 2018-01-11  Basuke Suzuki  <Basuke.Suzuki@sony.com>
604
605         [Curl] Extract multipart handling from ResourceHandle to CurlRequest.
606         https://bugs.webkit.org/show_bug.cgi?id=181506
607
608         Reviewed by Alex Christensen.
609
610         Rename old MultipartHandle class to CurlMultipartHandle and modernize it. Also move the responsibility 
611         of handling multi part from ResourceHandle to CurlRequest. This is required for upcoming NetworkLoadTask.
612
613         No new tests because no new behavior.
614
615         * platform/Curl.cmake:
616         * platform/network/curl/CurlMultipartHandle.cpp: Renamed from Source/WebCore/platform/network/curl/MultipartHandle.cpp.
617         (WebCore::CurlMultipartHandle::createIfNeeded):
618         (WebCore::CurlMultipartHandle::extractBoundary):
619         (WebCore::CurlMultipartHandle::extractBoundaryFromContentType):
620         (WebCore::CurlMultipartHandle::CurlMultipartHandle):
621         (WebCore::CurlMultipartHandle::didReceiveData):
622         (WebCore::CurlMultipartHandle::didComplete):
623         (WebCore::CurlMultipartHandle::processContent):
624         (WebCore::CurlMultipartHandle::checkForBoundary):
625         (WebCore::CurlMultipartHandle::matchedLength):
626         (WebCore::CurlMultipartHandle::parseHeadersIfPossible):
627         * platform/network/curl/CurlMultipartHandle.h: Renamed from Source/WebCore/platform/network/curl/MultipartHandle.h.
628         (WebCore::CurlMultipartHandle::~CurlMultipartHandle):
629         * platform/network/curl/CurlMultipartHandleClient.h: Added.
630         (WebCore::CurlMultipartHandleClient::~CurlMultipartHandleClient):
631         * platform/network/curl/CurlRequest.cpp:
632         (WebCore::CurlRequest::CurlRequest):
633         (WebCore::CurlRequest::didReceiveHeader):
634         (WebCore::CurlRequest::didReceiveData):
635         (WebCore::CurlRequest::didReceiveHeaderFromMultipart):
636         (WebCore::CurlRequest::didReceiveDataFromMultipart):
637         (WebCore::CurlRequest::didCompleteTransfer):
638         (WebCore::CurlRequest::finalizeTransfer):
639         (WebCore::CurlRequest::invokeDidReceiveResponseForFile):
640         (WebCore::CurlRequest::invokeDidReceiveResponse):
641         (WebCore::CurlRequest::completeDidReceiveResponse):
642         * platform/network/curl/CurlRequest.h:
643         (WebCore::CurlRequest::create):
644         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
645         (WebCore::ResourceHandleCurlDelegate::createCurlRequest):
646         (WebCore::ResourceHandleCurlDelegate::curlDidReceiveResponse):
647         (WebCore::ResourceHandleCurlDelegate::curlDidReceiveBuffer):
648         (WebCore::ResourceHandleCurlDelegate::curlDidComplete):
649         * platform/network/curl/ResourceHandleCurlDelegate.h:
650
651 2018-01-11  Zalan Bujtas  <zalan@apple.com>
652
653         RenderTreeUpdater::current() returns null_ptr when mutation is done through Document::resolveStyle.
654         https://bugs.webkit.org/show_bug.cgi?id=181513
655         <rdar://problem/36367085>
656
657         Reviewed by Antti Koivisto.
658
659         This patch ensures that we use a valid RenderTreeBuilder even when
660         Document::resolveStyle (incorrectly) triggers tree mutation.
661         It can be reverted soon after the incorrect mutations are taken care of.
662
663         Test: fast/forms/button-set-text-crash.html
664
665         * rendering/RenderButton.cpp:
666         (WebCore::RenderButton::setText):
667         * rendering/RenderMenuList.cpp:
668         (RenderMenuList::setText):
669
670 2018-01-11  Antoine Quint  <graouts@apple.com>
671
672         Only listen to webkitplaybacktargetavailabilitychanged when media controls are visible to the user
673         https://bugs.webkit.org/show_bug.cgi?id=181547
674         <rdar://problem/35947650>
675
676         Reviewed by Eric Carlson.
677
678         Because listening to "webkitplaybacktargetavailabilitychanged" events incurs some higher power usage on iOS,
679         we only listen to such events when controls are visible to the user. In other words, the MediaControls need to
680         have both "visible" set to "true" and "faded" set to "false". To support this, we add a delegate method on
681         MediaControls such that it can tell the MediaController that the "visible" property changed. With this message,
682         MediaController can inform its MediaControllerSupport objects that user visibility of the controls changed, which
683         lets AirplaySupport disable itself when controls are no longer visible.
684
685         Test: media/modern-media-controls/airplay-support/airplay-support-disable-event-listeners-with-hidden-controls.html
686
687         * Modules/modern-media-controls/controls/media-controls.js:
688         (MediaControls.prototype.set visible):
689         * Modules/modern-media-controls/media/airplay-support.js:
690         (AirplaySupport.prototype.controlsUserVisibilityDidChange):
691         * Modules/modern-media-controls/media/media-controller-support.js:
692         (MediaControllerSupport.prototype.controlsUserVisibilityDidChange):
693         * Modules/modern-media-controls/media/media-controller.js:
694         (MediaController.prototype.mediaControlsVisibilityDidChange):
695         (MediaController.prototype.mediaControlsFadedStateDidChange):
696         (MediaController.prototype._controlsUserVisibilityDidChange):
697
698 2018-01-11  Antoine Quint  <graouts@apple.com>
699
700         [iOS] There should be no controls markup generated in fullscreen
701         https://bugs.webkit.org/show_bug.cgi?id=181540
702         <rdar://problem/35060379>
703
704         Reviewed by Eric Carlson.
705
706         We completely forgo the display of any content when fullscreen on iOS by setting the
707         "visible" flag to "false" on the MediaControls, which will prevent any DOM content from
708         being added.
709
710         * Modules/modern-media-controls/media/media-controller.js:
711         (MediaController.prototype.handleEvent):
712         (MediaController.prototype._updateiOSFullscreenProperties):
713         (MediaController):
714         (MediaController.prototype._updateSupportingObjectsEnabledState): Deleted.
715
716 2018-01-11  Alex Christensen  <achristensen@webkit.org>
717
718         Revert changes accidentally committed with r226789.
719         https://bugs.webkit.org/show_bug.cgi?id=181423
720
721         I had some local changes I did not mean to commit.
722
723         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
724         (scheduledWithCustomRunLoopMode):
725         (-[WebCoreResourceHandleAsOperationQueueDelegate callFunctionOnMainThread:]):
726         (WebCore::if): Deleted.
727         (WebCore::>::fromCallable): Deleted.
728
729 2018-01-10  Simon Fraser  <simon.fraser@apple.com>
730
731         On macOS, getBoundingClientRect gives incorrect values when pinch-zoomed
732         https://bugs.webkit.org/show_bug.cgi?id=181511
733         rdar://problem/33741427
734
735         Reviewed by Zalan Bujtas.
736         
737         When reverting "client coordinates are relative to layout viewport" in r219829
738         I broke documentToClientOffset() on macOS by failing to take pinch zoom scale into
739         account (frameScaleFactor() is always 1 on iOs, so this bug doesn't manifest there).
740
741         Covered by existing tests.
742
743         * page/FrameView.cpp:
744         (WebCore::FrameView::documentToClientOffset const):
745
746 2018-01-11  Youenn Fablet  <youenn@apple.com>
747
748         Replace WebRTCLegacyAPIDisabled by WebRTCLegacyAPIEnabled and switch off WebRTC legacy flag by default
749         https://bugs.webkit.org/show_bug.cgi?id=181480
750
751         Reviewed by Eric Carlson.
752
753         No change of behavior.
754
755         * page/RuntimeEnabledFeatures.h: Set default value to false.
756
757 2018-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
758
759         [Attachment Support] Support moving attachment elements in editable areas using drag and drop
760         https://bugs.webkit.org/show_bug.cgi?id=181337
761         <rdar://problem/36324813>
762
763         Reviewed by Tim Horton.
764
765         Makes slight adjustments to attachment-specific drag and drop logic to ensure that moving attachments via drag
766         and drop behaves correctly. See per-change comments for more detail.
767
768         Tests:  WKAttachmentTests.DragInPlaceVideoAttachmentElement
769                 WKAttachmentTests.MoveAttachmentElementAsIconByDragging
770                 WKAttachmentTests.MoveInPlaceAttachmentElementByDragging
771
772         * editing/cocoa/EditorCocoa.mm:
773         (WebCore::Editor::getPasteboardTypesAndDataForAttachment):
774
775         Stop vending the private web archive pasteboard type for attachments, for now. This works around issues where an
776         attachment element that is dragged and dropped within the same page may lose its blob backing data if we try to
777         remove and insert it as a fragment from the archive. Providing a web archive would allow us to avoid destroying
778         and recreating an attachment element when dragging within the same page, but this is a nice-to-have optimization
779         we can re-enable after investigation in a subsequent patch.
780
781         * html/HTMLAttachmentElement.cpp:
782         (WebCore::HTMLAttachmentElement::populateShadowRootIfNecessary):
783
784         Add `draggable=false` to the image element of an in-place attachment element.
785
786         * page/DragController.cpp:
787         (WebCore::enclosingAttachmentElement):
788         (WebCore::DragController::draggableElement const):
789
790         Tweak single-selected-attachment handling to account for in-place attachments. Since the hit-tested node is
791         inside the shadow subtree of the attachment element, the condition needs to check for the startElement as well
792         as the startElement's shadow host.
793
794         (WebCore::DragController::startDrag):
795
796         Make two tweaks here. First, don't require a RenderAttachment to drag an attachment element (this is required
797         for dragging in-place attachments). This was added in r217083 to address <rdar://problem/32282831>, but is no
798         longer correct, since attachments may now be displayed in-place.
799
800         Secondly, only restore the previous selection if the attachment is in a richly contenteditable area. This was
801         added to prevent the selection highlight from appearing in when dragging non-editable attachment elements in the
802         Mail viewer. However, to allow drag moves to occur, we need the selection to persist after drag start.
803
804 2018-01-04  Filip Pizlo  <fpizlo@apple.com>
805
806         CodeBlocks should be in IsoSubspaces
807         https://bugs.webkit.org/show_bug.cgi?id=180884
808
809         Reviewed by Saam Barati.
810
811         No new tests because no new behavior.
812         
813         Adopting new parallel constraint API, so that more of the logic of doing parallel
814         constraint solving is shared between the DOM's output constraints and JSC's output
815         constraints.
816
817         * bindings/js/DOMGCOutputConstraint.cpp:
818         (WebCore::DOMGCOutputConstraint::executeImpl):
819         (WebCore::DOMGCOutputConstraint::doParallelWorkImpl): Deleted.
820         (WebCore::DOMGCOutputConstraint::finishParallelWorkImpl): Deleted.
821         * bindings/js/DOMGCOutputConstraint.h:
822
823 2018-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
824
825         [Attachment Support] Support dragging attachment elements out as files on iOS
826         https://bugs.webkit.org/show_bug.cgi?id=181199
827         <rdar://problem/36299316>
828
829         Reviewed by Tim Horton, Andy Estes and Joseph Pecoraro.
830
831         Adds support for dragging "files" (i.e. creating item providers with preferred attachment presentation styles)
832         from attachment elements on iOS for Mail. See below for more detail.
833
834         Tests:  WKAttachmentTestsIOS.DragAttachmentInsertedAsData
835                 WKAttachmentTestsIOS.DragAttachmentInsertedAsFile
836
837         * page/DragController.cpp:
838         (WebCore::DragController::platformContentTypeForBlobType const):
839         (WebCore::DragController::dragAttachmentElement):
840         * page/DragController.h:
841         * page/mac/DragControllerMac.mm:
842         (WebCore::DragController::platformContentTypeForBlobType const):
843
844         Add a private method to convert the type of a promised blob to a platform type. For Cocoa platforms, this
845         converts the blob type (either a UTI or a MIME type) to a UTI for the platform to consume.
846
847         * platform/ios/WebItemProviderPasteboard.h:
848         * platform/ios/WebItemProviderPasteboard.mm:
849
850         Refactor WebItemProviderRegistrationInfo. WebItemProviderRegistrationInfo currently encapsulates a single item
851         provider registration call, and contains either a type identifier and data buffer, or an NSItemProviderWriting-
852         conformant object. To register an item provider using a WebItemProviderRegistrationInfo, the item provider
853         pasteboard currently checks to see whether the info contains an object or a type and data.
854
855         This patch removes WebItemProviderRegistrationInfo and replaces it with WebItemProviderDataRegistrar. Objects
856         that implement this protocol know how to take an NSItemProvider and register data to it. So far, there are
857         three implementations below.
858
859         (-[WebItemProviderDataRegistrar initWithData:type:]):
860         (-[WebItemProviderDataRegistrar typeIdentifier]):
861         (-[WebItemProviderDataRegistrar data]):
862         (-[WebItemProviderDataRegistrar typeIdentifierForClient]):
863         (-[WebItemProviderDataRegistrar dataForClient]):
864         (-[WebItemProviderDataRegistrar registerItemProvider:]):
865         (-[WebItemProviderDataRegistrar description]):
866
867         A data registrar takes a UTI and data buffer, and registers the UTI to the data. This replaces a
868         WebItemProviderRegistrationInfo with both a type and data, but no representing object.
869
870         (-[WebItemProviderWritableObjectRegistrar initWithObject:]):
871         (-[WebItemProviderWritableObjectRegistrar representingObjectForClient]):
872         (-[WebItemProviderWritableObjectRegistrar registerItemProvider:]):
873         (-[WebItemProviderWritableObjectRegistrar description]):
874
875         The writable object registrar writes an NSItemProviderWriting-conformant object to an item provider. This
876         replaces a WebItemProviderRegistrationInfo with only a representing object.
877
878         (-[WebItemProviderPromisedFileRegistrar initWithType:callback:]):
879         (-[WebItemProviderPromisedFileRegistrar registerItemProvider:]):
880         (-[WebItemProviderPromisedFileRegistrar description]):
881         (-[WebItemProviderRegistrationInfoList addData:forType:]):
882         (-[WebItemProviderRegistrationInfoList addRepresentingObject:]):
883         (-[WebItemProviderRegistrationInfoList addPromisedType:fileCallback:]):
884
885         Helper methods to add new registrars to a registration info list.
886
887         (-[WebItemProviderRegistrationInfoList itemAtIndex:]):
888         (-[WebItemProviderRegistrationInfoList enumerateItems:]):
889         (-[WebItemProviderRegistrationInfoList itemProvider]):
890         (-[WebItemProviderRegistrationInfoList description]):
891         (-[WebItemProviderRegistrationInfo initWithRepresentingObject:typeIdentifier:data:]): Deleted.
892         (-[WebItemProviderRegistrationInfo representingObject]): Deleted.
893         (-[WebItemProviderRegistrationInfo typeIdentifier]): Deleted.
894
895 2018-01-11  Michael Saboff  <msaboff@apple.com>
896
897         Add a DOM gadget for Spectre testing
898         https://bugs.webkit.org/show_bug.cgi?id=181351
899
900         Reviewed by Ryosuke Niwa.
901
902         This change is used to test Spectre mitigations.
903
904         Added a new DOM class to test for Spectre issues in the DOM layer.
905         This additional functionality is disabled by default and must be enabled
906         through the JSC option "enableSpectreGadgets".
907
908         * CMakeLists.txt:
909         * DerivedSources.make:
910         * Sources.txt:
911         * WebCore.xcodeproj/project.pbxproj:
912         * bindings/js/WebCoreBuiltinNames.h:
913         * dom/SpectreGadget.cpp: Added.
914         (WebCore::SpectreGadget::SpectreGadget):
915         (WebCore::SpectreGadget::create):
916         (WebCore::SpectreGadget::setReadLength):
917         (WebCore::SpectreGadget::charCodeAt):
918         (WebCore::SpectreGadget::clflushReadLength):
919         * dom/SpectreGadget.h: Added.
920         * dom/SpectreGadget.idl: Added.
921         * page/RuntimeEnabledFeatures.cpp:
922         (WebCore::RuntimeEnabledFeatures::spectreGadgetsEnabled const):
923         * page/RuntimeEnabledFeatures.h:
924
925 2018-01-11  Philippe Normand  <pnormand@igalia.com>
926
927         [GTK] media/muted-video-is-playing-audio.html is timing out
928         https://bugs.webkit.org/show_bug.cgi?id=163781
929
930         Reviewed by Carlos Garcia Campos.
931
932         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
933         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideo): Sprinkle some debugging.
934         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfAudio): Ditto.
935         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
936         (WebCore::MediaPlayerPrivateGStreamerBase::setMuted): Ditto.
937
938 2018-01-10  Andy Estes  <aestes@apple.com>
939
940         [Payment Request] Rename ApplePayMerchantValidationEvent to MerchantValidationEvent
941         https://bugs.webkit.org/show_bug.cgi?id=181437
942         <rdar://problem/36376481>
943
944         Reviewed by Tim Horton.
945         
946         Renamed ApplePayMerchantValidationEvent to MerchantValidationEvent and changed complete() to accept a Promise.
947
948         Test: http/tests/paymentrequest/payment-request-merchant-validation.https.html
949
950         * DerivedSources.make:
951         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
952         (WebCore::ApplePayPaymentHandler::merchantValidationCompleted):
953         (WebCore::ApplePayPaymentHandler::validateMerchant):
954         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
955         * Modules/paymentrequest/MerchantValidationEvent.cpp: Renamed from Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.cpp.
956         (WebCore::MerchantValidationEvent::create):
957         (WebCore::MerchantValidationEvent::MerchantValidationEvent):
958         (WebCore::MerchantValidationEvent::eventInterface const):
959         (WebCore::MerchantValidationEvent::complete):
960         * Modules/paymentrequest/MerchantValidationEvent.h: Renamed from Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.h.
961         * Modules/paymentrequest/MerchantValidationEvent.idl: Renamed from Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.idl.
962         * Modules/paymentrequest/PaymentHandler.h:
963         * Modules/paymentrequest/PaymentRequest.cpp:
964         (WebCore::PaymentRequest::completeMerchantValidation):
965         * Modules/paymentrequest/PaymentRequest.h:
966         * Modules/paymentrequest/PaymentRequest.idl:
967         * WebCore.xcodeproj/project.pbxproj:
968         * dom/EventNames.h:
969         * dom/EventNames.in:
970
971 2018-01-10  Basuke Suzuki  <Basuke.Suzuki@sony.com>
972
973         [Curl] Cross-protocol, cross-site scripting (XPXSS) using HTML forms
974         Nhttps://bugs.webkit.org/show_bug.cgi?id=153088
975
976         Reviewed by Alex Christensen.
977
978         No new tests because it's covered by existing tests.
979
980         * platform/network/curl/CurlContext.cpp:
981         (WebCore::CurlHandle::getHttpVersion):
982         * platform/network/curl/CurlContext.h:
983         * platform/network/curl/CurlRequest.cpp:
984         (WebCore::CurlRequest::didReceiveHeader):
985         * platform/network/curl/CurlResponse.h:
986         (WebCore::CurlResponse::isolatedCopy const):
987         * platform/network/curl/ResourceResponseCurl.cpp:
988         (WebCore::ResourceResponse::ResourceResponse):
989         (WebCore::ResourceResponse::setStatusLine):
990
991 2018-01-10  Wenson Hsieh  <wenson_hsieh@apple.com>
992
993         REGRESSION(r222507): Composition highlight doesn't render when using IME
994         https://bugs.webkit.org/show_bug.cgi?id=181485
995         <rdar://problem/35896516>
996
997         Reviewed by Ryosuke Niwa.
998
999         Fixes the order of arguments passed to paintTextSubrangeBackground from paintCompositionBackground.
1000
1001         Test: editing/marked-text-appearance.html
1002
1003         * rendering/InlineTextBox.cpp:
1004         (WebCore::InlineTextBox::paintCompositionBackground):
1005
1006 2018-01-10  Youenn Fablet  <youenn@apple.com>
1007
1008         Use no-cache fetch mode when loading main documents with location.reload()
1009         https://bugs.webkit.org/show_bug.cgi?id=181285
1010
1011         Reviewed by Alex Christensen.
1012
1013         Covered by rebased tests.
1014
1015         Start to translate cache policy used for navigation as FetchOptions::Cache.
1016         This allows ensuring service workers receive the right cache mode when intercepting navigation loads.
1017         To not change current navigation behavior, ReturnCacheDataElseLoad and ReturnCacheDataDontLoad still trigger default fetch cache mode.
1018
1019         For Reload and ReloadExpiredOnly frame load types, using no-cache mode is more efficient than reload mode,
1020         as a conditional request will be sent if possible. This applies to location.reload which is consistent with other browsers.
1021         Keep reload mode for ReloadFromOrigin.
1022
1023         * loader/DocumentLoader.cpp:
1024         (WebCore::toFetchOptionsCache):
1025         (WebCore::DocumentLoader::loadMainResource):
1026         * loader/FrameLoader.cpp:
1027         (WebCore::FrameLoader::loadFrameRequest):
1028         (WebCore::FrameLoader::loadURL):
1029         (WebCore::FrameLoader::load):
1030         (WebCore::FrameLoader::reload):
1031         (WebCore::FrameLoader::defaultRequestCachingPolicy):
1032         (WebCore::FrameLoader::loadDifferentDocumentItem):
1033         * loader/NavigationScheduler.cpp:
1034
1035 2018-01-10  Commit Queue  <commit-queue@webkit.org>
1036
1037         Unreviewed, rolling out r226667 and r226673.
1038         https://bugs.webkit.org/show_bug.cgi?id=181488
1039
1040         This caused a flaky crash. (Requested by mlewis13 on #webkit).
1041
1042         Reverted changesets:
1043
1044         "CodeBlocks should be in IsoSubspaces"
1045         https://bugs.webkit.org/show_bug.cgi?id=180884
1046         https://trac.webkit.org/changeset/226667
1047
1048         "REGRESSION (r226667): CodeBlocks should be in IsoSubspaces"
1049         https://bugs.webkit.org/show_bug.cgi?id=180884
1050         https://trac.webkit.org/changeset/226673
1051
1052 2018-01-10  Antti Koivisto  <antti@apple.com>
1053
1054         REGRESSION(r225650): The scores of MotionMark tests Multiply and Leaves dropped by 8%
1055         https://bugs.webkit.org/show_bug.cgi?id=181460
1056         <rdar://problem/36379776>
1057
1058         Reviewed by Ryosuke Niwa.
1059
1060         * css/parser/CSSParser.cpp:
1061         (WebCore::CSSParserContext::CSSParserContext):
1062
1063         Don't do the expensive security origin test if the sheet base URL and document URL are identical.
1064         This is true for inline style and inline stylesheets.
1065
1066 2018-01-10  Antti Koivisto  <antti@apple.com>
1067
1068         Try to fix windows build.
1069
1070         * css/RuleFeature.cpp:
1071         (WebCore::RuleFeatureSet::computeNextMatchElement):
1072
1073 2018-01-10  Zalan Bujtas  <zalan@apple.com>
1074
1075         [RenderTreeBuilder] Move RenderRuby's moveChildren logic to RenderTreeBuilder
1076         https://bugs.webkit.org/show_bug.cgi?id=181470
1077         <rdar://problem/36397683>
1078
1079         Reviewed by Antti Koivisto.
1080
1081         This is about moving code, no cleanup and/or normalization (unfortunately it also means
1082         some temporary changes).  
1083
1084         No change in functionality.
1085
1086         * rendering/RenderBlockFlow.h:
1087         * rendering/RenderRubyBase.cpp:
1088         (WebCore::RenderRubyBase::moveChildren): Deleted.
1089         (WebCore::RenderRubyBase::mergeChildrenWithBase): Deleted.
1090         (WebCore::RenderRubyBase::moveInlineChildren): Deleted.
1091         (WebCore::RenderRubyBase::moveBlockChildren): Deleted.
1092         * rendering/RenderRubyBase.h:
1093         * rendering/RenderRubyRun.cpp:
1094         (WebCore::RenderRubyRun::takeChild):
1095         * rendering/updating/RenderTreeBuilder.cpp:
1096         (WebCore::RenderTreeBuilder::moveRubyChildren):
1097         * rendering/updating/RenderTreeBuilder.h:
1098         * rendering/updating/RenderTreeBuilderRuby.cpp:
1099         (WebCore::RenderTreeBuilder::Ruby::moveInlineChildren):
1100         (WebCore::RenderTreeBuilder::Ruby::moveBlockChildren):
1101         (WebCore::RenderTreeBuilder::Ruby::moveChildren):
1102         (WebCore::RenderTreeBuilder::Ruby::moveChildrenInternal):
1103         (WebCore::RenderTreeBuilder::Ruby::insertChild):
1104         * rendering/updating/RenderTreeBuilderRuby.h:
1105
1106 2018-01-10  Philippe Normand  <pnormand@igalia.com>
1107
1108         [GStreamer] fix critical GObject warning
1109
1110         Rubber-stamped by Carlos Garcia Campos.
1111
1112         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1113         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): No need to
1114         resort to complicated things to get the element name...
1115
1116 2018-01-10  Philippe Normand  <pnormand@igalia.com>
1117
1118         [GStreamer] REGRESSION(r226629): broke media/video-interruption-with-resume-allowing-play.html
1119         https://bugs.webkit.org/show_bug.cgi?id=181471
1120         <rdar://problem/36402323>
1121
1122         Reviewed by Carlos Garcia Campos.
1123
1124         This patch mainly reduces the amount of playback state changes
1125         emitted by the GStreamer player to its client. Emitting those
1126         notifications too often has bad side effects.
1127
1128         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1129         (WebCore::MediaPlayerPrivateGStreamer::paused const): Add debug messages.
1130         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): This debug message appears too much. Demote.
1131         (WebCore::MediaPlayerPrivateGStreamer::maxTimeLoaded const): Ditto.
1132         (WebCore::MediaPlayerPrivateGStreamer::didLoadingProgress const): Ditto.
1133         (WebCore::MediaPlayerPrivateGStreamer::updateStates): Try to emit
1134         playback state change notification only when going to PLAYING.
1135         (WebCore::MediaPlayerPrivateGStreamer::loadingFailed): Add warning message.
1136
1137 2018-01-10  Youenn Fablet  <youenn@apple.com>
1138
1139         Add Service Worker CSP persistency
1140         https://bugs.webkit.org/show_bug.cgi?id=181434
1141
1142         Reviewed by Alex Christensen.
1143
1144         Covered by manual testing.
1145         Future work on service worker test infrastructure should allow automating such tests.
1146
1147         Add support for service worker CSP data persistency.
1148         Add a version parameter to increment each time the schema is changing.
1149         This allows the same store to be used by multiple WebKits.
1150
1151         * workers/service/server/RegistrationDatabase.cpp:
1152         (WebCore::v1RecordsTableSchema):
1153         (WebCore::RegistrationDatabase::openSQLiteDatabase):
1154         (WebCore::RegistrationDatabase::doPushChanges):
1155         (WebCore::RegistrationDatabase::importRecords):
1156
1157 2018-01-10  Antti Koivisto  <antti@apple.com>
1158
1159         Invalidate current element style on class change accurately
1160         https://bugs.webkit.org/show_bug.cgi?id=181210
1161
1162         Reviewed by Zalan Bujtas.
1163
1164         * css/DocumentRuleSets.cpp:
1165         (WebCore::DocumentRuleSets::collectFeatures const):
1166         (WebCore::DocumentRuleSets::subjectClassRules const):
1167
1168             New rule set containing class rules affecting the subject element.
1169
1170         (WebCore::DocumentRuleSets::ancestorClassRules const):
1171         * css/DocumentRuleSets.h:
1172         * css/RuleFeature.cpp:
1173         (WebCore::RuleFeatureSet::recursivelyCollectFeaturesFromSelector):
1174
1175             Classify selector components into various buckets based on the elements they match relative to
1176             the subject element. There are more categories than this patch strictly needs, for future use.
1177
1178         (WebCore::RuleFeatureSet::collectFeatures):
1179         (WebCore::RuleFeatureSet::add):
1180         (WebCore::RuleFeatureSet::clear):
1181         (WebCore::RuleFeatureSet::shrinkToFit):
1182         * css/RuleFeature.h:
1183         * css/StyleResolver.h:
1184         (WebCore::StyleResolver::hasSelectorForClass const): Deleted.
1185         * style/ClassChangeInvalidation.cpp:
1186         (WebCore::Style::elementNeedsInvalidation):
1187         (WebCore::Style::ClassChangeInvalidation::computeInvalidation):
1188
1189             Don't invalidate current element unconditionally on class change. Instead find the subject rulesets
1190             that might affect it use them to perform invalidation.
1191
1192         (WebCore::Style::ClassChangeInvalidation::invalidateStyleWithRuleSets):
1193         (WebCore::Style::ClassChangeInvalidation::invalidateStyle): Deleted.
1194         (WebCore::Style::ClassChangeInvalidation::invalidateDescendantStyle): Deleted.
1195         * style/ClassChangeInvalidation.h:
1196         (WebCore::Style::ClassChangeInvalidation::ClassChangeInvalidation):
1197         (WebCore::Style::ClassChangeInvalidation::~ClassChangeInvalidation):
1198         * style/StyleSharingResolver.cpp:
1199         (WebCore::Style::SharingResolver::classNamesAffectedByRules const):
1200
1201 2018-01-09  Antoine Quint  <graouts@apple.com>
1202
1203         [Web Animations] Expose the id property on Animation
1204         https://bugs.webkit.org/show_bug.cgi?id=181450
1205         <rdar://problem/36383600>
1206
1207         Reviewed by Dean Jackson.
1208
1209         Expose the "id" property on Animation and handle the "id" property on the optional KeyframeAnimationOptions object
1210         passed to Element.animate(). All of the WPT tests related to this property are now passing.
1211
1212         * animation/WebAnimation.h:
1213         * animation/WebAnimation.idl:
1214         * dom/Element.cpp:
1215         (WebCore::Element::animate):
1216
1217 2018-01-09  Chris Dumez  <cdumez@apple.com>
1218
1219         Make service workers behave correctly with regards to Page Cache
1220         https://bugs.webkit.org/show_bug.cgi?id=181446
1221         <rdar://problem/36164291>
1222
1223         Reviewed by Youenn Fablet.
1224
1225         Make service workers behave correctly with regards to Page Cache:
1226         1. If a document has an active service worker, do not let it go into PageCache
1227         2. When a document goes into page cache, unregister it from the list of service worker clients
1228         3. When a document is restored from page cache, add it nack to the list of service worker clients
1229
1230         Tests: http/tests/workers/service/client-added-to-clients-when-restored-from-page-cache.html
1231                http/tests/workers/service/client-removed-from-clients-while-in-page-cache.html
1232                http/tests/workers/service/no-page-cache-when-controlled.html
1233                http/tests/workers/service/other_resources/test.html
1234
1235         * dom/Document.cpp:
1236         (WebCore::Document::suspend):
1237         (WebCore::Document::resume):
1238         * history/PageCache.cpp:
1239         (WebCore::canCacheFrame):
1240         * page/DiagnosticLoggingKeys.cpp:
1241         (WebCore::DiagnosticLoggingKeys::serviceWorkerKey):
1242         * page/DiagnosticLoggingKeys.h:
1243
1244 2018-01-09  Chris Dumez  <cdumez@apple.com>
1245
1246         We should not return undefined for most properties of a detached Window
1247         https://bugs.webkit.org/show_bug.cgi?id=181416
1248         <rdar://problem/36162489>
1249
1250         Reviewed by Ryosuke Niwa.
1251
1252         We should not return undefined for most properties on a detached Window. WebKit previously only exposed "closed"
1253         and "close" properties on detached / frameless windows. However, this does not match the HTML specification [1]
1254         or the behavior of Firefox and Chrome.
1255
1256         Note that Chrome does not seem to fully follow the HTML specification either, it seems to treat detached windows
1257         the same way as cross-origin ones. As a result, it only exposed properties that are visible cross-origin when
1258         a window is detached / frameless.
1259
1260         [1] https://html.spec.whatwg.org/#windowproxy-get
1261
1262         No new tests, updated existingt tests.
1263
1264         * bindings/js/JSDOMWindowCustom.cpp:
1265         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
1266         (WebCore::JSDOMWindow::getOwnPropertySlot):
1267         (WebCore::JSDOMWindow::getOwnPropertySlotByIndex):
1268
1269 2018-01-09  Darin Adler  <darin@apple.com>
1270
1271         Further refinement to list item and counter code after "list-item" counter fix
1272         https://bugs.webkit.org/show_bug.cgi?id=181426
1273
1274         Reviewed by Zalan Bujtas.
1275
1276         * css/StyleBuilderCustom.h:
1277         (WebCore::StyleBuilderCustom::applyInheritCounter): Use auto.
1278         (WebCore::StyleBuilderCustom::applyValueCounter): Use auto, removed unneeded
1279         null checks for things that can never be null, moved the saturated addition
1280         here and got rid of the addIncrementValue function from CounterDirectives.
1281         Use the saturatedAddition function from SaturatedArithmetic.h instead of the
1282         much less efficient one that did the same thing, CounterDirectives::addClamped.
1283
1284         * rendering/RenderCounter.cpp:
1285         (WebCore::listItemCounterDirectives): Use aggregate syntax for the return
1286         statements.
1287         (WebCore::planCounter): Changed to use a struct return value instead of two
1288         out arguments. Use the saturatedAddition function from SaturatedArithmetic.h
1289         instead of the much less efficient one that did the same thing,
1290         CounterDirectives::addClamped.
1291         (WebCore::findPlaceForCounter): Changed to use a struct return value instead
1292         of two out arguments.
1293         (WebCore::makeCounterNode): Updated for the above changes. Changed code to
1294         use add instead of both get and set. Updated to keep the counter maps inside
1295         the values of the "map of maps" instead of using a unique_ptr and allocating
1296         each one on the heap.
1297         (WebCore::destroyCounterNodeWithoutMapRemoval): Changed argument to a reference
1298         instead of a pointer. Updated for changes to the map. Use RefPtr more
1299         consistently.
1300         (WebCore::RenderCounter::destroyCounterNodes): Use iterators less.
1301         (WebCore::RenderCounter::destroyCounterNode): Ditto.
1302         (WebCore::RenderCounter::rendererRemovedFromTree): Add a check of
1303         hasCounterNodeMap here before calling destroyCounterNodes, so that function
1304         can assume the flag is true (both other callers already check it).
1305         (WebCore::updateCounters): Use auto and update for changes above.
1306         (WebCore::RenderCounter::rendererStyleChanged): Use modern for loops instead
1307         of iterators.
1308         (showCounterRendererTree): Use auto and udpate for changes above.
1309
1310         * rendering/RenderListItem.cpp:
1311         (WebCore::enclosingList): Stop referring to elements as "nodes". Changed
1312         the local variable names for clarity.
1313         (WebCore::nextListItemHelper): Renamed from nextListItem since it's not
1314         intended to be called directly and we want to use a function pointer to
1315         nextListItem. Fixed the algorithm to correctly handle ad hoc "lists" that
1316         are not actually HTML list elements, using the definition in the enclosingList
1317         function as the previousListItem function already did.
1318         (WebCore::nextListItem): Updated for name changes.
1319         (WebCore::firstListItem): Renamed from nextListItem for clarity.
1320         (WebCore::previousListItem): Rewrote loop so it doesn't have to do things
1321         so strangely when we find another list.
1322         (WebCore::RenderListItem::updateItemValuesForOrderedList): Use auto and
1323         update local variable names.
1324         (WebCore::RenderListItem::itemCountForOrderedList): Ditto.
1325         (WebCore::RenderListItem::updateValueNow const): Rewrote to use an iterative
1326         algorithm instead of a recursive one. Fixes the FIXME here.
1327         (WebCore::RenderListItem::updateValue): Use m_valueWasSetExplicitly
1328         instead of m_explicitValue.
1329         (WebCore::RenderListItem::explicitValueChanged): Use auto and simplified
1330         the loop a bit.
1331         (WebCore::RenderListItem::setExplicitValue): Set m_valueWasSetExplicitly
1332         instead of m_explicitValue.
1333         (WebCore::previousOrNextItem): Deleted.
1334         (WebCore::RenderListItem::updateListMarkerNumbers): Streamlined the loop
1335         a bit and used a fucntion pointer to handle the two different directions.
1336         (WebCore::RenderListItem::isInReversedOrderedList const): Simplified by
1337         getting rid of an unneeded use of pointers and local variables.
1338
1339         * rendering/RenderListItem.h: Use a boolean, m_valueWasSetExplicitly,
1340         instead of a separate optional m_explicitValue.
1341
1342         * rendering/style/CounterDirectives.h: Since all the code in this file was
1343         rewritten, removed old copyrights. Deleted the addIncrementValue function,
1344         since it is clear enough in the one call site in the style builder.
1345         Deleted the addClamped function because it was just a much slower
1346         version of the saturatedAddition function. Made == and != into constexpr
1347         functions since they are simple enough to be.
1348
1349         * rendering/style/RenderStyle.cpp:
1350         (WebCore::RenderStyle::getCounterDirectives const): Deleted. Caller can
1351         handle this just fine without a helper function.
1352         * rendering/style/RenderStyle.h: Ditto.
1353
1354 2018-01-09  Myles C. Maxfield  <mmaxfield@apple.com>
1355
1356         font-display:fallback can cause a visual flash (which is supposed to be impossible)
1357         https://bugs.webkit.org/show_bug.cgi?id=181374
1358
1359         Reviewed by Simon Fraser.
1360
1361         A FontCascade represents an entire font-family fallback list, but sometimes we need to pull out a single
1362         representative font from the list to calculate things like line height. Previously, if the first item in
1363         the font-family list was in the middle of being downloaded, this representative font was hardcoded to be
1364         Times. However, when actually laying out and drawing the glyphs, we have logic to skip the interstitial
1365         Times if there are any installed fonts present in the font-family list (so you wouldn't ever actually
1366         see Times). This means that line height (among other things) was being calculated as if Times was used,
1367         but in reality, some other font from the font-family list was being used.
1368
1369         Alone, this isn't a huge problem, but font-display:fallback makes a font transition between "timed out"
1370         and "failed," and when the font hits the failed state, the representative font skips over the cancelled
1371         item and hits the next item in the fallback list. This means that line heights will change, which causes
1372         a visual flash, even when font-display:fallback is specified.
1373
1374         The solution is simply to educate the logic which identifies this representative font so that it
1375         understands what to do for currently-loading fonts.
1376
1377         Tests: fast/text/font-display/swap-flash.html
1378
1379         * platform/graphics/FontCascadeFonts.h:
1380         (WebCore::FontCascadeFonts::primaryFont):
1381         * rendering/line/BreakingContext.h:
1382         (WebCore::textWidth):
1383
1384 2018-01-04  Filip Pizlo  <fpizlo@apple.com>
1385
1386         CodeBlocks should be in IsoSubspaces
1387         https://bugs.webkit.org/show_bug.cgi?id=180884
1388
1389         Reviewed by Saam Barati.
1390
1391         No new tests because no new behavior.
1392         
1393         Adopting new parallel constraint API, so that more of the logic of doing parallel
1394         constraint solving is shared between the DOM's output constraints and JSC's output
1395         constraints.
1396
1397         * bindings/js/DOMGCOutputConstraint.cpp:
1398         (WebCore::DOMGCOutputConstraint::executeImpl):
1399         (WebCore::DOMGCOutputConstraint::doParallelWorkImpl): Deleted.
1400         (WebCore::DOMGCOutputConstraint::finishParallelWorkImpl): Deleted.
1401         * bindings/js/DOMGCOutputConstraint.h:
1402
1403 2018-01-08  Simon Fraser  <simon.fraser@apple.com>
1404
1405         Clean up Marquee-related enums
1406         https://bugs.webkit.org/show_bug.cgi?id=181347
1407
1408         Reviewed by Anders Carlsson.
1409
1410         Modernize EMarqueeBehavior and EMarqueeDirection enums. Stop using the weird negative
1411         values in the MarqueeDirection and do manual reverse direction mapping.
1412
1413         Make some member functions of RenderMarquee private.
1414
1415         Stop using bitfields in RenderMarquee because the memory saving is not worth it, and doing so
1416         allows us to use modern initialization.
1417
1418         No behavior change.
1419
1420         * css/CSSPrimitiveValueMappings.h:
1421         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
1422         (WebCore::CSSPrimitiveValue::operator MarqueeBehavior const):
1423         (WebCore::CSSPrimitiveValue::operator MarqueeDirection const):
1424         (WebCore::CSSPrimitiveValue::operator EMarqueeBehavior const): Deleted.
1425         (WebCore::CSSPrimitiveValue::operator EMarqueeDirection const): Deleted.
1426         * css/StyleResolver.cpp:
1427         (WebCore::StyleResolver::adjustRenderStyle):
1428         * rendering/RenderBox.cpp:
1429         (WebCore::RenderBox::sizesLogicalWidthToFitContent const):
1430         * rendering/RenderLayer.cpp:
1431         (WebCore::RenderLayer::calculateClipRects const):
1432         * rendering/RenderMarquee.cpp:
1433         (WebCore::RenderMarquee::RenderMarquee):
1434         (WebCore::reverseDirection):
1435         (WebCore::RenderMarquee::direction const):
1436         (WebCore::RenderMarquee::isHorizontal const):
1437         (WebCore::RenderMarquee::computePosition):
1438         (WebCore::RenderMarquee::start):
1439         (WebCore::RenderMarquee::updateMarqueePosition):
1440         (WebCore::RenderMarquee::updateMarqueeStyle):
1441         (WebCore::RenderMarquee::timerFired):
1442         * rendering/RenderMarquee.h:
1443         * rendering/style/RenderStyle.h:
1444         (WebCore::RenderStyle::marqueeBehavior const):
1445         (WebCore::RenderStyle::marqueeDirection const):
1446         (WebCore::RenderStyle::setMarqueeDirection):
1447         (WebCore::RenderStyle::setMarqueeBehavior):
1448         (WebCore::RenderStyle::initialMarqueeBehavior):
1449         (WebCore::RenderStyle::initialMarqueeDirection):
1450         * rendering/style/RenderStyleConstants.h:
1451         * rendering/style/StyleMarqueeData.cpp:
1452         (WebCore::StyleMarqueeData::StyleMarqueeData):
1453         * rendering/style/StyleMarqueeData.h:
1454
1455 2018-01-09  Jer Noble  <jer.noble@apple.com>
1456
1457         Many CVDisplayLink threads created and destroyed while watching a YouTube video
1458         https://bugs.webkit.org/show_bug.cgi?id=181396
1459
1460         Reviewed by Simon Fraser.
1461
1462         When watching some YouTube videos (or any video with default controls), event handlers for
1463         the "timeupdate" event which use rAF will cause the underlying platform objects to be
1464         destroyed in between "timeupdate" events being fired, since they occur every 250ms, and rAF
1465         objects are destroyed every 166ms (or 10/60hz). Update this constant to destroy the
1466         underlying objects every 333ms (or 20/60hz) so that this common pattern doesn't lead to
1467         excessive rAF platform object turnover.
1468
1469         * platform/Logging.h:
1470         * platform/graphics/DisplayRefreshMonitor.h:
1471         (WebCore::DisplayRefreshMonitor::shouldBeTerminated const):
1472         * platform/graphics/DisplayRefreshMonitor.cpp:
1473         (WebCore::DisplayRefreshMonitor::displayDidRefresh):
1474         * platform/graphics/DisplayRefreshMonitorManager.cpp:
1475         (WebCore::DisplayRefreshMonitorManager::createMonitorForClient):
1476         (WebCore::DisplayRefreshMonitorManager::displayDidRefresh):
1477
1478 2018-01-09  Zalan Bujtas  <zalan@apple.com>
1479
1480         [RenderTreeBuilder] Move RenderElement addChild mutation logic to RenderTreeBuilder
1481         https://bugs.webkit.org/show_bug.cgi?id=181451
1482         <rdar://problem/36385562>
1483
1484         Reviewed by Antti Koivisto.
1485
1486         This is about moving code, no cleanup and/or normalization (unfortunately it also means
1487         some temporary changes).  
1488
1489         No change in functionality.
1490
1491         * rendering/RenderElement.cpp:
1492         (WebCore::RenderElement::addChild):
1493         (WebCore::RenderElement::childRequiresTable const): Deleted.
1494         * rendering/RenderElement.h:
1495         * rendering/updating/RenderTreeBuilder.cpp:
1496         (WebCore::RenderTreeBuilder::insertChildToRenderElement):
1497         (WebCore::RenderTreeBuilder::childRequiresTable):
1498         * rendering/updating/RenderTreeBuilder.h:
1499         * rendering/updating/RenderTreeBuilderInline.cpp:
1500         (WebCore::RenderTreeBuilder::Inline::insertChildToContinuation):
1501         (WebCore::RenderTreeBuilder::Inline::insertChildIgnoringContinuation):
1502         (WebCore::RenderTreeBuilder::Inline::newChildIsInline):
1503         (WebCore::newChildIsInline): Deleted.
1504         * rendering/updating/RenderTreeBuilderInline.h:
1505
1506 2018-01-09  Matt Lewis  <jlewis3@apple.com>
1507
1508         Unreviewed, rolling out r226531.
1509
1510         This caused test failures on macOS WK2.
1511
1512         Reverted changeset:
1513
1514         "Use no-cache fetch mode when loading main documents with
1515         location.reload()"
1516         https://bugs.webkit.org/show_bug.cgi?id=181285
1517         https://trac.webkit.org/changeset/226531
1518
1519 2018-01-09  Michael Saboff  <msaboff@apple.com>
1520
1521         Unreviewed, rolling out r226600 and r226603
1522         https://bugs.webkit.org/show_bug.cgi?id=181351
1523
1524         Add a DOM gadget for Spectre testing
1525
1526         * dom/Comment.cpp:
1527         (WebCore::Comment::Comment):
1528         (WebCore::Comment::setReadLength): Deleted.
1529         (WebCore::Comment::charCodeAt): Deleted.
1530         (WebCore::Comment::clflushReadLength): Deleted.
1531         * dom/Comment.h:
1532         * dom/Comment.idl:
1533         * page/RuntimeEnabledFeatures.cpp:
1534         (WebCore::RuntimeEnabledFeatures::spectreGadgetsEnabled const): Deleted.
1535         * page/RuntimeEnabledFeatures.h:
1536
1537 2018-01-09  Don Olmstead  <don.olmstead@sony.com>
1538
1539         Add additional WEBCORE_EXPORTs
1540         https://bugs.webkit.org/show_bug.cgi?id=181414
1541
1542         Reviewed by Alex Christensen.
1543
1544         No new tests. No change in behavior.
1545
1546         * dom/Document.h:
1547         * dom/ViewportArguments.h:
1548         * page/DOMWindow.h:
1549         * page/FrameView.h:
1550         * page/PageOverlayController.h:
1551         * platform/ContextMenuItem.h:
1552         * platform/Pasteboard.h:
1553         * platform/SharedBuffer.h:
1554         * platform/UserAgent.h:
1555         * platform/graphics/GLContext.h:
1556         * platform/graphics/GraphicsContext.h:
1557         * platform/graphics/GraphicsLayerTransform.h:
1558         * platform/graphics/PlatformDisplay.h:
1559         * platform/graphics/cairo/BackingStoreBackendCairoImpl.h:
1560         * platform/graphics/cairo/PlatformContextCairo.h:
1561         * platform/graphics/cairo/RefPtrCairo.h:
1562         * platform/graphics/nicosia/NicosiaBuffer.h:
1563         * platform/graphics/nicosia/NicosiaPaintingEngine.h:
1564         * platform/graphics/texmap/TextureMapper.h:
1565         * platform/graphics/texmap/TextureMapperAnimation.h:
1566         * platform/graphics/texmap/TextureMapperBackingStore.h:
1567         * platform/graphics/texmap/TextureMapperFPSCounter.h:
1568         * platform/graphics/texmap/TextureMapperLayer.h:
1569         (WebCore::TextureMapperLayer::TextureMapperLayer): Deleted.
1570         (WebCore::TextureMapperLayer::setID): Deleted.
1571         (WebCore::TextureMapperLayer::id): Deleted.
1572         (WebCore::TextureMapperLayer:: const): Deleted.
1573         (WebCore::TextureMapperLayer::setScrollClient): Deleted.
1574         (WebCore::TextureMapperLayer::setIsScrollable): Deleted.
1575         (WebCore::TextureMapperLayer::isScrollable const): Deleted.
1576         (WebCore::TextureMapperLayer::textureMapper const): Deleted.
1577         (WebCore::TextureMapperLayer::setTextureMapper): Deleted.
1578         (WebCore::TextureMapperLayer::drawsContent const): Deleted.
1579         (WebCore::TextureMapperLayer::contentsAreVisible const): Deleted.
1580         (WebCore::TextureMapperLayer::size const): Deleted.
1581         (WebCore::TextureMapperLayer::opacity const): Deleted.
1582         (WebCore::TextureMapperLayer::transform const): Deleted.
1583         (WebCore::TextureMapperLayer::hasFilters const): Deleted.
1584         (WebCore::TextureMapperLayer::isShowingRepaintCounter const): Deleted.
1585         (WebCore::TextureMapperLayer::fixedToViewport const): Deleted.
1586         (WebCore::TextureMapperLayer::rootLayer const): Deleted.
1587         (WebCore::TextureMapperLayer::texture): Deleted.
1588         (WebCore::TextureMapperLayer::adjustedPosition const): Deleted.
1589         (WebCore::TextureMapperLayer::layerRect const): Deleted.
1590         (WebCore::TextureMapperLayer::State::State): Deleted.
1591         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
1592         * platform/graphics/texmap/TextureMapperTile.h:
1593         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
1594         (WebCore::CoordinatedGraphicsLayer::isScrollable const): Deleted.
1595         (WebCore::CoordinatedGraphicsLayer::id const): Deleted.
1596         (WebCore::CoordinatedGraphicsLayer::coverRect const): Deleted.
1597         (WebCore::CoordinatedGraphicsLayer::fixedToViewport const): Deleted.
1598         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.h:
1599         (WebCore::CoordinatedImageBacking::id const): Deleted.
1600         * platform/graphics/texmap/coordinated/TiledBackingStore.h:
1601         * platform/graphics/texmap/coordinated/UpdateAtlas.h:
1602         * platform/network/AuthenticationChallengeBase.h:
1603         * platform/network/CredentialBase.h:
1604         * platform/network/ProtectionSpaceBase.h:
1605         * platform/network/curl/SocketStreamHandleImpl.h:
1606         * replay/UserInputBridge.h:
1607
1608 2018-01-09  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1609
1610         [Curl] Move FormData related tasks into new CurlFormDataStream class.
1611         https://bugs.webkit.org/show_bug.cgi?id=181106
1612
1613         Reviewed by Alex Christensen.
1614
1615         No new tests because no behavior change.
1616
1617         * platform/Curl.cmake:
1618         * platform/network/curl/CurlFormDataStream.cpp: Added.
1619         (WebCore::CurlFormDataStream::CurlFormDataStream):
1620         (WebCore::CurlFormDataStream::~CurlFormDataStream):
1621         (WebCore::CurlFormDataStream::clean):
1622         (WebCore::CurlFormDataStream::shouldUseChunkTransfer):
1623         (WebCore::CurlFormDataStream::totalSize):
1624         (WebCore::CurlFormDataStream::computeContentLength):
1625         (WebCore::CurlFormDataStream::read):
1626         (WebCore::CurlFormDataStream::readFromFile):
1627         (WebCore::CurlFormDataStream::readFromData):
1628         * platform/network/curl/CurlFormDataStream.h: Renamed from Source/WebCore/platform/network/curl/FormDataStreamCurl.h.
1629         (WebCore::CurlFormDataStream::elementSize):
1630         (WebCore::CurlFormDataStream::totalReadSize):
1631         * platform/network/curl/CurlRequest.cpp:
1632         (WebCore::CurlRequest::CurlRequest):
1633         (WebCore::CurlRequest::willSendData):
1634         (WebCore::CurlRequest::finalizeTransfer):
1635         (WebCore::CurlRequest::setupPUT):
1636         (WebCore::CurlRequest::setupPOST):
1637         (WebCore::CurlRequest::setupSendData):
1638         (WebCore::CurlRequest::resolveBlobReferences): Deleted.
1639         (WebCore::CurlRequest::setupFormData): Deleted.
1640         * platform/network/curl/CurlRequest.h:
1641         * platform/network/curl/FormDataStreamCurl.cpp: Removed.
1642
1643 2018-01-09  Zalan Bujtas  <zalan@apple.com>
1644
1645         [RenderTreeBuilder] Move MathML addChild logic to RenderTreeBuilder
1646         https://bugs.webkit.org/show_bug.cgi?id=181443
1647         <rdar://problem/36380228>
1648
1649         Reviewed by Antti Koivisto.
1650
1651         This is about moving code, no cleanup and/or normalization (unfortunately it also means
1652         some temporary changes).  
1653
1654         No change in functionality.
1655
1656         * Sources.txt:
1657         * WebCore.xcodeproj/project.pbxproj:
1658         * rendering/mathml/RenderMathMLFenced.cpp:
1659         (WebCore::RenderMathMLFenced::addChild):
1660         (WebCore::RenderMathMLFenced::createMathMLOperator): Deleted.
1661         (WebCore::RenderMathMLFenced::makeFences): Deleted.
1662         * rendering/mathml/RenderMathMLFenced.h:
1663         * rendering/updating/RenderTreeBuilder.cpp:
1664         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
1665         (WebCore::RenderTreeBuilder::insertChildToRenderMathMLFenced):
1666         * rendering/updating/RenderTreeBuilder.h:
1667         (WebCore::RenderTreeBuilder::mathMLBuilder):
1668
1669 2018-01-09  Antti Koivisto  <antti@apple.com>
1670
1671         Blank page except for inner iframes because pending stylesheets cause style.isNotFinal() to be true
1672         https://bugs.webkit.org/show_bug.cgi?id=180940
1673         <rdar://problem/36116507>
1674
1675         Reviewed by Darin Adler.
1676
1677         Test: http/tests/local/loading-stylesheet-import-remove.html
1678
1679         If a <link> referencing a stylesheet containing an @import that was still loading was removed
1680         from the document, the loading state was never cleared. For head stylesheets this blocked
1681         rendering permanently.
1682
1683         Test reduction by Justin Ridgewell.
1684
1685         * html/HTMLLinkElement.cpp:
1686         (WebCore::HTMLLinkElement::removedFromAncestor):
1687
1688         Test if the stylesheet it loading before clearing the pointer.
1689
1690 2018-01-09  Dan Bernstein  <mitz@apple.com>
1691
1692         Removed some empty directories that were left behind
1693
1694         * Modules/indieui: Removed.
1695         * Modules/vibration: Removed.
1696         * platform/graphics/ca/mac: Removed.
1697         * platform/mediastream/gstreamer: Removed.
1698
1699 2018-01-09  Antoine Quint  <graouts@apple.com>
1700
1701         Refactor timing function solving code
1702         https://bugs.webkit.org/show_bug.cgi?id=181428
1703
1704         Reviewed by Dean Jackson.
1705
1706         We have duplicated code to solve "cubic" and "steps" timing functions in AnimationBase and TextureMapperAnimation,
1707         and we will soon need similar code to deal with timing functions in Web Animations. We move this code into TimingFunction
1708         with a single transformTime() function that can be called directly on the timing function rather than having callers
1709         figure out what type timing functions are to solve them.
1710
1711         No test as there shouldn't be any behavior change.
1712
1713         * page/animation/AnimationBase.cpp:
1714         (WebCore::AnimationBase::progress const):
1715         (WebCore::solveEpsilon): Deleted.
1716         (WebCore::solveCubicBezierFunction): Deleted.
1717         (WebCore::solveStepsFunction): Deleted.
1718         (WebCore::solveSpringFunction): Deleted.
1719         * platform/animation/TimingFunction.cpp:
1720         (WebCore::TimingFunction::transformTime const):
1721         * platform/animation/TimingFunction.h:
1722         * platform/graphics/texmap/TextureMapperAnimation.cpp:
1723         (WebCore::TextureMapperAnimation::apply):
1724         (WebCore::solveEpsilon): Deleted.
1725         (WebCore::solveCubicBezierFunction): Deleted.
1726         (WebCore::solveStepsFunction): Deleted.
1727         (WebCore::applyTimingFunction): Deleted.
1728
1729 2018-01-09  Michael Catanzaro  <mcatanzaro@igalia.com>
1730
1731         Unreviewed, silence -Wunused-parameter warning
1732
1733         * testing/js/WebCoreTestSupport.cpp:
1734         (WebCoreTestSupport::setupNewlyCreatedServiceWorker):
1735
1736 2018-01-09  Said Abou-Hallawa  <sabouhallawa@apple.com>
1737
1738         Check Image::m_image is not null in ImageLoader::decode()
1739         https://bugs.webkit.org/show_bug.cgi?id=180386
1740         <rdar://problem/34634483>
1741
1742         Reviewed by Tim Horton.
1743
1744         Ensure ImageLoader::m_image is not null before referencing it.
1745
1746         * loader/ImageLoader.cpp:
1747         (WebCore::ImageLoader::decode):
1748
1749 2018-01-09  Yusuke Suzuki  <utatane.tea@gmail.com>
1750
1751         [FreeType] Use FastMalloc for FreeType
1752         https://bugs.webkit.org/show_bug.cgi?id=181387
1753
1754         Reviewed by Michael Catanzaro.
1755
1756         Add custom memory allocator for FreeType to use FastMalloc.
1757
1758         * platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp:
1759         (WebCore::initializeFreeTypeLibrary):
1760         (WebCore::createFontCustomPlatformData):
1761
1762 2018-01-09  Zalan Bujtas  <zalan@apple.com>
1763
1764         [RenderTreeBuilder] Move RenderTable* addChild mutation logic to RenderTreeBuilder
1765         https://bugs.webkit.org/show_bug.cgi?id=181424
1766         <rdar://problem/36368628>
1767
1768         Reviewed by Antti Koivisto.
1769
1770         This is about moving code, no cleanup and/or normalization (unfortunately it also means
1771         some temporary changes).  
1772
1773         Covered by existing tests.
1774
1775         * rendering/RenderTable.cpp:
1776         (WebCore::RenderTable::addChild):
1777         * rendering/RenderTableRow.cpp:
1778         (WebCore::RenderTableRow::addChild):
1779         * rendering/RenderTableSection.cpp:
1780         (WebCore::RenderTableSection::addChild):
1781         * rendering/updating/RenderTreeBuilder.cpp:
1782         (WebCore::RenderTreeBuilder::insertChildToRenderTable):
1783         (WebCore::RenderTreeBuilder::insertChildToRenderTableSection):
1784         (WebCore::RenderTreeBuilder::insertChildToRenderTableRow):
1785         * rendering/updating/RenderTreeBuilder.h:
1786         * rendering/updating/RenderTreeBuilderTable.cpp:
1787         (WebCore::RenderTreeBuilder::Table::insertChild):
1788         * rendering/updating/RenderTreeBuilderTable.h:
1789
1790 2018-01-09  Zalan Bujtas  <zalan@apple.com>
1791
1792         [RenderTreeBuilder] Transition Render*::addChild() calls to RenderTreeBuilder::insertChildToRender*()
1793         https://bugs.webkit.org/show_bug.cgi?id=181407
1794         <rdar://problem/36361176>
1795
1796         Reviewed by Antti Koivisto.
1797
1798         Eventually all mutation will be going through the RenderTreeBuilder.
1799
1800         No change in functionality.
1801
1802         * rendering/RenderGrid.cpp:
1803         (WebCore::RenderGrid::addChild):
1804         * rendering/RenderMultiColumnFlow.cpp:
1805         (WebCore::RenderMultiColumnFlow::processPossibleSpannerDescendant):
1806         * rendering/RenderRubyRun.cpp:
1807         (WebCore::RenderRubyRun::rubyBaseSafe):
1808         * rendering/updating/RenderTreeBuilderBlockFlow.cpp:
1809         (WebCore::RenderTreeBuilder::BlockFlow::insertChild):
1810         * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
1811         (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow):
1812         * rendering/updating/RenderTreeBuilderRuby.cpp:
1813         (WebCore::RenderTreeBuilder::Ruby::findOrCreateParentForChild):
1814
1815 2018-01-09  Philippe Normand  <pnormand@igalia.com>
1816
1817         [GStreamer] Ensure SleepDisabler is not held by pages in page cache
1818         https://bugs.webkit.org/show_bug.cgi?id=180197
1819
1820         Reviewed by Eric Carlson.
1821
1822         The sleep disabler is now checked again whenever the media player
1823         playback state or other characteristic has changed in the media
1824         engine.
1825
1826         * html/HTMLMediaElement.cpp:
1827         (WebCore::HTMLMediaElement::mediaPlayerPlaybackStateChanged):
1828         Check if the sleep disabler state needs to be updated or not.
1829         (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged): Ditto.
1830         (WebCore::HTMLMediaElement::shouldDisableSleep const): Enable
1831         sleep disabler for GTK and WPE ports.
1832
1833 2018-01-09  Philippe Normand  <pnormand@igalia.com>
1834
1835         [GStreamer] Missing notifications to player client
1836         https://bugs.webkit.org/show_bug.cgi?id=181432
1837
1838         Reviewed by Carlos Garcia Campos.
1839
1840         We now properly emit playback state changes and characteristic
1841         updates to the client when the pipeline state changes and when
1842         audio/video tracks changes are detected.
1843
1844         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1845         (WebCore::MediaPlayerPrivateGStreamer::playbackPosition const):
1846         This debug message appears too often in logs. Demote.
1847         (WebCore::MediaPlayerPrivateGStreamer::durationMediaTime const): Ditto.
1848         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideo): Emit
1849         charasteristicChanged notification.
1850         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfAudio): Ditto.
1851         (WebCore::MediaPlayerPrivateGStreamer::updateStates): Keep track
1852         of old and current pipeline state.
1853         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
1854
1855
1856 2018-01-09  Youenn Fablet  <youenn@apple.com>
1857
1858         Add CSP support to service workers
1859         https://bugs.webkit.org/show_bug.cgi?id=181385
1860
1861         Reviewed by Chris Dumez.
1862
1863         Covered by rebased tests.
1864
1865         Added recovery of CSP information from WorkerScriptLoader.
1866         Added plumbing to pass the CSP information to Service Workers.
1867         Did not add persistency support for the CSP information as this requires changing the SQL database schema.
1868         This will be done in a follow-up.
1869
1870         * workers/WorkerScriptLoader.cpp:
1871         (WebCore::WorkerScriptLoader::loadAsynchronously):
1872         (WebCore::WorkerScriptLoader::didReceiveResponse):
1873         * workers/WorkerScriptLoader.h:
1874         (WebCore::WorkerScriptLoader::contentSecurityPolicy const):
1875         * workers/service/SWClientConnection.cpp:
1876         (WebCore::SWClientConnection::finishedFetchingScript):
1877         (WebCore::SWClientConnection::failedFetchingScript):
1878         * workers/service/SWClientConnection.h:
1879         * workers/service/ServiceWorkerContainer.cpp:
1880         (WebCore::ServiceWorkerContainer::addRegistration):
1881         (WebCore::ServiceWorkerContainer::jobFailedWithException):
1882         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
1883         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
1884         * workers/service/ServiceWorkerContainer.h:
1885         * workers/service/ServiceWorkerContextData.cpp:
1886         (WebCore::ServiceWorkerContextData::isolatedCopy const):
1887         * workers/service/ServiceWorkerContextData.h:
1888         (WebCore::ServiceWorkerContextData::encode const):
1889         (WebCore::ServiceWorkerContextData::decode):
1890         * workers/service/ServiceWorkerFetchResult.h:
1891         (WebCore::ServiceWorkerFetchResult::encode const):
1892         (WebCore::ServiceWorkerFetchResult::decode):
1893         * workers/service/ServiceWorkerGlobalScope.cpp:
1894         (WebCore::ServiceWorkerGlobalScope::create):
1895         * workers/service/ServiceWorkerGlobalScope.h:
1896         * workers/service/ServiceWorkerJob.cpp:
1897         (WebCore::ServiceWorkerJob::notifyFinished):
1898         * workers/service/ServiceWorkerJobClient.h:
1899         * workers/service/context/ServiceWorkerThread.cpp:
1900         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
1901         (WebCore::ServiceWorkerThread::createWorkerGlobalScope):
1902         * workers/service/server/RegistrationDatabase.cpp:
1903         (WebCore::v1RecordsTableSchema):
1904         (WebCore::RegistrationDatabase::importRecords):
1905         * workers/service/server/SWServer.cpp:
1906         (WebCore::SWServer::updateWorker):
1907         (WebCore::SWServer::installContextData):
1908         * workers/service/server/SWServer.h:
1909         * workers/service/server/SWServerJobQueue.cpp:
1910         (WebCore::SWServerJobQueue::scriptFetchFinished):
1911         * workers/service/server/SWServerWorker.cpp:
1912         (WebCore::SWServerWorker::SWServerWorker):
1913         (WebCore::m_contentSecurityPolicy):
1914         (WebCore::SWServerWorker::contextData const):
1915         * workers/service/server/SWServerWorker.h:
1916
1917 2018-01-09  Antoine Quint  <graouts@apple.com>
1918
1919         Provide a method to obtain a CSS value from a RenderStyle by CSSPropertyID
1920         https://bugs.webkit.org/show_bug.cgi?id=181429
1921
1922         Reviewed by Antti Koivisto.
1923
1924         The KeyframeEffect.getKeyframes() method from Web Animations requires that we return all styles applied at a given
1925         animation effect keyframe. When we parse keyframes, we create RenderStyle objects that are stored in a KeyframeList,
1926         as well as a list of CSSPropertyIDs that are animated. In order to provide the list of animated properties and their
1927         values when calling getKeyframes(), we need to be able to read back from the RenderStyle we create. As a first step
1928         towards this goal, we factor some code in ComputedStyleExtractor::propertyValue() out into a new method
1929         ComputedStyleExtractor::valueForPropertyinStyle() which takes in an explicit RenderStyle.
1930
1931         No test as this is simply refactoring that doesn't change or add behavior.
1932
1933         * css/CSSComputedStyleDeclaration.cpp:
1934         (WebCore::ComputedStyleExtractor::propertyValue):
1935         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
1936         * css/CSSComputedStyleDeclaration.h:
1937
1938 2018-01-09  Youenn Fablet  <youenn@apple.com>
1939
1940         SWClientConnection should not keep references to service worker jobs
1941         https://bugs.webkit.org/show_bug.cgi?id=181381
1942
1943         Reviewed by Chris Dumez.
1944
1945         Difficult to test determiniscally but corresponding crash log should no longer happen in debug builds.
1946
1947         Stopped passing ServiceWorkerJob references from ServiceWorkerContainer (potentially in service worker thread) to SWClientConnection (main thread).
1948         Instead pass job identifiers and related data to the main thread.
1949
1950         Minor refactoring to use ServiceWorkerJobIdentifier instead of ServiceWorkerJobDataIdentifier which contains more data than needed.
1951
1952         * workers/service/SWClientConnection.cpp:
1953         (WebCore::SWClientConnection::scheduleJob):
1954         (WebCore::SWClientConnection::failedFetchingScript):
1955         (WebCore::SWClientConnection::postTaskForJob):
1956         (WebCore::SWClientConnection::jobRejectedInServer):
1957         (WebCore::SWClientConnection::registrationJobResolvedInServer):
1958         (WebCore::SWClientConnection::unregistrationJobResolvedInServer):
1959         (WebCore::SWClientConnection::startScriptFetchForServer):
1960         (WebCore::SWClientConnection::clearPendingJobs):
1961         (WebCore::SWClientConnection::finishedFetchingScript): Deleted.
1962         * workers/service/SWClientConnection.h:
1963         * workers/service/ServiceWorkerContainer.cpp:
1964         (WebCore::ServiceWorkerContainer::scheduleJob):
1965         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
1966         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
1967         (WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
1968         * workers/service/ServiceWorkerContainer.h:
1969         * workers/service/server/SWServer.cpp:
1970         (WebCore::SWServer::rejectJob):
1971         (WebCore::SWServer::resolveRegistrationJob):
1972         (WebCore::SWServer::resolveUnregistrationJob):
1973         (WebCore::SWServer::startScriptFetch):
1974         * workers/service/server/SWServer.h:
1975
1976 2018-01-09  Carlos Garcia Campos  <cgarcia@igalia.com>
1977
1978         REGRESSION(r224460): Text fields sometimes get "messed up"
1979         https://bugs.webkit.org/show_bug.cgi?id=181115
1980
1981         Reviewed by Zalan Bujtas.
1982
1983         Add the scroll position to paint offset before computing the clip rectangle. Before r224460, scroll position was
1984         substracted after the clip rectangle was computed.
1985
1986         * rendering/LayoutState.cpp:
1987         (WebCore::LayoutState::computeClipRect):
1988
1989 2018-01-09  Ali Juma  <ajuma@chromium.org>
1990
1991         Implement VisualViewport API events
1992         https://bugs.webkit.org/show_bug.cgi?id=179386
1993
1994         Reviewed by Frédéric Wang.
1995
1996         Implement the events (resize and scroll) defined by the Visual Viewport API
1997         (https://wicg.github.io/visual-viewport/#events).
1998
1999         This is behind the VisualViewportAPI experimental feature flag.
2000
2001         In order to detect when events need to be fired, change the computation of
2002         Visual Viewport attributes to happen whenever the layout viewport is updated
2003         rather than only on-demand.
2004
2005         Tests: fast/visual-viewport/resize-event-fired-window-resized.html
2006                fast/visual-viewport/resize-event-fired.html
2007                fast/visual-viewport/scroll-event-fired.html
2008
2009         * dom/Document.cpp:
2010         (WebCore::Document::addListenerTypeIfNeeded):
2011         Add support for tracking resize event listeners.
2012         * dom/Document.h:
2013         * dom/DocumentEventQueue.cpp:
2014         (WebCore::DocumentEventQueue::enqueueOrDispatchScrollEvent):
2015         (WebCore::DocumentEventQueue::enqueueScrollEvent):
2016         Factored out of enqueueOrDispatchScrollEvent so that this logic can be reused
2017         for Visual Viewport scroll events.
2018         (WebCore::DocumentEventQueue::enqueueResizeEvent):
2019         (WebCore::DocumentEventQueue::pendingEventTimerFired):
2020         * dom/DocumentEventQueue.h:
2021         * page/FrameView.cpp:
2022         (WebCore::FrameView::updateLayoutViewport):
2023         * page/VisualViewport.cpp:
2024         (WebCore::VisualViewport::addEventListener):
2025         (WebCore::layoutIfNonNull):
2026         (WebCore::VisualViewport::offsetLeft const):
2027         Remove attribute computation logic since this now happens during update().
2028         (WebCore::VisualViewport::offsetTop const): Ditto.
2029         (WebCore::VisualViewport::pageLeft const): Ditto.
2030         (WebCore::VisualViewport::pageTop const): Ditto.
2031         (WebCore::VisualViewport::width const): Ditto.
2032         (WebCore::VisualViewport::height const): Ditto.
2033         (WebCore::VisualViewport::scale const):
2034         (WebCore::VisualViewport::update):
2035         Added. Computes all of the Visual Viewport attributes and determines
2036         whether events need to be fired.
2037         (WebCore::VisualViewport::enqueueResizeEvent):
2038         (WebCore::VisualViewport::enqueueScrollEvent):
2039         (WebCore::getFrameViewAndLayoutIfNonNull): Deleted.
2040         * page/VisualViewport.h:
2041
2042 2018-01-09  Yacine Bandou  <yacine.bandou_ext@softathome.com>
2043
2044         [EME] Add the CENC initData support in ClearKey CDM
2045         https://bugs.webkit.org/show_bug.cgi?id=180081
2046
2047         Reviewed by Xabier Rodriguez-Calvar.
2048
2049         Add the "cenc" initDataType support in ClearKey CDM.
2050         Parse the CENC initData and extract the KIDs by following the W3C spec
2051         https://www.w3.org/TR/eme-initdata-cenc/#common-system
2052
2053         Tests: media/encrypted-media/clearKey/clearKey-message-cenc-event.html
2054                media/encrypted-media/clearKey/clearKey-message-cenc-event-mse.html
2055
2056         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
2057         (WebCore::extractKeyidsLocationFromCencInitData):
2058         (WebCore::isCencInitData):
2059         (WebCore::extractKeyidsFromCencInitData):
2060         (WebCore::CDMPrivateClearKey::supportsInitDataType const):
2061         (WebCore::CDMPrivateClearKey::supportsInitData const):
2062         (WebCore::CDMInstanceClearKey::requestLicense):
2063
2064 2018-01-09  Zan Dobersek  <zdobersek@igalia.com>
2065
2066         [Cairo] Pass state values directly to Cairo operations
2067         https://bugs.webkit.org/show_bug.cgi?id=181389
2068
2069         Reviewed by Carlos Garcia Campos.
2070
2071         Instead of passing reference to the GraphicsContextState object to
2072         various Cairo operations, only pass the required state values. This
2073         makes it explicit what state values are used in these operations, at the
2074         expense of some long parameter lists, but this will be better addressed
2075         by future refactoring of this code into more concise functions.
2076
2077         No new tests -- no change in functionality.
2078
2079         * platform/graphics/cairo/CairoOperations.cpp:
2080         (WebCore::Cairo::drawGlyphsShadow):
2081         (WebCore::Cairo::dashedLineCornerWidthForStrokeWidth):
2082         (WebCore::Cairo::dashedLinePatternWidthForStrokeWidth):
2083         (WebCore::Cairo::drawGlyphs):
2084         (WebCore::Cairo::drawRect):
2085         (WebCore::Cairo::drawLine):
2086         (WebCore::Cairo::drawEllipse):
2087         * platform/graphics/cairo/CairoOperations.h:
2088         * platform/graphics/cairo/FontCairo.cpp:
2089         (WebCore::FontCascade::drawGlyphs):
2090         * platform/graphics/cairo/GraphicsContextCairo.cpp:
2091         (WebCore::GraphicsContext::drawRect):
2092         (WebCore::GraphicsContext::drawLine):
2093         (WebCore::GraphicsContext::drawEllipse):
2094
2095 2018-01-09  Ryosuke Niwa  <rniwa@webkit.org>
2096
2097         Release assert in addResourceTiming when a cache resource is requested during style recalc
2098         https://bugs.webkit.org/show_bug.cgi?id=181137
2099         <rdar://problem/35666574>
2100
2101         Reviewed by Simon Fraser.
2102
2103         Make the dispatching of resourcetimingbufferfull event asynchronous to avoid dispatching it
2104         synchronously during a style resolution when CachedResourceLoader::requestImage requests
2105         a previously loaded image.
2106
2107         We now schedule a timer when the resource timing buffer becomes full, and dispatch the event
2108         when the timer fires. Meanwhile, we have a backup buffer to which additional resource timing
2109         entries would be added. Once the event is dispatched, we refill the buffer exposed to author
2110         scripts. When refilling the buffer results in it becoming full again, we keep repeating the
2111         process of firing resourcetimingbufferfull and re-filling the buffer until either we stop
2112         making progress (i.e. the script didn't increase the number of empty entires in the buffer)
2113         or the backup buffer (at the time we started this process) becomes empty.
2114
2115         Also fixed a bug that we were firing resourcetimingbufferfull event when the last entry that
2116         fits within the buffer size was added instead of when an entry is being added to an already
2117         full buffer. To make this work, the patch introduces m_resourceTimingBufferFullFlag,
2118         representing the concept "resource timing buffer full" flag in the resource timing specification.
2119
2120         Test: http/tests/performance/performance-resource-timing-resourcetimingbufferfull-crash.html
2121
2122         * page/Performance.cpp:
2123         (WebCore::Performance::Performance):
2124         (WebCore::Performance::clearResourceTimings):
2125         (WebCore::Performance::setResourceTimingBufferSize):
2126         (WebCore::Performance::addResourceTiming):
2127         (WebCore::Performance::resourceTimingBufferFullTimerFired):
2128         * page/Performance.h:
2129
2130 2018-01-08  Chris Nardi  <csnardi1@gmail.com>
2131
2132         ::first-letter incorrectly selects grapheme pairs
2133         https://bugs.webkit.org/show_bug.cgi?id=181315
2134
2135         Reviewed by Darin Adler.
2136
2137         Grapheme pairs were incorrectly selected by ::first-letter. This
2138         change fixes their selection.
2139
2140         Tests: Updated fast/css/first-letter-punctuation.html and imported
2141         LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo-4/first-letter-004.html
2142
2143         * rendering/updating/RenderTreeBuilderFirstLetter.cpp:
2144         (WebCore::isPunctuationForFirstLetter):
2145         (WebCore::shouldSkipForFirstLetter):
2146         (WebCore::RenderTreeBuilder::FirstLetter::createRenderers):
2147
2148 2018-01-08  Darin Adler  <darin@apple.com>
2149
2150         Special list-item counter starts from an incorrect number for ::before and ::after
2151         https://bugs.webkit.org/show_bug.cgi?id=181084
2152
2153         Reviewed by Zalan Bujtas.
2154
2155         Test: fast/css/counters/counter-list-item.html
2156
2157         * Sources.txt: Removed CounterDirectives.cpp.
2158         * WebCore.xcodeproj/project.pbxproj: Ditto.
2159
2160         * css/CSSComputedStyleDeclaration.cpp:
2161         (WebCore::counterToCSSValue): Updated for changes to the CounterDirectives struct.
2162         * css/StyleBuilderCustom.h:
2163         (WebCore::StyleBuilderCustom::applyInheritCounter): Ditto.
2164         (WebCore::StyleBuilderCustom::applyValueCounter): Ditto.
2165
2166         * html/HTMLLIElement.cpp:
2167         (WebCore::HTMLLIElement::parseValue): Call setExplicitValue(std::nullopt) instead
2168         of clearExplicitValue since we are using std::optional now.
2169
2170         * rendering/RenderCounter.cpp:
2171         (WebCore::listItemCounterDirectives): Added. Computes the counter directives that
2172         express the effects on the list-item counter from list item and list elements.
2173         Used something as close to what the CSS 3 draft says as possible. This uses a
2174         negative increment when creating a list to counteract the positive increment done
2175         by a list element, except in the case of an unordered list. This is where the bug
2176         fix actually lies. Also fixed handling of reversed ordered lists at the same time.
2177         (WebCore::planCounter): Refactored to use the function above. Also changed the
2178         code to pay attention to both the counter directives and the implicit ones from
2179         list item and list elements, getting as close as possible to what the specification
2180         seems to call for.
2181
2182         * rendering/RenderListItem.cpp:
2183         (WebCore::RenderListItem::RenderListItem): Since we are using std::optional and no
2184         longer using bit fields, simplified the constructor for each list item.
2185         (WebCore::RenderListItem::calcValue const): Deleted.
2186         (WebCore::RenderListItem::updateValueNow const): Merged in all the code from the
2187         old calcValue function, but it is also simpler now since m_value is std::optional.
2188         (WebCore::RenderListItem::updateValue): Updated to use std::optional.
2189         (WebCore::RenderListItem::setExplicitValue): Ditto.
2190         (WebCore::RenderListItem::clearExplicitValue): Deleted.
2191         (WebCore::RenderListItem::updateListMarkerNumbers): Updated to use std::optional.
2192         (WebCore::RenderListItem::isInReversedOrderedList const): Added. This is used by
2193         the counter code so it can decrement instead of incrementing.
2194
2195         * rendering/RenderListItem.h: Updated to use std::optional. Also marked functions
2196         final instead of override and initialized m_notInList after making it not be a
2197         bitfield any more.
2198
2199         * rendering/style/CounterDirectives.cpp: Removed.
2200         * rendering/style/CounterDirectives.h: Removed most of the CounterDirectives
2201         class and replaced it with a struct with two std::optional. Added an addClamped
2202         function so the counter code can share it with the addIncrementValue function.
2203         If we want to make a faster version that doesn't use double, we can come back
2204         and do that. Also moved the == function to the header since the implementation
2205         is so trivial.
2206
2207         * rendering/style/StyleAllInOne.cpp: Removed CounterDirectives.cpp.
2208
2209         * rendering/style/StyleRareNonInheritedData.cpp:
2210         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData): Updated to
2211         use std::make_unique directly instead of using a clone function.
2212
2213 2018-01-08  Wenson Hsieh  <wenson_hsieh@apple.com>
2214
2215         [Attachment Support] Expose HTMLAttachmentElement.uniqueIdentifier to bindings
2216         https://bugs.webkit.org/show_bug.cgi?id=181420
2217         <rdar://problem/36365827>
2218
2219         Reviewed by Alex Christensen.
2220
2221         Add a new IDL definition for uniqueIdentifier on HTMLAttachmentElement. This allows clients to relate attachment
2222         elements in the DOM to _WKAttachments delivered via Objective-C SPI.
2223
2224         Adjusted existing tests in WKAttachmentTests.
2225
2226         * html/HTMLAttachmentElement.idl:
2227
2228 2018-01-08  Don Olmstead  <don.olmstead@sony.com>
2229
2230         AccessibilityARIAGrid does not compile when accessibility is disabled
2231         https://bugs.webkit.org/show_bug.cgi?id=181418
2232         <rdar://problem/36365398>
2233
2234         Reviewed by Chris Fleizach.
2235
2236         No new tests. No change in behavior.
2237
2238         * accessibility/AccessibilityARIAGrid.cpp:
2239
2240 2018-01-08  Commit Queue  <commit-queue@webkit.org>
2241
2242         Unreviewed, rolling out r226532 and r226540.
2243         https://bugs.webkit.org/show_bug.cgi?id=181422
2244
2245         jessie says basic browsing does not seem to work (Requested by
2246         alexchristensen on #webkit).
2247
2248         Reverted changesets:
2249
2250         "Add CSP support to service workers"
2251         https://bugs.webkit.org/show_bug.cgi?id=181385
2252         https://trac.webkit.org/changeset/226532
2253
2254         "SWClientConnection should not keep references to service
2255         worker jobs"
2256         https://bugs.webkit.org/show_bug.cgi?id=181381
2257         https://trac.webkit.org/changeset/226540
2258
2259 2018-01-08  Wenson Hsieh  <wenson_hsieh@apple.com>
2260
2261         [Attachment Support] Expose file name and content type of WKAttachment
2262         https://bugs.webkit.org/show_bug.cgi?id=181390
2263         <rdar://problem/36336837>
2264
2265         Reviewed by Tim Horton.
2266
2267         Add new structs in AttachmentTypes.h and refactor HTMLAttachmentElement::requestData to requestInfo. See below
2268         for more details. Augmented existing API tests in WKAttachmentTests.
2269
2270         * html/AttachmentTypes.h:
2271
2272         Add a struct to represent a snapshot of information about an attachment element.
2273
2274         * html/HTMLAttachmentElement.cpp:
2275         (WebCore::HTMLAttachmentElement::requestInfo):
2276         (WebCore::HTMLAttachmentElement::requestData): Deleted.
2277         * html/HTMLAttachmentElement.h:
2278
2279         Change requestData to requestInfo. Instead of fetching and delivering data via callback, requestInfo returns an
2280         AttachmentInfo.
2281
2282         * rendering/RenderThemeIOS.mm:
2283         (WebCore::RenderAttachmentInfo::addLine):
2284         (WebCore::RenderAttachmentInfo::buildWrappedLines):
2285         (WebCore::RenderAttachmentInfo::buildSingleLine):
2286         (WebCore::RenderAttachmentInfo::RenderAttachmentInfo):
2287         (WebCore::RenderThemeIOS::attachmentBaseline const):
2288         (WebCore::paintAttachmentIcon):
2289         (WebCore::paintAttachmentText):
2290         (WebCore::paintAttachmentProgress):
2291         (WebCore::attachmentBorderPath):
2292         (WebCore::RenderThemeIOS::paintAttachment):
2293         (WebCore::AttachmentInfo::addLine): Deleted.
2294         (WebCore::AttachmentInfo::buildWrappedLines): Deleted.
2295         (WebCore::AttachmentInfo::buildSingleLine): Deleted.
2296         (WebCore::AttachmentInfo::AttachmentInfo): Deleted.
2297
2298         Rename AttachmentInfo to RenderAttachmentInfo to resolve a name conflict with the new AttachmentInfo struct.
2299
2300 2018-01-08  Saam Barati  <sbarati@apple.com>
2301
2302         Speculative build fix after r226600. We only use clflush on x86 and the `asm volatile` syntax is not available in the Windows build.
2303
2304         No new tests because this is a build fix.
2305
2306         * dom/Comment.cpp:
2307         (WebCore::Comment::clflushReadLength):
2308
2309 2018-01-08  Michael Saboff  <msaboff@apple.com>
2310
2311         Add a DOM gadget for Spectre testing
2312         https://bugs.webkit.org/show_bug.cgi?id=181351
2313
2314         Reviewed by Saam Barati.
2315
2316         This change is used to test Spectre mitigations.
2317
2318         Added a side data array to the Comment DOM node to test for Spectre issues in
2319         the DOM layer.  This additional functionality is disabled by default and must
2320         be enabled through the JSC option "enableSpectreGadgets".
2321
2322         * dom/Comment.cpp:
2323         (WebCore::Comment::Comment):
2324         (WebCore::Comment::setReadLength):
2325         (WebCore::Comment::charCodeAt):
2326         (WebCore::Comment::clflushReadLength):
2327         * dom/Comment.h:
2328         * dom/Comment.idl:
2329         * page/RuntimeEnabledFeatures.cpp:
2330         (WebCore::RuntimeEnabledFeatures::spectreGadgetsEnabled const):
2331         * page/RuntimeEnabledFeatures.h:
2332
2333 2018-01-08  Said Abou-Hallawa  <sabouhallawa@apple.com>
2334
2335         A canvas should not be tainted if it draws a data URL SVGImage with a <foreignObject>
2336         https://bugs.webkit.org/show_bug.cgi?id=180301
2337
2338         Reviewed by Dean Jackson.
2339
2340         Don't taint the canvas if it draws a data URL SVGImage with a <foreignObject>.
2341         There should not be a cross-origin data leak in this case.
2342
2343         Tests: svg/as-image/svg-canvas-data-url-svg-with-feimage-not-tainted.html
2344                svg/as-image/svg-canvas-data-url-svg-with-foreign-object-not-tainted.html
2345                svg/as-image/svg-canvas-data-url-svg-with-image-not-tainted.html
2346
2347         * html/ImageBitmap.cpp:
2348         (WebCore::taintsOrigin):
2349         * html/canvas/CanvasRenderingContext.cpp:
2350         (WebCore::CanvasRenderingContext::wouldTaintOrigin):
2351
2352 2018-01-08  Don Olmstead  <don.olmstead@sony.com>
2353
2354         Simplify platform checks in Graphics Context
2355         https://bugs.webkit.org/show_bug.cgi?id=181344
2356
2357         Reviewed by Alex Christensen.
2358
2359         No new tests. No change in behavior.
2360
2361         * platform/graphics/ANGLEWebKitBridge.h:
2362         * platform/graphics/GLContext.h:
2363         * platform/graphics/GraphicsContext3D.h:
2364         * platform/graphics/OpenGLESShims.h:
2365         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
2366         (WebCore::GraphicsContext3D::checkVaryingsPacking const):
2367
2368 2018-01-08  Zalan Bujtas  <zalan@apple.com>
2369
2370         [RenderTreeBuilder] Move SVG addChild logic to RenderTreeBuilder
2371         https://bugs.webkit.org/show_bug.cgi?id=181405
2372         <rdar://problem/36360476>
2373
2374         Reviewed by Antti Koivisto.
2375
2376         This is about moving the code, no cleanup and/or normalization (unfortunately it also means
2377         some temporary changes).  
2378
2379         No change in functionality.
2380
2381         * Sources.txt:
2382         * WebCore.xcodeproj/project.pbxproj:
2383         * rendering/svg/RenderSVGContainer.cpp:
2384         (WebCore::RenderSVGContainer::addChild):
2385         * rendering/svg/RenderSVGInline.cpp:
2386         (WebCore::RenderSVGInline::addChild):
2387         * rendering/svg/RenderSVGRoot.cpp:
2388         (WebCore::RenderSVGRoot::addChild):
2389         * rendering/svg/RenderSVGText.cpp:
2390         (WebCore::RenderSVGText::addChild):
2391         * rendering/updating/RenderTreeBuilder.cpp:
2392         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
2393         (WebCore::RenderTreeBuilder::insertChildToSVGContainer):
2394         (WebCore::RenderTreeBuilder::insertChildToSVGInline):
2395         (WebCore::RenderTreeBuilder::insertChildToSVGRoot):
2396         (WebCore::RenderTreeBuilder::insertChildToSVGText):
2397         * rendering/updating/RenderTreeBuilder.h:
2398         (WebCore::RenderTreeBuilder::SVGBuilder):
2399         * rendering/updating/RenderTreeBuilderSVG.cpp: Added.
2400         (WebCore::RenderTreeBuilder::SVG::SVG):
2401         (WebCore::RenderTreeBuilder::SVG::insertChild):
2402         * rendering/updating/RenderTreeBuilderSVG.h: Added.
2403
2404 2018-01-08  John Wilander  <wilander@apple.com>
2405
2406         Storage Access API: Remove access for all frames under a page when the page is closed
2407         https://bugs.webkit.org/show_bug.cgi?id=181398
2408         <rdar://problem/36357879>
2409
2410         Reviewed by Alex Christensen.
2411
2412         No new tests. Discussed with Alex Christensen and we concluded that
2413         both a layout test and an API test would require a lot of work and
2414         we have existing tests for clearing out storage access for frames.
2415
2416         * platform/network/NetworkStorageSession.h:
2417         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
2418         (WebCore::NetworkStorageSession::removeStorageAccessForAllFramesOnPage):
2419
2420 2018-01-08  Matt Lewis  <jlewis3@apple.com>
2421
2422         Unreviewed, rolling out r226385.
2423
2424         The test introduced with this was a flaky since being added.
2425
2426         Reverted changeset:
2427
2428         "AX: when invert colors is on, double-invert certain media
2429         elements in UserAgentStyleSheet"
2430         https://bugs.webkit.org/show_bug.cgi?id=168447
2431         https://trac.webkit.org/changeset/226385
2432
2433 2018-01-08  Youenn Fablet  <youenn@apple.com>
2434
2435         SWClientConnection should not keep references to service worker jobs
2436         https://bugs.webkit.org/show_bug.cgi?id=181381
2437
2438         Reviewed by Chris Dumez.
2439
2440         Difficult to test determiniscally but corresponding crash log should no longer happen in debug builds.
2441
2442         Stopped passing ServiceWorkerJob references from ServiceWorkerContainer (potentially in service worker thread) to SWClientConnection (main thread).
2443         Instead pass job identifiers and related data to the main thread.
2444
2445         Minor refactoring to use ServiceWorkerJobIdentifier instead of ServiceWorkerJobDataIdentifier which contains more data than needed.
2446
2447         * workers/service/SWClientConnection.cpp:
2448         (WebCore::SWClientConnection::scheduleJob):
2449         (WebCore::SWClientConnection::failedFetchingScript):
2450         (WebCore::SWClientConnection::postTaskForJob):
2451         (WebCore::SWClientConnection::jobRejectedInServer):
2452         (WebCore::SWClientConnection::registrationJobResolvedInServer):
2453         (WebCore::SWClientConnection::unregistrationJobResolvedInServer):
2454         (WebCore::SWClientConnection::startScriptFetchForServer):
2455         (WebCore::SWClientConnection::clearPendingJobs):
2456         (WebCore::SWClientConnection::finishedFetchingScript): Deleted.
2457         * workers/service/SWClientConnection.h:
2458         * workers/service/ServiceWorkerContainer.cpp:
2459         (WebCore::ServiceWorkerContainer::scheduleJob):
2460         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
2461         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
2462         (WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
2463         * workers/service/ServiceWorkerContainer.h:
2464         * workers/service/server/SWServer.cpp:
2465         (WebCore::SWServer::rejectJob):
2466         (WebCore::SWServer::resolveRegistrationJob):
2467         (WebCore::SWServer::resolveUnregistrationJob):
2468         (WebCore::SWServer::startScriptFetch):
2469         * workers/service/server/SWServer.h:
2470
2471 2018-01-08  Wenson Hsieh  <wenson_hsieh@apple.com>
2472
2473         Copying, pasting, and then deleting an attachment element breaks attachment data requests
2474         https://bugs.webkit.org/show_bug.cgi?id=181365
2475         <rdar://problem/36340647>
2476
2477         Reviewed by Tim Horton.
2478
2479         Currently, copying and pasting an attachment element within the same document and then deleting backwards to
2480         remove the pasted attachment element causes the original attachment element to be inaccessible via SPI. This is
2481         because there are now two different attachment elements with the same unique identifier, such that Document,
2482         which keeps a map of all unique attachment identifiers to attachment elements, will lose track of the original
2483         attachment element.
2484
2485         To fix this, we ensure that attachment elements should always have unique identifiers when they are inserted
2486         into the document. We make several small adjustments to accomplish this:
2487
2488         1.  First, refactor HTMLAttachmentElement's unique identifier so that it no longer depends on the value of the
2489             "webkitattachmentid" attribute, and is instead just a member of HTMLAttachmentElement that is not exposed to
2490             DOM bindings. This means setting and querying an attachment element's uniqueIdentifier can be done without
2491             triggering any side effects, such as layout or mutation events.
2492
2493         2.  Next, make "webkitattachmentid" a temporary attribute similar to "webkitattachmentpath" and
2494             "webkitattachmentbloburl", so that it is added only when generating a markup fragment for editing, and
2495             removed upon deserialization.
2496
2497         3.  Lastly, shift the responsibility of assigning a unique identifier to an attachment away from places where we
2498             create attachment elements, and instead have Document enforce this when an attachment element is inserted.
2499
2500         Tests:  WKAttachmentTests.InsertAndRemoveDuplicateAttachment
2501                 WKAttachmentTests.InsertDuplicateAttachmentAndUpdateData
2502
2503         * dom/Document.cpp:
2504         (WebCore::Document::didInsertAttachmentElement):
2505
2506         Assign the unique identifier of an attachment element that has been inserted. If the identifier already tracks
2507         an existing attachment element in the document or is missing, reassign the identifier to a new value.
2508
2509         * editing/cocoa/WebContentReaderCocoa.mm:
2510         (WebCore::createFragmentForImageAttachment):
2511         (WebCore::replaceRichContentWithAttachments):
2512         (WebCore::WebContentReader::readFilePaths):
2513
2514         Remove calls to setUniqueIdentifier here, since Document will assign a unique identifier upon insertion.
2515
2516         * editing/markup.cpp:
2517         (WebCore::StyledMarkupAccumulator::appendCustomAttributes):
2518         (WebCore::createFragmentFromMarkup):
2519
2520         Set the attachment's unique identifier to the value of the "webkitattachmentid" attribute. When moving existing
2521         attachments around in the DOM without duplication, this ensures that the attachment will be removed and
2522         reinserted in the document without triggering removal and insertion client delegate methods.
2523
2524         When pasting an attachment element that has the same identifier as an existing attachment, we let Document
2525         realize that the attachment identifier already exists, and reassign it to a unique value.
2526
2527         * html/HTMLAttachmentElement.cpp:
2528         (WebCore::HTMLAttachmentElement::uniqueIdentifier const): Deleted.
2529         (WebCore::HTMLAttachmentElement::setUniqueIdentifier): Deleted.
2530         * html/HTMLAttachmentElement.h:
2531
2532 2018-01-08  Zalan Bujtas  <zalan@apple.com>
2533
2534         [RenderTreeBuilder] Move RenderBlockFlow addChild logic to RenderTreeBuilder
2535         https://bugs.webkit.org/show_bug.cgi?id=181348
2536         <rdar://problem/36328117>
2537
2538         Reviewed by Antti Koivisto.
2539
2540         This is about moving the code, no cleanup and/or normalization (unfortunately it also means
2541         some temporary changes).  
2542
2543         No change in functionality.
2544
2545         * Sources.txt:
2546         * WebCore.xcodeproj/project.pbxproj:
2547         * rendering/RenderBlockFlow.cpp:
2548         (WebCore::RenderBlockFlow::addChild):
2549         * rendering/updating/RenderTreeBuilder.cpp:
2550         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
2551         (WebCore::RenderTreeBuilder::insertChildToRenderBlockFlow):
2552         * rendering/updating/RenderTreeBuilder.h:
2553         (WebCore::RenderTreeBuilder::blockFlowBuilder):
2554         * rendering/updating/RenderTreeBuilderBlockFlow.cpp: Added.
2555         (WebCore::RenderTreeBuilder::BlockFlow::BlockFlow):
2556         (WebCore::RenderTreeBuilder::BlockFlow::insertChild):
2557         * rendering/updating/RenderTreeBuilderBlockFlow.h: Added.
2558
2559 2018-01-08  Youenn Fablet  <youenn@apple.com>
2560
2561         Add CSP support to service workers
2562         https://bugs.webkit.org/show_bug.cgi?id=181385
2563
2564         Reviewed by Chris Dumez.
2565
2566         Covered by rebased tests.
2567
2568         Added recovery of CSP information from WorkerScriptLoader.
2569         Added plumbing to pass the CSP information to Service Workers.
2570         Added persistency support for the CSP information.
2571
2572         * workers/WorkerScriptLoader.cpp:
2573         (WebCore::WorkerScriptLoader::loadAsynchronously):
2574         (WebCore::WorkerScriptLoader::didReceiveResponse):
2575         * workers/WorkerScriptLoader.h:
2576         (WebCore::WorkerScriptLoader::contentSecurityPolicy const):
2577         * workers/service/SWClientConnection.cpp:
2578         (WebCore::SWClientConnection::finishedFetchingScript):
2579         (WebCore::SWClientConnection::failedFetchingScript):
2580         * workers/service/SWClientConnection.h:
2581         * workers/service/ServiceWorkerContainer.cpp:
2582         (WebCore::ServiceWorkerContainer::addRegistration):
2583         (WebCore::ServiceWorkerContainer::jobFailedWithException):
2584         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
2585         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
2586         * workers/service/ServiceWorkerContainer.h:
2587         * workers/service/ServiceWorkerContextData.cpp:
2588         (WebCore::ServiceWorkerContextData::isolatedCopy const):
2589         * workers/service/ServiceWorkerContextData.h:
2590         (WebCore::ServiceWorkerContextData::encode const):
2591         (WebCore::ServiceWorkerContextData::decode):
2592         * workers/service/ServiceWorkerFetchResult.h:
2593         (WebCore::ServiceWorkerFetchResult::encode const):
2594         (WebCore::ServiceWorkerFetchResult::decode):
2595         * workers/service/ServiceWorkerGlobalScope.cpp:
2596         (WebCore::ServiceWorkerGlobalScope::create):
2597         * workers/service/ServiceWorkerGlobalScope.h:
2598         * workers/service/ServiceWorkerJob.cpp:
2599         (WebCore::ServiceWorkerJob::notifyFinished):
2600         * workers/service/ServiceWorkerJobClient.h:
2601         * workers/service/context/ServiceWorkerThread.cpp:
2602         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
2603         (WebCore::ServiceWorkerThread::createWorkerGlobalScope):
2604         * workers/service/server/RegistrationDatabase.cpp:
2605         (WebCore::v1RecordsTableSchema):
2606         (WebCore::RegistrationDatabase::openSQLiteDatabase):
2607         (WebCore::RegistrationDatabase::doPushChanges):
2608         (WebCore::RegistrationDatabase::importRecords):
2609         * workers/service/server/SWServer.cpp:
2610         (WebCore::SWServer::updateWorker):
2611         (WebCore::SWServer::installContextData):
2612         * workers/service/server/SWServer.h:
2613         * workers/service/server/SWServerJobQueue.cpp:
2614         (WebCore::SWServerJobQueue::scriptFetchFinished):
2615         * workers/service/server/SWServerWorker.cpp:
2616         (WebCore::SWServerWorker::SWServerWorker):
2617         (WebCore::m_contentSecurityPolicy):
2618         (WebCore::SWServerWorker::contextData const):
2619         * workers/service/server/SWServerWorker.h:
2620
2621 2018-01-08  Youenn Fablet  <youenn@apple.com>
2622
2623         Use no-cache fetch mode when loading main documents with location.reload()
2624         https://bugs.webkit.org/show_bug.cgi?id=181285
2625
2626         Reviewed by Alex Christensen.
2627
2628         Covered by rebased tests.
2629
2630         Start to translate cache policy used for navigation as FetchOptions::Cache.
2631         This allows ensuring service workers receive the right cache mode when intercepting navigation loads.
2632         To not change current navigation behavior, ReturnCacheDataElseLoad and ReturnCacheDataDontLoad still trigger default fetch cache mode.
2633
2634         For Reload and ReloadExpiredOnly frame load types, using no-cache mode is more efficient than reload mode,
2635         as a conditional request will be sent if possible. This applies to location.reload which is consistent with other browsers.
2636         Keep reload mode for ReloadFromOrigin.
2637
2638         * loader/DocumentLoader.cpp:
2639         (WebCore::toFetchOptionsCache):
2640         (WebCore::DocumentLoader::loadMainResource):
2641         * loader/FrameLoader.cpp:
2642         (WebCore::FrameLoader::loadFrameRequest):
2643         (WebCore::FrameLoader::loadURL):
2644         (WebCore::FrameLoader::load):
2645         (WebCore::FrameLoader::reload):
2646         (WebCore::FrameLoader::defaultRequestCachingPolicy):
2647         (WebCore::FrameLoader::loadDifferentDocumentItem):
2648         * loader/NavigationScheduler.cpp:
2649
2650 2018-01-08  Youenn Fablet  <youenn@apple.com>
2651
2652         Stop exposing fetch and extendable events to window
2653         https://bugs.webkit.org/show_bug.cgi?id=181325
2654
2655         Reviewed by Chris Dumez.
2656
2657         Covered by updated tests.
2658
2659         Marked FetchEvent and ExtendableEvent as visible in ServiceWorker environments only.
2660         Moved related Internals testing routines to ServiceWorkerInternals.
2661
2662         * testing/Internals.cpp:
2663         (WebCore::Internals::waitForFetchEventToFinish): Deleted.
2664         (WebCore::Internals::createBeingDispatchedFetchEvent): Deleted.
2665         * testing/Internals.h:
2666         * testing/Internals.idl:
2667         * testing/ServiceWorkerInternals.cpp:
2668         (WebCore::ServiceWorkerInternals::waitForFetchEventToFinish):
2669         (WebCore::ServiceWorkerInternals::createBeingDispatchedFetchEvent):
2670         * testing/ServiceWorkerInternals.h:
2671         * testing/ServiceWorkerInternals.idl:
2672         * workers/service/ExtendableEvent.idl:
2673         * workers/service/FetchEvent.idl:
2674
2675 2018-01-08  Antti Koivisto  <antti@apple.com>
2676
2677         REGRESSION (r219145): Toggling layer borders on a static document no longer works immediately
2678         https://bugs.webkit.org/show_bug.cgi?id=176260
2679         <rdar://problem/34219966>
2680
2681         Reviewed by Simon Fraser.
2682
2683         Optimization reveled bugs in debug indicator painting.
2684
2685         Test: compositing/debug-borders-dynamic.html
2686
2687         * platform/graphics/ca/GraphicsLayerCA.cpp:
2688         (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
2689         (WebCore::GraphicsLayerCA::updateDebugIndicators):
2690         (WebCore::GraphicsLayerCA::updateDebugBorder): Deleted.
2691
2692         - Rename to indicate this is not just about debug borders.
2693         - Trigger display so repaint counters get painted. This helper is only called when the indicators change.
2694
2695         * platform/graphics/ca/GraphicsLayerCA.h:
2696         * rendering/RenderLayerCompositor.cpp:
2697         (WebCore::RenderLayerCompositor::cacheAcceleratedCompositingFlags):
2698
2699         Ensure we do compositing update on debug border change even when there is no layout.
2700
2701 2018-01-08  Zalan Bujtas <zalan@apple.com>
2702
2703         [RenderTreeBuilder] Move RenderInline addChild logic to RenderTreeBuilder
2704         https://bugs.webkit.org/show_bug.cgi?id=181336
2705         <rdar://problem/36324693>
2706
2707         Reviewed by Antti Koivisto.
2708
2709         This is about moving the code, no cleanup and/or normalization (unfortunately it also means
2710         some temporary changes).  
2711
2712         No change in functionality.
2713
2714         * Sources.txt:
2715         * WebCore.xcodeproj/project.pbxproj:
2716         * rendering/RenderInline.cpp:
2717         (WebCore::RenderInline::addChild):
2718         (WebCore::RenderInline::addChildIgnoringContinuation):
2719         (WebCore::RenderInline::childBecameNonInline):
2720         (WebCore::nextContinuation): Deleted.
2721         (WebCore::RenderInline::continuationBefore): Deleted.
2722         (WebCore::newChildIsInline): Deleted.
2723         (WebCore::RenderInline::cloneAsContinuation const): Deleted.
2724         (WebCore::RenderInline::splitInlines): Deleted.
2725         (WebCore::RenderInline::splitFlow): Deleted.
2726         (WebCore::canUseAsParentForContinuation): Deleted.
2727         (WebCore::RenderInline::addChildToContinuation): Deleted.
2728         * rendering/RenderInline.h:
2729         * rendering/updating/RenderTreeBuilder.cpp:
2730         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
2731         (WebCore::RenderTreeBuilder::insertChildToRenderInline):
2732         (WebCore::RenderTreeBuilder::insertChildToRenderInlineIgnoringContinuation):
2733         (WebCore::RenderTreeBuilder::splitFlow):
2734         * rendering/updating/RenderTreeBuilder.h:
2735         (WebCore::RenderTreeBuilder::inlineBuilder):
2736         * rendering/updating/RenderTreeBuilderInline.cpp: Added.
2737         (WebCore::canUseAsParentForContinuation):
2738         (WebCore::nextContinuation):
2739         (WebCore::continuationBefore):
2740         (WebCore::cloneAsContinuation):
2741         (WebCore::newChildIsInline):
2742         (WebCore::inFlowPositionedInlineAncestor):
2743         (WebCore::RenderTreeBuilder::Inline::Inline):
2744         (WebCore::RenderTreeBuilder::Inline::insertChild):
2745         (WebCore::RenderTreeBuilder::Inline::insertChildToContinuation):
2746         (WebCore::RenderTreeBuilder::Inline::insertChildIgnoringContinuation):
2747         (WebCore::RenderTreeBuilder::Inline::splitFlow):
2748         (WebCore::RenderTreeBuilder::Inline::splitInlines):
2749         * rendering/updating/RenderTreeBuilderInline.h: Added.
2750
2751 2018-01-08  Zalan Bujtas  <zalan@apple.com>
2752
2753         [RenderTreeBuilder] Move RenderBlock addChild logic to RenderTreeBuilder
2754         https://bugs.webkit.org/show_bug.cgi?id=181319
2755         <rdar://problem/36313464>
2756
2757         Reviewed by Antti Koivisto.
2758
2759         This is about moving the code, no cleanup and/or normalization (unfortunately it also means
2760         some temporary changes).  
2761
2762         No change in functionality.
2763
2764         * Sources.txt:
2765         * WebCore.xcodeproj/project.pbxproj:
2766         * rendering/RenderBlock.cpp:
2767         (WebCore::RenderBlock::addChild):
2768         (WebCore::RenderBlock::addChildIgnoringContinuation):
2769         (WebCore::RenderBlock::childBecameNonInline):
2770         (WebCore::RenderBlock::continuationBefore): Deleted.
2771         (WebCore::RenderBlock::addChildToContinuation): Deleted.
2772         (WebCore::getInlineRun): Deleted.
2773         (WebCore::RenderBlock::makeChildrenNonInline): Deleted.
2774         * rendering/RenderBlock.h:
2775         * rendering/RenderBox.cpp:
2776         (WebCore::markBoxForRelayoutAfterSplit): Deleted.
2777         (WebCore::RenderBox::splitAnonymousBoxesAroundChild): Deleted.
2778         * rendering/RenderBox.h:
2779         * rendering/RenderRubyBase.cpp:
2780         (WebCore::RenderRubyBase::moveChildren):
2781         (WebCore::RenderRubyBase::moveBlockChildren):
2782         * rendering/RenderTable.cpp:
2783         (WebCore::RenderTable::addChild):
2784         * rendering/RenderTableRow.cpp:
2785         (WebCore::RenderTableRow::addChild):
2786         * rendering/RenderTableSection.cpp:
2787         (WebCore::RenderTableSection::addChild):
2788         * rendering/updating/RenderTreeBuilder.cpp:
2789         (WebCore::markBoxForRelayoutAfterSplit):
2790         (WebCore::getInlineRun):
2791         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
2792         (WebCore::RenderTreeBuilder::insertChildToRenderBlock):
2793         (WebCore::RenderTreeBuilder::insertChildToRenderBlockIgnoringContinuation):
2794         (WebCore::RenderTreeBuilder::makeChildrenNonInline):
2795         (WebCore::RenderTreeBuilder::splitAnonymousBoxesAroundChild):
2796         * rendering/updating/RenderTreeBuilder.h:
2797         (WebCore::RenderTreeBuilder::blockBuilder):
2798         * rendering/updating/RenderTreeBuilderBlock.cpp: Added.
2799         (WebCore::continuationBefore):
2800         (WebCore::RenderTreeBuilder::Block::Block):
2801         (WebCore::RenderTreeBuilder::Block::insertChild):
2802         (WebCore::RenderTreeBuilder::Block::insertChildToContinuation):
2803         (WebCore::RenderTreeBuilder::Block::insertChildIgnoringContinuation):
2804         * rendering/updating/RenderTreeBuilderBlock.h: Added.
2805         
2806 2018-01-08  Jeremy Jones  <jeremyj@apple.com>
2807
2808         Standard controls sometimes say video is in pip when it isnt.
2809         https://bugs.webkit.org/show_bug.cgi?id=181095
2810         rdar://problem/36182687
2811
2812         Reviewed by Eric Carlson.
2813
2814         * html/HTMLMediaElement.cpp:
2815         (WebCore::HTMLMediaElement::exitFullscreen):
2816
2817 2018-01-08  Jer Noble  <jer.noble@apple.com>
2818
2819         REGRESSION: [iOS] ASSERTION FAILED: !node.isConnected() in WebCore::notifyNodeInsertedIntoDocument
2820         https://bugs.webkit.org/show_bug.cgi?id=181091
2821
2822         Reviewed by Darin Adler.
2823
2824         Move the work previously performed in insertedIntoAncestor() into didFinishInsertingNode().
2825
2826         * html/HTMLMediaElement.cpp:
2827         (WebCore::HTMLMediaElement::prepareForLoad):
2828
2829 2018-01-08  Zan Dobersek  <zdobersek@igalia.com>
2830
2831         [Cairo] Use isolated fill and stroke source containers
2832         https://bugs.webkit.org/show_bug.cgi?id=181386
2833
2834         Reviewed by Carlos Garcia Campos.
2835
2836         Generate fill and stroke source objects upon invocation of various Cairo
2837         operations, initializing necessary data from the GraphicsContextState
2838         object.
2839
2840         Cairo::FillSource and Cairo::StrokeSource structs are introduced, both
2841         being default-constructible as well as providing a constructor that
2842         accepts a GraphicsContextState object from which the appropriate
2843         resources are created.
2844
2845         The FillSource and StrokeSource objects are then passed to
2846         PlatformContextCairo's prepareForFilling() and prepareForStroking()
2847         methods. Here the helper prepareCairoContextSource() function is now
2848         invoked with cairo_pattern_t objects as pattern or gradient sources, or
2849         the source color if neither cairo_pattern_t object is specified.
2850
2851         The FillSource and StrokeSource constructors mimic the previous behavior
2852         of prepareCairoContextSource(). In case the source is a Pattern object,
2853         a cairo_pattern_t object is created from that. In case of FillSource,
2854         we also retrieve pattern size, transform and repetition information. In
2855         case the source os a Gradient object, we create a 'base' cairo_pattern_t
2856         object for a completely opaque alpha channel. Additionally, if the alpha
2857         value on the state is not 1, we create an alpha-adjusted cairo_pattern_t
2858         that is potentially used for any filling or stroking operation that has
2859         to preserve transparency. If neither Pattern or Gradient objects are set
2860         on the GraphicsContextState, we default to the current fill or stroke
2861         color.
2862
2863         Overall, there's no change in behavior, this is simply a refactoring
2864         that enables us to construct Cairo objects for filling and stroking
2865         sources at the time of Cairo operation dispatch, instead of pulling down
2866         GraphicsContextState deeper into the Cairo-specific code.
2867
2868         No new tests -- no change in functionality.
2869
2870         * platform/graphics/cairo/CairoOperations.cpp:
2871         (WebCore::Cairo::drawPathShadow):
2872         (WebCore::Cairo::fillCurrentCairoPath):
2873         (WebCore::Cairo::FillSource::FillSource):
2874         (WebCore::Cairo::StrokeSource::StrokeSource):
2875         (WebCore::Cairo::fillRect):
2876         (WebCore::Cairo::fillRectWithRoundedHole):
2877         (WebCore::Cairo::fillPath):
2878         (WebCore::Cairo::strokeRect):
2879         (WebCore::Cairo::strokePath):
2880         (WebCore::Cairo::drawGlyphs):
2881         * platform/graphics/cairo/CairoOperations.h:
2882         * platform/graphics/cairo/FontCairo.cpp:
2883         (WebCore::FontCascade::drawGlyphs):
2884         * platform/graphics/cairo/GraphicsContextCairo.cpp:
2885         (WebCore::GraphicsContext::fillPath):
2886         (WebCore::GraphicsContext::strokePath):
2887         (WebCore::GraphicsContext::fillRect):
2888         (WebCore::GraphicsContext::strokeRect):
2889         (WebCore::GraphicsContext::fillRectWithRoundedHole):
2890         * platform/graphics/cairo/PlatformContextCairo.cpp:
2891         (WebCore::prepareCairoContextSource):
2892         (WebCore::PlatformContextCairo::prepareForFilling):
2893         (WebCore::PlatformContextCairo::prepareForStroking):
2894         (WebCore::PlatformContextCairo::clipForPatternFilling):
2895         * platform/graphics/cairo/PlatformContextCairo.h:
2896
2897 2018-01-08  Youenn Fablet  <youenn@apple.com>
2898
2899         navigator.onLine does not work inside service workers
2900         https://bugs.webkit.org/show_bug.cgi?id=181079
2901         <rdar://problem/36178606>
2902
2903         Reviewed by Darin Adler.
2904
2905         Test: http/wpt/service-workers/online.https.html
2906
2907         Added support for onLine by reusing a similar implementation as regular workers.
2908         Added ServiceWorkerInternals as an interface for an object exposed as self.internals in WTR.
2909         This object has currently one method to trigger change in the online/offline status.
2910         This allows writing a test for the onLine feature.
2911
2912         Note that self.internals is inserted asynchronously after the script was evaluated.
2913         When writing a worker script using self.internals, one must make sure to use self.internals when initialized.
2914         online-worker.js for instance makes use of self.internals in a postMessage callback.
2915
2916         * CMakeLists.txt:
2917         * DerivedSources.make:
2918         * WebCore.xcodeproj/project.pbxproj:
2919         * bindings/js/WorkerScriptController.h:
2920         * dom/ScriptExecutionContext.h:
2921         * testing/ServiceWorkerInternals.cpp: Added.
2922         (WebCore::ServiceWorkerInternals::ServiceWorkerInternals):
2923         (WebCore::ServiceWorkerInternals::setOnline):
2924         * testing/ServiceWorkerInternals.h: Added.
2925         * testing/ServiceWorkerInternals.idl: Added.
2926         * testing/js/WebCoreTestSupport.cpp:
2927         (WebCoreTestSupport::setupNewlyCreateServiceWorker):
2928         * testing/js/WebCoreTestSupport.h:
2929         * workers/service/context/SWContextManager.cpp:
2930         (WebCore::SWContextManager::registerServiceWorkerThreadForInstall):
2931         (WebCore::SWContextManager::startedServiceWorker):
2932         * workers/service/context/SWContextManager.h:
2933         (WebCore::SWContextManager::setServiceWorkerCreationCallback):
2934         (WebCore::SWContextManager::workerByID):
2935         * workers/service/context/ServiceWorkerThread.cpp:
2936         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
2937         * workers/service/context/ServiceWorkerThreadProxy.cpp:
2938         (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
2939         (WebCore::ServiceWorkerThreadProxy::~ServiceWorkerThreadProxy):
2940         (WebCore::ServiceWorkerThreadProxy::networkStateChanged):
2941         (WebCore::ServiceWorkerThreadProxy::notifyNetworkStateChange):
2942         * workers/service/context/ServiceWorkerThreadProxy.h:
2943
2944 2018-01-08  Zan Dobersek  <zdobersek@igalia.com>
2945
2946         [Cairo] Contain shadow blur requirement state in a separate object
2947         https://bugs.webkit.org/show_bug.cgi?id=181380
2948
2949         Reviewed by Carlos Garcia Campos.
2950
2951         Instead of picking up the necessary state parameters from a
2952         GraphicsContextState object, store the necessary parameters in a helper
2953         ShadowBlurUsage struct. Mimicking the mustUseShadowBlur() function that
2954         is being removed, values of the shadow color, shadow blur, and shadow
2955         transform ignorance are stored there. Additionally, the required()
2956         method accepts a PlatformContextCairo object through which it can
2957         retrieve the current CTM and determine whether it's an identity, finally
2958         deciding whether shadow blur can or cannot be ignored.
2959
2960         Goal of this change is to limit usage of GraphicsContextState directly
2961         in operations implemented inside the Cairo namespace. Instead, the
2962         state parameters should be passed directly, or an equivalent but limited
2963         state object should be constructed for invocation of such operations.
2964
2965         This is likely only an intermediate solution. It's possible it will be
2966         replaced by a more complete shadow state struct that would be used for
2967         any operation that is required to draw shadows, if necessary.
2968
2969         No new tests -- no change in functionality.
2970
2971         * platform/graphics/cairo/CairoOperations.cpp:
2972         (WebCore::Cairo::drawGlyphsShadow):
2973         (WebCore::Cairo::ShadowBlurUsage::ShadowBlurUsage):
2974         (WebCore::Cairo::ShadowBlurUsage::required const):
2975         (WebCore::Cairo::fillRectWithRoundedHole):
2976         (WebCore::Cairo::drawGlyphs):
2977         (WebCore::Cairo::mustUseShadowBlur): Deleted.
2978         * platform/graphics/cairo/CairoOperations.h:
2979         * platform/graphics/cairo/FontCairo.cpp:
2980         (WebCore::FontCascade::drawGlyphs):
2981         * platform/graphics/cairo/GraphicsContextCairo.cpp:
2982         (WebCore::GraphicsContext::fillRectWithRoundedHole):
2983
2984 2018-01-08  Philippe Normand  <pnormand@igalia.com>
2985
2986         [GStreamer][Soup] Remove dead getCreateOrReadBuffer code path
2987         https://bugs.webkit.org/show_bug.cgi?id=181376
2988
2989         Reviewed by Carlos Garcia Campos.
2990
2991         This code path is no longer used now that the GStreamer HTTP
2992         source element uses data coming directly from the network process.
2993
2994         * SourcesGTK.txt:
2995         * SourcesWPE.txt:
2996         * loader/MediaResourceLoader.cpp:
2997         (WebCore::MediaResource::getOrCreateReadBuffer): Deleted.
2998         * loader/MediaResourceLoader.h:
2999         * loader/SubresourceLoader.h:
3000         * loader/cache/CachedRawResource.h:
3001         * loader/cache/CachedRawResourceClient.h:
3002         (WebCore::CachedRawResourceClient::finishedTimingForWorkerLoad):
3003         (WebCore::CachedRawResourceClient::getOrCreateReadBuffer): Deleted.
3004         * loader/cache/CachedResource.h:
3005         (WebCore::CachedResource::getOrCreateReadBuffer): Deleted.
3006         * loader/soup/CachedRawResourceSoup.cpp: Removed.
3007         * loader/soup/SubresourceLoaderSoup.cpp: Removed.
3008         * platform/graphics/PlatformMediaResourceLoader.h:
3009         (WebCore::PlatformMediaResourceClient::loadFinished):
3010         (WebCore::PlatformMediaResourceClient::getOrCreateReadBuffer): Deleted.
3011         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
3012         (CachedResourceStreamingClient::getOrCreateReadBuffer): Deleted.
3013         * platform/network/ResourceHandleClient.h:
3014         (WebCore::ResourceHandleClient::getOrCreateReadBuffer): Deleted.
3015         * platform/network/soup/ResourceHandleSoup.cpp:
3016         (WebCore::ResourceHandle::ensureReadBuffer):
3017
3018 2018-01-08  Zan Dobersek  <zdobersek@igalia.com> and Carlos Garcia Campos  <cgarcia@igalia.com>
3019
3020         [GStreamer] use FastMalloc-based GstAllocator
3021         https://bugs.webkit.org/show_bug.cgi?id=165793
3022
3023         Reviewed by Philippe Normand.
3024
3025         Add GstAllocatorFastMalloc, a GstAllocator implementation using fast malloc. It's only used when fast malloc is
3026         enabled and can be disabled using an environment variable for debugging purposes.
3027
3028         * platform/GStreamer.cmake:
3029         * platform/graphics/gstreamer/GStreamerUtilities.cpp:
3030         (WebCore::initializeGStreamer):
3031         * platform/graphics/gstreamer/GstAllocatorFastMalloc.cpp: Added.
3032         (gstMemoryFastMallocNew):
3033         (gstAllocatorFastMallocAlloc):
3034         (gstAllocatorFastMallocFree):
3035         (gstAllocatorFastMallocMemMap):
3036         (gstAllocatorFastMallocMemUnmap):
3037         (gstAllocatorFastMallocMemCopy):
3038         (gstAllocatorFastMallocMemShare):
3039         (gstAllocatorFastMallocMemIsSpan):
3040         (gst_allocator_fast_malloc_class_init):
3041         (gst_allocator_fast_malloc_init):
3042         * platform/graphics/gstreamer/GstAllocatorFastMalloc.h: Added.
3043
3044 2018-01-07  Ms2ger  <Ms2ger@igalia.com>
3045
3046         Implement createImageBitmap(ImageBitmap)
3047         https://bugs.webkit.org/show_bug.cgi?id=181287
3048
3049         Reviewed by Darin Adler.
3050
3051         Tests: imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage.html
3052                imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args.html
3053
3054         * html/ImageBitmap.cpp:
3055         (WebCore::ImageBitmap::createPromise):
3056
3057 2018-01-07  Ryosuke Niwa  <rniwa@webkit.org>
3058
3059         Reduce the precision of "high" resolution time to 1ms
3060         https://bugs.webkit.org/show_bug.cgi?id=180910
3061         <rdar://problem/36085943>
3062
3063         Reviewed by Saam Barati.
3064
3065         Reduced the high prevision time's resolution to 1ms, the same precision as Date.now().
3066
3067         Also fixed the bug in fillRTCStats that we weren't reducing the time resolution in RTCStats dictionaries.
3068
3069         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
3070         (WebCore::fillRTCStats):
3071         * page/Performance.cpp:
3072         (WebCore::Performance::reduceTimeResolution):
3073
3074 2018-01-06  Simon Fraser  <simon.fraser@apple.com>
3075
3076         Possible crash computing event regions
3077         https://bugs.webkit.org/show_bug.cgi?id=181368
3078         rdar://problem/34847081
3079
3080         Reviewed by Zalan Bujtas.
3081
3082         Don't trigger layout in Element::absoluteEventHandlerBounds(), since this can run arbirary script
3083         which might delete elements or re-enter Document::absoluteRegionForEventTargets().
3084
3085         It's OK to not trigger layout, because if layout is dirty, the next layout will update event regions again.
3086
3087         Add a LayoutDisallowedScope to check that Document::absoluteRegionForEventTargets() doesn't
3088         trigger layout, and move the check for LayoutDisallowedScope::isLayoutAllowed() from Document::updateLayout()
3089         to LayoutContext::layout(), since some layouts don't happen via the former (e.g. the one being removed here).
3090
3091         The test checks that the assertion does not fire. I was not able to get a reliable test for any crash.
3092
3093         Test: fast/events/event-handler-regions-layout.html
3094
3095         * dom/Document.cpp:
3096         (WebCore::Document::updateLayout):
3097         (WebCore::Document::absoluteRegionForEventTargets):
3098         * dom/Element.cpp:
3099         (WebCore::Element::absoluteEventHandlerBounds):
3100         * page/LayoutContext.cpp:
3101         (WebCore::LayoutContext::layout):
3102         * rendering/LayoutDisallowedScope.h: Move the #ifdefs around to avoid defining the enum twice.
3103         (WebCore::LayoutDisallowedScope::LayoutDisallowedScope):
3104         (WebCore::LayoutDisallowedScope::isLayoutAllowed):
3105
3106 2018-01-06  Simon Fraser  <simon.fraser@apple.com>
3107
3108         Crash under RenderLayer::scrollTo() with marquee
3109         https://bugs.webkit.org/show_bug.cgi?id=181349
3110         rdar://problem/36190168
3111
3112         Reviewed by Zalan Bujtas.
3113
3114         Don't call updateWidgetPositions() synchonously during RenderLayer scrolling, because it
3115         can run arbitrary script which may trigger destruction of this RenderLayer.
3116
3117         Instead, queue up updateWidgetPositions() on a zero-delay timer.
3118
3119         Under some circumstances this may allow a paint to occur before the widgets have been
3120         updated (which could be fixed with a more invasive change), but in practice I saw no
3121         painting issues with plug-ins or iframes inside overflow scroll, in WebKit or LegacyWebKit.
3122
3123         Test: fast/scrolling/marquee-scroll-crash.html
3124
3125         * page/FrameView.cpp:
3126         (WebCore::FrameView::FrameView):
3127         (WebCore::FrameView::updateWidgetPositions):
3128         (WebCore::FrameView::scheduleUpdateWidgetPositions):
3129         (WebCore::FrameView::updateWidgetPositionsTimerFired):
3130         * page/FrameView.h:
3131         * rendering/RenderLayer.cpp:
3132         (WebCore::RenderLayer::scrollTo):
3133
3134 2018-01-05  Dean Jackson  <dino@apple.com>
3135
3136         Accurately clip copyTexImage2D and copyTexSubImage2D
3137         https://bugs.webkit.org/show_bug.cgi?id=181356
3138         <rdar://problem/35083877>
3139
3140         Reviewed by Eric Carlson.
3141
3142         The code to make sure copyTexSubImage2D and copyTexImage2D will not try to read
3143         out of bounds had a bad bug introduced here:
3144         https://bugs.webkit.org/show_bug.cgi?id=51421
3145
3146         With appropriate parameters, it would produce a rectangle with
3147         negative dimensions. Most GL drivers just ignored this, but some
3148         are not happy.
3149
3150         Test: fast/canvas/webgl/copy-tex-image-and-sub-image-2d-bad-input.html
3151
3152         * html/canvas/WebGLRenderingContextBase.cpp:
3153         (WebCore::clip2D): Reimplement this in a more sane manner, and use
3154         checked arithmetic while here.
3155         * html/canvas/WebGLRenderingContextBase.h:
3156         (WebCore::clip1D): Deleted.
3157         (WebCore::clip2D): Deleted.
3158
3159 2018-01-06  Antti Koivisto  <antti@apple.com>
3160
3161         Use WeakPtr for RenderTreePosition::m_nextSibling
3162         https://bugs.webkit.org/show_bug.cgi?id=181363
3163
3164         Reviewed by Zalan Bujtas.
3165
3166         For safety. In most cases it is null and won't cause us to instantiate WeakReferences for
3167         many new objects.
3168
3169         * rendering/updating/RenderTreePosition.cpp:
3170         (WebCore::RenderTreePosition::computeNextSibling):
3171         * rendering/updating/RenderTreePosition.h:
3172         (WebCore::RenderTreePosition::RenderTreePosition):
3173         (WebCore::RenderTreePosition::nextSibling const):
3174
3175 2018-01-05  David Kilzer  <ddkilzer@apple.com>
3176
3177         Re-enable -Wcast-qual in WebCore for Apple ports
3178         <https://webkit.org/b/177895>
3179         <rdar://problem/34960830>
3180
3181         Reviewed by Joseph Pecoraro.
3182
3183         * Configurations/Base.xcconfig:
3184         (WARNING_CFLAGS): Remove FIXME and add -Wcast-qual back to
3185         arguments.
3186
3187         * crypto/mac/SerializedCryptoKeyWrapMac.mm:
3188         (WebCore::createAndStoreMasterKey):
3189         - Use checked_cf_cast<SecACLRef>().
3190
3191         * editing/cocoa/DataDetection.mm:
3192         (WebCore::detectItemAtPositionWithRange):
3193         - Manually cast CFTypeRef to DDResultRef until
3194           DDResultGetTypeID() is available as SPI.
3195
3196         * platform/gamepad/mac/HIDGamepad.cpp:
3197         (WebCore::HIDGamepad::initElementsFromArray):
3198         - Use checked_cf_cast<IOHIDElementRef>().
3199
3200         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
3201         (WebCore::MediaSampleAVFObjC::createImageSample):
3202         (WebCore::CMSampleBufferIsRandomAccess):
3203         (WebCore::CMSampleBufferIsNonDisplaying):
3204         (WebCore::MediaSampleAVFObjC::createNonDisplayingCopy const):
3205         - Use checked_cf_cast<CFMutableDictionaryRef>() and
3206           checked_cf_cast<CFDictionaryRef>().
3207
3208         * platform/graphics/cocoa/IOSurface.h:
3209         (WebCore::IOSurface::asLayerContents):
3210         - Use reinterpret_cast<id>() to cast from IOSurfaceRef to id.
3211
3212         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
3213         (WebCore::WebCoreDecompressionSession::getFirstVideoFrame):
3214         (WebCore::WebCoreDecompressionSession::automaticDequeue):
3215         (WebCore::WebCoreDecompressionSession::imageForTime):
3216         (WebCore::WebCoreDecompressionSession::getDecodeTime):
3217         (WebCore::WebCoreDecompressionSession::getPresentationTime):
3218         (WebCore::WebCoreDecompressionSession::getDuration):
3219         - Use checked_cf_cast<CMSampleBufferRef>().
3220
3221         * platform/graphics/Font.h:
3222         (WebCore::Font::m_kernedCFStringAttributes):
3223         (WebCore::Font::m_nonKernedCFStringAttributes):
3224         - Change type from RetainPtr<CFDictionaryRef> to
3225           RetainPtr<CFMutableDictionaryRef> since that's what they are.
3226         * platform/graphics/mac/SimpleFontDataCoreText.cpp:
3227         (WebCore::Font::getCFStringAttributes const):
3228         - Replace local `mutableAttributes` variable with
3229           `attributesDictionary.get()` since it returns the correct type
3230           now.
3231
3232         * platform/ios/wak/WAKView.mm:
3233         (-[WAKView _initWithViewRef:]):
3234         (_WAKCopyWrapper):
3235         * platform/ios/wak/WKView.mm:
3236         (_WKViewClearSuperview):
3237         (WKViewFirstChild):
3238         (WKViewNextSibling):
3239         - Use static_cast<WKViewRef>(const_cast<void*>()) to convert
3240           const void* variable to WKViewRef.
3241
3242         * platform/mac/PasteboardMac.mm:
3243         (WebCore::flipImageSpec):
3244         (WebCore::setDragImageImpl):
3245         - Use const_cast<> to remove 'const' modifier from
3246           unsigned char pointers.  This regressed while -Wcast-qual was
3247           disabled for WebCore.
3248
3249         * platform/mac/SSLKeyGeneratorMac.mm:
3250         (WebCore::signedPublicKeyAndChallengeString):
3251         - Use checked_cf_cast<SecACLRef>().
3252
3253         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.cpp:
3254         (WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):
3255         - Use checked_cf_cast<CFMutableDictionaryRef>().
3256
3257         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
3258         (WebCore::copyCONNECTProxyResponse):
3259         - Use checked_cf_cast<CFHTTPMessageRef>().
3260
3261         * platform/network/cocoa/ResourceResponseCocoa.mm:
3262         (WebCore::ResourceResponse::platformCertificateInfo const):
3263         - Use checked_cf_cast<SecTrustRef>().
3264
3265         * platform/network/mac/CertificateInfoMac.mm:
3266         (WebCore::CertificateInfo::containsNonRootSHA1SignedCertificate const):
3267         (WebCore::CertificateInfo::dump const):
3268         - Use checked_cf_cast<SecCertificateRef>().
3269
3270         * testing/cocoa/WebArchiveDumpSupport.mm:
3271         (WebCoreTestSupport::createCFURLResponseFromResponseData):
3272         - Use checked_cf_cast<>() for CFMutable* types.
3273
3274 2018-01-05  John Wilander  <wilander@apple.com>
3275
3276         Storage Access API: Refactor to make naming accurate and explicit, simplify access table, and prepare for access removal for page
3277         https://bugs.webkit.org/show_bug.cgi?id=181357
3278         <rdar://problem/36331031>
3279
3280         Reviewed by Alex Christensen.
3281
3282         No new tests. The only changed functionality that isn't covered
3283         by existing tests is cross-origin iframes in the same partition
3284         should be handled as already having access. This cannot be
3285         tested in layout tests since they don't support subdomains.
3286
3287         This change does the following:
3288         - Changes function and message names to reflect how this feature
3289           was eventually implemented, i.e. access per frame.
3290         - Makes it explicit that the UI process is only involved in
3291           granting storage access and not removing storage access.
3292           The latter is done directly by the web process.
3293         - Simplifies the network process' entry map since only needs to
3294           be able to give access to one domain in one frame at a time.
3295           Access goes away on frame navigation so there can only be one
3296           domain at a time per frame. Also, the map now uses pageIDs as
3297           main keys to prepare for efficient access removal for all
3298           frames under a page.
3299         - Fixes a bug in so that a cross-origin iframe with the same
3300           partition as the top frame correctly is handled as already
3301           having access.
3302
3303         * platform/network/NetworkStorageSession.h:
3304         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
3305         (WebCore::NetworkStorageSession::cookieStoragePartition const):
3306             The only change here is the changed named of the call to
3307             NetworkStorageSession::hasStorageAccessForFrame().
3308         (WebCore::NetworkStorageSession::hasStorageAccessForFrame const):
3309         (WebCore::NetworkStorageSession::grantStorageAccessForFrame):
3310         (WebCore::NetworkStorageSession::removeStorageAccessForFrame):
3311         (WebCore::NetworkStorageSession::isStorageAccessGranted const): Deleted.
3312         (WebCore::NetworkStorageSession::setStorageAccessGranted): Deleted.
3313         (WebCore::NetworkStorageSession::removeStorageAccess): Deleted.
3314
3315 2018-01-05  Youenn Fablet  <youenn@apple.com>
3316
3317         Implement Cache API partitioning based on ClientOrigin
3318         https://bugs.webkit.org/show_bug.cgi?id=181240
3319
3320         Reviewed by Alex Christensen.
3321
3322         Covered by updated tests.
3323
3324         Previously, cache storage was partitioned according the origin of the client, represented as a String.
3325         We now partition according both client and top origins, represented as a ClientOrigin
3326
3327         Minor refactoring to use more makePendingActivity.
3328         Added support for IPC serialization of ClientOrigin.
3329         Added SecurityOriginData::toString which is used by WebKit2 Cache Storage implementation.
3330
3331         * Modules/cache/CacheStorageConnection.cpp:
3332         (WebCore::CacheStorageConnection::open):
3333         (WebCore::CacheStorageConnection::retrieveCaches):
3334         * Modules/cache/CacheStorageConnection.h:
3335         (WebCore::CacheStorageConnection::clearMemoryRepresentation):
3336         (WebCore::CacheStorageConnection::doOpen):
3337         (WebCore::CacheStorageConnection::doRetrieveCaches):
3338         * Modules/cache/DOMCacheStorage.cpp:
3339         (WebCore::DOMCacheStorage::origin const):
3340         (WebCore::DOMCacheStorage::retrieveCaches):
3341         (WebCore::DOMCacheStorage::open):
3342         (WebCore::DOMCacheStorage::remove):
3343         * Modules/cache/DOMCacheStorage.h:
3344         * Modules/cache/WorkerCacheStorageConnection.cpp:
3345         (WebCore::WorkerCacheStorageConnection::doOpen):
3346         (WebCore::WorkerCacheStorageConnection::doRetrieveCaches):
3347         * Modules/cache/WorkerCacheStorageConnection.h:
3348         * page/ClientOrigin.h:
3349         (WebCore::ClientOrigin::isolatedCopy const):
3350         (WebCore::ClientOrigin::encode const):
3351         (WebCore::ClientOrigin::decode):
3352         * page/SecurityOriginData.cpp:
3353         (WebCore::SecurityOriginData::toString const):
3354         (WebCore::SecurityOriginData::debugString const): Deleted.
3355         * page/SecurityOriginData.h:
3356         (WebCore::SecurityOriginData::debugString const):
3357         * testing/Internals.cpp:
3358         (WebCore::Internals::clearCacheStorageMemoryRepresentation):
3359
3360 2018-01-05  Wenson Hsieh  <wenson_hsieh@apple.com>
3361
3362         [Attachment Support] Add a way to write blob data to a file URL from the UI process
3363         https://bugs.webkit.org/show_bug.cgi?id=181236
3364
3365         Reviewed by Brady Eidson.
3366
3367         Add support for writing a blob to a designated file path. See comments below for more detail. No new tests, as
3368         there change in behavior yet. See part 2: https://bugs.webkit.org/show_bug.cgi?id=181199.
3369
3370         * page/DragController.cpp:
3371         (WebCore::DragController::dragAttachmentElement):
3372         * platform/PromisedBlobInfo.h:
3373
3374         Remove PromisedBlobData entirely. This was added with the premise of having the web process deliver blob data to
3375         the UI process. However, the new approach I'm taking just has the UI process tell the network process to write
3376         a blob to a given location, so a data structure to deliver blob data over IPC is no longer necessary.
3377
3378         (WebCore::PromisedBlobData::hasData const): Deleted.
3379         (WebCore::PromisedBlobData::hasFile const): Deleted.
3380         (WebCore::PromisedBlobData::operator bool const): Deleted.
3381         (WebCore::PromisedBlobData::fulfills const): Deleted.
3382         * platform/network/BlobRegistryImpl.cpp:
3383         (WebCore::BlobRegistryImpl::populateBlobsForFileWriting):
3384
3385         Introduce a new helper to build a list of blob data for file writing.
3386
3387         (WebCore::writeFilePathsOrDataBuffersToFile):
3388
3389         Introduce a new static helper to write blob data (a list of file paths and data buffers) to a given file handle.
3390         Automatically closes the given file handle upon exit.
3391
3392         (WebCore::BlobRegistryImpl::writeBlobsToTemporaryFiles):
3393         (WebCore::BlobRegistryImpl::writeBlobToFilePath):
3394
3395         Pull out common logic in writeBlobsToTemporaryFiles and writeBlobToFilePath into helper methods (see above), and
3396         refactor both methods to use the helpers.
3397
3398         * platform/network/BlobRegistryImpl.h:
3399
3400 2018-01-05  Alex Christensen  <achristensen@webkit.org>
3401
3402         Forbid < and > in URL hosts
3403         https://bugs.webkit.org/show_bug.cgi?id=181308
3404         <rdar://problem/36012757>
3405
3406         Reviewed by Tim Horton.
3407
3408         https://url.spec.whatwg.org/#forbidden-host-code-point does not include these characters yet, but I think it should.
3409         Firefox fails to parse URLs with < or > in the host.  Chrome percent encodes them.  Safari needs to do something.
3410         The web platform tests are unclear on this case, and they will need to be updated with the specification.
3411         They do show a change in behavior, though.
3412
3413         * platform/URLParser.cpp:
3414         Add < and > to the list of forbidden host code points.
3415
3416 2018-01-05  Eric Carlson  <eric.carlson@apple.com>
3417
3418         [MediaStream] Add Mac screen capture source
3419         https://bugs.webkit.org/show_bug.cgi?id=181333
3420         <rdar://problem/36323219>
3421
3422         Reviewed by Dean Jackson.
3423