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