Missing layer content when animating elements on-screen
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-11-29  Simon Fraser  <simon.fraser@apple.com>
2
3         Missing layer content when animating elements on-screen
4         https://bugs.webkit.org/show_bug.cgi?id=180178
5         rdar://problem/34923438
6
7         Reviewed by Dean Jackson.
8
9         If a delayed animation starts, that animates layers from offscreen, then we would fail
10         to run the logic that ensures that those layers have backing store.
11
12         Fix by ensuring that if any layer starts or ends a transform animation, we re-evaluate
13         backing store attachment on all its descendants.
14
15         I tried to make a test, but layer flushing is timing-sensitive and the test would have taken
16         5s, and not been reliable. There's a manual test in the bug.
17
18         * platform/graphics/ca/GraphicsLayerCA.cpp:
19         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
20         * platform/graphics/ca/GraphicsLayerCA.h:
21
22 2017-11-29  Youenn Fablet  <youenn@apple.com>
23
24         ServiceWorkerClient objects should be reused if there is already one existing with the same identifier
25         https://bugs.webkit.org/show_bug.cgi?id=180143
26
27         Reviewed by Chris Dumez.
28
29         Covered by updated tests.
30
31         ServiceWorkerGlobalScope keeps a map of all live ServiceWorkerClient objects.
32         Before creating a new client, it checks whether the map has one such object with the same identifier.
33         If so, it reuses this object. Otherwise it creates either a ServiceWorkerWindowClient or ServiceWorkerClient.
34
35         Add support for using a ServiceWorkerClientIdentifier as a HashMap key.
36
37         * workers/service/ServiceWorkerClient.cpp:
38         (WebCore::ServiceWorkerClient::ServiceWorkerClient):
39         (WebCore::ServiceWorkerClient::~ServiceWorkerClient):
40         * workers/service/ServiceWorkerClient.h:
41         (WebCore::ServiceWorkerClient::getOrCreate):
42         * workers/service/ServiceWorkerClientIdentifier.h:
43         (WebCore::ServiceWorkerClientIdentifier::hash const):
44         (WTF::ServiceWorkerClientIdentifierHash::hash):
45         (WTF::ServiceWorkerClientIdentifierHash::equal):
46         (WTF::HashTraits<WebCore::ServiceWorkerClientIdentifier>::emptyValue):
47         (WTF::HashTraits<WebCore::ServiceWorkerClientIdentifier>::constructDeletedValue):
48         (WTF::HashTraits<WebCore::ServiceWorkerClientIdentifier>::isDeletedValue):
49         * workers/service/ServiceWorkerGlobalScope.cpp:
50         (WebCore::ServiceWorkerGlobalScope::serviceWorkerClient):
51         (WebCore::ServiceWorkerGlobalScope::addServiceWorkerClient):
52         (WebCore::ServiceWorkerGlobalScope::removeServiceWorkerClient):
53         * workers/service/ServiceWorkerGlobalScope.h:
54         * workers/service/ServiceWorkerWindowClient.cpp:
55         (WebCore::ServiceWorkerWindowClient::ServiceWorkerWindowClient):
56         * workers/service/ServiceWorkerWindowClient.h:
57         * workers/service/context/ServiceWorkerThread.cpp:
58         (WebCore::ServiceWorkerThread::postMessageToServiceWorkerGlobalScope):
59
60 2017-11-29  Zalan Bujtas  <zalan@apple.com>
61
62         Add missing WTF_MAKE_ISO_ALLOCATED macros
63         https://bugs.webkit.org/show_bug.cgi?id=180165
64         <rdar://problem/35755617>
65
66         Reviewed by Simon Fraser.
67
68         * rendering/RenderFrame.h:
69         * rendering/RenderFullScreen.cpp:
70         * rendering/RenderIFrame.h:
71
72 2017-11-29  Said Abou-Hallawa  <sabouhallawa@apple.com>
73
74         Remove the ImageSource from the class hierarchy that connects BitmapImage to ImageFrame
75         https://bugs.webkit.org/show_bug.cgi?id=175595
76
77         Reviewed by Darin Adler.
78
79         The class hierarchy that connects BitmapImage to ImageFrame has been
80         troublesome. ImageSource does not have a clear responsibility other than
81         a bridge that connects BitmapIamge to ImageFrameCache. Sharing the 
82         ImageDecoder between ImageSource and ImageFrameCache is ugly and caused
83         few crashes in the past.
84
85         This patch will do the first step for fixing this issue. First get rid of
86         ImageSource by moving its APIs to ImageFrameCache and BitmapImage. Replace
87         all the instances of ImageSource by ImageFrameCache. The next step will
88         be to rename ImageFrameCache to ImageSource. But this will be done in a
89         follow-up patch
90
91         * Sources.txt:
92         * WebCore.xcodeproj/project.pbxproj:
93         * platform/graphics/BitmapImage.cpp:
94         (WebCore::BitmapImage::BitmapImage):
95         (WebCore::BitmapImage::~BitmapImage):
96         (WebCore::BitmapImage::destroyDecodedData):
97         (WebCore::BitmapImage::destroyDecodedDataIfNecessary):
98         (WebCore::BitmapImage::dataChanged):
99         (WebCore::BitmapImage::frameImageAtIndexCacheIfNeeded):
100         (WebCore::BitmapImage::draw):
101         (WebCore::BitmapImage::canUseAsyncDecodingForLargeImages const):
102         (WebCore::BitmapImage::shouldUseAsyncDecodingForAnimatedImages const):
103         (WebCore::BitmapImage::subsamplingLevelForScaleFactor):
104         (WebCore::BitmapImage::canDestroyDecodedData):
105         (WebCore::BitmapImage::internalStartAnimation):
106         (WebCore::BitmapImage::stopAnimation):
107         (WebCore::BitmapImage::decode):
108         (WebCore::BitmapImage::imageFrameAvailableAtIndex):
109         (WebCore::BitmapImage::dump const):
110         * platform/graphics/BitmapImage.h:
111         * platform/graphics/GraphicsContext3D.h:
112         * platform/graphics/ImageFrameCache.cpp:
113         (WebCore::ImageFrameCache::ImageFrameCache):
114         (WebCore::ImageFrameCache::ensureDecoderAvailable):
115         (WebCore::ImageFrameCache::setData):
116         (WebCore::ImageFrameCache::resetData):
117         (WebCore::ImageFrameCache::dataChanged):
118         (WebCore::ImageFrameCache::isAllDataReceived):
119         (WebCore::ImageFrameCache::clearFrameBufferCache):
120         (WebCore::ImageFrameCache::canUseAsyncDecoding):
121         (WebCore::ImageFrameCache::maximumSubsamplingLevel):
122         (WebCore::ImageFrameCache::setTargetContext):
123         (WebCore::ImageFrameCache::createFrameImageAtIndex):
124         (WebCore::ImageFrameCache::dump):
125         (WebCore::ImageFrameCache::setDecoder): Deleted.
126         (WebCore::ImageFrameCache::decoder const): Deleted.
127         * platform/graphics/ImageFrameCache.h:
128         (WebCore::ImageFrameCache::create):
129         (WebCore::ImageFrameCache::requestFrameAsyncDecodingAtIndex):
130         * platform/graphics/ImageSource.cpp: Removed.
131         * platform/graphics/ImageSource.h: Removed.
132         * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
133         (WebCore::GraphicsContext3D::ImageExtractor::~ImageExtractor):
134         (WebCore::GraphicsContext3D::ImageExtractor::extractImage):
135         * platform/graphics/cg/GraphicsContext3DCG.cpp:
136         (WebCore::GraphicsContext3D::ImageExtractor::extractImage):
137         * platform/graphics/cg/ImageSourceCG.h:
138
139 2017-11-29  Brady Eidson  <beidson@apple.com>
140
141         When managing context startups, make ServiceWorkerJobDataIdentifier's optional.
142         https://bugs.webkit.org/show_bug.cgi?id=180166
143
144         Reviewed by Chris Dumez.
145
146         No new tests (No behavior change).
147
148         We'll sometimes be starting SW contexts without an associated job, so ServiceWorkerContextData
149         should not required actually having a job identifier.
150
151         * workers/service/ServiceWorkerContextData.h:
152         (WebCore::ServiceWorkerContextData::decode):
153
154         * workers/service/context/SWContextManager.h:
155
156         * workers/service/server/SWServer.cpp:
157         (WebCore::SWServer::scriptContextFailedToStart):
158         (WebCore::SWServer::scriptContextStarted):
159         (WebCore::SWServer::didFinishInstall):
160         * workers/service/server/SWServer.h:
161
162         * workers/service/server/SWServerToContextConnection.cpp:
163         (WebCore::SWServerToContextConnection::scriptContextFailedToStart):
164         (WebCore::SWServerToContextConnection::scriptContextStarted):
165         (WebCore::SWServerToContextConnection::didFinishInstall):
166         * workers/service/server/SWServerToContextConnection.h:
167
168         * workers/service/server/SWServerWorker.cpp:
169         (WebCore::SWServerWorker::scriptContextFailedToStart):
170         (WebCore::SWServerWorker::scriptContextStarted):
171         (WebCore::SWServerWorker::didFinishInstall):
172         * workers/service/server/SWServerWorker.h:
173
174 2017-11-29  Youenn Fablet  <youenn@apple.com>
175
176         Add support for service worker generated redirections
177         https://bugs.webkit.org/show_bug.cgi?id=179498
178
179         Reviewed by Darin Adler.
180
181         Test: http/tests/workers/service/service-worker-redirection-fetch.https.html
182
183         Added redirection routines following fetch specification to:
184         - check whether a response is a redirection
185         - generate a redirected request from a request and its redirection response.
186         Added some specific redirect request generation following existing WebKit networking code.
187
188         * Modules/fetch/FetchResponse.cpp:
189         (WebCore::FetchResponse::redirect):
190         (WebCore::isRedirectStatus): Deleted.
191         * platform/network/ResourceRequestBase.cpp:
192         (WebCore::shouldUseGet):
193         (WebCore::ResourceRequestBase::redirectedRequest const):
194         * platform/network/ResourceRequestBase.h:
195         * platform/network/ResourceResponseBase.h:
196         (WebCore::ResourceResponseBase::isRedirectionStatusCode):
197         (WebCore::ResourceResponseBase::isRedirection const):
198
199 2017-11-29  Chris Dumez  <cdumez@apple.com>
200
201         Start exposing self.registration inside service workers
202         https://bugs.webkit.org/show_bug.cgi?id=180162
203
204         Reviewed by Brady Eidson.
205
206         Start exposing self.registration inside service workers as per:
207         - https://w3c.github.io/ServiceWorker/#serviceworkerglobalscope-interface
208
209         This is very initial support:
210         - The operations on the registration (such as update) will reject the promise for now.
211         - The registration's service workers are not yet populated.
212
213         This will be implemented in a follow-up.
214
215         Tests: http/tests/workers/service/ServiceWorkerGlobalScope_registration_SameObject.html
216                http/tests/workers/service/self_registration.html
217
218         * bindings/js/JSServiceWorkerGlobalScopeCustom.cpp:
219         (WebCore::JSServiceWorkerGlobalScope::visitAdditionalChildren):
220         * workers/service/ServiceWorkerContainer.cpp:
221         (WebCore::ServiceWorkerContainer::addRegistration):
222         * workers/service/ServiceWorkerContextData.cpp:
223         (WebCore::ServiceWorkerContextData::isolatedCopy const):
224         * workers/service/ServiceWorkerContextData.h:
225         (WebCore::ServiceWorkerContextData::encode const):
226         (WebCore::ServiceWorkerContextData::decode):
227         * workers/service/ServiceWorkerGlobalScope.cpp:
228         (WebCore::ServiceWorkerGlobalScope::ServiceWorkerGlobalScope):
229         * workers/service/ServiceWorkerGlobalScope.h:
230         (WebCore::ServiceWorkerGlobalScope::registration):
231         * workers/service/server/SWServer.cpp:
232         (WebCore::SWServer::updateWorker):
233         (WebCore::SWServer::installContextData):
234         * workers/service/server/SWServer.h:
235         * workers/service/server/SWServerJobQueue.cpp:
236         (WebCore::SWServerJobQueue::scriptFetchFinished):
237
238 2017-11-29  Youenn Fablet  <youenn@apple.com>
239
240         Add support for FetchEvent.clientId
241         https://bugs.webkit.org/show_bug.cgi?id=180052
242
243         Reviewed by Chris Dumez.
244
245         Covered by updated test.
246
247         Add script execution context identifier as a FetchOptions parameter.
248         This is then sent to the service worker process which can then set FetchEvent.clientId appropriately.
249         If the fetch is for a subresource, clientId is used directly.
250         If it is a navigation, clientId is set to targetClientId.
251
252         * loader/FetchOptions.h:
253         (WebCore::FetchOptions::encode const):
254         (WebCore::FetchOptions::decode):
255         * loader/cache/CachedResourceLoader.cpp:
256         (WebCore::CachedResourceLoader::prepareFetch):
257         * loader/cache/CachedResourceRequest.cpp:
258         (WebCore::CachedResourceRequest::setClientIdentifierIfNeeded):
259         * loader/cache/CachedResourceRequest.h:
260         * workers/service/context/ServiceWorkerFetch.cpp:
261         (WebCore::ServiceWorkerFetch::dispatchFetchEvent):
262         * workers/service/context/ServiceWorkerFetch.h:
263         * workers/service/context/ServiceWorkerThread.cpp:
264         (WebCore::ServiceWorkerThread::postFetchTask):
265         * workers/service/context/ServiceWorkerThread.h:
266
267 2017-11-29  Youenn Fablet  <youenn@apple.com>
268
269         Flaky crash in WebCore::DOMGuardedObject::clear() during service worker tests
270         https://bugs.webkit.org/show_bug.cgi?id=180045
271         <rdar://problem/35737288>
272
273         Reviewed by Chris Dumez.
274
275         Manually tested by running concurrently service worker tests using FetchEvents which store promise references.
276
277         Before the patch, on workers, clearing of DOMGuardedObjects happens at the time WorkerGlobalScope is destroyed.
278         This is too late as it is expected that the JSDOMGlobalObject is still alive.
279
280         This patch adds a clearDOMGuardedObjects method on JSWorkerGlobalScopeBase.
281         It is called when stopping a WorkerThread, just before releasing the strong reference to JSWorkerGlobalScopeBase.
282
283         * bindings/js/JSDOMGuardedObject.h:
284         * bindings/js/JSWorkerGlobalScopeBase.cpp:
285         (WebCore::JSWorkerGlobalScopeBase::clearDOMGuardedObjects):
286         * bindings/js/JSWorkerGlobalScopeBase.h:
287         * bindings/js/WorkerScriptController.cpp:
288
289 2017-11-29  Alex Christensen  <achristensen@webkit.org>
290
291         Fix Mac CMake build.
292
293         * PlatformMac.cmake:
294
295 2017-11-29  Simon Fraser  <simon.fraser@apple.com>
296
297         REGRESSION (r213590): Scrolling to anchors broken in web views when content loaded via HTML string
298         https://bugs.webkit.org/show_bug.cgi?id=180155
299         rdar://problem/34220827
300
301         Reviewed by Zalan Bujtas.
302         
303         When content is loaded in a UIWebView or WKWebView via an HTML string, history().currentItem()
304         is null so itemAllowsScrollRestoration() would return false, preventing scrolling to anchors.
305
306         Fix by allowing scroll restoration if the the history item is null.
307
308         Tested by WebKit.NoHistoryItemScrollToFragment API test.
309
310         * loader/FrameLoader.cpp:
311         (WebCore::itemAllowsScrollRestoration):
312
313 2017-11-29  Chris Dumez  <cdumez@apple.com>
314
315         Introduce ServiceWorkerContainer::ensureSWClientConnection()
316         https://bugs.webkit.org/show_bug.cgi?id=180146
317
318         Reviewed by Youenn Fablet.
319
320         Introduce ServiceWorkerContainer::ensureSWClientConnection() to reduce
321         code duplication. Also use callOnMainThread() in preparation for this
322         getting called from a service worker thread (now that ServiceWorkerContainer
323         is exposed to service workers). This is needed because constructing the
324         SWClientConnection initializes the IPC connection from the WebProcess to
325         the StorageProcess, which involves a synchronous IPC with the UIProcess.
326         Doing a synchronous IPC from a background thread is unsupported.
327
328         * workers/service/ServiceWorkerContainer.cpp:
329         (WebCore::ServiceWorkerContainer::addRegistration):
330         (WebCore::ServiceWorkerContainer::getRegistration):
331         (WebCore::ServiceWorkerContainer::getRegistrations):
332         (WebCore::ServiceWorkerContainer::ensureSWClientConnection):
333         * workers/service/ServiceWorkerContainer.h:
334
335 2017-11-29  Antoine Quint  <graouts@apple.com>
336
337         [iOS] Media controls should stop updating while media is playing in fullscreen
338         https://bugs.webkit.org/show_bug.cgi?id=180144
339         <rdar://problem/35060379>
340
341         Reviewed by Eric Carlson.
342
343         Updating inline media controls while playing media in fullscreen is useless since we're guaranteed not to
344         have those controls visible, and hurtful since this has impact on battery life. To avoid this, we remove
345         all media event listeners while in fullscreen on iOS, which will prevent the UI to be udpated since all
346         updates are driven by media events.
347
348         To implement this, we remove the MediaControllerSupport destroy() method and make it a disable() method,
349         and factor code out of the MediaControllerSupport constructor into an enable() method that registers the
350         media event listeners. Then, as we enter and exit fullscreen, we call the disable() and enable() method
351         on the various MediaControllerSupport objects that were created to support the iOS inline media controls.
352
353         Test: media/modern-media-controls/media-controller/ios/media-controller-stop-updates-in-fullscreen.html
354
355         * Modules/modern-media-controls/media/controls-visibility-support.js:
356         (ControlsVisibilitySupport):
357         (ControlsVisibilitySupport.prototype.enable):
358         (ControlsVisibilitySupport.prototype.disable):
359         (ControlsVisibilitySupport.prototype.destroy): Deleted.
360         * Modules/modern-media-controls/media/media-controller-support.js:
361         (MediaControllerSupport):
362         (MediaControllerSupport.prototype.enable):
363         (MediaControllerSupport.prototype.disable):
364         (MediaControllerSupport.prototype.destroy): Deleted.
365         * Modules/modern-media-controls/media/media-controller.js:
366         (MediaController.prototype.handleEvent):
367         (MediaController.prototype._updateControlsIfNeeded):
368         (MediaController.prototype._updateSupportingObjectsEnabledState):
369         (MediaController):
370
371 2017-11-29  Simon Fraser  <simon.fraser@apple.com>
372
373         Viewport unit values affected by Comand-+ zoom
374         https://bugs.webkit.org/show_bug.cgi?id=145614
375
376         Reviewed by Zalan Bujtas.
377         
378         Don't apply zooming when resolving viewport-relative lengths, since they should not
379         change based on the zoom level.
380
381         Test: fast/css/viewport-units-zoom.html
382
383         * css/CSSPrimitiveValue.cpp:
384         (WebCore::CSSPrimitiveValue::computeNonCalcLengthDouble):
385
386 2017-11-29  Brent Fulgham  <bfulgham@apple.com>
387
388         Unreviewed test fix after r225264.
389         <rdar://problem/35750689>
390
391         The changes in r225264 were meant to have no changes in behavior. However, I mistakenly
392         switched to a secure coding API call in the PlatformPasteboard::write method. This should
393         have used the 'insecure' version of this function.
394
395         * platform/ios/PlatformPasteboardIOS.mm:
396         (WebCore::PlatformPasteboard::write): 
397
398 2017-11-29  Youenn Fablet  <youenn@apple.com>
399
400         LibWebRTCPeerConnectionBackend should clean its stats promises when being cleaned
401         https://bugs.webkit.org/show_bug.cgi?id=180101
402
403         Reviewed by Eric Carlson.
404
405         No change of behavior.
406
407         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
408         (WebCore::LibWebRTCPeerConnectionBackend::doStop): Cleaning stat promises hash map.
409
410 2017-11-29  Zan Dobersek  <zdobersek@igalia.com>
411
412         [CoordGraphics] Rename CoordinatedBuffer to Nicosia::Buffer
413         https://bugs.webkit.org/show_bug.cgi?id=180135
414
415         Reviewed by Carlos Garcia Campos.
416
417         Rename CoordinatedBuffer to Nicosia::Buffer, starting an abstraction
418         layer that will in the future allow us to prototype and potentially
419         support different 2D rasterization libraries. The layer is envisioned
420         as separate from the CoordinatedGraphics code, but will in the mid-term
421         only be used there.
422
423         In order to keep CMake changes to a minimum for now, the source code is
424         included in the build along with the CoordinatedGraphics source files,
425         in TextureMapper.cmake.
426
427         No new tests -- no change in functionality.
428
429         * platform/TextureMapper.cmake:
430         * platform/graphics/nicosia/NicosiaBuffer.cpp: Renamed from Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedBuffer.cpp.
431         (Nicosia::Buffer::create):
432         (Nicosia::Buffer::Buffer):
433         (Nicosia::Buffer::context):
434         (Nicosia::Buffer::uploadImage):
435         * platform/graphics/nicosia/NicosiaBuffer.h: Renamed from Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedBuffer.h.
436         (Nicosia::Buffer::size const):
437         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
438         (WebCore::CoordinatedGraphicsLayer::updateContentBuffers):
439         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
440         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
441         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp:
442         (WebCore::CoordinatedImageBacking::update):
443         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.h:
444         * platform/graphics/texmap/coordinated/Tile.h:
445
446 2017-11-29  Antoine Quint  <graouts@apple.com>
447
448         Pressing the space bar while watching a fullscreen video doesn't play or pause
449         https://bugs.webkit.org/show_bug.cgi?id=180033
450         <rdar://problem/33610443>
451
452         Reviewed by Eric Carlson.
453
454         We register a "keydown" event to track when the space bar is pressed, and if the media is playing
455         in fullscreen, we toggle playback. This does not interfere with full keyboard access since activating
456         one of the media controls using the keyboard will not let the events we register for be dispatched
457         this far along the event dispatch phase.
458
459         Test: media/modern-media-controls/media-controller/media-controller-space-bar-toggle-playback.html
460
461         * Modules/modern-media-controls/media/media-controller.js:
462         (MediaController):
463         (MediaController.prototype.togglePlayback): Add a catch() statement since calling play() could sometime
464         lead to some extraneous unhandled promise console logging that pollutes test output.
465         (MediaController.prototype.handleEvent):
466
467 2017-11-28  Brent Fulgham  <bfulgham@apple.com>
468
469         Adopt updated NSKeyed[Un]Archiver API when available
470         https://bugs.webkit.org/show_bug.cgi?id=180127
471         <rdar://problem/35710738>
472
473         Reviewed by Alex Christensen.
474
475         Switch to new NSKeyed[Un]Archiver methods when available. We do not attempt
476         to adopt secure coding in places we were not under the original API.
477
478         Most of the new API is wrapped in a set of convenience methods so we can
479         build without the new API on older systems.
480
481         No change in behavior.
482
483         * editing/cocoa/EditorCocoa.mm:
484         (WebCore::archivedDataForAttributedString): Use new convenience method
485         to archive the string object.
486         * loader/archive/cf/LegacyWebArchiveMac.mm:
487         (WebCore::LegacyWebArchive::createResourceResponseFromMacArchivedData): Update to
488         use secure coding where possible.
489         (WebCore::LegacyWebArchive::createPropertyListRepresentation): Ditto.
490         * platform/ios/PlatformPasteboardIOS.mm:
491         (WebCore::PlatformPasteboard::write): Use new secure API.
492         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const): Ditto.
493         * testing/cocoa/WebArchiveDumpSupport.mm:
494         (WebCoreTestSupport::createCFURLResponseFromResponseData): Update to
495         secure coding API where possible.
496
497 2017-11-28  Joseph Pecoraro  <pecoraro@apple.com>
498
499         Web Inspector: Cleanup Inspector classes be more consistent about using fast malloc / noncopyable
500         https://bugs.webkit.org/show_bug.cgi?id=180119
501
502         Reviewed by Devin Rousso.
503
504         * inspector/InspectorCanvas.cpp:
505         * inspector/InspectorDatabaseResource.cpp:
506         * inspector/InspectorFrontendClientLocal.cpp:
507         * inspector/InspectorFrontendClientLocal.h:
508         * inspector/InspectorFrontendHost.cpp:
509         * inspector/InspectorHistory.h:
510         * inspector/InspectorInstrumentation.cpp:
511         * inspector/InspectorOverlay.cpp:
512         * inspector/InspectorShaderProgram.cpp:
513         * inspector/InspectorStyleSheet.cpp:
514         * inspector/InstrumentingAgents.cpp:
515         * inspector/PageScriptDebugServer.h:
516         * inspector/TimelineRecordFactory.cpp:
517         * inspector/WebInjectedScriptManager.cpp:
518         * inspector/WebInjectedScriptManager.h:
519         * inspector/WorkerScriptDebugServer.cpp:
520         * inspector/WorkerScriptDebugServer.h:
521         * inspector/agents/*
522         Be more consistent about namespace / fast malloc / noncopyable.
523
524 2017-11-28  Zan Dobersek  <zdobersek@igalia.com>
525
526         [Cairo] Limit the number of active contexts in GraphicsContext3DCairo
527         https://bugs.webkit.org/show_bug.cgi?id=166968
528
529         Reviewed by Alex Christensen.
530
531         Cairo's implementation of GraphicsContext3D should follow the Mac's
532         and limit the number of active GraphicsContext3D objects.
533
534         The active contexts are listed in a global Deque, with the first
535         among them being recycled when the GraphicsContext3D::create()
536         function sees that the limit has been reached. That function still
537         returns null if even after recycling the number of contexts didn't
538         decrease.
539
540         Finally, in the GraphicsContext3D destructor, the context being
541         destroyed is removed from the list of active contexts.
542
543         No new tests -- relevant tests are now passing.
544
545         * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
546         (WebCore::activeContexts):
547         (WebCore::GraphicsContext3D::create):
548         (WebCore::GraphicsContext3D::~GraphicsContext3D):
549
550 2017-11-28  Zalan Bujtas  <zalan@apple.com>
551
552         Clean up spanners before creating nested column context
553         https://bugs.webkit.org/show_bug.cgi?id=180107
554         <rdar://problem/35686655>
555         
556         Reviewed by Antti Koivisto.
557
558         When an existing spanner placeholder is moved into a newly constructed (and nested)
559         multicolumn context, we figure it's not valid anymore and end up destroying it
560         (see RenderMultiColumnFlow::fragmentedFlowDescendantInserted).
561         This is very unfortunate since as we climb back on the stack, we could hit this renderer as
562         the newly inserted child. 
563
564         This patch proactively removes the invalid placeholders and moves the associated spanners back to their
565         original position. 
566
567         Test: fast/multicol/crash-when-constructing-nested-columns.html
568
569         * rendering/RenderMultiColumnFlow.h:
570         * style/RenderTreeUpdaterMultiColumn.cpp:
571         (WebCore::RenderTreeUpdater::MultiColumn::createFragmentedFlow): 
572         RenderTreeUpdater::MultiColumn::destroyFragmentedFlow still relies on the placeholder removal
573         logic in RenderMultiColumnFlow::fragmentedFlowDescendantInserted.
574
575 2017-11-28  Tim Horton  <timothy_horton@apple.com>
576
577         REGRESSION (High Sierra): Layout Test fast/multicol/newmulticol/spanner2.html is a flaky image failure on WK1
578         https://bugs.webkit.org/show_bug.cgi?id=177826
579         <rdar://problem/34876498>
580
581         Reviewed by Alexey Proskuryakov.
582
583         No new tests, fixes some already-broken tests.
584
585         * platform/graphics/mac/PDFDocumentImageMac.mm:
586         (WebCore::PDFDocumentImage::drawPDFPage):
587         Save and restore one more piece of context state that
588         PDFKit mutates while drawing.
589
590 2017-11-28  Wenson Hsieh  <wenson_hsieh@apple.com>
591
592         Allow attachment elements with no appearance to defer rendering to child nodes
593         https://bugs.webkit.org/show_bug.cgi?id=180117
594         <rdar://problem/35735339>
595
596         Reviewed by Tim Horton.
597
598         Test: fast/attachment/attachment-without-appearance.html
599
600         When -webkit-appearance: none; is specified on an attachment element, allow it to fall back to rendering its
601         subtree. Currently, attachment elements without an appearance don't allow this and truncate the render tree at
602         the RenderAttachment, since RenderAttachment cannot have any children.
603
604         In a followup, this will enable us to render a shadow subtree under the attachment element to display in-place
605         attachment content, and easily toggle between in-place and icon display by changing the appearance.
606
607         * html/HTMLAttachmentElement.cpp:
608         (WebCore::HTMLAttachmentElement::createElementRenderer):
609
610         If no appearance is specified, emit a RenderBlockFlow instead of a RenderAttachment.
611
612         (WebCore::HTMLAttachmentElement::setFile):
613         (WebCore::HTMLAttachmentElement::attachmentRenderer const):
614
615         Renamed from renderer(). HTMLAttachmentElement::renderer() now uses the superclass' implementation, and no
616         longer returns a RenderAttachment in all circumstances. Instead, places that expect a RenderAttachment now go
617         through HTMLAttachmentElement::renderAttachment() instead.
618
619         (WebCore::HTMLAttachmentElement::parseAttribute):
620         * html/HTMLAttachmentElement.h:
621         * page/DragController.cpp:
622         (WebCore::DragController::startDrag):
623         * rendering/RenderAttachment.h:
624         (WebCore::HTMLAttachmentElement::renderer const): Deleted.
625
626 2017-11-28  Youenn Fablet  <youenn@apple.com>
627
628         Register Documents as ServiceWorker clients to the StorageProcess
629         https://bugs.webkit.org/show_bug.cgi?id=180047
630
631         Reviewed by Brady Eidson.
632
633         No change of behavior.
634         These changes will be covered when implementing ServiceWorker Clients API.
635
636         Registering a document when being created by DocumentLoader.
637         In the future, we may restrict registration to only documents related to origins that have some ongoing service worker activity.
638         This would require to keep track of which documents are registered so that we unregister these ones.
639         This would also require to register existing documents when one of the document with the same origin starts registering a service worker.
640         Unregistering a document inside prepareForDestruction.
641
642         Storing all clients in SWServer as a HasMap keyed by ClientOrigin.
643         Processing will then iterate through the list of clients scoped by the client origin.
644
645         Adding a ClientOrigin class as a pair of top origin and frame origin since service workers will be related based on that information.
646
647         * WebCore.xcodeproj/project.pbxproj:
648         * dom/Document.cpp:
649         (WebCore::Document::prepareForDestruction):
650         * loader/DocumentLoader.cpp:
651         (WebCore::DocumentLoader::commitData):
652         * page/ClientOrigin.h: Added.
653         (WebCore::ClientOrigin::emptyKey):
654         (WebCore::ClientOrigin::hash const):
655         (WebCore::ClientOrigin::operator== const):
656         (WTF::ClientOriginKeyHash::hash):
657         (WTF::ClientOriginKeyHash::equal):
658         (WTF::HashTraits<WebCore::ClientOrigin>::emptyValue):
659         (WTF::HashTraits<WebCore::ClientOrigin>::constructDeletedValue):
660         (WTF::HashTraits<WebCore::ClientOrigin>::isDeletedValue):
661         * workers/service/ServiceWorkerClientIdentifier.h:
662         (WebCore::ServiceWorkerClientIdentifier::operator== const):
663         * workers/service/server/SWClientConnection.h:
664         * workers/service/server/SWServer.cpp:
665         (WebCore::SWServer::registerServiceWorkerClient):
666         (WebCore::SWServer::unregisterServiceWorkerClient):
667         * workers/service/server/SWServer.h:
668
669 2017-11-28  Chris Dumez  <cdumez@apple.com>
670
671         ServiceWorkerGlobalScope.clients should always return the same object
672         https://bugs.webkit.org/show_bug.cgi?id=180116
673
674         Reviewed by Geoffrey Garen.
675
676         ServiceWorkerGlobalScope.clients should always return the same object, as per the specification:
677         - https://w3c.github.io/ServiceWorker/#serviceworkerglobalscope-interface
678
679         Test: http/tests/workers/service/ServiceWorkerGlobalScope_clients_SameObject.html
680
681         * Sources.txt:
682         * WebCore.xcodeproj/project.pbxproj:
683         * bindings/js/JSServiceWorkerGlobalScopeCustom.cpp: Added.
684         (WebCore::JSServiceWorkerGlobalScope::visitAdditionalChildren):
685         * workers/service/ServiceWorkerClients.idl:
686         * workers/service/ServiceWorkerGlobalScope.idl:
687
688 2017-11-28  Chris Dumez  <cdumez@apple.com>
689
690         Get rid of ServiceWorker::allWorkers() hashmap
691         https://bugs.webkit.org/show_bug.cgi?id=180111
692
693         Reviewed by Brady Eidson.
694
695         Get rid of ServiceWorker::allWorkers() hashmap as it is not thread safe and we'll soon have
696         ServiceWorker objects living in various service worker threads.
697
698         Instead, we now have a per-ScriptExecutionContext map, which is inherently thread-safe.
699
700         No new tests, no web-facing behavior change.
701
702         * dom/ScriptExecutionContext.cpp:
703         (WebCore::ScriptExecutionContext::registerServiceWorker):
704         (WebCore::ScriptExecutionContext::unregisterServiceWorker):
705         * dom/ScriptExecutionContext.h:
706         (WebCore::ScriptExecutionContext::serviceWorker):
707         * workers/service/ServiceWorker.cpp:
708         (WebCore::ServiceWorker::getOrCreate):
709         (WebCore::ServiceWorker::ServiceWorker):
710         (WebCore::ServiceWorker::~ServiceWorker):
711         (WebCore::ServiceWorker::stop):
712         * workers/service/ServiceWorker.h:
713         * workers/service/server/SWClientConnection.cpp:
714         (WebCore::SWClientConnection::updateWorkerState):
715
716 2017-11-28  Said Abou-Hallawa  <sabouhallawa@apple.com>
717
718         [CG] PostScript images should be supported if they are sub-resource images
719         https://bugs.webkit.org/show_bug.cgi?id=178502
720         <rdar://problem/35102988>
721
722         Reviewed by Simon Fraser.
723
724         Make CachedImage detect the PostScript mime type and the file extension.
725         Let PDFDocumentImage replaces the PostScript data with the equivalent PDF
726         data and use it when creating the PDFDocument.
727
728         Test: fast/images/eps-as-image.html
729
730         * WebCore.xcodeproj/project.pbxproj:
731         * loader/cache/CachedImage.cpp:
732         (WebCore::CachedImage::isPDFRequest const):
733         (WebCore::CachedImage::isPostScriptRequest const):
734         These functions return whether the request is for a PDF or a PostScript 
735         image. They check for the same conditions we do in WebPage::createPlugin().
736
737         (WebCore::CachedImage::createImage): Create a PDFDocumentImage for either
738         a PDF or a PostScript image. For PostScript, the data will be converted
739         to PDF when all the data is received.
740
741         (WebCore::CachedImage::updateBufferInternal): Use the size() of m_data
742         instead of using the m_image->data() to setEncodedSize(). Image::m_data
743         and CachedImage::m_data point to the same SharedBuffer.
744
745         (WebCore::CachedImage::convertedDataIfNeeded const): Convert the PostScript
746         data to PDF if the system can convert it. If the same can't convert it,
747         return null so loading the image will be canceled.
748
749         (WebCore::CachedImage::updateImageData): Get rid of the data argument since
750         we always send the member m_data to this function.
751
752         (WebCore::CachedImage::finishLoading): Convert the PostScript data to PDF 
753         data since all the data is received. Use m_data to set setEncodedSize().
754
755         * loader/cache/CachedImage.h:
756         * platform/MIMETypeRegistry.cpp:
757         (WebCore::MIMETypeRegistry::isPostScriptMIMEType):
758         (WebCore::MIMETypeRegistry::isPDFOrPostScriptMIMEType):
759         * platform/MIMETypeRegistry.h:
760         * platform/graphics/cg/PDFDocumentImage.cpp:
761         (WebCore::PDFDocumentImage::PDFDocumentImage):
762         (WebCore::PDFDocumentImage::convertPostScriptDataToPDF):
763         * platform/graphics/cg/PDFDocumentImage.h:
764
765 2017-11-14  Carlos Garcia Campos  <cgarcia@igalia.com>
766
767         Move JSONValues to WTF and convert uses of InspectorValues.h to JSONValues.h
768         https://bugs.webkit.org/show_bug.cgi?id=173793
769
770         Reviewed by Joseph Pecoraro.
771
772         Based on patch by Brian Burg.
773
774         * ForwardingHeaders/inspector/InspectorValues.h: Removed.
775         * Modules/encryptedmedia/InitDataRegistry.cpp:
776         (WebCore::extractKeyIDsKeyids):
777         (WebCore::sanitizeKeyids):
778         * html/parser/XSSAuditorDelegate.cpp:
779         (WebCore::XSSAuditorDelegate::generateViolationReport):
780         * inspector/CommandLineAPIHost.cpp:
781         (WebCore::CommandLineAPIHost::inspect):
782         * inspector/CommandLineAPIHost.h:
783         * inspector/InspectorCanvas.cpp:
784         (WebCore::InspectorCanvas::recordAction):
785         (WebCore::InspectorCanvas::releaseData):
786         (WebCore::InspectorCanvas::indexForData):
787         (WebCore::buildArrayForVector):
788         (WebCore::InspectorCanvas::buildInitialState):
789         (WebCore::InspectorCanvas::buildAction):
790         (WebCore::InspectorCanvas::buildArrayForCanvasGradient):
791         (WebCore::InspectorCanvas::buildArrayForCanvasPattern):
792         (WebCore::InspectorCanvas::buildArrayForImageData):
793         (WebCore::InspectorCanvas::buildArrayForImageBitmap):
794         * inspector/InspectorCanvas.h:
795         * inspector/InspectorDatabaseResource.cpp:
796         * inspector/InspectorOverlay.cpp:
797         (WebCore::evaluateCommandInOverlay):
798         (WebCore::InspectorOverlay::evaluateInOverlay):
799         * inspector/InspectorOverlay.h:
800         * inspector/InspectorShaderProgram.h:
801         * inspector/InspectorStyleSheet.h:
802         (WebCore::InspectorCSSId::InspectorCSSId):
803         * inspector/TimelineRecordFactory.cpp:
804         (WebCore::TimelineRecordFactory::createGenericRecord):
805         (WebCore::TimelineRecordFactory::createFunctionCallData):
806         (WebCore::TimelineRecordFactory::createConsoleProfileData):
807         (WebCore::TimelineRecordFactory::createProbeSampleData):
808         (WebCore::TimelineRecordFactory::createEventDispatchData):
809         (WebCore::TimelineRecordFactory::createGenericTimerData):
810         (WebCore::TimelineRecordFactory::createTimerInstallData):
811         (WebCore::TimelineRecordFactory::createEvaluateScriptData):
812         (WebCore::TimelineRecordFactory::createTimeStampData):
813         (WebCore::TimelineRecordFactory::createAnimationFrameData):
814         (WebCore::createQuad):
815         (WebCore::TimelineRecordFactory::createPaintData):
816         (WebCore::TimelineRecordFactory::appendLayoutRoot):
817         * inspector/TimelineRecordFactory.h:
818         * inspector/agents/InspectorApplicationCacheAgent.cpp:
819         * inspector/agents/InspectorApplicationCacheAgent.h:
820         * inspector/agents/InspectorCSSAgent.cpp:
821         (WebCore::computePseudoClassMask):
822         (WebCore::InspectorCSSAgent::setStyleText):
823         (WebCore::InspectorCSSAgent::setRuleSelector):
824         (WebCore::InspectorCSSAgent::forcePseudoState):
825         * inspector/agents/InspectorCSSAgent.h:
826         * inspector/agents/InspectorDOMAgent.cpp:
827         (WebCore::parseColor):
828         (WebCore::parseConfigColor):
829         (WebCore::parseQuad):
830         (WebCore::InspectorDOMAgent::performSearch):
831         (WebCore::InspectorDOMAgent::setSearchingForNode):
832         (WebCore::InspectorDOMAgent::highlightConfigFromInspectorObject):
833         (WebCore::InspectorDOMAgent::setInspectModeEnabled):
834         (WebCore::InspectorDOMAgent::highlightRect):
835         (WebCore::InspectorDOMAgent::highlightQuad):
836         (WebCore::InspectorDOMAgent::innerHighlightQuad):
837         (WebCore::InspectorDOMAgent::highlightSelector):
838         (WebCore::InspectorDOMAgent::highlightNode):
839         (WebCore::InspectorDOMAgent::highlightNodeList):
840         (WebCore::InspectorDOMAgent::highlightFrame):
841         * inspector/agents/InspectorDOMAgent.h:
842         * inspector/agents/InspectorDOMDebuggerAgent.cpp:
843         (WebCore::InspectorDOMDebuggerAgent::didInvalidateStyleAttr):
844         (WebCore::InspectorDOMDebuggerAgent::willInsertDOMNode):
845         (WebCore::InspectorDOMDebuggerAgent::willRemoveDOMNode):
846         (WebCore::InspectorDOMDebuggerAgent::willModifyDOMAttr):
847         (WebCore::InspectorDOMDebuggerAgent::descriptionForDOMEvent):
848         (WebCore::InspectorDOMDebuggerAgent::pauseOnNativeEventIfNeeded):
849         (WebCore::InspectorDOMDebuggerAgent::willSendXMLHttpRequest):
850         * inspector/agents/InspectorDOMDebuggerAgent.h:
851         * inspector/agents/InspectorDOMStorageAgent.cpp:
852         (WebCore::InspectorDOMStorageAgent::getDOMStorageItems):
853         (WebCore::InspectorDOMStorageAgent::setDOMStorageItem):
854         (WebCore::InspectorDOMStorageAgent::removeDOMStorageItem):
855         (WebCore::InspectorDOMStorageAgent::findStorageArea):
856         * inspector/agents/InspectorDOMStorageAgent.h:
857         * inspector/agents/InspectorDatabaseAgent.cpp:
858         * inspector/agents/InspectorIndexedDBAgent.cpp:
859         (WebCore::Inspector::idbKeyFromInspectorObject):
860         (WebCore::Inspector::idbKeyRangeFromKeyRange):
861         (WebCore::InspectorIndexedDBAgent::requestData):
862         * inspector/agents/InspectorIndexedDBAgent.h:
863         * inspector/agents/InspectorNetworkAgent.cpp:
864         (WebCore::buildObjectForHeaders):
865         (WebCore::InspectorNetworkAgent::buildObjectForResourceResponse):
866         (WebCore::InspectorNetworkAgent::setExtraHTTPHeaders):
867         * inspector/agents/InspectorNetworkAgent.h:
868         * inspector/agents/InspectorPageAgent.cpp:
869         * inspector/agents/InspectorPageAgent.h:
870         * inspector/agents/InspectorTimelineAgent.cpp:
871         (WebCore::InspectorTimelineAgent::setInstruments):
872         (WebCore::InspectorTimelineAgent::internalStart):
873         (WebCore::InspectorTimelineAgent::didInvalidateLayout):
874         (WebCore::InspectorTimelineAgent::willLayout):
875         (WebCore::InspectorTimelineAgent::didScheduleStyleRecalculation):
876         (WebCore::InspectorTimelineAgent::willRecalculateStyle):
877         (WebCore::InspectorTimelineAgent::willComposite):
878         (WebCore::InspectorTimelineAgent::willPaint):
879         (WebCore::InspectorTimelineAgent::addRecordToTimeline):
880         (WebCore::InspectorTimelineAgent::setFrameIdentifier):
881         (WebCore::InspectorTimelineAgent::appendRecord):
882         (WebCore::InspectorTimelineAgent::sendEvent):
883         (WebCore::InspectorTimelineAgent::createRecordEntry):
884         (WebCore::InspectorTimelineAgent::pushCurrentRecord):
885         * inspector/agents/InspectorTimelineAgent.h:
886         * page/csp/ContentSecurityPolicy.cpp:
887         (WebCore::ContentSecurityPolicy::reportViolation const):
888         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
889         (WebCore::parseJSONObject):
890         (WebCore::parseLicenseFormat):
891         (WebCore::parseLicenseReleaseAcknowledgementFormat):
892         (WebCore::CDMInstanceClearKey::updateLicense):
893         (WebCore::CDMInstanceClearKey::removeSessionData):
894         * platform/graphics/avfoundation/CDMFairPlayStreaming.cpp:
895         (WebCore::extractSinfData):
896         * testing/Internals.cpp:
897
898 2017-11-28  Simon Fraser  <simon.fraser@apple.com>
899
900         Use the TextStream indent manipulator in more places
901         https://bugs.webkit.org/show_bug.cgi?id=180065
902
903         Reviewed by Sam Weinig.
904
905         Replace writeIndent() with << indent, and use an IndentScope in a few places.
906
907         * dom/ViewportArguments.cpp:
908         (WebCore::operator<<):
909         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
910         (WebCore::ScrollingStateFrameScrollingNode::dumpProperties const):
911         * page/scrolling/ScrollingStateNode.cpp:
912         (WebCore::ScrollingStateNode::dump const):
913         * platform/graphics/FloatRoundedRect.cpp:
914         (WebCore::operator<<):
915         * platform/graphics/transforms/TransformationMatrix.cpp:
916         (WebCore::operator<<):
917
918 2017-11-28  Noah Chase  <nchase@gmail.com>
919
920         Web Audio's AnalyserNode.fftSize cannot be greater than 2048 in Safari; spec says it can be up to 32768
921         https://bugs.webkit.org/show_bug.cgi?id=180040
922
923         Reviewed by Alex Christensen.
924
925         I fixed up the existing test/output for realtimeanalyser-fft-sizing.
926         one thing that I'm a bit unsure of here is whether or not there are other
927         places in WebKit's Web Audio implementation that use fftSize and
928         should have the wider range available (instead of capping out at
929         2048). based on a quick naive scan I think that there are.
930
931         * Modules/webaudio/RealtimeAnalyser.cpp:
932
933 2017-11-28  Daniel Bates  <dabates@apple.com>
934
935         Add WebKitAdditions extension point to add user-agent stylesheet
936         https://bugs.webkit.org/show_bug.cgi?id=179702
937         <rdar://problem/35711147>
938
939         Reviewed by Andy Estes.
940
941         * DerivedSources.make: Write user agent stylesheet generation recipe in terms of the
942         automatic variable $^, which represents the list of the names of all prerequisites
943         for the rule. Make automatically expands the names in $^ up to their full absolute
944         path.
945
946 2017-11-28  Daniel Bates  <dabates@apple.com>
947
948         [Cocoa] First pass at implementing alternative presentation button element
949         https://bugs.webkit.org/show_bug.cgi?id=179785
950         Part of <rdar://problem/34917108>
951
952         Reviewed by Brent Fulgham.
953
954         Implement support for substituting a button for one or more elements in a page.
955         This is a first pass. We will refine the logic and the API/SPI in subsequent
956         commits.
957
958         Tests: accessibility/alternative-presentation-button-input-type.html
959                accessibility/alternative-presentation-button.html
960                fast/forms/alternative-presentation-button/replace-and-remove.html
961                fast/forms/alternative-presentation-button/replacement.html
962
963         * English.lproj/Localizable.strings: Add placeholder strings for localization.
964         * SourcesCocoa.txt: Add some files.
965         * WebCore.xcodeproj/project.pbxproj: Ditto.
966         * dom/Element.h:
967         * editing/Editor.cpp:
968         (WebCore::Editor::clear): Clear out all substitutions. This is called whenever
969         we are navigating between pages.
970         (WebCore::Editor::substituteWithAlternativePresentationButton): Added.
971         (WebCore::Editor::removeAlternativePresentationButton): Added.
972         (WebCore::Editor::didInsertAlternativePresentationButtonElement): Added.
973         (WebCore::Editor::didRemoveAlternativePresentationButtonElement): Added.
974         * editing/Editor.h:
975         * editing/cocoa/AlternativePresentationButtonSubstitution.cpp: Added.
976         (WebCore::AlternativePresentationButtonSubstitution::AlternativePresentationButtonSubstitution):
977         (WebCore::AlternativePresentationButtonSubstitution::initializeSavedDisplayStyles):
978         (WebCore::AlternativePresentationButtonSubstitution::apply):
979         (WebCore::AlternativePresentationButtonSubstitution::unapply):
980         * editing/cocoa/AlternativePresentationButtonSubstitution.h:
981         * html/HTMLInputElement.cpp:
982         (WebCore::HTMLInputElement::alternativePresentationButtonElement const): Added.
983         (WebCore::HTMLInputElement::setTypeWithoutUpdatingAttribute): Added.
984         (WebCore::HTMLInputElement::createInputType): Extracted the logic to create the InputType from
985         HTMLInputElement::updateType() to here and added logic to create the input type for the
986         alternative presentation button. This input type is not web exposed.
987         (WebCore::HTMLInputElement::updateType): Modified to take the name of the InputType object to
988         create as an argument and pass it through to HTMLInputElement::createInputType() to actually
989         create it. Reordered the logic for destroying the shadow tree of the old InputType, deallocating
990         the old InputType, and assigning the new InputType such that we assign the new InputType,
991         destroy the shadow tree of the old InputType, and deallocate the old InputType. This ordering
992         allows AlternativePresentationButtonSubstitution::substitute() to avoid restoring the input
993         type saved before the substitution when the input type is changed by the page as opposed to
994         by SPI.
995         (WebCore::HTMLInputElement::parseAttribute): Pass the parsed type.
996         (WebCore::HTMLInputElement::willAttachRenderers): Ditto.
997         * html/HTMLInputElement.h: Change visibility of removeShadowRoot() from private to public so
998         that it can be called from AlternativePresentationButtonSubstitution.
999         * html/InputType.h:
1000         (WebCore::InputType::alternativePresentationButtonElement const): Added.
1001         * html/InputTypeNames.cpp:
1002         (WebCore::InputTypeNames::alternativePresentationButton): Added.
1003         * html/InputTypeNames.h:
1004         * html/shadow/cocoa/AlternativePresentationButtonElement.cpp: Added.
1005         (WebCore::AlternativePresentationButtonElement::create):
1006         (WebCore::AlternativePresentationButtonElement::AlternativePresentationButtonElement):
1007         (WebCore::AlternativePresentationButtonElement::insertedIntoAncestor):
1008         (WebCore::AlternativePresentationButtonElement::removedFromAncestor):
1009         (WebCore::AlternativePresentationButtonElement::didFinishInsertingNode):
1010         (WebCore::AlternativePresentationButtonElement::defaultEventHandler):
1011         * html/shadow/cocoa/AlternativePresentationButtonElement.h:
1012         * html/shadow/cocoa/AlternativePresentationButtonInputType.cpp: Added.
1013         (WebCore::AlternativePresentationButtonInputType::AlternativePresentationButtonInputType):
1014         (WebCore::AlternativePresentationButtonInputType::formControlType const):
1015         (WebCore::AlternativePresentationButtonInputType::appendFormData const):
1016         (WebCore::AlternativePresentationButtonInputType::supportsValidation const):
1017         (WebCore::AlternativePresentationButtonInputType::isTextButton const):
1018         (WebCore::AlternativePresentationButtonInputType::alternativePresentationButtonElement const):
1019         (WebCore::AlternativePresentationButtonInputType::createShadowSubtree):
1020         (WebCore::AlternativePresentationButtonInputType::destroyShadowSubtree):
1021         * html/shadow/cocoa/AlternativePresentationButtonInputType.h:
1022         * page/ChromeClient.h:
1023         * platform/LocalizedStrings.cpp:
1024         (WebCore::AXAlternativePresentationButtonLabel):
1025         (WebCore::alternativePresentationButtonTitle):
1026         (WebCore::alternativePresentationButtonSubtitle):
1027         * platform/LocalizedStrings.h:
1028         * testing/Internals.cpp:
1029         (WebCore::Internals::substituteWithAlternativePresentationButton): Added.
1030         (WebCore::Internals::removeAlternativePresentationButton): Added.
1031         * testing/Internals.h:
1032         * testing/Internals.idl:
1033
1034 2017-11-28  Commit Queue  <commit-queue@webkit.org>
1035
1036         Unreviewed, rolling out r225209.
1037         https://bugs.webkit.org/show_bug.cgi?id=180092
1038
1039         Tests are still timing out (Requested by ap on #webkit).
1040
1041         Reverted changeset:
1042
1043         "Pressing the space bar while watching a fullscreen video
1044         doesn't play or pause"
1045         https://bugs.webkit.org/show_bug.cgi?id=180033
1046         https://trac.webkit.org/changeset/225209
1047
1048 2017-11-28  Chris Dumez  <cdumez@apple.com>
1049
1050         Start exposing navigator.serviceWorker inside service workers
1051         https://bugs.webkit.org/show_bug.cgi?id=180087
1052
1053         Reviewed by Brady Eidson.
1054
1055         Start exposing navigator.serviceWorker inside service workers as per:
1056         - https://w3c.github.io/ServiceWorker/#navigator-serviceworker
1057
1058         Although the property is now exposed, the API on ServiceWorkerContainer is not
1059         supported yet inside service workers and the promise will be rejected. This will
1060         be implemented in a follow-up.
1061
1062         Test: http/tests/workers/service/WorkerNavigator_serviceWorker.html
1063
1064         * Sources.txt:
1065         * WebCore.xcodeproj/project.pbxproj:
1066         * bindings/js/JSWorkerNavigatorCustom.cpp: Added.
1067         (WebCore::JSWorkerNavigator::visitAdditionalChildren):
1068         * page/WorkerNavigator.idl:
1069         * workers/service/ServiceWorker.idl:
1070         * workers/service/ServiceWorkerContainer.cpp:
1071         (WebCore::ServiceWorkerContainer::controller const):
1072         (WebCore::ServiceWorkerContainer::addRegistration):
1073         (WebCore::ServiceWorkerContainer::getRegistration):
1074         (WebCore::ServiceWorkerContainer::getRegistrations):
1075         * workers/service/ServiceWorkerContainer.idl:
1076         * workers/service/ServiceWorkerRegistration.cpp:
1077         (WebCore::ServiceWorkerRegistration::update):
1078         (WebCore::ServiceWorkerRegistration::unregister):
1079         * workers/service/ServiceWorkerRegistration.idl:
1080
1081 2017-11-28  Simon Fraser  <simon.fraser@apple.com>
1082
1083         Modernize GraphicsLayer dumping
1084         https://bugs.webkit.org/show_bug.cgi?id=180067
1085
1086         Reviewed by Sam Weinig.
1087
1088         Use the indent stream manipulator, and TextStream's built-in indent amount
1089         for GraphicsLayer dumping.
1090
1091         * platform/graphics/GraphicsLayer.cpp:
1092         (WebCore::GraphicsLayer::dumpLayer const):
1093         (WebCore::dumpChildren):
1094         (WebCore::GraphicsLayer::dumpProperties const):
1095         (WebCore::GraphicsLayer::layerTreeAsText const):
1096         * platform/graphics/GraphicsLayer.h:
1097         (WebCore::GraphicsLayer::dumpAdditionalProperties const):
1098         * platform/graphics/ca/GraphicsLayerCA.cpp:
1099         (WebCore::dumpInnerLayer):
1100         (WebCore::GraphicsLayerCA::dumpAdditionalProperties const):
1101         * platform/graphics/ca/GraphicsLayerCA.h:
1102
1103 2017-11-28  Antoine Quint  <graouts@apple.com>
1104
1105         Remove dead debugging code in modern media controls
1106         https://bugs.webkit.org/show_bug.cgi?id=180079
1107
1108         Reviewed by Eric Carlson.
1109
1110         This debug utility is no longer necessary and is just dead code.
1111
1112         * Modules/modern-media-controls/controls/scheduler.js:
1113         (const.scheduler.new.prototype.scheduleLayout):
1114         (const.scheduler.new.prototype.unscheduleLayout):
1115         (const.scheduler.new.prototype._requestFrameIfNeeded):
1116         (const.scheduler.new.prototype._frameDidFire):
1117         (const.scheduler.new.prototype._layout):
1118
1119 2017-11-28  Antoine Quint  <graouts@apple.com>
1120
1121         Skip back and forward buttons should not hard-code their numeric amount in localised strings
1122         https://bugs.webkit.org/show_bug.cgi?id=180077
1123
1124         Reviewed by Eric Carlson.
1125
1126         Split out the numeric value used in the skip forward and skip back localized strings to make
1127         it easier to localized the numeric value itself.
1128
1129         Test: media/modern-media-controls/localized-strings/replaced-string.html
1130
1131         * English.lproj/modern-media-controls-localized-strings.js:
1132         * Modules/modern-media-controls/main.js:
1133         (UIString):
1134
1135 2017-11-28  Antoine Quint  <graouts@apple.com>
1136
1137         Pressing the space bar while watching a fullscreen video doesn't play or pause
1138         https://bugs.webkit.org/show_bug.cgi?id=180033
1139         <rdar://problem/33610443>
1140
1141         Reviewed by Eric Carlson.
1142
1143         We register a "keydown" event to track when the space bar is pressed, and if the media is playing
1144         in fullscreen, we toggle playback. This does not interfere with full keyboard access since activating
1145         one of the media controls using the keyboard will not let the events we register for be dispatched
1146         this far along the event dispatch phase.
1147
1148         Test: media/modern-media-controls/media-controller/media-controller-space-bar-toggle-playback.html
1149
1150         * Modules/modern-media-controls/media/media-controller.js:
1151         (MediaController):
1152         (MediaController.prototype.togglePlayback): Add a catch() statement since calling play() could sometime
1153         lead to some extraneous unhandled promise console logging that pollutes test output.
1154         (MediaController.prototype.handleEvent):
1155
1156 2017-11-27  Tim Horton  <timothy_horton@apple.com>
1157
1158         Web Content process crashes when dragging a link in recovery mode
1159         https://bugs.webkit.org/show_bug.cgi?id=180058
1160         <rdar://problem/35172170>
1161
1162         Reviewed by Alexey Proskuryakov.
1163
1164         * platform/mac/DragImageMac.mm:
1165         (WebCore::LinkImageLayout::LinkImageLayout):
1166         LinkPresentation isn't available in the base system. Make it optional,
1167         and fall back to the full URL like we do on platforms where it doesn't
1168         exist at all.
1169
1170 2017-11-27  Chris Dumez  <cdumez@apple.com>
1171
1172         Move callOnMainThreadAndWait() from SocketStreamHandleImplCFNet.cpp to MainThread.h
1173         https://bugs.webkit.org/show_bug.cgi?id=180060
1174
1175         Reviewed by Alex Christensen.
1176
1177         Move callOnMainThreadAndWait() from SocketStreamHandleImplCFNet.cpp to MainThread.h so that it can be reused.
1178
1179         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
1180         (WebCore::callOnMainThreadAndWait): Deleted.
1181
1182 2017-11-27  Matt Lewis  <jlewis3@apple.com>
1183
1184         Unreviewed, rolling out r225201.
1185
1186         This caused multiple tests to timeout consistently.
1187
1188         Reverted changeset:
1189
1190         "Pressing the space bar while watching a fullscreen video
1191         doesn't play or pause"
1192         https://bugs.webkit.org/show_bug.cgi?id=180033
1193         https://trac.webkit.org/changeset/225201
1194
1195 2017-11-27  Chris Dumez  <cdumez@apple.com>
1196
1197         NavigatorBase::serviceWorker() should return a reference instead of a raw pointer
1198         https://bugs.webkit.org/show_bug.cgi?id=180059
1199
1200         Reviewed by Geoffrey Garen.
1201
1202         NavigatorBase::serviceWorker() should return a reference instead of a raw pointer
1203         as it can never return null.
1204
1205         * bindings/js/JSNavigatorCustom.cpp:
1206         (WebCore::JSNavigator::visitAdditionalChildren):
1207         * dom/ScriptExecutionContext.cpp:
1208         (WebCore::ScriptExecutionContext::serviceWorkerContainer):
1209         * page/NavigatorBase.cpp:
1210         (WebCore::NavigatorBase::serviceWorker):
1211         * page/NavigatorBase.h:
1212
1213 2017-11-27  Antoine Quint  <graouts@apple.com>
1214
1215         Pressing the space bar while watching a fullscreen video doesn't play or pause
1216         https://bugs.webkit.org/show_bug.cgi?id=180033
1217         <rdar://problem/33610443>
1218
1219         Reviewed by Eric Carlson.
1220
1221         We register a "keydown" event to track when the space bar is pressed, and if the media is playing
1222         in fullscreen, we toggle playback. This does not interfere with full keyboard access since activating
1223         one of the media controls using the keyboard will not let the events we register for be dispatched
1224         this far along the event dispatch phase.
1225
1226         Test: media/modern-media-controls/media-controller/media-controller-space-bar-toggle-playback.html
1227
1228         * Modules/modern-media-controls/media/media-controller.js:
1229         (MediaController):
1230         (MediaController.prototype.togglePlayback): Add a catch() statement since calling play() could sometime
1231         lead to some extraneous unhandled promise console logging that pollutes test output.
1232         (MediaController.prototype.handleEvent):
1233
1234 2017-11-27  Matt Lewis  <jlewis3@apple.com>
1235
1236         Unreviewed, rolling out r225173.
1237
1238         This caused multiple tests to timeout consistently.
1239
1240         Reverted changeset:
1241
1242         "Pressing the space bar while watching a fullscreen video
1243         doesn't play or pause"
1244         https://bugs.webkit.org/show_bug.cgi?id=180033
1245         https://trac.webkit.org/changeset/225173
1246
1247 2017-11-27  Chris Dumez  <cdumez@apple.com>
1248
1249         ASSERTION FAILED: addResult.isNewEntry WebCore::SWServerRegistration::addClientUsingRegistration(WebCore::ServiceWorkerClientIdentifier const&) + 141
1250         https://bugs.webkit.org/show_bug.cgi?id=180049
1251
1252         Reviewed by Brady Eidson.
1253
1254         SWServer::serviceWorkerStoppedControllingClient() was failing to remove the client from the
1255         SWServerRegistration in some cases. This is because we relied on the Service Worker Identifier
1256         to get the SWServerRegistration, via the corresponding SWServerServiceWorker object. However,
1257         It is possible for the SWServerServiceWorker to have been destroyed already.
1258
1259         In serviceWorkerStartedControllingClient / serviceWorkerStoppedControllingClient, we now
1260         pass the registration identifier, so that we are able to look up the registration directly,
1261         without going through the service worker object.
1262
1263         No new tests, already covered by imported/w3c/web-platform-tests/service-workers/service-worker/claim-affect-other-registration.https.html.
1264
1265         * dom/ScriptExecutionContext.cpp:
1266         (WebCore::ScriptExecutionContext::setActiveServiceWorker):
1267         * workers/service/ServiceWorker.h:
1268         * workers/service/ServiceWorkerContainer.cpp:
1269         (WebCore::ServiceWorkerContainer::addRegistration):
1270         (WebCore::ServiceWorkerContainer::removeRegistration):
1271         * workers/service/ServiceWorkerData.cpp:
1272         (WebCore::ServiceWorkerData::isolatedCopy const):
1273         * workers/service/ServiceWorkerData.h:
1274         (WebCore::ServiceWorkerData::encode const):
1275         (WebCore::ServiceWorkerData::decode):
1276         * workers/service/server/SWClientConnection.h:
1277         * workers/service/server/SWServer.cpp:
1278         (WebCore::SWServer::addRegistration):
1279         (WebCore::SWServer::removeRegistration):
1280         (WebCore::SWServer::clearAll):
1281         (WebCore::SWServer::Connection::addServiceWorkerRegistrationInServer):
1282         (WebCore::SWServer::Connection::removeServiceWorkerRegistrationInServer):
1283         (WebCore::SWServer::Connection::serviceWorkerStartedControllingClient):
1284         (WebCore::SWServer::Connection::serviceWorkerStoppedControllingClient):
1285         (WebCore::SWServer::addClientServiceWorkerRegistration):
1286         (WebCore::SWServer::removeClientServiceWorkerRegistration):
1287         (WebCore::SWServer::serviceWorkerStartedControllingClient):
1288         (WebCore::SWServer::serviceWorkerStoppedControllingClient):
1289         (WebCore::SWServer::installContextData):
1290         * workers/service/server/SWServer.h:
1291         * workers/service/server/SWServerWorker.cpp:
1292         (WebCore::SWServerWorker::SWServerWorker):
1293         * workers/service/server/SWServerWorker.h:
1294
1295 2017-11-27  Tim Horton  <timothy_horton@apple.com>
1296
1297         REGRESSION (r225142): Crashes when command clicking or force touching links
1298         https://bugs.webkit.org/show_bug.cgi?id=180055
1299         <rdar://problem/35703910>
1300
1301         Reviewed by Wenson Hsieh.
1302
1303         No new tests; affects an existing API test.
1304
1305         * editing/mac/DictionaryLookup.mm:
1306         (WebCore::tokenRange):
1307         The 'options' out argument from tokenRangeForString is autoreleased.
1308
1309 2017-11-27  Dean Jackson  <dino@apple.com>
1310
1311         Implement OffscreenCanvas.getContext("webgl")
1312         https://bugs.webkit.org/show_bug.cgi?id=180050
1313         <rdar://problem/35705473>
1314
1315         Reviewed by Sam Weinig.
1316
1317         Implement enough of getContext("webgl") to actually return an
1318         active WebGLRenderingContext, even though it isn't actually
1319         hooked up to draw.
1320
1321         Introduce a new type, WebGLCanvas, which is a variant of HTMLCanvasElement
1322         and OffscreenCanvas, so that it can be exposed by the 'canvas' attribute
1323         on WebGLRenderingContext.
1324
1325         At the moment we still assume that all uses of WebGLRenderingContext come
1326         from HTMLCanvasElement, so add a bunch of logic to detect that case.
1327
1328         Updated the existing (proposed) WPT.
1329
1330         * html/OffscreenCanvas.cpp:
1331         (WebCore::OffscreenCanvas::getContext): Implement enough of getContext to
1332         return a WebGLRenderingContext.
1333         * html/OffscreenCanvas.h: Use the new OffscreenRenderingContext type, even
1334         though it's just a WebGLRenderingContext at the moment.
1335
1336         * html/canvas/WebGLRenderingContextBase.cpp:
1337         (WebCore::WebGLRenderingContextBase::canvas): Now returns a WebGLCanvas.
1338         (WebCore::WebGLRenderingContextBase::htmlCanvas): Helper to get the HTMLCanvasElement if it exists.
1339         (WebCore::WebGLRenderingContextBase::offscreenCanvas): Ditto for OffscreenCanvas.
1340         (WebCore::WebGLRenderingContextBase::checkForContextLossHandling): Guard for htmlCanvas().
1341         (WebCore::WebGLRenderingContextBase::registerWithWebGLStateTracker):
1342         (WebCore::WebGLRenderingContextBase::setupFlags):
1343         (WebCore::WebGLRenderingContextBase::addActivityStateChangeObserverIfNecessary):
1344         (WebCore::WebGLRenderingContextBase::removeActivityStateChangeObserver):
1345         (WebCore::WebGLRenderingContextBase::markContextChanged):
1346         (WebCore::WebGLRenderingContextBase::markContextChangedAndNotifyCanvasObserver):
1347         (WebCore::WebGLRenderingContextBase::paintRenderingResultsToCanvas):
1348         (WebCore::WebGLRenderingContextBase::reshape):
1349         (WebCore::WebGLRenderingContextBase::compileShader):
1350         (WebCore::WebGLRenderingContextBase::isContextLostOrPending):
1351         (WebCore::WebGLRenderingContextBase::readPixels):
1352         (WebCore::WebGLRenderingContextBase::loseContextImpl):
1353         (WebCore::WebGLRenderingContextBase::printToConsole):
1354         (WebCore::WebGLRenderingContextBase::dispatchContextLostEvent):
1355         (WebCore::WebGLRenderingContextBase::maybeRestoreContext):
1356         (WebCore::WebGLRenderingContextBase::dispatchContextChangedEvent):
1357         (WebCore::WebGLRenderingContextBase::clampedCanvasSize):
1358         * html/canvas/WebGLRenderingContextBase.h: Define WebGLCanvas.
1359         * html/canvas/WebGLRenderingContextBase.idl:
1360
1361         * inspector/InspectorInstrumentation.h: Handle the variant options, although leave OffscreenCanvas
1362         unimplemented for the moment.
1363         (WebCore::InspectorInstrumentation::didEnableExtension):
1364         (WebCore::InspectorInstrumentation::didCreateProgram):
1365         (WebCore::InspectorInstrumentation::willDeleteProgram):
1366         (WebCore::InspectorInstrumentation::isShaderProgramDisabled):
1367         * inspector/agents/InspectorCanvasAgent.cpp:
1368         (WebCore::InspectorCanvasAgent::didEnableExtension):
1369         (WebCore::InspectorCanvasAgent::didCreateProgram):
1370
1371 2017-11-27  Michael Catanzaro  <mcatanzaro@igalia.com>
1372
1373         Unreviewed, fix an improper #include
1374
1375         * platform/network/soup/NetworkStorageSessionSoup.cpp:
1376
1377 2017-11-27  Alex Christensen  <achristensen@webkit.org>
1378
1379         imported/w3c/web-platform-tests/url/failure.html crashes on debug builds
1380         https://bugs.webkit.org/show_bug.cgi?id=172337
1381
1382         Reviewed by Chris Dumez.
1383
1384         There were two problems:
1385         1. Invalid URLs can contain non-ASCII characters in its UTF8 representation.
1386         We should not put these URLs into content extension finite state machines.  They won't load anyways.
1387         2. If we don't have any content extensions installed, we still call String.utf8 unnecessarily.  Let's not.
1388
1389         * contentextensions/ContentExtensionsBackend.cpp:
1390         (WebCore::ContentExtensions::ContentExtensionsBackend::actionsForResourceLoad const):
1391
1392 2017-11-27  Simon Fraser  <simon.fraser@apple.com>
1393
1394         Use TextStream's indent tracking, rather than passing indent to all the externalRepresentation() functions
1395         https://bugs.webkit.org/show_bug.cgi?id=180027
1396
1397         Reviewed by Jon Lee.
1398
1399         Remove all the indent arguments, and make use of TextStream::IndentScope to control
1400         output indentation.
1401         
1402         Add an indent stream manipulator so you can say
1403           ts << indent << "text"
1404         to write the indent.
1405
1406         * platform/graphics/filters/FEBlend.cpp:
1407         (WebCore::FEBlend::externalRepresentation const):
1408         * platform/graphics/filters/FEBlend.h:
1409         * platform/graphics/filters/FEColorMatrix.cpp:
1410         (WebCore::FEColorMatrix::externalRepresentation const):
1411         * platform/graphics/filters/FEColorMatrix.h:
1412         * platform/graphics/filters/FEComponentTransfer.cpp:
1413         (WebCore::FEComponentTransfer::externalRepresentation const):
1414         * platform/graphics/filters/FEComponentTransfer.h:
1415         * platform/graphics/filters/FEComposite.cpp:
1416         (WebCore::FEComposite::externalRepresentation const):
1417         * platform/graphics/filters/FEComposite.h:
1418         * platform/graphics/filters/FEConvolveMatrix.cpp:
1419         (WebCore::FEConvolveMatrix::externalRepresentation const):
1420         * platform/graphics/filters/FEConvolveMatrix.h:
1421         * platform/graphics/filters/FEDiffuseLighting.cpp:
1422         (WebCore::FEDiffuseLighting::externalRepresentation const):
1423         * platform/graphics/filters/FEDiffuseLighting.h:
1424         * platform/graphics/filters/FEDisplacementMap.cpp:
1425         (WebCore::FEDisplacementMap::externalRepresentation const):
1426         * platform/graphics/filters/FEDisplacementMap.h:
1427         * platform/graphics/filters/FEDropShadow.cpp:
1428         (WebCore::FEDropShadow::externalRepresentation const):
1429         * platform/graphics/filters/FEDropShadow.h:
1430         * platform/graphics/filters/FEFlood.cpp:
1431         (WebCore::FEFlood::externalRepresentation const):
1432         * platform/graphics/filters/FEFlood.h:
1433         * platform/graphics/filters/FEGaussianBlur.cpp:
1434         (WebCore::FEGaussianBlur::externalRepresentation const):
1435         * platform/graphics/filters/FEGaussianBlur.h:
1436         * platform/graphics/filters/FEMerge.cpp:
1437         (WebCore::FEMerge::externalRepresentation const):
1438         * platform/graphics/filters/FEMerge.h:
1439         * platform/graphics/filters/FEMorphology.cpp:
1440         (WebCore::FEMorphology::externalRepresentation const):
1441         * platform/graphics/filters/FEMorphology.h:
1442         * platform/graphics/filters/FEOffset.cpp:
1443         (WebCore::FEOffset::externalRepresentation const):
1444         * platform/graphics/filters/FEOffset.h:
1445         * platform/graphics/filters/FESpecularLighting.cpp:
1446         (WebCore::FESpecularLighting::externalRepresentation const):
1447         * platform/graphics/filters/FESpecularLighting.h:
1448         * platform/graphics/filters/FETile.cpp:
1449         (WebCore::FETile::externalRepresentation const):
1450         * platform/graphics/filters/FETile.h:
1451         * platform/graphics/filters/FETurbulence.cpp:
1452         (WebCore::FETurbulence::externalRepresentation const):
1453         * platform/graphics/filters/FETurbulence.h:
1454         * platform/graphics/filters/FilterEffect.cpp:
1455         (WebCore::FilterEffect::externalRepresentation const):
1456         * platform/graphics/filters/FilterEffect.h:
1457         * platform/graphics/filters/SourceAlpha.cpp:
1458         (WebCore::SourceAlpha::externalRepresentation const):
1459         * platform/graphics/filters/SourceAlpha.h:
1460         * platform/graphics/filters/SourceGraphic.cpp:
1461         (WebCore::SourceGraphic::externalRepresentation const):
1462         * platform/graphics/filters/SourceGraphic.h:
1463         * rendering/RenderTreeAsText.cpp:
1464         (WebCore::write):
1465         (WebCore::writeLayer):
1466         (WebCore::writeLayerRenderers):
1467         (WebCore::writeLayers):
1468         (WebCore::externalRepresentation):
1469         * rendering/RenderTreeAsText.h:
1470         * rendering/svg/SVGRenderTreeAsText.cpp:
1471         (WebCore::writeSVGInlineTextBox):
1472         (WebCore::writeSVGInlineTextBoxes):
1473         (WebCore::writeStandardPrefix):
1474         (WebCore::writeChildren):
1475         (WebCore::writeSVGResourceContainer):
1476         (WebCore::writeSVGContainer):
1477         (WebCore::write):
1478         (WebCore::writeSVGText):
1479         (WebCore::writeSVGInlineText):
1480         (WebCore::writeSVGImage):
1481         (WebCore::writeSVGGradientStop):
1482         (WebCore::writeResources):
1483         * rendering/svg/SVGRenderTreeAsText.h:
1484         * svg/graphics/filters/SVGFEImage.cpp:
1485         (WebCore::FEImage::externalRepresentation const):
1486         * svg/graphics/filters/SVGFEImage.h:
1487
1488 2017-11-27  Chris Dumez  <cdumez@apple.com>
1489
1490         Give Document a strongly typed identifier instead of a uint64_t
1491         https://bugs.webkit.org/show_bug.cgi?id=180041
1492
1493         Reviewed by Youenn Fablet.
1494
1495         Give Document a strongly typed identifier instead of a uint64_t, for clarity.
1496
1497         * WebCore.xcodeproj/project.pbxproj:
1498         * dom/Document.cpp:
1499         (WebCore::m_identifier):
1500         * dom/Document.h:
1501         (WebCore::Document::identifier const):
1502         * dom/DocumentIdentifier.h: Copied from Source/WebCore/workers/service/ServiceWorkerClientIdentifier.h.
1503         * workers/service/ServiceWorkerClientIdentifier.h:
1504         (WebCore::ServiceWorkerClientIdentifier::toString const):
1505         (WebCore::ServiceWorkerClientIdentifier::encode const):
1506         (WebCore::ServiceWorkerClientIdentifier::decode):
1507         * workers/service/server/SWClientConnection.cpp:
1508         (WebCore::SWClientConnection::postMessageToServiceWorkerClient):
1509         (WebCore::SWClientConnection::notifyClientsOfControllerChange):
1510         * workers/service/server/SWClientConnection.h:
1511         * workers/service/server/SWServer.cpp:
1512         (WebCore::SWServer::Connection::serviceWorkerStartedControllingClient):
1513         (WebCore::SWServer::Connection::serviceWorkerStoppedControllingClient):
1514         (WebCore::SWServer::serviceWorkerStartedControllingClient):
1515         (WebCore::SWServer::serviceWorkerStoppedControllingClient):
1516         * workers/service/server/SWServer.h:
1517         * workers/service/server/SWServerRegistration.cpp:
1518         (WebCore::SWServerRegistration::addClientUsingRegistration):
1519         (WebCore::SWServerRegistration::removeClientUsingRegistration):
1520         * workers/service/server/SWServerRegistration.h:
1521
1522 2017-11-27  Simon Fraser  <simon.fraser@apple.com>
1523
1524         Optimize FEDisplacementMap
1525         https://bugs.webkit.org/show_bug.cgi?id=180023
1526
1527         Reviewed by Sam Weinig.
1528
1529         Make FEDisplacementMap about 3x faster by operating on whole pixels rather than
1530         individual channels. There's no per-channel logic once the srcX and srcY are computed.
1531         
1532         Other sundry cleanup.
1533
1534         * platform/graphics/ColorUtilities.h:
1535         (WebCore::byteOffsetOfPixel): Will use this in more places in future.
1536         * platform/graphics/filters/FEDisplacementMap.cpp:
1537         (WebCore::FEDisplacementMap::platformApplySoftware):
1538         * platform/graphics/filters/FEDisplacementMap.h:
1539         (WebCore::FEDisplacementMap::xChannelIndex const):
1540         (WebCore::FEDisplacementMap::yChannelIndex const):
1541
1542 2017-11-27  Tim Horton  <timothy_horton@apple.com>
1543
1544         One too many zeroes in macOS version number in FeatureDefines
1545         https://bugs.webkit.org/show_bug.cgi?id=180011
1546
1547         Reviewed by Dan Bernstein.
1548
1549         * Configurations/FeatureDefines.xcconfig:
1550
1551 2017-11-27  Zan Dobersek  <zdobersek@igalia.com>
1552
1553         [CoordGraphics] CoordinatedGraphicsLayer doesn't need to inherit from TextureMapperPlatformLayer::Client
1554         https://bugs.webkit.org/show_bug.cgi?id=180036
1555
1556         Reviewed by Carlos Garcia Campos.
1557
1558         There's no reason CoordinatedGraphicsLayer should inherit from
1559         TextureMapperPlatformLayer::Client. CoordinatedGraphicsLayer objects are
1560         not used anywhere through that type, and all the overridden methods are
1561         empty anyway. The TextureMapperPlatformLayer::Client class (along with
1562         TextureMapperPlatformLayer) is nowadays only used in the direct
1563         TextureMapper implementation of GraphicsLayer.
1564
1565         No new tests -- no change in behavior.
1566
1567         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
1568         (WebCore::CoordinatedGraphicsLayer::platformLayerWillBeDestroyed): Deleted.
1569         (WebCore::CoordinatedGraphicsLayer::setPlatformLayerNeedsDisplay): Deleted.
1570         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
1571
1572 2017-11-27  Antoine Quint  <graouts@apple.com>
1573
1574         Pressing the space bar while watching a fullscreen video doesn't play or pause
1575         https://bugs.webkit.org/show_bug.cgi?id=180033
1576         <rdar://problem/33610443>
1577
1578         Reviewed by Eric Carlson.
1579
1580         We register a "keydown" event to track when the space bar is pressed, and if the media is playing
1581         in fullscreen, we toggle playback. This does not interfere with full keyboard access since activating
1582         one of the media controls using the keyboard will not let the events we register for be dispatched
1583         this far along the event dispatch phase.
1584
1585         Test: media/modern-media-controls/media-controller/media-controller-space-bar-toggle-playback.html
1586
1587         * Modules/modern-media-controls/media/media-controller.js:
1588         (MediaController):
1589         (MediaController.prototype.togglePlayback): Add a catch() statement since calling play() could sometime
1590         lead to some extraneous unhandled promise console logging that pollutes test output.
1591         (MediaController.prototype.handleEvent):
1592
1593 2017-11-27  Simon Fraser  <simon.fraser@apple.com>
1594
1595         Optimize FEMorphology
1596         https://bugs.webkit.org/show_bug.cgi?id=180020
1597
1598         Reviewed by Sam Weinig.
1599
1600         Use const PaintingData&.
1601         Compute all components at once.
1602         Avoid Vector<> capacity changes during the pixel loop.
1603         Tweak the parallel jobs scaling.
1604         Templatize the the inner loop functions that compute min or max based
1605         on the filter type to avoid conditionals in tight loops.
1606         
1607         This is about a 4x speedup before the parallel jobs tweaking. With fixed parallelism,
1608         a 200x200 filter went from 15ms to about 1ms with these changes.
1609
1610         * platform/graphics/ColorUtilities.h:
1611         (WebCore::ColorComponents::fromRGBA):
1612         (WebCore::ColorComponents::toRGBA const):
1613         (WebCore::perComponentMax):
1614         (WebCore::perComponentMin):
1615         * platform/graphics/filters/FEColorMatrix.cpp:
1616         (WebCore::FEColorMatrix::platformApplySoftware): Remove some old perf logging code.
1617         TimingScope now does something similar.
1618         * platform/graphics/filters/FEMorphology.cpp:
1619         (WebCore::pixelArrayIndex):
1620         (WebCore::minOrMax):
1621         (WebCore::columnExtremum):
1622         (WebCore::kernelExtremum):
1623         (WebCore::FEMorphology::platformApplyGeneric):
1624         (WebCore::FEMorphology::platformApplyWorker):
1625         (WebCore::FEMorphology::platformApply):
1626         (WebCore::FEMorphology::platformApplySoftware):
1627         (WebCore::shouldSupersedeExtremum): Deleted.
1628         * platform/graphics/filters/FEMorphology.h:
1629
1630 2017-11-27  Yacine Bandou  <yacine.bandou_ext@softathome.com>
1631
1632         [EME][GStreamer] Change the ClearKey's SystemID value
1633         https://bugs.webkit.org/show_bug.cgi?id=180007
1634
1635         Reviewed by Xabier Rodriguez-Calvar.
1636
1637         Use 1077efec-c0b2-4d02-ace3-3c1e52e2fb4b instead of
1638         58147ec8-0423-4659-92e6-f52c5ce8c3cc, as is specified in W3C.
1639         https://www.w3.org/TR/eme-initdata-cenc/#common-system-definition
1640
1641         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h:
1642
1643 2017-11-27  Javier Fernandez  <jfernandez@igalia.com>
1644
1645         [css-grid] Display issues with child with max-width
1646         https://bugs.webkit.org/show_bug.cgi?id=178973
1647
1648         Reviewed by Darin Adler.
1649
1650         We have an utility function to compute the grid item's margins
1651         when the item still needs to layout. We used the function
1652         RenderStyle::hasMarings to decide whether such margin computation
1653         worths. However, we need that function to operate on a specific
1654         axis, hence I added a new function adding such logic.
1655
1656         Additionally, we must treat any 'auto' margin as 0px during the
1657         tracks sizing algorithm, as the CSS Grid spec states:
1658
1659           - https://drafts.csswg.org/css-grid/#auto-margins
1660
1661         Test: fast/css-grid-layout/auto-margins-ignored-during-track-sizing.html
1662
1663         * rendering/GridLayoutFunctions.cpp:
1664         (WebCore::GridLayoutFunctions::childHasMargin): New funciton with axis dependent logic.
1665         (WebCore::GridLayoutFunctions::computeMarginLogicalSizeForChild): Ignore auto margins.
1666         (WebCore::GridLayoutFunctions::marginLogicalSizeForChild): Ignore auto margins.
1667
1668 2017-11-26  Simon Fraser  <simon.fraser@apple.com>
1669
1670         feImage as filter input has skewed colors
1671         https://bugs.webkit.org/show_bug.cgi?id=180021
1672
1673         Reviewed by Sam Weinig.
1674         
1675         Using an <feImage> as a filter input sometimes results in incorrect colors, because
1676         the image is being sourced as linearRGB when it should always be sRGB.
1677         
1678         Fix by setting the result colorspace in FEImage before we allocate the output
1679         buffer.
1680
1681         Tests: svg/filters/feImage-color-fidelity-expected.svg
1682                svg/filters/feImage-color-fidelity.svg
1683
1684         * svg/graphics/filters/SVGFEImage.cpp:
1685         (WebCore::FEImage::platformApplySoftware):
1686
1687 2017-11-26  Minsheng Liu  <lambda@liu.ms>
1688
1689         Cleanup code for RenderMathMLUnderOver::layoutBlock
1690         https://bugs.webkit.org/show_bug.cgi?id=179681
1691
1692         Reviewed by Frédéric Wang.
1693
1694         The patch removes some unnecessary calls to layoutIfNeeds() and guards the change
1695         with assertion. Since there is no behavior change, no new tests are required.
1696
1697         * rendering/mathml/RenderMathMLUnderOver.cpp:
1698         (WebCore::RenderMathMLUnderOver::stretchHorizontalOperatorsAndLayoutChildren):
1699         (WebCore::RenderMathMLUnderOver::layoutBlock):
1700         (WebCore::RenderMathMLUnderOver::computeOperatorsHorizontalStretch): Deleted.
1701         * rendering/mathml/RenderMathMLUnderOver.h:
1702
1703 2017-11-26  Simon Fraser  <simon.fraser@apple.com>
1704
1705         Use more Uint8ClampedArray& and constness in filter and image buffer code
1706         https://bugs.webkit.org/show_bug.cgi?id=180008
1707
1708         Reviewed by Darin Adler.
1709
1710         Use references to Uint8ClampedArrays rather than pointers where necessary.
1711         
1712         Use const for source data buffers when possible, and uint8_t for the underlying
1713         data type.
1714         
1715         Fix a bug in FEGaussianBlur where the output of the last blur pass wasn't
1716         copied to the result buffer, which required a test adjustment.
1717
1718         * html/canvas/CanvasRenderingContext2D.cpp:
1719         (WebCore::CanvasRenderingContext2D::putImageData):
1720         * platform/graphics/ImageBuffer.cpp:
1721         (WebCore::ImageBuffer::genericConvertToLuminanceMask):
1722         * platform/graphics/ImageBuffer.h:
1723         * platform/graphics/ShadowBlur.cpp:
1724         (WebCore::ShadowBlur::blurShadowBuffer):
1725         * platform/graphics/cairo/ImageBufferCairo.cpp:
1726         (WebCore::ImageBuffer::putByteArray):
1727         * platform/graphics/cg/ImageBufferCG.cpp:
1728         (WebCore::ImageBuffer::putByteArray):
1729         * platform/graphics/cg/ImageBufferDataCG.cpp:
1730         (WebCore::ImageBufferData::getData const):
1731         (WebCore::ImageBufferData::putData):
1732         * platform/graphics/cg/ImageBufferDataCG.h:
1733         * platform/graphics/cpu/arm/filters/FEBlendNEON.h:
1734         (WebCore::FEBlend::platformApplySoftware):
1735         * platform/graphics/cpu/arm/filters/FECompositeArithmeticNEON.h:
1736         (WebCore::FEComposite::computeArithmeticPixelsNeon):
1737         (WebCore::FEComposite::platformArithmeticNeon):
1738         * platform/graphics/cpu/arm/filters/FEGaussianBlurNEON.h:
1739         (WebCore::boxBlurNEON):
1740         * platform/graphics/cpu/arm/filters/NEONHelpers.h:
1741         (WebCore::loadRGBA8AsFloat):
1742         * platform/graphics/filters/FEColorMatrix.cpp:
1743         (WebCore::effectApplyAccelerated):
1744         (WebCore::effectType):
1745         (WebCore::FEColorMatrix::platformApplySoftware):
1746         * platform/graphics/filters/FEComponentTransfer.cpp:
1747         (WebCore::FEComponentTransfer::platformApplySoftware):
1748         * platform/graphics/filters/FEComposite.cpp:
1749         (WebCore::computeArithmeticPixels):
1750         (WebCore::FEComposite::platformArithmeticSoftware):
1751         (WebCore::FEComposite::platformApplySoftware):
1752         * platform/graphics/filters/FEComposite.h:
1753         * platform/graphics/filters/FEConvolveMatrix.cpp:
1754         (WebCore::setDestinationPixels):
1755         (WebCore::FEConvolveMatrix::fastSetInteriorPixels):
1756         (WebCore::FEConvolveMatrix::fastSetOuterPixels):
1757         (WebCore::FEConvolveMatrix::platformApplySoftware):
1758         * platform/graphics/filters/FEConvolveMatrix.h:
1759         * platform/graphics/filters/FEDisplacementMap.cpp:
1760         (WebCore::FEDisplacementMap::platformApplySoftware):
1761         * platform/graphics/filters/FEDropShadow.cpp:
1762         (WebCore::FEDropShadow::platformApplySoftware):
1763         * platform/graphics/filters/FEGaussianBlur.cpp:
1764         (WebCore::boxBlurAlphaOnly):
1765         (WebCore::boxBlur):
1766         (WebCore::accelerateBoxBlur):
1767         (WebCore::standardBoxBlur):
1768         (WebCore::FEGaussianBlur::platformApplyGeneric):
1769         (WebCore::FEGaussianBlur::platformApplyWorker):
1770         (WebCore::FEGaussianBlur::platformApply):
1771         (WebCore::FEGaussianBlur::platformApplySoftware):
1772         * platform/graphics/filters/FEGaussianBlur.h:
1773         * platform/graphics/filters/FELighting.cpp:
1774         (WebCore::FELighting::drawLighting):
1775         (WebCore::FELighting::platformApplySoftware):
1776         * platform/graphics/filters/FELighting.h:
1777         * platform/graphics/filters/FEMorphology.cpp:
1778         (WebCore::columnExtremum):
1779         (WebCore::FEMorphology::platformApplyGeneric):
1780         (WebCore::FEMorphology::platformApplyDegenerate):
1781         (WebCore::FEMorphology::platformApplySoftware):
1782         * platform/graphics/filters/FEMorphology.h:
1783         * platform/graphics/filters/FETurbulence.cpp:
1784         (WebCore::FETurbulence::fillRegion const):
1785         (WebCore::FETurbulence::fillRegionWorker):
1786         (WebCore::FETurbulence::platformApplySoftware):
1787         * platform/graphics/filters/FETurbulence.h:
1788         * platform/graphics/filters/FilterEffect.cpp:
1789         (WebCore::FilterEffect::forceValidPreMultipliedPixels):
1790         (WebCore::FilterEffect::imageBufferResult):
1791         (WebCore::FilterEffect::unmultipliedResult):
1792         (WebCore::FilterEffect::premultipliedResult):
1793         (WebCore::FilterEffect::copyImageBytes const):
1794         (WebCore::copyPremultiplyingAlpha):
1795         (WebCore::copyUnpremultiplyingAlpha):
1796         (WebCore::FilterEffect::copyUnmultipliedResult):
1797         (WebCore::FilterEffect::copyPremultipliedResult):
1798         * platform/graphics/filters/FilterEffect.h:
1799         * platform/graphics/win/ImageBufferDataDirect2D.cpp:
1800         (WebCore::ImageBufferData::putData):
1801         * platform/graphics/win/ImageBufferDataDirect2D.h:
1802
1803 2017-11-25  Zalan Bujtas  <zalan@apple.com>
1804
1805         Make RenderSnapshottedPlugIn ISO allocated
1806         https://bugs.webkit.org/show_bug.cgi?id=180010
1807         <rdar://problem/35671977>
1808
1809         Reviewed by David Kilzer.
1810
1811         RenderEmbeddedObject, the base class is ISO allocated since r224537. 
1812
1813         * rendering/RenderSnapshottedPlugIn.cpp:
1814         * rendering/RenderSnapshottedPlugIn.h:
1815
1816 2016-08-05  Darin Adler  <darin@apple.com>
1817
1818         Fix some minor problems in the StringImpl header
1819         https://bugs.webkit.org/show_bug.cgi?id=160630
1820
1821         Reviewed by Brent Fulgham.
1822
1823         * html/HTMLOptionElement.cpp:
1824         (WebCore::HTMLOptionElement::text): Use stripLeadingAndTrailingHTMLSpaces
1825         instead of stripWhiteSpace(isHTMLSpace).
1826         (WebCore::HTMLOptionElement::value): Ditto.
1827         (WebCore::HTMLOptionElement::label): Ditto.
1828         (WebCore::HTMLOptionElement::displayLabel): Ditto.
1829         * loader/FrameLoader.cpp:
1830         (WebCore::FrameLoader::didBeginDocument): Use stripLeadingAndTrailingHTMLSpaces
1831         instead of calling the general purpose one and passing isHTMLSpace.
1832         * platform/network/HTTPParsers.h:
1833         (WebCore::stripLeadingAndTrailingHTTPSpaces): Updated to use the
1834         new name, stripLeadingAndTrailingCharacters.
1835
1836 2017-11-23  Darin Adler  <darin@apple.com>
1837
1838         Fix dictionary leak in lookup, convert FindOptions to OptionSet, tweak code style nearby
1839         https://bugs.webkit.org/show_bug.cgi?id=179981
1840
1841         Reviewed by Sam Weinig.
1842
1843         * accessibility/AXObjectCache.cpp:
1844         (WebCore::AXObjectCache::rangeMatchesTextNearRange): Pass { } instead of 0.
1845         * accessibility/AccessibilityObject.cpp:
1846         (WebCore::AccessibilityObject::rangeOfStringClosestToRangeInDirection const): Use { }
1847         instead of | to construct value.
1848         * editing/Editor.cpp:
1849         (WebCore::Editor::findString): Use contains instead of & to test an option.
1850         (WebCore::Editor::rangeOfString): Ditto.
1851         (WebCore::Editor::countMatchesForText): Ditto.
1852         * editing/EditorCommand.cpp:
1853         (WebCore::executeFindString): Use { } instead of | to construct value.
1854         * editing/FindOptions.h: Use OptionSet for type.
1855         * editing/TextIterator.cpp:
1856         (WebCore::SearchBuffer::SearchBuffer): Use contains instead of &. Also use -= instead
1857         of &= coupled with ~ to remove a flag.
1858         (WebCore::SearchBuffer::isWordEndMatch const): Ditto.
1859         (WebCore::SearchBuffer::isWordStartMatch const): Ditto.
1860         (WebCore::SearchBuffer::search): Ditto.
1861         (WebCore::findIteratorOptions): Ditto.
1862         (WebCore::findClosestPlainText): Ditto.
1863         (WebCore::findPlainText): Ditto.
1864
1865         * editing/mac/DictionaryLookup.h: Changed optional dictionary out arguments to
1866         RetainPtr<NSDictionary>. Before, they were returning a retained object, but callers
1867         did not seem to realize that.
1868         * editing/mac/DictionaryLookup.mm:
1869         (WebCore::tokenRange): Added helper. Takes care of doing adoptNS on the options
1870         dictionary, and also handles the Objective-C exception possibility cleanly. Also
1871         fixed the exception case to return NSNotFound instead of a zero-length range at
1872         the location we are searching, which is what the code expects.
1873         (WebCore::DictionaryLookup::rangeForSelection): Refactored to use the tokenRange
1874         helper function, and also to do much less work when the options pointer is null.
1875         (WebCore::DictionaryLookup::rangeAtHitTestResult): Use the tokenRange helper
1876         function and also use auto a bunch to tighten up the code a bit.
1877         (WebCore::DictionaryLookup::stringForPDFSelection): Ditto.
1878
1879         * page/DOMWindow.cpp:
1880         (WebCore::DOMWindow::find const): Use |= instead of | to build find options.
1881         * page/Page.cpp:
1882         (WebCore::Page::findString): Use contains instead of & and also - instead of
1883         & combined with ~.
1884         (WebCore::Page::findStringMatchingRanges): Ditto.
1885         (WebCore::Page::rangeOfString): Ditto.
1886
1887         * page/mac/EventHandlerMac.mm:
1888         (WebCore::EventHandler::selectClosestWordFromHitTestResultBasedOnLookup):
1889         Pass nullptr to indicate we don't need the options dictionary. The code before
1890         was passing a pointer to a null, which meant we would do the work to get the
1891         options dictionary, not use it, and also leak it.
1892
1893         * testing/Internals.cpp:
1894         (WebCore::Internals::rangeOfStringNearLocation): Pass { } instead of 0.
1895         (WebCore::Internals::rangeForDictionaryLookupAtLocation): Pass nullptr to
1896         indicate we don't need the options dictionary as above.
1897         (WebCore::parseFindOptions): Initialize options without an explicit 0, since
1898         an OptionSet starts out empty rather than uninitialized.
1899
1900 2017-11-24  Antti Koivisto  <antti@apple.com>
1901
1902         Style resolution spin due to calc() values always comparing inequal (seen on arstechnica.com)
1903         https://bugs.webkit.org/show_bug.cgi?id=179982
1904         <rdar://problem/35677991>
1905
1906         Reviewed by Darin Adler.
1907
1908         Test: transitions/transition-with-calc-spin.html
1909
1910         Something like calc(100% - 10px) would compare inequal to itself. This causes the implicit animation engine think that
1911         there is a new target value after style resolution and restart the transition. Starting the transition triggers another style
1912         resolution on zero duration timer and so on.
1913
1914         * platform/CalculationValue.cpp:
1915         (WebCore::operator==):
1916         * platform/CalculationValue.h:
1917
1918         Deep compare the child vectors.
1919
1920 2017-11-24  Antoine Quint  <graouts@apple.com>
1921
1922         Captions move when <video> with no controls is hovered
1923         https://bugs.webkit.org/show_bug.cgi?id=178600
1924         <rdar://problem/35112309>
1925
1926         Reviewed by Jer Noble.
1927
1928         We should only reduce the text tracks container height to make room for the controls
1929         bar when controls are enabled.
1930
1931         Tests: media/modern-media-controls/text-tracks/text-tracks-height-no-controls.html
1932                media/modern-media-controls/text-tracks/text-tracks-height-with-controls.html
1933
1934         * Modules/modern-media-controls/controls/text-tracks.css:
1935         (video[controls]::-webkit-media-text-track-container.visible-controls-bar):
1936         (video::-webkit-media-text-track-container.visible-controls-bar): Deleted.
1937
1938 2017-11-23  Simon Fraser  <simon.fraser@apple.com>
1939
1940         Some FilterEffect cleanup and logging
1941         https://bugs.webkit.org/show_bug.cgi?id=179932
1942
1943         Reviewed by Darin Adler.
1944         
1945         Rename the FilterEffect functions that get the result of the filter
1946         to have "result" in the name.
1947         
1948         Re-order FilterEffect member variables and use initializers. webkit.org/b/45614
1949         is closed so remove the comment about things moving to RenderSVGResourceFilterPrimitive.
1950         
1951         Add a virtual filterName() function for use by logging.
1952         
1953         Add a Filters log channel. Log some stuff.
1954         
1955         Rename RenderSVGResourceFilter::m_filter to m_rendererFilterDataMap.
1956
1957         * platform/Logging.h:
1958         * platform/graphics/cpu/arm/filters/FEBlendNEON.h:
1959         (WebCore::FEBlend::platformApplySoftware):
1960         * platform/graphics/filters/FEBlend.cpp:
1961         (WebCore::FEBlend::platformApplySoftware):
1962         * platform/graphics/filters/FEBlend.h:
1963         * platform/graphics/filters/FEColorMatrix.cpp:
1964         (WebCore::FEColorMatrix::platformApplySoftware):
1965         * platform/graphics/filters/FEColorMatrix.h:
1966         * platform/graphics/filters/FEComponentTransfer.cpp:
1967         (WebCore::FEComponentTransfer::platformApplySoftware):
1968         * platform/graphics/filters/FEComponentTransfer.h:
1969         * platform/graphics/filters/FEComposite.cpp:
1970         (WebCore::FEComposite::platformApplySoftware):
1971         * platform/graphics/filters/FEComposite.h:
1972         * platform/graphics/filters/FEConvolveMatrix.cpp:
1973         (WebCore::FEConvolveMatrix::platformApplySoftware):
1974         * platform/graphics/filters/FEConvolveMatrix.h:
1975         * platform/graphics/filters/FEDisplacementMap.cpp:
1976         (WebCore::FEDisplacementMap::platformApplySoftware):
1977         * platform/graphics/filters/FEDisplacementMap.h:
1978         * platform/graphics/filters/FEDropShadow.cpp:
1979         (WebCore::FEDropShadow::platformApplySoftware):
1980         * platform/graphics/filters/FEDropShadow.h:
1981         * platform/graphics/filters/FEFlood.h:
1982         * platform/graphics/filters/FEGaussianBlur.cpp:
1983         (WebCore::FEGaussianBlur::platformApplySoftware):
1984         * platform/graphics/filters/FEGaussianBlur.h:
1985         * platform/graphics/filters/FELighting.cpp:
1986         (WebCore::FELighting::platformApplySoftware):
1987         * platform/graphics/filters/FELighting.h:
1988         * platform/graphics/filters/FEMerge.cpp:
1989         (WebCore::FEMerge::platformApplySoftware):
1990         * platform/graphics/filters/FEMerge.h:
1991         * platform/graphics/filters/FEMorphology.cpp:
1992         (WebCore::FEMorphology::platformApplyDegenerate):
1993         (WebCore::FEMorphology::platformApplySoftware):
1994         * platform/graphics/filters/FEMorphology.h:
1995         * platform/graphics/filters/FEOffset.cpp:
1996         (WebCore::FEOffset::platformApplySoftware):
1997         * platform/graphics/filters/FEOffset.h:
1998         * platform/graphics/filters/FETile.cpp:
1999         (WebCore::FETile::platformApplySoftware):
2000         * platform/graphics/filters/FETile.h:
2001         * platform/graphics/filters/FETurbulence.cpp:
2002         (WebCore::operator<<):
2003         * platform/graphics/filters/FETurbulence.h:
2004         * platform/graphics/filters/FilterEffect.cpp:
2005         (WebCore::FilterEffect::FilterEffect):
2006         (WebCore::FilterEffect::imageBufferResult):
2007         (WebCore::FilterEffect::unmultipliedResult):
2008         (WebCore::FilterEffect::premultipliedResult):
2009         (WebCore::FilterEffect::copyImageBytes const): This can be const. It'a also crazy
2010         to mark a large, slow function like this as 'inline'.
2011         (WebCore::FilterEffect::copyUnmultipliedResult):
2012         (WebCore::FilterEffect::copyPremultipliedResult):
2013         (WebCore::FilterEffect::createImageBufferResult):
2014         (WebCore::FilterEffect::createUnmultipliedImageResult):
2015         (WebCore::FilterEffect::createPremultipliedImageResult):
2016         (WebCore::FilterEffect::transformResultColorSpace):
2017         (WebCore::FilterEffect::asImageBuffer): Deleted.
2018         (WebCore::FilterEffect::asUnmultipliedImage): Deleted.
2019         (WebCore::FilterEffect::asPremultipliedImage): Deleted.
2020         (WebCore::FilterEffect::copyImageBytes): Deleted.
2021         (WebCore::FilterEffect::copyUnmultipliedImage): Deleted.
2022         (WebCore::FilterEffect::copyPremultipliedImage): Deleted.
2023         * platform/graphics/filters/FilterEffect.h:
2024         * platform/graphics/filters/SourceAlpha.cpp:
2025         (WebCore::SourceAlpha::platformApplySoftware):
2026         * platform/graphics/filters/SourceAlpha.h:
2027         * platform/graphics/filters/SourceGraphic.h:
2028         * rendering/FilterEffectRenderer.cpp:
2029         (WebCore::FilterEffectRenderer::output const):
2030         * rendering/svg/RenderSVGResourceFilter.cpp:
2031         (WebCore::RenderSVGResourceFilter::removeAllClientsFromCache):
2032         (WebCore::RenderSVGResourceFilter::removeClientFromCache):
2033         (WebCore::RenderSVGResourceFilter::applyResource):
2034         (WebCore::RenderSVGResourceFilter::postApplyResource):
2035         (WebCore::RenderSVGResourceFilter::primitiveAttributeChanged):
2036         (WebCore::RenderSVGResourceFilter::drawingRegion const):
2037         (WebCore::operator<<):
2038         * rendering/svg/RenderSVGResourceFilter.h:
2039         (WebCore::FilterData::FilterData): Deleted.
2040         * svg/graphics/filters/SVGFEImage.h:
2041
2042 2017-11-24  Antoine Quint  <graouts@apple.com>
2043
2044         [Web Animations] Allow getComputedStyle() to return animated values for accelerated animations
2045         https://bugs.webkit.org/show_bug.cgi?id=179975
2046         <rdar://problem/35676811>
2047
2048         Reviewed by Dean Jackson.
2049
2050         In case we're running an accelerated animation, we are not blending RenderStyles as the animation
2051         progresses and thus we need to hook into computeRenderStyleForProperty() to query the DocumentTimeline
2052         for the animated style of running accelerated animations where we blend styles manually for the
2053         animation's current time.
2054
2055         Test: http/wpt/wk-web-animations/interfaces/keyframe-effect-getComputedStyle.html
2056
2057         * animation/DocumentTimeline.cpp:
2058         (WebCore::DocumentTimeline::animatedStyleForRenderer): Iterate through all running accelerated animations
2059         for the element to which the provided renderer is attached and ask for their animated styles.
2060         * animation/DocumentTimeline.h:
2061         * animation/KeyframeEffect.cpp:
2062         (WebCore::KeyframeEffect::getAnimatedStyle): Manually blend all animated properties and populate the provided
2063         RenderStyle with their values, creating the RenderStyle if needed.
2064         * animation/KeyframeEffect.h:
2065         * css/CSSComputedStyleDeclaration.cpp:
2066         (WebCore::computeRenderStyleForProperty): Query the DocumentTimeline for accelerated animated properties in
2067         case such animations are running, otherwise let the CSS animation controller report the animated values.
2068
2069 2017-11-24  Zan Dobersek  <zdobersek@igalia.com>
2070
2071         [CoordGraphics] CoordinatedGraphicsLayer::updateContentBuffers() should always assume a non-null CoordinatedBuffer
2072         https://bugs.webkit.org/show_bug.cgi?id=179977
2073
2074         Reviewed by Carlos Garcia Campos.
2075
2076         CoordinatedGraphicsLayer::updateContentBuffers() retrieves a RefPtr<CoordinatedBuffer>
2077         from the CompositingCoordinator. This pointer should never be null since if no
2078         existing UpdateAtlas can provide the necessary memory area, a fresh UpdateAtlas is
2079         created and its buffer returned. This can't fail in theory since the tiles that are
2080         being updated are smaller than the UpdateAtlas area.
2081
2082         The CoordinatedGraphicsLayerClient::getCoordinatedBuffer() method is updated to
2083         always return a Ref<CoordinatedBuffer> value. Code in updateContentBuffers() is
2084         updated to remove a null-check on what is now the Ref<CoordinatedBuffer> value.
2085
2086         No new tests -- no change in functionality.
2087
2088         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
2089         (WebCore::CoordinatedGraphicsLayer::updateContentBuffers):
2090         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
2091
2092 2017-11-23  Antoine Quint  <graouts@apple.com>
2093
2094         [Web Animations] Perform accelerated animations when possible
2095         https://bugs.webkit.org/show_bug.cgi?id=179973
2096         <rdar://problem/34953922>
2097
2098         Reviewed by Dean Jackson.
2099
2100         When we're entering and leaving the active duration of an animation effect, we now check
2101         whether the animation can be accelerated, using the existing CSSPropertyAnimation::animationOfPropertyIsAccelerated()
2102         utility, and start and stop animations using the startAnimation() and animationFinished() functions on RenderBoxModelObject.
2103
2104         This patch is only a first step towards full support for accelerated animations,
2105         there are two known issues at the moment. Because we're not blending the styles to perform
2106         the animation, getComputedStyle() will not return the animated value (webkit.org/b/179974).
2107         Additionally, if other animations happen to run later during the active state of an animation
2108         that can run accelerated, we will not fall back to software-only animation for this
2109         element and these animations will appear not to run (webkit.org/b/179975). These will be
2110         addressed in follow-up patches.
2111
2112         Tests: webanimations/left-and-opacity-animation-yields-no-compositing.html
2113                webanimations/opacity-animation-no-longer-composited-upon-completion.html
2114                webanimations/opacity-animation-yields-compositing.html
2115                webanimations/width-and-opacity-separate-animation-yields-no-compositing.html
2116
2117         * animation/DocumentTimeline.cpp:
2118         (WebCore::DocumentTimeline::updateAnimations): Check in the map of pending accelerated animations
2119         to see if any animation requires toggling their active state after their styles have been invalidated.
2120         (WebCore::DocumentTimeline::animationAcceleratedRunningStateDidChange): New function to
2121         let animations indicate that they need to have their accelerated backing animation toggled after
2122         style invalidation has been completed.
2123         (WebCore::DocumentTimeline::runningAnimationsForElementAreAllAccelerated): This function is used
2124         in RenderLayerCompositor::requiresCompositingForAnimation() to identify whether an element requires
2125         hardware compositing due to running accelerated animations. We check all running animations for the
2126         provided element to see if they can all be running accelerated and return true in this situation only.
2127         * animation/DocumentTimeline.h:
2128         * animation/KeyframeEffect.cpp:
2129         (WebCore::KeyframeEffect::applyAtLocalTime): Identify if we're crossing into or out of the active state
2130         for an animation and check if it will be or has been running accelerated such that we can notify the
2131         DocumentTimeline, through the associated animation, that the accelerated backing animation will need to
2132         be toggled after style invalidation has been completed.
2133         (WebCore::KeyframeEffect::shouldRunAccelerated): Check that all properties for this animation
2134         effect can be accelerated according to CSSPropertyAnimation::animationOfPropertyIsAccelerated().
2135         (WebCore::KeyframeEffect::startOrStopAccelerated): Start or stop the associated accelerated
2136         animation through the associated element's RenderBoxModelObject renderer.
2137         * animation/KeyframeEffect.h:
2138         * animation/WebAnimation.cpp:
2139         (WebCore::WebAnimation::acceleratedRunningStateDidChange): Called from AnimationEffect::applyAtLocalTime(),
2140         we forward to the DocumentTimeline the information that the animation will cross an active state boundary while
2141         allowing to be backed by hardware compositing.
2142         (WebCore::WebAnimation::startOrStopAccelerated): Forward to the associated KeyframeEffect that accelerated
2143         animation backing should be toggled.
2144         * animation/WebAnimation.h:
2145         * rendering/RenderLayerCompositor.cpp:
2146         (WebCore::RenderLayerCompositor::requiresCompositingForAnimation const): Check via the renderer's element's
2147         DocumentTimeline that all running animations for this particular element are accelerated to ensure that
2148         the element will be hardware-composited.
2149
2150 2017-11-23  Fujii Hironori  <Hironori.Fujii@sony.com>
2151
2152         [Win] PasteboardWin.cpp(653): error C2039: 'containsOnlyASCII': is not a member of 'WTF::String'
2153         https://bugs.webkit.org/show_bug.cgi?id=179991
2154
2155         Unreviewed build fix.
2156
2157         No new tests (No behaviour change).
2158
2159         * platform/win/PasteboardWin.cpp:
2160         (WebCore::Pasteboard::writeURLToDataObject): Renamed containsOnlyASCII() to isAllASCII().
2161
2162 2017-11-23  Carlos Alberto Lopez Perez  <clopez@igalia.com>
2163
2164         [GTK] [Debug] Fix build after r225117.
2165         https://bugs.webkit.org/show_bug.cgi?id=179907
2166
2167         Unreviewed build fix.
2168
2169         r225117 renamed containsOnlyASCII() to isAllASCII().
2170         And this reference was not updated for the GTK Debug build.
2171
2172         No new tests, its a build fix.
2173
2174         * loader/archive/mhtml/MHTMLArchive.cpp:
2175         (WebCore::MHTMLArchive::generateMHTMLData):
2176
2177 2017-11-23  Simon Fraser  <simon.fraser@apple.com>
2178
2179         FELighting cleanup and optimization
2180         https://bugs.webkit.org/show_bug.cgi?id=179933
2181
2182         Reviewed by Darin Adler.
2183
2184         Make FELighting about 25% faster by maintaining an "alpha" window of the alpha
2185         values of the 9 pixels surrounding the current pixel, and sliding this window over
2186         when moving to the next pixel. This avoids reading the same alpha values from the original
2187         buffer multiple times.
2188
2189         Clean up LightSource and subclasses, adding SPECIALIZE_TYPE_TRAITS macros,
2190         and turning updatePaintingData() into a function with no side effects that returns
2191         the required data.
2192
2193         Remove explicit 'inline' keywords, allowing the compiler to make inlining decisions.
2194
2195         * platform/graphics/cpu/arm/filters/FELightingNEON.h:
2196         (WebCore::FELighting::platformApplyNeon):
2197         * platform/graphics/filters/DistantLightSource.cpp:
2198         (WebCore::DistantLightSource::initPaintingData):
2199         (WebCore::DistantLightSource::computePixelLightingData const):
2200         (WebCore::DistantLightSource::updatePaintingData): Deleted.
2201         * platform/graphics/filters/DistantLightSource.h:
2202         * platform/graphics/filters/FELighting.cpp:
2203         (WebCore::FELighting::LightingData::interiorNormal const):
2204         (WebCore::FELighting::setPixel):
2205         (WebCore::FELighting::setPixelInternal):
2206         (WebCore::FELighting::platformApplyGenericPaint):
2207         (WebCore::FELighting::platformApplyGeneric):
2208         (WebCore::FELighting::platformApply):
2209         (WebCore::FELighting::drawLighting):
2210         (WebCore::FELighting::inlineSetPixel): Deleted.
2211         * platform/graphics/filters/FELighting.h:
2212         (WebCore::FELighting::AlphaWindow::topLeft const):
2213         (WebCore::FELighting::AlphaWindow::left const):
2214         (WebCore::FELighting::AlphaWindow::bottomLeft const):
2215         (WebCore::FELighting::AlphaWindow::top const):
2216         (WebCore::FELighting::AlphaWindow::center const):
2217         (WebCore::FELighting::AlphaWindow::bottom const):
2218         (WebCore::FELighting::AlphaWindow::setTop):
2219         (WebCore::FELighting::AlphaWindow::setCenter):
2220         (WebCore::FELighting::AlphaWindow::setBottom):
2221         (WebCore::FELighting::AlphaWindow::setTopRight):
2222         (WebCore::FELighting::AlphaWindow::setRight):
2223         (WebCore::FELighting::AlphaWindow::setBottomRight):
2224         (WebCore::FELighting::AlphaWindow::shiftRow):
2225         (WebCore::FELighting::AlphaWindow::shift):
2226         * platform/graphics/filters/LightSource.h:
2227         * platform/graphics/filters/PointLightSource.cpp:
2228         (WebCore::PointLightSource::computePixelLightingData const):
2229         (WebCore::PointLightSource::updatePaintingData): Deleted.
2230         * platform/graphics/filters/PointLightSource.h:
2231         * platform/graphics/filters/SpotLightSource.cpp:
2232         (WebCore::SpotLightSource::initPaintingData):
2233         (WebCore::SpotLightSource::computePixelLightingData const):
2234         (WebCore::SpotLightSource::updatePaintingData): Deleted.
2235         * platform/graphics/filters/SpotLightSource.h:
2236
2237 2017-11-23  Simon Fraser  <simon.fraser@apple.com>
2238
2239         Add support for CanvasPattern.setTransform()
2240         https://bugs.webkit.org/show_bug.cgi?id=179935
2241
2242         Reviewed by Sam Weinig.
2243         
2244         Add support for setTransform() on CanvasPattern, per
2245         <https://html.spec.whatwg.org/multipage/canvas.html#dom-canvaspattern-settransform>
2246         It uses [MayThrowException] since the "validate and fixup" steps for DOMMatrix can throw
2247         an exception.
2248         
2249         Under the hood, the transform is just pushed onto Pattern as the patternSpaceTransform().
2250         
2251         Minor cleanup in Pattern.
2252
2253         Test: fast/canvas/canvas-pattern-with-transform.html
2254
2255         * html/canvas/CanvasPattern.cpp:
2256         (WebCore::CanvasPattern::setTransform):
2257         * html/canvas/CanvasPattern.h:
2258         * html/canvas/CanvasPattern.idl:
2259         * platform/graphics/Pattern.h:
2260
2261 2017-11-23  Sam Weinig  <sam@webkit.org>
2262
2263         Remove unneeded ScriptController::processingUserGesture() forwarding functions
2264         https://bugs.webkit.org/show_bug.cgi?id=179954
2265
2266         Reviewed by Darin Adler.
2267
2268         Replace ScriptController::processingUserGesture() and ScriptController::processingUserGestureForMedia()
2269         with direct calls to the corresponding UserGestureIndicator functions.
2270
2271         * Modules/applepay/ApplePaySession.cpp:
2272         (WebCore::ApplePaySession::create):
2273         (WebCore::ApplePaySession::openPaymentSetup):
2274         * Modules/speech/SpeechSynthesis.cpp:
2275         (WebCore::SpeechSynthesis::speak):
2276         * bindings/js/ScriptController.cpp:
2277         (WebCore::ScriptController::processingUserGesture): Deleted.
2278         (WebCore::ScriptController::processingUserGestureForMedia): Deleted.
2279         * bindings/js/ScriptController.h:
2280         * dom/Document.cpp:
2281         (WebCore::Document::processingUserGestureForMedia const):
2282         * html/BaseChooserOnlyDateAndTimeInputType.cpp:
2283         (WebCore::BaseChooserOnlyDateAndTimeInputType::handleDOMActivateEvent):
2284         * html/ColorInputType.cpp:
2285         (WebCore::ColorInputType::handleDOMActivateEvent):
2286         * html/FileInputType.cpp:
2287         (WebCore::FileInputType::handleDOMActivateEvent):
2288         * html/HTMLFormElement.cpp:
2289         (WebCore::HTMLFormElement::submitFromJavaScript):
2290         * html/HTMLPlugInImageElement.cpp:
2291         (WebCore::HTMLPlugInImageElement::HTMLPlugInImageElement):
2292         (WebCore::HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn):
2293         * loader/FrameLoader.cpp:
2294         (WebCore::FrameLoader::submitForm):
2295         (WebCore::shouldOpenExternalURLsPolicyToApply):
2296         * page/DOMWindow.cpp:
2297         (WebCore::DOMWindow::allowPopUp):
2298         (WebCore::DOMWindow::setLocation):
2299         (WebCore::DOMWindow::createWindow):
2300         (WebCore::DOMWindow::open):
2301         * page/PointerLockController.cpp:
2302         (WebCore::PointerLockController::requestPointerLock):
2303
2304 2017-11-22  Dean Jackson  <dino@apple.com>
2305
2306         Add a base class for HTMLCanvasElement and OffscreenCanvas
2307         https://bugs.webkit.org/show_bug.cgi?id=179701
2308         <rdar://problem/35545195>
2309
2310         Post-review updates from Darin Adler review.
2311
2312         * html/CanvasBase.cpp:
2313         (WebCore::CanvasBase::asHTMLCanvasElement): Deleted. Replaced by having the call
2314         sites get the reference and do the correct downcast<>.
2315         * html/CanvasBase.h: Remove asHTMLCanvasElement. Add pure virtual ref/deref functions
2316         so they can be overridden by subclasses. Unfortunately they can't be called ref/deref otherwise
2317         they conflict with Node.
2318         * html/HTMLCanvasElement.h: Add the type traits, so is<HTMLCanvasElement>(canvasBase) will
2319         work.
2320         * html/HTMLTagNames.in: Specify the <canvas> element as having custom type traits.
2321         * html/OffscreenCanvas.h: Lots of overrides to finals.
2322         * html/canvas/CanvasRenderingContext.cpp: Use canvasBase.de/refCanvasBase rather than
2323         casting.
2324         (WebCore::CanvasRenderingContext::ref):
2325         (WebCore::CanvasRenderingContext::deref):
2326         * html/canvas/CanvasRenderingContext.h: Lots of overrides to finals.
2327         * html/canvas/CanvasRenderingContext2D.h:
2328         * html/canvas/ImageBitmapRenderingContext.cpp:
2329         (WebCore::ImageBitmapRenderingContext::canvas const):
2330         * html/canvas/WebGLRenderingContextBase.cpp:
2331         (WebCore::WebGLRenderingContextBase::create):
2332         (WebCore::WebGLRenderingContextBase::canvas):
2333         * html/canvas/WebGPURenderingContext.cpp:
2334         (WebCore::WebGPURenderingContext::canvas const):
2335         * inspector/InspectorInstrumentation.h:
2336         (WebCore::InspectorInstrumentation::recordCanvasAction):
2337         * inspector/agents/InspectorCanvasAgent.cpp:
2338         (WebCore::InspectorCanvasAgent::recordCanvasAction):
2339
2340 2017-11-23  Darin Adler  <darin@apple.com>
2341
2342         Reduce WTF::String operations that do unnecessary Unicode operations instead of ASCII
2343         https://bugs.webkit.org/show_bug.cgi?id=179907
2344
2345         Reviewed by Sam Weinig.
2346
2347         * Modules/plugins/YouTubePluginReplacement.cpp:
2348         (WebCore::hasCaseInsensitivePrefix): Deleted.
2349         (WebCore::processAndCreateYouTubeURL): Use startsWithLettersIgnoringASCIICase.
2350
2351         * Modules/websockets/WebSocketHandshake.cpp:
2352         (WebCore::WebSocketHandshake::readHTTPHeaders): Use isAllASCII.
2353
2354         * accessibility/atk/AccessibilityObjectAtk.cpp:
2355         (WebCore::AccessibilityObject::getLengthForTextRange const): Use text().length().
2356
2357         * accessibility/AXObjectCache.cpp:
2358         (WebCore::AXObjectCache::traverseToOffsetInRange): Use isHTMLSpace instead of
2359         isSpaceOrNewline since the code is trying to skip collapsible HTML spaces, not
2360         arbitrary Unicode whitespace.
2361         * accessibility/AccessibilityList.cpp:
2362         (WebCore::AccessibilityList::childHasPseudoVisibleListItemMarkers): Use
2363         isAllSpecialCharacters<isHTMLSpace> for the same reason as above.
2364
2365         * accessibility/AccessibilityNodeObject.cpp:
2366         (WebCore::AccessibilityNodeObject::isSearchField const): Use containsIgnoringASCIICase.
2367
2368         * accessibility/AccessibilityObject.cpp:
2369         (WebCore::AccessibilityObject::accessibilityObjectContainsText const): Use
2370         new findPlainText function exported from TextIterator so this can share the
2371         same search matching logic used to find text in webpages.
2372         (WebCore::AccessibilityObject::selectText): Use capitalize and its return value
2373         rather than makeCapitalize modifying a string in place.
2374
2375         * accessibility/AccessibilityRenderObject.cpp:
2376         (WebCore::objectInclusionFromAltText): Use isAllSpecialCharacters<isHTMLSpace>
2377         for the same reason as above.
2378         (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored const): Ditto.
2379
2380         * bindings/js/JSDOMConvertStrings.cpp:
2381         (WebCore::stringToByteString): Use isAllLatin1.
2382
2383         * contentextensions/ContentExtensionParser.cpp:
2384         (WebCore::ContentExtensions::containsOnlyASCIIWithNoUppercase): Use
2385         StringView::codeUnits instead of String::at.
2386
2387         * contentextensions/ContentExtensionsBackend.cpp:
2388         (WebCore::ContentExtensions::ContentExtensionsBackend::actionsForResourceLoad const):
2389         Use isAllASCII.
2390         * contentextensions/URLFilterParser.cpp:
2391         (WebCore::ContentExtensions::URLFilterParser::addPattern): Ditto.
2392
2393         * css/CSSFontFaceSrcValue.cpp:
2394         (WebCore::CSSFontFaceSrcValue::isSupportedFormat const): Use protocolIs and
2395         endsWithIgnoringASCIICase.
2396
2397         * css/DOMCSSNamespace.cpp:
2398         (WebCore::valueWithoutImportant): Use endsWithIgnoringASCIICase.
2399
2400         * css/parser/CSSPropertyParser.cpp:
2401         (WebCore::parseGridTemplateAreasRow): Use isAllSpecialCharacters<isCSSSpace>,
2402         for the preflight, which matches what the actual parsing code uses.
2403
2404         * dom/CharacterData.cpp:
2405         (WebCore::CharacterData::containsOnlyWhitespace const): Deleted. Callers can
2406         efficiently get at the data and do this kind of check on the data directly.
2407         * dom/CharacterData.h: Updated for the above.
2408
2409         * dom/DataTransfer.cpp:
2410         (WebCore::normalizeType): Use startsWith since the string is already converted
2411         to ASCII lowercase.
2412
2413         * dom/Position.cpp:
2414         (WebCore::Position::leadingWhitespacePosition const): Use isHTMLSpace since
2415         since the code is trying to check for collapsible HTML spaces, not general
2416         Unicode spaces. Other call sites of isSpaceOrNewline need to be checked for
2417         this, but I did not fix them all at this time.
2418         (WebCore::Position::trailingWhitespacePosition const): Ditto.
2419
2420         * editing/Editor.cpp:
2421         (WebCore::Editor::editorUIUpdateTimerFired): Use noBreakSpace.
2422
2423         * editing/FrameSelection.cpp:
2424         (WebCore::FrameSelection::debugRenderer const): Use text().length() instead
2425         of textLength.
2426         (WebCore::FrameSelection::selectionAtWordStart const): Use noBreakSpace.
2427         (WebCore::FrameSelection::wordSelectionContainingCaretSelection): Ditto.
2428         (WebCore::FrameSelection::actualSelectionAtSentenceStart const): Ditto.
2429
2430         * editing/TextIterator.cpp:
2431         (WebCore::textNodeOffsetInFlow): Use text().length().
2432         (WebCore::TextIterator::handleTextNode): Ditto.
2433         (WebCore::collapsedSpaceLength): Updated since RenderText::text now returns
2434         a reference rather than a pointer.
2435         (WebCore::findPlainText): Added. Uses SearchBuffer to search for one string
2436         within another. Exported so accessibility code can do this operation.
2437         * editing/TextIterator.h: Updated for the above.
2438
2439         * editing/TypingCommand.cpp:
2440         (WebCore::TypingCommand::markMisspellingsAfterTyping): Use noBreakSpace.
2441
2442         * editing/VisibleUnits.cpp:
2443         (WebCore::findStartOfParagraph): Updated since RenderText::text now returns
2444         a reference.
2445         (WebCore::findEndOfParagraph): Ditto.
2446
2447         * editing/cocoa/HTMLConverter.mm:
2448         (HTMLConverter::_processText): Use String::characterAt instead of String::at.
2449         Use capitalize instead of makeCapitalized.
2450
2451         * editing/cocoa/WebContentReaderCocoa.mm:
2452         (WebCore::stripMicrosoftPrefix): Use findIgnoringASCIICase.
2453
2454         * html/Autofill.cpp:
2455         (WebCore::AutofillData::createFromHTMLFormControlElement): Use
2456         startsWithLettersIgnoringASCIICase.
2457
2458         * html/BaseTextInputType.cpp:
2459         (WebCore::BaseTextInputType::patternMismatch const): Removed explicit
2460         TextCaseSensitive since it now is the default, and needed to touch this anyway
2461         because the enumeration is now in a different namespace.
2462
2463         * html/EmailInputType.cpp:
2464         (WebCore::isValidEmailAddress): Updated to use JSC::Yarr::TextCaseInsensitive.
2465
2466         * html/HTMLObjectElement.cpp:
2467         (WebCore::HTMLObjectElement::hasFallbackContent const): Use
2468         isAllSpecialCharacters<isHTMLSpace>.
2469         (WebCore::HTMLObjectElement::shouldAllowQuickTimeClassIdQuirk): Use
2470         startsWithLettersIgnoringASCIICase.
2471         (WebCore::HTMLObjectElement::hasValidClassId): Use protocolIs.
2472         (WebCore::preventsParentObjectFromExposure): Use isAllSpecialCharacters<isHTMLSpace>.
2473
2474         * html/parser/HTMLConstructionSite.cpp:
2475         (WebCore::HTMLConstructionSite::setCompatibilityModeFromDoctype):
2476         Use startsWithLettersIgnoringASCIICase.
2477
2478         * html/parser/HTMLMetaCharsetParser.cpp:
2479         (WebCore::extractCharset): Use findIgnoringASCIICase.
2480
2481         * html/parser/XSSAuditor.cpp:
2482         (WebCore::XSSAuditor::isContainedInRequest): Use containsIgnoringASCIICase.
2483
2484         * html/track/WebVTTParser.cpp:
2485         (WebCore::WebVTTParser::hasRequiredFileIdentifier): Don't pass the length to
2486         the String::startsWith function. There has never been a version of that function
2487         that takes the length, there is no need to pass the length since the function
2488         handles null-terminated strings like the one here, and in the past the length
2489         has been getting converted to a boolean making the comparison be case sensitive.
2490         Removing the argument entirely leaves it case sensitive.
2491
2492         * inspector/InspectorNodeFinder.cpp:
2493         (WebCore::InspectorNodeFinder::matchesElement): Use startsWithIgnoringASCIICase
2494         and endsWithIgnoringASCIICase.
2495
2496         * inspector/InspectorStyleSheet.cpp:
2497         (WebCore::selectorsFromSource): Use JSC::Yarr::TextCaseSensitive.
2498
2499         * inspector/agents/InspectorDOMAgent.cpp:
2500         (WebCore::containsOnlyHTMLWhitespace): Made this a non-member function
2501         and reimplemented using isAllSpecialCharacters<isHTMLSpace>().
2502         (WebCore::InspectorDOMAgent::innerFirstChild): Use containsOnlyHTMLWhitespace.
2503         (WebCore::InspectorDOMAgent::innerNextSibling): Ditto.
2504         (WebCore::InspectorDOMAgent::innerPreviousSibling): Ditto.
2505         (WebCore::InspectorDOMAgent::innerChildNodeCount): Ditto.
2506         (WebCore::InspectorDOMAgent::didInsertDOMNode): Ditto.
2507         (WebCore::InspectorDOMAgent::didRemoveDOMNode): Ditto.
2508         * inspector/agents/InspectorDOMAgent.h: Updated for above change.
2509
2510         * loader/appcache/ApplicationCacheStorage.cpp:
2511         (WebCore::ApplicationCacheStorage::shouldStoreResourceAsFlatFile):
2512         Use startsWithLettersIgnoringASCIICase.
2513
2514         * page/Base64Utilities.cpp:
2515         (WebCore::Base64Utilities::btoa): Use isAllLatin1.
2516
2517         * page/Frame.cpp:
2518         (WebCore::createRegExpForLabels): Removed TextCaseSensitive argument since
2519         that is now the default and also used JSC::Yarr::TextCaseInsensitive.
2520         (WebCore::matchLabelsAgainstString): More of the same.
2521
2522         * page/FrameView.cpp:
2523         (WebCore::countRenderedCharactersInRenderObjectWithThreshold): Use
2524         text().length().
2525
2526         * page/SecurityOrigin.cpp:
2527         (WebCore::isFeedWithNestedProtocolInHTTPFamily): Use
2528         startsWithLettersIgnoringASCIICase.
2529
2530         * page/UserContentURLPattern.cpp:
2531         (WebCore::UserContentURLPattern::matchesHost const):
2532         Use endsWithIgnoringASCIICase.
2533         * page/csp/ContentSecurityPolicySource.cpp:
2534         (WebCore::ContentSecurityPolicySource::hostMatches const): Ditto.
2535
2536         * page/csp/ContentSecurityPolicySourceList.cpp:
2537         (WebCore::ContentSecurityPolicySourceList::parseNonceSource):
2538         Use startsWithIgnoringASCIICase.
2539
2540         * page/ios/FrameIOS.mm:
2541         (WebCore::Frame::wordsInCurrentParagraph const): Use noBreakSpace.
2542
2543         * platform/ContentType.cpp:
2544         (WebCore::ContentType::parameter const): Use findIgnoringASCIICase.
2545
2546         * platform/MIMETypeRegistry.cpp:
2547         (WebCore::MIMETypeRegistry::isSupportedFontMIMEType): Use
2548         startsWithLettersIgnoringASCIICase.
2549         (WebCore::MIMETypeRegistry::isSupportedJSONMIMEType): Use
2550         mimeType.endsWithIgnoringASCIICase.
2551         (WebCore::MIMETypeRegistry::isTextMIMEType): Use
2552         startsWithLettersIgnoringASCIICase.
2553         (WebCore::MIMETypeRegistry::isXMLMIMEType): Use endsWithIgnoringASCIICase.
2554         (WebCore::MIMETypeRegistry::isJavaAppletMIMEType): Use
2555         startsWithLettersIgnoringASCIICase.
2556         (WebCore::MIMETypeRegistry::canShowMIMEType): Ditto.
2557
2558         * platform/URL.cpp:
2559         (WebCore::isAllASCII): Renamed from containsOnlyASCII.
2560         (WebCore::appendEncodedHostname): Use isAllASCII.
2561
2562         * platform/URLParser.cpp:
2563         (WebCore::containsOnlyASCII): Deleted.
2564         (WebCore::URLParser::domainToASCII): Use StringImpl::isAllASCII. Changed
2565         to take StringImpl& to guarantee we won't keep doing null checks since
2566         the caller already checks for null.
2567         (WebCore::URLParser::parseHostAndPort): Pass StringImpl&.
2568         * platform/URLParser.h: Updated for above.
2569
2570         * platform/graphics/MediaPlayer.cpp:
2571         (WebCore::MediaPlayer::supportsType): Use endsWithIgnoringASCIICase
2572         and startsWithLettersIgnoringASCIICase.
2573
2574         * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm:
2575         (WebCore::validKeySystemRE): Use JSC::Yarr::TextCaseInsensitive.
2576
2577         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2578         (WebCore::FontCache::similarFont): Use containsIgnoringASCIICase for
2579         the Geeza font special cases.
2580
2581         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
2582         (WebCore::shouldRejectMIMEType): Use startsWithLettersIgnoringASCIICase.
2583
2584         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
2585         (WebCore::GraphicsContext3D::getUnmangledInfoLog): Removed
2586         TextCaseSensitive since it now is the default.
2587
2588         * platform/mac/PublicSuffixMac.mm:
2589         (WebCore::topPrivatelyControlledDomain): Use isAllASCII.
2590
2591         * platform/mac/SSLKeyGeneratorMac.mm:
2592         (WebCore::signedPublicKeyAndChallengeString): Use isAllASCII.
2593
2594         * platform/mac/StringUtilities.mm:
2595         (WebCore::stringMatchesWildcardString): Use JSC::Yarr::TextCaseInsensitive.
2596
2597         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
2598         (WebCore::addStringToSHA1): Use isAllASCII.
2599
2600         * platform/network/CacheValidation.cpp:
2601         (WebCore::parseCacheControlDirectives): Use containsIgnoringASCIICase.
2602
2603         * platform/network/HTTPParsers.cpp:
2604         (WebCore::parseHTTPRefresh): Use findIgnoringASCIICase.
2605         (WebCore::findCharsetInMediaType): Ditto.
2606         (WebCore::parseRange): Use startsWithLettersIgnoringASCIICase.
2607
2608         * platform/network/curl/AuthenticationChallengeCurl.cpp:
2609         (WebCore::AuthenticationChallenge::protectionSpaceFromHandle):
2610         Use findIgnoringASCIICase.
2611         * platform/network/curl/MultipartHandle.cpp:
2612         (WebCore::MultipartHandle::extractBoundary): Ditto.
2613         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
2614         (WebCore::ResourceHandleCurlDelegate::handleDataURL): Use
2615         endsWithIgnoringASCIICase.
2616         * platform/network/curl/ResourceResponseCurl.cpp:
2617         (WebCore::ResourceResponse::isAppendableHeader): Use
2618         startsWithLettersIgnoringASCIICase.
2619         (WebCore::ResourceResponse::appendHTTPHeaderField): Ditto.
2620
2621         * platform/win/ClipboardUtilitiesWin.cpp:
2622         (WebCore::extractMarkupFromCFHTML): Use findIgnoringASCIICase.
2623         (WebCore::fragmentFromCFHTML): Ditto.
2624
2625         * rendering/BidiRun.cpp:
2626         (WebCore::BidiRun::BidiRun): Use text().length().
2627         * rendering/HitTestResult.cpp:
2628         (WebCore::HitTestResult::absolutePDFURL const): Use
2629         endsWithIgnoringASCIICase.
2630         * rendering/InlineFlowBox.cpp:
2631         (WebCore::InlineFlowBox::placeBoxRangeInInlineDirection): Use text().length().
2632         * rendering/InlineIterator.h:
2633         (WebCore::InlineIterator::fastIncrementInTextNode): Ditto.
2634         (WebCore::InlineIterator::increment): Dtto.
2635         * rendering/InlineTextBox.cpp:
2636         (WebCore::InlineTextBox::isLineBreak const): Updated since RenderText::text
2637         now returns a StringImpl&.
2638         (WebCore::InlineTextBox::selectionStartEnd const): Use text().length().
2639         (WebCore::InlineTextBox::text const): Updated since RenderText::text
2640         now returns a StringImpl&.
2641         * rendering/RenderBlock.cpp:
2642         (WebCore::RenderBlock::constructTextRun): Use text().length().
2643         * rendering/RenderBlockFlow.cpp:
2644         (WebCore::isVisibleRenderText): Use isAllSpecialCharacters<isHTMLSpace>().
2645         (WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths const):
2646         Use the new trimmedPreferredWidths that returns a structure instead of the
2647         old one with lots of arguments. Also use text().length().
2648         * rendering/RenderBlockLineLayout.cpp:
2649         (WebCore::endsWithHTMLSpaces): Renamed and changed to use isHTMLSpace
2650         instead of isASCIISpace.
2651         (WebCore::reachedEndOfTextRenderer): Use endsWithHTMLSpaces.
2652         (WebCore::RenderBlockFlow::computeInlineDirectionPositionsForSegment):
2653         Updated for hcanges to RenderText.
2654         (WebCore::RenderBlockFlow::handleTrailingSpaces): Ditto.
2655         (WebCore::RenderBlockFlow::determineStartPosition): Ditto.
2656
2657         * rendering/RenderCombineText.cpp:
2658         (WebCore::RenderCombineText::combineTextIfNeeded): Use
2659         isAllSpecialCharacters<isHTMLSpace>.
2660         * rendering/RenderLayer.cpp:
2661         (WebCore::RenderLayer::calculateClipRects const): Ditto.
2662
2663         * rendering/RenderListBox.cpp:
2664         (WebCore::bolder): Added. Helper function.
2665         (WebCore::RenderListBox::updateFromElement): Rewrote to
2666         only compute the bolder font once rather than for every item.
2667         (WebCore::RenderListBox::paintItemForeground): Updated for
2668         change to applyTextTransform.
2669
2670         * rendering/RenderMenuList.cpp:
2671         (WebCore::RenderMenuList::adjustInnerStyle): Updated for change
2672         to RenderText::text.
2673         (RenderMenuList::updateOptionsWidth): Updated for change to
2674         applyTextTransform.
2675         (RenderMenuList::itemText const): Ditto.
2676
2677         * rendering/RenderText.cpp:
2678         (WebCore::capitalize): Renamed from makeCapitalized. Changed to
2679         take and return a String instead of taking a String*.
2680         (WebCore::RenderText::RenderText): Use isAllASCII. Also moved
2681         initialization of most non-bitfield members to the class definition.
2682         (WebCore::RenderText::positionForPoint): Use text().
2683         (WebCore::RenderText::widthFromCache const): Ditto.
2684         (WebCore::RenderText::hangablePunctuationStartWidth const): Ditto.
2685         (WebCore::RenderText::hangablePunctuationEndWidth const): Ditto.
2686         (WebCore::RenderText::isHangableStopOrComma): Ditto.
2687         (WebCore::RenderText::firstCharacterIndexStrippingSpaces const): Ditto.
2688         (WebCore::RenderText::lastCharacterIndexStrippingSpaces const): Ditto.
2689         (WebCore::RenderText::trimmedPreferredWidths): Changed to return values
2690         in a structure instead of taking lots of arguments.
2691         (WebCore::RenderText::computePreferredLogicalWidths): Updated to use
2692         the text() function.
2693         (WebCore::isAllCollapsibleWhitespace): Added.
2694         (WebCore::RenderText::isAllCollapsibleWhitespace const): Updated to
2695         use a tighter loop.
2696         (WebCore::isAllPossiblyCollapsibleWhitespace): Added.
2697         (WebCore::RenderText::containsOnlyHTMLWhitespace const): Updated to
2698         use a tighter loop. Renamed from containsOnlyWhitespace.
2699         (WebCore::RenderText::setTextWithOffset): Updated to  use text().
2700         (WebCore::isInlineFlowOrEmptyText): Rewrote to be easier to read.
2701         (WebCore::RenderText::previousCharacter const): Got rid of unneeded
2702         null check and simplified.
2703         (WebCore::applyTextTransform): Changed to return a String rather
2704         than modifying one that is passed in.
2705         (WebCore::RenderText::setRenderedText): Updated use of applyTextTransform.
2706         (WebCore::RenderText::secureText): More of the same.
2707         (WebCore::RenderText::computeCanUseSimplifiedTextMeasuring const): Ditto.
2708         (WebCore::RenderText::textWithoutConvertingBackslashToYenSymbol const): Ditto.
2709         (WebCore::RenderText::width const): Ditto.
2710         (WebCore::RenderText::collectSelectionRectsForLineBoxes): Ditto.
2711         (WebCore::RenderText::previousOffset const): Ditto.
2712         (WebCore::RenderText::previousOffsetForBackwardDeletion const): Ditto.
2713         (WebCore::RenderText::nextOffset const): Ditto.
2714         (WebCore::RenderText::computeCanUseSimpleFontCodePath const): Ditto.
2715         (WebCore::RenderText::stringView const): Ditto.
2716
2717         * rendering/RenderText.h: Made some more members private and final.
2718         Updated for above, including adding the Widths structure. Got rid of the
2719         textLength function, which existed as a workaround before we could mark
2720         a function like length final. Made the text function return a StringImpl&,
2721         which is good since the m_text string is never null, and so callers end
2722         up using StringImpl directly and saving null checks. Removed functions
2723         that are not needed, including is8Bit, characters8, characters16,
2724         uncheckedCharacterAt, operator[], and isAllASCII.
2725
2726         * rendering/RenderTextFragment.cpp:
2727         (WebCore::RenderTextFragment::setText): Use text().length().
2728         * rendering/RenderTextLineBoxes.cpp:
2729         (WebCore::RenderTextLineBoxes::caretMaxOffset const): Ditto.
2730         (WebCore::RenderTextLineBoxes::positionForPoint const): Ditto.
2731         (WebCore::RenderTextLineBoxes::setSelectionState): Ditto.
2732         (WebCore::RenderTextLineBoxes::absoluteQuads const): Ditto.
2733         * rendering/SimpleLineLayout.cpp:
2734         (WebCore::SimpleLineLayout::canUseForFontAndText): Ditto.
2735         * rendering/SimpleLineLayoutCoverage.cpp:
2736         (WebCore::SimpleLineLayout::textLengthForSubtree): Ditto.
2737         (WebCore::SimpleLineLayout::collectNonEmptyLeafRenderBlockFlows): Ditto.
2738         * rendering/SimpleLineLayoutFlowContents.cpp:
2739         (WebCore::SimpleLineLayout::initializeSegments): Ditto.
2740         * rendering/SimpleLineLayoutFunctions.cpp:
2741         (WebCore::SimpleLineLayout::textOffsetForPoint): Ditto.
2742         * rendering/SimpleLineLayoutFunctions.h:
2743         (WebCore::SimpleLineLayout::findCaretMaximumOffset): Ditto.
2744         * rendering/line/BreakingContext.h:
2745         (WebCore::shouldAddBorderPaddingMargin): Ditto.
2746         (WebCore::shouldSkipWhitespaceAfterStartObject): Ditto.
2747         (WebCore::iteratorIsBeyondEndOfRenderCombineText): Ditto.
2748         (WebCore::textWidth): Ditto.
2749         (WebCore::BreakingContext::handleText): Ditto.
2750         (WebCore::BreakingContext::optimalLineBreakLocationForTrailingWord): Ditto.
2751         * rendering/line/TrailingObjects.cpp:
2752         (WebCore::TrailingObjects::updateWhitespaceCollapsingTransitionsForTrailingBoxes): Ditto.
2753
2754         * rendering/mathml/RenderMathMLFenced.cpp:
2755         (WebCore::RenderMathMLFenced::updateFromElement): Removed stray use of "unsigned int".
2756
2757         * rendering/svg/RenderSVGInlineText.cpp:
2758         (WebCore::RenderSVGInlineText::characterStartsNewTextChunk const): Use text().length().
2759         (WebCore::RenderSVGInlineText::positionForPoint): Ditto.
2760         * rendering/svg/SVGTextLayoutAttributesBuilder.cpp:
2761         (WebCore::processRenderSVGInlineText): Ditto.
2762         * rendering/svg/SVGTextLayoutEngine.cpp:
2763         (WebCore::SVGTextLayoutEngine::currentLogicalCharacterAttributes): Ditto.
2764         * rendering/svg/SVGTextQuery.cpp:
2765         (WebCore::SVGTextQuery::modifyStartEndPositionsRespectingLigatures const): Ditto.
2766
2767         * style/RenderTreeUpdater.cpp:
2768         (WebCore::RenderTreeUpdater::updateRenderTree): Use isAllSpecialCharacters<isHTMLSpace>.
2769         (WebCore::RenderTreeUpdater::textRendererIsNeeded): Ditto.
2770
2771         * svg/SVGTests.cpp:
2772         (WebCore::SVGTests::hasFeatureForLegacyBindings): Use startsWithLettersIgnoringASCIICase.
2773         * xml/parser/XMLDocumentParserLibxml2.cpp:
2774         (WebCore::shouldAllowExternalLoad): Ditto.
2775
2776 2017-11-23  Zan Dobersek  <zdobersek@igalia.com>
2777
2778         [CoordGraphics] Simplify CoordinatedGraphicsLayer's content buffer updates
2779         https://bugs.webkit.org/show_bug.cgi?id=179972
2780
2781         Reviewed by Carlos Garcia Campos.
2782
2783         During layer flushes, when a CoordinatedGraphicsLayer's tiled backing store
2784         has dirty tiles that need to be updated, the following chain of calls would
2785         be invoked to perform the painting, starting in
2786         CoordinatedGraphicsLayer::updateContentBuffers():
2787         |- CoordinatedGraphicsLayer::updateContentBuffers()
2788          |- TiledBackingStore::updateTileBuffers()
2789           |- Tile::updateBackBuffer()
2790            |- CoordinatedGraphicsLayer::paintToSurface()
2791             |- CompositingCoordinator::paintToSurface()
2792              |- UpdateAtlas::paintOnAvailableBuffer()
2793               |- ThreadSafeCoordinatedSurface::paintToSurface()
2794                |- Tile::paintToSurfaceContext()
2795                 |- CoordinatedGraphicsLayer::tiledBackingStorePaint()
2796                  |- GraphicsLayer::paintGraphicsLayerContents()
2797
2798         That's a bit much.
2799
2800         In CoordinatedGraphicsLayer::updateContentBuffers(), we now first retrieve
2801         all the dirty layers in our TiledBackingStore. We then iterate through them,
2802         first establishing their ID and then retrieving an available CoordinatedBuffer
2803         that we can use for painting. The CoordinatedBuffer is retrieved through
2804         CompositingCoordinator, which is still caching these buffers via UpdateAtlas
2805         objects.
2806
2807         With a CoordinatedBuffer available, we can then proceed with painting. The
2808         painting context has to be properly set up to paint into the correct area of
2809         the given buffer, and the alpha channel, if necessary, has to be addressed.
2810         After properly positioning and scaling ourselves on the given context, we
2811         can proceed with the GraphicsLayer::paintGraphicsLayerContents() call.
2812
2813         What's left is filling out the missing SurfaceUpdateInfo information which is
2814         then passed to the updateTile() method that properly registers the tile
2815         update we've just performed. The tile itself is marked clean. After the
2816         iteration, we call the didUpdateTileBuffers() method in case any successful
2817         tile update was indeed performed, incrementing the repaint counter.
2818
2819         That's it -- we clipped 8 calls from the call chain. We can now also remove
2820         the CoordinatedBuffer::Client interface, as well as slim down the
2821         TiledBackingStore interface. The Tile class is cleaned up a bit, with methods
2822         shifted into a more sensible order.
2823
2824         No new tests -- no change in functionality.
2825
2826         * platform/graphics/texmap/coordinated/CoordinatedBuffer.cpp:
2827         * platform/graphics/texmap/coordinated/CoordinatedBuffer.h:
2828         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
2829         (WebCore::CoordinatedGraphicsLayer::didUpdateTileBuffers):
2830         (WebCore::CoordinatedGraphicsLayer::updateContentBuffers):
2831         (WebCore::CoordinatedGraphicsLayer::tiledBackingStorePaint): Deleted.
2832         (WebCore::CoordinatedGraphicsLayer::paintToSurface): Deleted.
2833         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
2834         * platform/graphics/texmap/coordinated/Tile.cpp:
2835         (WebCore::Tile::ensureTileID):
2836         (WebCore::Tile::isDirty const):
2837         (WebCore::Tile::invalidate):
2838         (WebCore::Tile::markClean):
2839         (WebCore::Tile::updateBackBuffer): Deleted.
2840         (WebCore::Tile::paintToSurfaceContext): Deleted.
2841         * platform/graphics/texmap/coordinated/Tile.h:
2842         (WebCore::Tile::tileID const):
2843         (WebCore::Tile::dirtyRect const):
2844         * platform/graphics/texmap/coordinated/TiledBackingStore.cpp:
2845         (WebCore::TiledBackingStore::dirtyTiles):
2846         (WebCore::TiledBackingStore::updateTileBuffers): Deleted.
2847         * platform/graphics/texmap/coordinated/TiledBackingStore.h:
2848         * platform/graphics/texmap/coordinated/TiledBackingStoreClient.h:
2849
2850 2017-11-23  Zan Dobersek  <zdobersek@igalia.com>
2851
2852         [CoordGraphics] Remove relay CoordinatedBuffer::Client implementations
2853         https://bugs.webkit.org/show_bug.cgi?id=179970
2854
2855         Reviewed by Carlos Garcia Campos.
2856
2857         Drop CoordinatedBuffer::painToSurface() in favor of a simpler
2858         GraphicsContext reference getter that returns a reference to the
2859         GraphicsContext object of the internal ImageBuffer.
2860
2861         Remove the ImageBackingSurfaceClient class that only acted as a relay
2862         that enabled a CoordinatedBuffer to draw an image through its context.
2863         Instead, we use the GraphicsContext of the allocated CoordinatedBuffer
2864         to draw the image directly. We still use a rectangle whose size
2865         matches the size of the given Image as the clipping area and as the
2866         source and destination rectangle for the image.
2867
2868         No new tests -- no change in behavior.
2869
2870         * platform/graphics/texmap/coordinated/CoordinatedBuffer.cpp:
2871         (WebCore::CoordinatedBuffer::context):
2872         (WebCore::CoordinatedBuffer::paintToSurface): Deleted.
2873         * platform/graphics/texmap/coordinated/CoordinatedBuffer.h:
2874         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp:
2875         (WebCore::CoordinatedImageBacking::update):
2876         (WebCore::ImageBackingSurfaceClient::ImageBackingSurfaceClient): Deleted.
2877
2878 2017-11-23  Zan Dobersek  <zdobersek@igalia.com>
2879
2880         [CoordGraphics] TiledBackingStore: use a reference to the client
2881         https://bugs.webkit.org/show_bug.cgi?id=179969
2882
2883         Reviewed by Carlos Garcia Campos.
2884
2885         TiledBackingStore should keep a C++ reference to the TiledBackingStoreClient
2886         object, and not a pointer. client() method is updated to reflect that, and
2887         uses of this method and the member variable are updated accordingly.
2888
2889         No new tests -- no change in behavior.
2890
2891         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
2892         (WebCore::CoordinatedGraphicsLayer::createBackingStore):
2893         * platform/graphics/texmap/coordinated/Tile.cpp:
2894         (WebCore::Tile::~Tile):
2895         (WebCore::Tile::updateBackBuffer):
2896         (WebCore::Tile::paintToSurfaceContext):
2897         * platform/graphics/texmap/coordinated/TiledBackingStore.cpp:
2898         (WebCore::TiledBackingStore::TiledBackingStore):
2899         (WebCore::TiledBackingStore::updateTileBuffers):
2900         (WebCore::TiledBackingStore::createTiles):
2901         * platform/graphics/texmap/coordinated/TiledBackingStore.h:
2902         (WebCore::TiledBackingStore::client):
2903
2904 2017-11-23  Zan Dobersek  <zdobersek@igalia.com>
2905
2906         [CoordGraphics] Early tile buffer update in TiledBackingStore::createTiles() is unnecessary
2907         https://bugs.webkit.org/show_bug.cgi?id=179968
2908
2909         Reviewed by Carlos Garcia Campos.
2910
2911         Under CoordinatedGraphicsLayer::updateContentBuffers(), the TiledBackingStore
2912         object has the createTilesIfNeeded() method invoked, if necessary. This
2913         invokes createTiles(), where the edge tiles are resized if necessary, and
2914         the missing tiles are created. If any of those two cases is fulfilled, the
2915         updateTileBuffers() method is invoked, updating any dirty tiles (i.e. the
2916         ones that were resized or newly-created).
2917
2918         This specific invocation of updateTileBuffers() is not needed since it's the
2919         very next method that's invoked on the TiledBackingStore object by
2920         CoordinatedGraphicsLayer::updateContentBuffers(). It's therefore removed,
2921         and the resizeEdgeTiles() method is changed to not return any value.
2922
2923         No new tests -- no change in behavior.
2924
2925         * platform/graphics/texmap/coordinated/TiledBackingStore.cpp:
2926         (WebCore::TiledBackingStore::createTiles):
2927         (WebCore::TiledBackingStore::resizeEdgeTiles):
2928         * platform/graphics/texmap/coordinated/TiledBackingStore.h:
2929
2930 2017-11-23  Antti Koivisto  <antti@apple.com>
2931
2932         RenderBlockFlow::layoutRunsAndFloatsInRange is O(n^2) for runs of inlines without any text
2933         https://bugs.webkit.org/show_bug.cgi?id=179950
2934
2935         Reviewed by Simon Fraser.
2936
2937         It calls createBidiRunsForLine for each line. createBidiRunsForLine traverses past the end of the line until
2938         it finds the end of the current bidi run. If there is no text in the flow, it never finds anything and traverses
2939         the entire flow. This is O(n^2) for the number of renderers in the flow.
2940
2941         Tested by PerformanceTests/Layout/inline-layout-no-text.html
2942
2943         * platform/text/BidiResolver.h:
2944         (WebCore::BidiResolverBase::needsContinuePastEnd const):
2945         (WebCore::BidiResolverBase::needsContinuePastEndInternal const):
2946         (WebCore::DerivedClass>::createBidiRunsForLine):
2947
2948             When past end of line call needsContinuePastEnd() to see if we need to continue searching for the end of the bidi run.
2949
2950         * rendering/InlineIterator.h:
2951         (WebCore::InlineBidiResolver::needsContinuePastEndInternal const):
2952
2953             InlineBidiResolver only returns runs up to the last renderer on the line and can bail out.
2954
2955 2017-11-23  Zan Dobersek  <zdobersek@igalia.com>
2956
2957         [CoordGraphics] Replace CoordinatedSurface, ThreadSafeCoordinatedSurface with CoordinatedBuffer
2958         https://bugs.webkit.org/show_bug.cgi?id=179967
2959
2960         Reviewed by Carlos Garcia Campos.
2961
2962         Roll the CoordinatedSurface and ThreadSafeCoordinatedSurface classes
2963         into one CoordinatedBuffer class.
2964
2965         CoordinatedBuffer class mimics CoordinatedSurface in providing the
2966         Client class that allows specifying how the client should paint using a
2967         GraphicsContext object. supportsAlpha() and size() methods are also
2968         present, as well as paintToSurface(). uploadImage() retrieves the
2969         Image that's created from the contained ImageBuffer, allowing the user
2970         to then manually upload the buffer data onto the GPU.
2971
2972         CoordinatedBuffer otherwise serves as a drop-in replacement for the
2973         CoordinatedSurface class, and the remaining changes in the
2974         CoordiantedGraphics code reflect that.
2975
2976         No new tests -- no change in behavior.
2977
2978         * platform/TextureMapper.cmake:
2979         * platform/graphics/texmap/coordinated/CoordinatedBuffer.cpp: Added.
2980         (WebCore::CoordinatedBuffer::create):
2981         (WebCore::CoordinatedBuffer::CoordinatedBuffer):
2982         (WebCore::CoordinatedBuffer::paintToSurface):
2983         (WebCore::CoordinatedBuffer::uploadImage):
2984         * platform/graphics/texmap/coordinated/CoordinatedBuffer.h: Added.
2985         (WebCore::CoordinatedBuffer::supportsAlpha const):
2986         (WebCore::CoordinatedBuffer::size const):
2987         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
2988         (WebCore::CoordinatedGraphicsLayer::paintToSurface):
2989         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
2990         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
2991         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp:
2992         (WebCore::CoordinatedImageBacking::update):
2993         (WebCore::CoordinatedImageBacking::releaseSurfaceIfNeeded):
2994         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.h:
2995         * platform/graphics/texmap/coordinated/CoordinatedSurface.cpp: Removed.
2996         * platform/graphics/texmap/coordinated/CoordinatedSurface.h: Removed.
2997         * platform/graphics/texmap/coordinated/Tile.h:
2998         * platform/graphics/texmap/coordinated/TiledBackingStoreClient.h:
2999
3000 2017-11-22  Simon Fraser  <simon.fraser@apple.com>
3001
3002         FEComponentTransfer cleanup and optimization
3003         https://bugs.webkit.org/show_bug.cgi?id=179952
3004
3005         Reviewed by Darin Adler.
3006
3007         Change terminology for FEComponentTransfer to be more explicit about the fact
3008         that it's creating and using lookup tables. Use std::array for the lookup tables.
3009         
3010         Use uint8_t instead of unsigned char.
3011         
3012         Avoid confusing arrays for channels in computeLookupTables; just setup the lut for
3013         each channel manually.
3014         
3015         This is about 1.25x faster than before.
3016
3017         * platform/graphics/filters/FEComponentTransfer.cpp:
3018         (WebCore::FEComponentTransfer::computeIdentityTable):
3019         (WebCore::FEComponentTransfer::computeTabularTable):
3020         (WebCore::FEComponentTransfer::computeDiscreteTable):
3021         (WebCore::FEComponentTransfer::computeLinearTable):
3022         (WebCore::FEComponentTransfer::computeGammaTable):
3023         (WebCore::FEComponentTransfer::platformApplySoftware):
3024         (WebCore::FEComponentTransfer::computeLookupTables):
3025         (WebCore::operator<<):
3026         (WebCore::identity): Deleted.
3027         (WebCore::table): Deleted.
3028         (WebCore::discrete): Deleted.
3029         (WebCore::linear): Deleted.
3030         (WebCore::gamma): Deleted.
3031         (WebCore::FEComponentTransfer::getValues): Deleted.
3032         * platform/graphics/filters/FEComponentTransfer.h:
3033         (WebCore::ComponentTransferFunction::ComponentTransferFunction): Deleted.
3034
3035 2017-11-22  Javier Fernandez  <jfernandez@igalia.com>
3036
3037         [css-grid] Refactoring and new namespace with grid related utility functions
3038         https://bugs.webkit.org/show_bug.cgi?id=179633
3039
3040         Reviewed by Darin Adler.
3041
3042         Added a new namespace with several utility functions to share logic
3043         between RenderGrid and GridTrackSizingAlgorithm.
3044
3045         No new tests, since no new functionality is added.
3046
3047         * Sources.txt:
3048         * WebCore.xcodeproj/project.pbxproj:
3049         * rendering/GridLayoutUtils.cpp: Added.
3050         (WebCore::GridLayoutUtils::computeMarginLogicalSizeForChild):
3051         (WebCore::GridLayoutUtils::marginLogicalSizeForChild):
3052         (WebCore::GridLayoutUtils::isOrthogonalChild):
3053         (WebCore::GridLayoutUtils::flowAwareDirectionForChild):
3054         * rendering/GridLayoutUtils.h: Added.
3055         * rendering/GridTrackSizingAlgorithm.cpp:
3056         (WebCore::GridTrackSizingAlgorithm::assumedRowsSizeForOrthogonalChild const):
3057         (WebCore::GridTrackSizingAlgorithmStrategy::logicalHeightForChild const):
3058         (WebCore::GridTrackSizingAlgorithmStrategy::minContentForChild const):
3059         (WebCore::GridTrackSizingAlgorithmStrategy::maxContentForChild const):
3060         (WebCore::GridTrackSizingAlgorithmStrategy::minSizeForChild const):
3061         (WebCore::DefiniteSizeStrategy::minLogicalWidthForChild const):
3062         * rendering/RenderGrid.cpp:
3063         (WebCore::RenderGrid::layoutBlock):
3064         (WebCore::RenderGrid::placeItemsOnGrid const):
3065         (WebCore::RenderGrid::layoutPositionedObject):
3066         (WebCore::RenderGrid::availableAlignmentSpaceForChildBeforeStretching const):
3067         (WebCore::RenderGrid::applyStretchAlignmentToChildIfNeeded):
3068         (WebCore::RenderGrid::isInlineBaselineAlignedChild const):
3069         (WebCore::RenderGrid::firstLineBaseline const):
3070         (WebCore::RenderGrid::columnAxisPositionForChild const):
3071         (WebCore::RenderGrid::rowAxisPositionForChild const):
3072         (WebCore::RenderGrid::columnAxisOffsetForChild const):
3073         (WebCore::RenderGrid::rowAxisOffsetForChild const):
3074         (WebCore::RenderGrid::findChildLogicalPosition const):
3075
3076 2017-11-22  Ali Juma  <ajuma@chromium.org>
3077
3078         Implement VisualViewport API attributes
3079         https://bugs.webkit.org/show_bug.cgi?id=179385
3080
3081         Reviewed by Frédéric Wang.
3082
3083         Add a visualViewport attribute to Window, and implement the VisualViewport
3084         interface (https://wicg.github.io/visual-viewport/#the-visualviewport-interface).
3085
3086         This is behind a newly-added VisualViewportAPI experimental feature flag.
3087
3088         Tests: fast/visual-viewport/viewport-dimensions-exclude-custom-scrollbars.html
3089                fast/visual-viewport/viewport-dimensions-exclude-scrollbars.html
3090                fast/visual-viewport/viewport-dimensions-iframe.html
3091                fast/visual-viewport/viewport-dimensions-under-page-zoom.html
3092                fast/visual-viewport/viewport-dimensions.html
3093
3094         * CMakeLists.txt:
3095         * DerivedSources.cpp:
3096         * DerivedSources.make:
3097         * Sources.txt:
3098         * WebCore.xcodeproj/project.pbxproj:
3099         * bindings/js/WebCoreBuiltinNames.h:
3100         * dom/EventTargetFactory.in:
3101         * page/DOMWindow.cpp:
3102         (WebCore::DOMWindow::~DOMWindow):
3103         (WebCore::DOMWindow::resetDOMWindowProperties):
3104         (WebCore::DOMWindow::visualViewport const):
3105         * page/DOMWindow.h:
3106         * page/DOMWindow.idl:
3107         * page/Settings.yaml:
3108         * page/VisualViewport.cpp: Added.
3109         (WebCore::VisualViewport::VisualViewport):
3110         (WebCore::VisualViewport::eventTargetInterface const):
3111         (WebCore::VisualViewport::scriptExecutionContext const):
3112         (WebCore::getFrameViewAndLayoutIfNonNull):
3113         (WebCore::VisualViewport::offsetLeft const):
3114         (WebCore::VisualViewport::offsetTop const):
3115         (WebCore::VisualViewport::pageLeft const):
3116         (WebCore::VisualViewport::pageTop const):
3117         (WebCore::VisualViewport::width const):
3118         (WebCore::VisualViewport::height const):
3119         (WebCore::VisualViewport::scale const):
3120         * page/VisualViewport.h: Added.
3121         * page/VisualViewport.idl: Added.
3122
3123 2017-11-22  Manuel Rego Casasnovas  <rego@igalia.com>
3124
3125         Available height is wrong for positioned elements with "box-sizing: border-box"
3126         https://bugs.webkit.org/show_bug.cgi?id=178783
3127
3128         Reviewed by Darin Adler.
3129
3130         These methods were returning a wrong value for positioned items
3131         in combination with "box-sizing: border-box".
3132         The problem was that if the height of the element is given
3133         by its offset properties (top and bottom) we don't need to call
3134         adjustContentBoxLogicalHeightForBoxSizing().
3135
3136         Tests: fast/box-sizing/fill-available.html
3137                fast/box-sizing/replaced.html
3138
3139         * rendering/RenderBox.cpp:
3140         (WebCore::RenderBox::computeReplacedLogicalHeightUsing const):
3141         (WebCore::RenderBox::availableLogicalHeightUsing const):
3142
3143 2017-11-22  Christopher Reid  <chris.reid@sony.com>
3144
3145         WebCoreObjCExtras.h is being included in too many places
3146         https://bugs.webkit.org/show_bug.cgi?id=179931
3147
3148         Reviewed by Darin Adler.
3149
3150         No new tests no change in behavior.
3151
3152         Fixing cases where WebCoreObjCExtras.h is imported but not used.
3153
3154         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
3155         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3156         * platform/mac/WebCoreNSURLExtras.mm:
3157
3158 2017-11-22  Antoine Quint  <graouts@apple.com>
3159
3160         [Web Animations] Adopt KeyframeList in KeyframeEffect
3161         https://bugs.webkit.org/show_bug.cgi?id=179941
3162         <rdar://problem/35666924>
3163
3164         Reviewed by Darin Adler.
3165
3166         KeyframeEffect used to model its keyframes by creating a new Keyframe struct and storing them in a Vector<Keyframe>.
3167         However, there already is a way to model keyframes in WebCore using the KeyframeList class. We now adopt this class
3168         in KeyframeEffect, which makes it possible to run hardware-composited animations using RenderBoxModelObject::startAnimation()
3169         in a follow-up patch, since this function expects a KeyframeList.
3170
3171         No news tests, this is an internals change and does not yield any changes in Web content.
3172
3173         * animation/KeyframeEffect.cpp:
3174         (WebCore::KeyframeEffect::KeyframeEffect): Create a default m_keyframes at construction time.
3175         (WebCore::KeyframeEffect::processKeyframes): Create a temporary KeyframeList as we parse keyframes passed from the JS API
3176         and assign it to m_keyframes upon successful parsing. We also use cssPropertyId to refer to a CSSPropertyID to make the code
3177         clearer and ensure there is no confusion with JS properties that we manipulate in this function.
3178         (WebCore::KeyframeEffect::computeStackingContextImpact): Use the list of CSS properties exposed on KeyframeList directly rather
3179         than enumerating each keyframe and use cssPropertyId to refer to individual CSSPropertyID values for consistency.
3180         (WebCore::KeyframeEffect::applyAtLocalTime): Use the list of CSS properties exposed on KeyframeList directly rather than
3181         using the properties specified on the first keyframe only. We also remove a stale FIXME comment which was addressed in r224957.
3182         * animation/KeyframeEffect.h: Remove the Keyframe struct and change the type of m_keyframes from Vector<Keyframe> to KeyframeList.
3183         * rendering/style/KeyframeList.h:
3184         (WebCore::KeyframeList::KeyframeList): We remove the default insertions at KeyframeList construction time since it requires
3185         an immediate call to clear() when doing any meaningful work with a KeyframeList. We also add the default move assignment operator
3186         to allow KeyframeEffect::processKeyframes() to make a move assignment from the temporary keyframe list we build at parsing to the
3187         member variable.
3188
3189 2017-11-22  Commit Queue  <commit-queue@webkit.org>
3190
3191         Unreviewed, rolling out r225093.
3192         https://bugs.webkit.org/show_bug.cgi?id=179938
3193
3194         Compilation failed on WinCairo 64-bit Release (Requested by
3195         fredw on #webkit).
3196
3197         Reverted changeset:
3198
3199         "Implement VisualViewport API attributes"
3200         https://bugs.webkit.org/show_bug.cgi?id=179385
3201         https://trac.webkit.org/changeset/225093
3202
3203 2017-11-21  Ali Juma  <ajuma@chromium.org>
3204
3205         Implement VisualViewport API attributes
3206         https://bugs.webkit.org/show_bug.cgi?id=179385
3207
3208         Reviewed by Frédéric Wang.
3209
3210         Add a visualViewport attribute to Window, and implement the VisualViewport
3211         interface (https://wicg.github.io/visual-viewport/#the-visualviewport-interface).
3212
3213         This is behind a newly-added VisualViewportAPI experimental feature flag.
3214
3215         Tests: fast/visual-viewport/viewport-dimensions-exclude-custom-scrollbars.html
3216                fast/visual-viewport/viewport-dimensions-exclude-scrollbars.html
3217                fast/visual-viewport/viewport-dimensions-iframe.html
3218                fast/visual-viewport/viewport-dimensions-under-page-zoom.html
3219                fast/visual-viewport/viewport-dimensions.html
3220
3221         * CMakeLists.txt:
3222         * DerivedSources.cpp:
3223         * DerivedSources.make:
3224         * Sources.txt:
3225         * WebCore.xcodeproj/project.pbxproj:
3226         * bindings/js/WebCoreBuiltinNames.h:
3227         * dom/EventTargetFactory.in:
3228         * page/DOMWindow.cpp:
3229         (WebCore::DOMWindow::~DOMWindow):
3230         (WebCore::DOMWindow::resetDOMWindowProperties):
3231         (WebCore::DOMWindow::visualViewport const):
3232         * page/DOMWindow.h:
3233         * page/DOMWindow.idl:
3234         * page/Settings.yaml:
3235         * page/VisualViewport.cpp: Added.
3236         (WebCore::VisualViewport::VisualViewport):
3237         (WebCore::VisualViewport::eventTargetInterface const):
3238         (WebCore::VisualViewport::scriptExecutionContext const):
3239         (WebCore::getFrameViewAndLayoutIfNonNull):
3240         (WebCore::VisualViewport::offsetLeft const):
3241         (WebCore::VisualViewport::offsetTop const):
3242         (WebCore::VisualViewport::pageLeft const):
3243         (WebCore::VisualViewport::pageTop const):
3244         (WebCore::VisualViewport::width const):
3245         (WebCore::VisualViewport::height const):
3246         (WebCore::VisualViewport::scale const):
3247         * page/VisualViewport.h: Added.
3248         * page/VisualViewport.idl: Added.
3249
3250 2017-11-21  Frederic Wang  <fwang@igalia.com>
3251
3252         Async frame scrolling: handle fixed root backgrounds in frames
3253         https://bugs.webkit.org/show_bug.cgi?id=176261
3254
3255         Based on patch by Simon Fraser <simon.fraser@apple.com>
3256         Reviewed by Antonio Gomes.
3257
3258         For frames with tiled backing, we register a slow-repaint object because we hit
3259         RenderElement::styleWillChange() before we've made a backing for the iframe's RenderView so
3260         view().compositor().supportsFixedRootBackgroundCompositing() returns false. This patch
3261         ensures that this object is removed when setBackgroundLayerPaintsFixedRootBackground is
3262         called. It also removes the opaque background of non-main frames with tiled backing.
3263         This fixes a possible hit of ASSERT(!m_backgroundLayer) after r221615.
3264
3265         Test: compositing/tiling/tiled-drawing-async-frame-scrolling.html
3266
3267         * rendering/RenderLayerBacking.cpp:
3268         (WebCore::RenderLayerBacking::updateGeometry): Do not set opaque contents for frames with
3269         tiled backing. We keep !m_isMainFrameRenderViewLayer for backward compatibility with WK1.
3270         (WebCore::RenderLayerBacking::setBackgroundLayerPaintsFixedRootBackground): Add an early
3271         return when m_backgroundLayerPaintsFixedRootBackground is not changed. Remove the slow
3272         repaint object previously registered for this frame. Also add an ASSERT to ensure that a
3273         fixed root background is only set for frames with async scrolling.
3274         (WebCore::RenderLayerBacking::updateRootLayerConfiguration): Restrict some special handling
3275         of background and opaqueness to the main frame.
3276
3277 2017-11-21  Zan Dobersek  <zdobersek@igalia.com>
3278
3279         Drop ENABLE_IMAGE_DECODER_DOWN_SAMPLING code
3280         https://bugs.webkit.org/show_bug.cgi?id=179921
3281
3282         Reviewed by Carlos Garcia Campos.
3283
3284         Drop the ENABLE_IMAGE_DECODER_DOWN_SAMPLING code, along with the build
3285         guard definitions in WTF and CMake.
3286
3287         This was apparently in use in the Qt port, but since then no port
3288         enables this. It's not exposed in the Xcode build, and the CMake option
3289         is disabled by default, with no way to enable it through build-webkit.
3290
3291         While the code guarded with this build guard is removed, there's still
3292         code in the ScalableImageDecoder class that only operated when this
3293         feature was enabled. This should be addressed in the future, after
3294         evaluating the need for this scaling capability.
3295
3296         No new tests -- no change in behavior.
3297
3298         * platform/graphics/Image.cpp:
3299         (WebCore::Image::adjustSourceRectForDownSampling const): Deleted.
3300         * platform/graphics/Image.h:
3301         * platform/graphics/cairo/CairoOperations.cpp:
3302         (WebCore::Cairo::drawNativeImage):
3303         * platform/image-decoders/ScalableImageDecoder.h:
3304         * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
3305         (WebCore::JPEGImageReader::decode):
3306         * platform/image-decoders/png/PNGImageDecoder.cpp:
3307         (WebCore::PNGImageDecoder::rowAvailable):
3308         (WebCore::PNGImageDecoder::frameComplete):
3309
3310 2017-11-21  Commit Queue  <commit-queue@webkit.org>
3311
3312         Unreviewed, rolling out r225089.
3313         https://bugs.webkit.org/show_bug.cgi?id=179937
3314
3315         This patch caused compilation failures (Requested by fredw on
3316         #webkit).
3317
3318         Reverted changeset:
3319
3320         "Async frame scrolling: handle fixed root backgrounds in
3321         frames"
3322         https://bugs.webkit.org/show_bug.cgi?id=176261
3323         https://trac.webkit.org/changeset/225089
3324
3325 2017-11-21  Frederic Wang  <fwang@igalia.com>
3326
3327         Async frame scrolling: handle fixed root backgrounds in frames
3328         https://bugs.webkit.org/show_bug.cgi?id=176261
3329
3330         Based on patch by Simon Fraser <simon.fraser@apple.com>
3331         Reviewed by Antonio Gomes.
3332
3333         For frames with tiled backing, we register a slow-repaint object because we hit
3334         RenderElement::styleWillChange() before we've made a backing for the iframe's RenderView so
3335         view().compositor().supportsFixedRootBackgroundCompositing() returns false. This patch
3336         ensures that this object is removed when setBackgroundLayerPaintsFixedRootBackground is
3337         called. It also removes the opaque background of non-main frames with tiled backing.
3338         This fixes a possible hit of ASSERT(!m_backgroundLayer) after r221615.
3339
3340         Test: compositing/tiling/tiled-drawing-async-frame-scrolling.html
3341
3342         * rendering/RenderLayerBacking.cpp:
3343         (WebCore::RenderLayerBacking::updateGeometry): Do not set opaque contents for frames with
3344         tiled backing. We keep !m_isMainFrameRenderViewLayer for backward compatibility with WK1.
3345         (WebCore::RenderLayerBacking::setBackgroundLayerPaintsFixedRootBackground): Add an early
3346         return when m_backgroundLayerPaintsFixedRootBackground is not changed. Remove the slow
3347         repaint object previously registered for this frame. Also add an ASSERT to ensure that a
3348         fixed root background is only set for frames with async scrolling.
3349         (WebCore::RenderLayerBacking::updateRootLayerConfiguration): Restrict some special handling
3350         of background and opaqueness to the main frame.
3351
3352 2017-11-21  Simon Fraser  <simon.fraser@apple.com>
3353
3354         Some FELighting cleanup
3355         https://bugs.webkit.org/show_bug.cgi?id=179924
3356
3357         Reviewed by Sam Weinig.
3358
3359         Make the normal-computation functions const and have them return an IntSize.
3360         Replace bit shifting with multiply by two (compilers know how to do this, folks).
3361
3362         * platform/graphics/filters/FELighting.cpp:
3363         (WebCore::FELighting::LightingData::topLeftNormal const):
3364         (WebCore::FELighting::LightingData::topRowNormal const):
3365         (WebCore::FELighting::LightingData::topRightNormal const):
3366         (WebCore::FELighting::LightingData::leftColumnNormal const):
3367         (WebCore::FELighting::LightingData::interiorNormal const):
3368         (WebCore::FELighting::LightingData::rightColumnNormal const):
3369         (WebCore::FELighting::LightingData::bottomLeftNormal const):
3370         (WebCore::FELighting::LightingData::bottomRowNormal const):
3371         (WebCore::FELighting::LightingData::bottomRightNormal const):
3372         (WebCore::FELighting::inlineSetPixel):
3373         (WebCore::FELighting::setPixel):
3374         (WebCore::FELighting::platformApplyGenericPaint):
3375         (WebCore::FELighting::drawLighting):
3376         (WebCore::FELighting::LightingData::topLeft): Deleted.
3377         (WebCore::FELighting::LightingData::topRow): Deleted.
3378         (WebCore::FELighting::LightingData::topRight): Deleted.
3379         (WebCore::FELighting::LightingData::leftColumn): Deleted.
3380         (WebCore::FELighting::LightingData::interior): Deleted.
3381         (WebCore::FELighting::LightingData::rightColumn): Deleted.
3382         (WebCore::FELighting::LightingData::bottomLeft): Deleted.
3383         (WebCore::FELighting::LightingData::bottomRow): Deleted.
3384         (WebCore::FELighting::LightingData::bottomRight): Deleted.
3385         * platform/graphics/filters/FELighting.h:
3386
3387 2017-11-21  Christopher Reid  <chris.reid@sony.com>
3388
3389         [PAL] Remove FileSystem's dependency on WebCoreNSStringExtras
3390         https://bugs.webkit.org/show_bug.cgi?id=179504
3391
3392         Reviewed by Darin Adler.
3393
3394         No new tests no change in behavior.
3395
3396         Removed WebCoreNSStringExtras.
3397         Replaced calls to string helpers in WebCoreNSStringExtras with calls to WTF::String.
3398         Moved filenameByFixingIllegalCharacters into LoaderNSURLExtras.
3399         Moved preferredBundleLocalizationName into WebKitLegacy.
3400
3401         * PlatformMac.cmake: Removed WebCoreNSStringExtras.mm
3402         * SourcesCocoa.txt: Removed WebCoreNSStringExtras.mm
3403         * WebCore.xcodeproj/project.pbxproj: Removed WebCoreNSStringExtras
3404         * loader/mac/LoaderNSURLExtras.h:
3405         * loader/mac/LoaderNSURLExtras.mm:
3406         * platform/graphics/mac/FontCacheMac.mm:
3407         * platform/mac/PasteboardMac.mm:
3408         * platform/mac/WebCoreNSURLExtras.mm:
3409
3410 2017-11-21  Simon Fraser  <simon.fraser@apple.com>
3411
3412         Use vImage to do alpha premultiplication/unpremultiplication in FilterEffect
3413         https://bugs.webkit.org/show_bug.cgi?id=179928
3414
3415         Reviewed by Tim Horton.
3416
3417         The vImage functions are about twice as fast as the existing code.
3418
3419         * platform/graphics/filters/FilterEffect.cpp:
3420         (WebCore::copyPremultiplyingAlpha):
3421         (WebCore::copyUnpremultiplyingAlpha):
3422         (WebCore::FilterEffect::copyUnmultipliedImage):
3423         (WebCore::FilterEffect::copyPremultipliedImage):
3424
3425 2017-11-21  Carlos Garcia Campos  <cgarcia@igalia.com>
3426
3427         [GLIB] Test FileMonitorTest.DetectChangeAndThenDelete sometimes crashes
3428         https://bugs.webkit.org/show_bug.cgi?id=179909
3429
3430         Reviewed by Michael Catanzaro.
3431
3432         The problem sems to be that the GFileMonitor is created in the main thread, but destroyed in the WorkQueue
3433         thread. We can create the monitor in the WorkQueue thread and do the monitoring there.
3434
3435         Fixes unit test FileMonitorTest.DetectChangeAndThenDelete.
3436
3437         * platform/glib/FileMonitorGLib.cpp:
3438         (WebCore::FileMonitor::FileMonitor): Create the GFileMonitor in the WorkQueue.
3439         (WebCore::FileMonitor::didChange): No need to dispatch the handler in the WorkQueue, since this is now called in
3440         the WorkQueue.
3441
3442 2017-11-21  Zan Dobersek  <zdobersek@igalia.com>
3443
3444         [Cairo] drawNativeImage(), drawPattern() in CairoOperations should operate directly with cairo_surface_t objects
3445         https://bugs.webkit.org/show_bug.cgi?id=179888
3446
3447         Reviewed by Carlos Garcia Campos.
3448
3449         Cairo::drawNativeImage() should receive a valid cairo_surface_t pointer
3450         and work with that, instead of using a NativeImagePtr. Callers are thus
3451         forced to pass the pointer into the drawNativeImage() call, and the
3452         CairoOperations implementation file drops the need to know about the
3453         NativeImagePtr type alias.
3454
3455         Cairo::drawPattern() now accepts pointer to the cairo_surface_t object,
3456         along with an IntSize object that descibes the surface's size. This way
3457         it's up to the caller to retrieve any valid native image for the current
3458         frame and pass that to the drawPattern() call. The need to use IntSize
3459         here is strange, but we should investigate this later.
3460
3461         No new tests -- no change in behavior.
3462
3463         * platform/graphics/cairo/CairoOperations.cpp:
3464         (WebCore::Cairo::drawNativeImage):
3465         (WebCore::Cairo::drawPattern):
3466         * platform/graphics/cairo/CairoOperations.h: Include the Cairo header.
3467         Also fix forward declaration of Cairo::drawGlyphs().
3468         * platform/graphics/cairo/GraphicsContextCairo.cpp:
3469         (WebCore::GraphicsContext::drawNativeImage):
3470         (WebCore::GraphicsContext::drawPattern):
3471         * platform/graphics/cairo/NativeImageCairo.cpp:
3472         (WebCore::drawNativeImage): Execute operation through GraphicsContext,
3473         kicking into effect any recording that could be done this way.
3474
3475 2017-11-21  Zan Dobersek  <zdobersek@igalia.com>
3476
3477         [Cairo] Gradient::fill() should only operate on PlatformContextCairo
3478         https://bugs.webkit.org/show_bug.cgi?id=179887
3479
3480         Reviewed by Carlos Garcia Campos.
3481
3482         In Gradient::fill(), directly invoke Cairo::save() and Cairo::restore(),
3483         instead of doing so indirectly through GraphicsContext::save() and
3484         GraphicsContext::restore(). The latter pair stashes the internal state
3485         that's managed in GraphicsContext, but that doesn't get modified at all
3486         in this case.
3487
3488         No new tests -- no change in behavior.
3489
3490         * platform/graphics/cairo/GradientCairo.cpp:
3491         (WebCore::Gradient::fill):
3492
3493 2017-11-21  Frederic Wang  <fwang@igalia.com>
3494
3495         Remove unintentionally committed .orig file.
3496         https://bugs.webkit.org/show_bug.cgi?id=174131
3497
3498         Unreviewed, fix previous commit.
3499
3500         * rendering/mathml/RenderMathMLScripts.cpp.orig: Removed.
3501
3502 2017-11-21  Frederic Wang  <fwang@igalia.com>
3503
3504         ASSERTION FAILED: !needsLayout() in WebCore::RenderMathMLScripts::firstLineBaseline
3505         https://bugs.webkit.org/show_bug.cgi?id=174131
3506
3507         Reviewed by Alejandro G. Castro.
3508
3509         RenderMathMLScripts::firstLineBaseline() has an ASSERT at the beginning to ensure that the function
3510         is called after the element was laid out. However, this is not respected by HTML table layout as
3511         RenderBlock::firstLineBaseline() is called for elements in a table cell before they are laid out.
3512         This happens for example for RenderGrid::firstLineBaseline() and probably for other renderers.
3513         Additionally, RenderMathMLScripts::firstLineBaseline() only involves calling firstLineBaseline();
3514         logicalTop() or logicalHeight() on the first child box so it is safe to call it before layout, even
3515         if the return value might be wrong at that time. This patch removes this too restrictive ASSERT for
3516         RenderMathMLScripts, for consistency with other implementations of firstLineBaseline().
3517
3518         Test: mathml/cells-and-scripts-crash.html
3519
3520         * rendering/mathml/RenderMathMLScripts.cpp:
3521         (WebCore::RenderMathMLScripts::firstLineBaseline const): Remove the ASSERT.
3522
3523 2017-11-20  Mario Sanchez Prada  <mario@endlessm.com>
3524
3525         [GTK] New API to add, retrieve and delete cookies via WebKitCookieManager
3526         https://bugs.webkit.org/show_bug.cgi?id=177932
3527
3528         Reviewed by Carlos Garcia Campos.
3529
3530         Implemented setCookie(), getCookies() and deleteCookie() in the Soup
3531         backend, and refactored some utility functions and conversions out of
3532         NetworkStorageSessionSoup into a new CookieSoup.cpp file, so
3533         that we now can convert between SoupCookie* and WebCore::Cookie
3534         easily from anywhere (this is now needed from the UI Process).
3535
3536         * platform/Cookie.h: Add declarations for the new conversions.
3537         * platform/SourcesSoup.txt: Add CookieSoup.cpp.
3538         * platform/network/soup/CookieSoup.cpp: Added.
3539         (WebCore::Cookie::Cookie): New constructor, creates a WebCore::Cookie out of a SoupCookie*.
3540         (WebCore::msToSoupDate): Moved from NetworkStorageSessionSoup.cpp.
3541         (WebCore::Cookie::toSoupCookie): New, based on toSoupCookie() from NetworkStorageSessionSoup.cpp.
3542         * platform/network/soup/NetworkStorageSessionSoup.cpp:
3543         (WebCore::NetworkStorageSession::setCookies): Used the new implicit conversion.
3544         (WebCore::NetworkStorageSession::setCookie): Newly implemented.
3545         (WebCore::NetworkStorageSession::deleteCookie): Newly implemented.
3546         (WebCore::NetworkStorageSession::getCookies): Newly implemented.
3547
3548 2017-11-20  Zalan Bujtas  <zalan@apple.com>
3549
3550         Remove slow repaint object from FrameView when style changes.
3551         https://bugs.webkit.org/show_bug.cgi?id=179871
3552
3553         Reviewed by Antti Koivisto.
3554
3555         The "oldStyleSlowScroll" value does not need to be computed. We already know its value
3556         by checking the HashSet. This code is also unnecessarily complicated and error prone
3557         (could lead to UAF errors by leaving stale renderers in the slow paint list).
3558
3559         Test: fast/repaint/slow-repaint-object-crash.html
3560
3561         * rendering/RenderElement.cpp:
3562         (WebCore::RenderElement::styleWillChange):
3563
3564 2017-11-20  Carlos Alberto Lopez Perez  <clopez@igalia.com>
3565
3566         [WPE] GLContextEGLWPE.cpp:44:96: error: invalid cast from type ‘GLNativeWindowType {aka long long unsigned int}’ to type ‘EGLNativeWindowType {aka unsigned int}
3567         https://bugs.webkit.org/show_bug.cgi?id=179511
3568
3569         Reviewed by Žan Doberšek.
3570
3571         r217208 changed the definition of GLNativeWindowType from EGLNativeWindowType to uint64_t for platform WPE.
3572         This built fine on a 64-bit platform since uint64_t matches the size of a pointer, but fails on 32-bits.
3573
3574         This switches back the definition to EGLNativeWindowType.
3575         And we need to include <EGL/eglplatform.h> first in order to get a definition for EGLNativeWindowType itself.
3576
3577         This commit pretty much reverts the changes r217208 did on platform/graphics/GLContext.h
3578
3579         No new tests, it is a build fix.
3580
3581         * platform/graphics/GLContext.h:
3582
3583 2017-11-20  Michael Catanzaro  <mcatanzaro@igalia.com>
3584
3585         Remove ENABLE_ALLINONE_BUILD option
3586         https://bugs.webkit.org/show_bug.cgi?id=179823
3587
3588         Reviewed by Darin Adler.
3589
3590         * CMakeLists.txt:
3591
3592 2017-11-20  Emilio Cobos Álvarez  <emilio@crisal.io>
3593
3594         Incorrect computed style in pseudo-elements with display: contents
3595         https://bugs.webkit.org/show_bug.cgi?id=179812
3596
3597         Reviewed by Antti Koivisto.
3598
3599         Bug 178513 gave them an anon renderer as the main renderer. Unfortunately, the
3600         style of that box is exposed via getComputedStyle, so that needs to be handled
3601         somehow to return the correct style.
3602
3603         Tests: imported/w3c/web-platform-tests/cssom/getComputedStyle-pseudo.html
3604
3605         * css/CSSComputedStyleDeclaration.cpp:
3606         (WebCore::ComputedStyleExtractor::styledRenderer const):
3607           Don't return a display: contents pseudo anon box.
3608         * dom/Element.cpp:
3609         (WebCore::Element::hasDisplayContents const):
3610           Just look at the rare data style.
3611         (WebCore::Element::existingComputedStyle const):
3612           Look at the rare data first. This also fixes an inefficiency in the
3613           sense that before then we'd compare the anon box style to the
3614           pseudo-element style during style update, that may be more changes
3615           than needed.
3616         * style/RenderTreeUpdaterGeneratedContent.cpp:
3617         (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement):
3618         * style/StyleTreeResolver.cpp:
3619         (WebCore::Style::TreeResolver::resolvePseudoStyle):
3620           Move the anon box creation to render tree update instead of style
3621           resolution.
3622
3623 2017-11-19  Tim Horton  <timothy_horton@apple.com>
3624
3625         Remove unused TOUCH_ICON_LOADING feature flag
3626         https://bugs.webkit.org/show_bug.cgi?id=179873
3627
3628         Reviewed by Simon Fraser.
3629
3630         * Configurations/FeatureDefines.xcconfig:
3631
3632 2017-11-19  Tim Horton  <timothy_horton@apple.com>
3633
3634         Remove unused LEGACY_VENDOR_PREFIXES feature flag
3635         https://bugs.webkit.org/show_bug.cgi?id=179872
3636
3637         Reviewed by Darin Adler.
3638
3639         * Configurations/FeatureDefines.xcconfig:
3640
3641 2017-11-18  Darin Adler  <darin@apple.com>
3642
3643         Eliminate some cases of double hashing, other related refactoring
3644         https://bugs.webkit.org/show_bug.cgi?id=179867
3645
3646         Reviewed by Sam Weinig.
3647
3648         * Modules/indexeddb/IDBTransaction.cpp:
3649         (WebCore::IDBTransaction::objectStore): Use get instead of find.
3650
3651         * Modules/mediasource/MediaSourceRegistry.cpp:
3652         (WebCore::MediaSourceRegistry::unregisterURL): Use take instead of find/remove.
3653
3654         * accessibility/AXObjectCache.cpp:
3655         (WebCore::AXObjectCache::~AXObjectCache): Call setAXObjectID instead of
3656         using the removeAXID, which doesn't do anything else useful in the destructor.
3657         (WebCore::AXObjectCache::remove): Use take instead of get/remove. Also rearrange
3658         logic to eliminate the removeAXID function.
3659         (WebCore::AXObjectCache::removeAXID): Deleted. This only did two things,
3660         setAXObjectID(0) and remove from m_idsInUse, and was only called in one place
3661         besides the destructor. Clearer to not have this funtion.
3662         (WebCore::AXObjectCache::visiblePositionForTextMarkerData): Use m_idsInUse
3663         directly instead of using a function.
3664
3665         * accessibility/AXObjectCache.h: Deleted removeAXID and isIDinUse.
3666
3667         * dom/Document.cpp:
3668         (WebCore::Document::removedLastRef): Call UserActionElementSet::clear instead
3669         of UserActionElementSet::documentDidRemoveLastRef; new name fo the same function.
3670         (WebCore::Document::updateHoverActiveState): Use a reference when calling
3671         setInActiveChain.
3672
3673         * dom/Element.cpp:
3674         (WebCore::Element::isUserActionElementInActiveChain const): Pass reference
3675         instead of pointer.
3676         (WebCore::Element::isUserActionElementActive const): Ditto.
3677         (WebCore::Element::isUserActionElementFocused const): Ditto.
3678         (WebCore::Element::isUserActionElementHovered const): Ditto.
3679         (WebCore::Element::setActive): Ditto.
3680         (WebCore::Element::setFocus): Ditto.
3681         (WebCore::Element::setHovered): Ditto.
3682         (WebCore::Element::clearHoverAndActiveStatusBeforeDetachingRenderer): Ditto.
3683
3684         * dom/GenericEventQueue.cpp:
3685         (WebCore::GenericEventQueue::resume): Removed unneeded speical case for
3686         empty vector.
3687
3688         * dom/ProcessingInstruction.cpp:
3689         (WebCore::ProcessingInstruction::checkStyleSheet): Updated now that
3690         parseAttributes returns an optional instead of using a boolean "OK" out argument.
3691
3692         * dom/SelectorQuery.cpp:
3693         (WebCore::SelectorQueryCache::add): Use get instead of find.
3694
3695         * dom/UserActionElementSet.cpp:
3696         (WebCore::UserActionElementSet::didDetach): Deleted. Moved to class definition and
3697         named clearActiveAndHovered.
3698         (WebCore::UserActionElementSet::clear): Renamed documentDidRemoveLastRef to clear.
3699         (WebCore::UserActionElementSet::hasFlag const): Renamed from hasFlags and also
3700         take reference and enumeration instead of pointer and unsigned. Makes it clearer
3701         this does not allow null and that it works on a single flag, not a set of flags.
3702         (WebCore::UserActionElementSet::clearFlags): Changed argument types to reference
3703         and OptionSet to make it clear this works on a set of flags.
3704         (WebCore::UserActionElementSet::setFlags): Ditto.
3705
3706         * dom/UserActionElementSet.h: Updated for changes above. Also made some name
3707         changes, and used an enum class instead of an enum.
3708
3709         * html/BaseCheckableInputType.cpp:
3710         (WebCore::BaseCheckableInputType::saveFormControlState const): Updated since
3711         FormControlState is now just a vector, not a class.
3712         * html/FileInputType.cpp:
3713         (WebCore::FileInputType::filesFromFormControlState): Ditto.
3714         (WebCore::FileInputType::restoreFormControlState): Removed unneeded check that
3715         valueSize is a multiple of 2. Code will ignore any extra strings at the end, so
3716         there is no need for the validity check.
3717
3718         * html/FormController.cpp:
3719         (WebCore::serializeFormControlStateTo): Made a non-member function since
3720         FormControlState is now just a vector, not a class.
3721         (WebCore::deserializeFormControlState): Ditto. Also return optional instead
3722         of relying on a special failure state.
3723         (WebCore::SavedFormState::deserialize): Updated for above changes.
3724         (WebCore::SavedFormState::serializeTo const): Ditto.
3725         (WebCore::SavedFormState::appendControlState): Use add instead of both find and add
3726         to avoid double hashing.
3727         (WebCore::SavedFormState::takeControlState): Removed unneeded check for empty
3728         hash table and tweaked coding style.
3729         (WebCore::SavedFormState::referencedFilePaths const): Renamed to remove "get".
3730         (WebCore::FormKeyGenerator::formKey): Use ensure instead of find and add.
3731         (WebCore::FormController::formElementsCharacterCount const): Don't call
3732         saveFormControlState for non-text-form-controls since we ignored those values.
3733         (WebCore::FormController::willDeleteForm): Take a reference.
3734         (WebCore::FormController::restoreControlStateFor): Update since FormControlState
3735         is now a vector.
3736         (WebCore::FormController::restoreControlStateIn): Use is/downcast and update
3737         since FormControlState is now a vector.
3738         (WebCore::FormController::referencedFilePaths): Renamed to remove "get".
3739         (WebCore::FormController::registerFormElementWithState):Take a reference.
3740         (WebCore::FormController::unregisterFormElementWithState): Ditto.
3741
3742         * html/FormController.h: Removed FormControlState class since it was just a
3743         Vector<String> with various unneeded features, such as a "failure" state,
3744         and a never-looked-at type of "skip" or "restore". Updated for other changes
3745         above.
3746
3747         * html/HTMLFormControlElementWithState.cpp:
3748         (WebCore::HTMLFormControlElementWithState::insertedIntoAncestor): Pass reference.
3749         (WebCore::HTMLFormControlElementWithState::removedFromAncestor): Ditto.
3750         * html/HTMLFormControlElementWithState.h: Updated for the above. Also added
3751         support for using is/downcast on this.
3752
3753         * html/HTMLFormElement.cpp:
3754         (WebCore::HTMLFormElement::~HTMLFormElement): Pass reference.
3755
3756         * html/HTMLSelectElement.cpp:
3757         (WebCore::HTMLSelectElement::saveFormControlState const): Use reserveInitialCapacit
3758         and uncheckedAppend.
3759         (WebCore::HTMLSelectElement::restoreFormControlState): Updated since state is now
3760         a vector.
3761         * html/HTMLTextAreaElement.cpp:
3762         (WebCore::HTMLTextAreaElement::saveFormControlState const): Ditto.
3763         * html/HiddenInputType.cpp:
3764         (WebCore::HiddenInputType::saveFormControlState const): Ditto.
3765         * html/InputType.cpp:
3766         (WebCore::InputType::saveFormControlState const): Ditto.
3767
3768         * inspector/agents/InspectorCSSAgent.cpp:
3769         (WebCore::InspectorCSSAgent::forcePseudoState): Use get instead of find/end and got
3770         rid of uneeded special case. In another overload, ue add and remove instead of
3771         a find followed by a set or a remove.
3772         (WebCore::InspectorCSSAgent::asInspectorStyleSheet): Use ensure instead of find/set.
3773         (WebCore::InspectorCSSAgent::didRemoveDOMNode): Use take instead of find/remove.
3774         (WebCore::InspectorCSSAgent::didModifyDOMAttr): Use get instead of find.
3775         * inspector/agents/InspectorCSSAgent.h: Removed unneeded NodeToInspectorStyleSheet
3776         typedef and changed value type to Ref instead of RefPtr.
3777
3778         * inspector/agents/InspectorDOMAgent.cpp:
3779         (WebCore::InspectorDOMAgent::unbind): Use remove instead of contains/remove.
3780         (WebCore::InspectorDOMAgent::nodeForId): Use isValidKey instead of just checking for
3781         0 and use get instead of find.
3782         (WebCore::InspectorDOMAgent::setAttributesAsText): Take out bogus const.
3783         (WebCore::InspectorDOMAgent::moveTo): Ditto.
3784         (WebCore::InspectorDOMAgent::resolveNode): Ditto.
3785         (WebCore::InspectorDOMAgent::isWhitespace): Added FIXME. Use is<Text> instead of
3786         slower nodeType.
3787         * inspector/agents/InspectorDOMAgent.h: Removed bogus const.
3788
3789         * inspector/agents/InspectorLayerTreeAgent.cpp:
3790         (WebCore::InspectorLayerTreeAgent::bind): Use ensure instead of get/set.
3791         (WebCore::InspectorLayerTreeAgent::unbind): Use take instead of find/remove.
3792         (WebCore::InspectorLayerTreeAgent::bindPseudoElement): Use ensure instead of get/set.
3793         (WebCore::InspectorLayerTreeAgent::unbindPseudoElement): Use take instead of
3794         find/remove.
3795
3796         * inspector/agents/InspectorPageAgent.cpp:
3797         (WebCore::InspectorPageAgent::getCookies): Use add instead of contains/add.
3798         (WebCore::InspectorPageAgent::frameDetached): Use take instead of find/remove.
3799         (WebCore::InspectorPageAgent::frameId): Use ensure instead of get/set.
3800         (WebCore::InspectorPageAgent::loaderId): Use ensure instead of get/set.
3801         (WebCore::InspectorPageAgent::findFrameWithSecurityOrigin): Got rid of unneeded
3802         local variable.
3803
3804         * loader/cache/CachedResourceLoader.cpp:
3805         (WebCore::CachedResourceLoader::sessionID const): Tweaked coding style and added
3806         a null check for page.
3807         (WebCore::CachedResourceLoader::requestResource): Call page directly on the frame
3808         instead of first getting the main frame. Also use take instead of find/remove.
3809         (WebCore::CachedResourceLoader::removeCachedResource): Rewrite assertion.
3810
3811         * platform/graphics/FontGenericFamilies.cpp:
3812         (WebCore::setGenericFontFamilyForScript): Use remove instead of find/remove.
3813         Simplified the logic a bit in the add case.
3814
3815         * platform/graphics/ca/GraphicsLayerCA.cpp:
3816         (WebCore::GraphicsLayerCA::pauseAnimation): Use add instead of find/add.
3817         Removed code that said "if (action != Remove) action = Pause" since that is a
3818         no-op; there are only two actions, Remove and Pause.
3819
3820         * rendering/RenderThemeMac.mm:
3821         (WebCore::RenderThemeMac::mediaControlsScript): Use makeString instead of StringBuilder.
3822         (WebCore::RenderThemeMac::systemColor const): Rewrote to use ensure instead of add.
3823         Also crunched the code a little.
3824
3825         * testing/Internals.cpp:
3826         (WebCore::Internals::getReferencedFilePaths const): Updated function name.
3827
3828         * xml/parser/XMLDocumentParser.h: Updated for change below.
3829         * xml/parser/XMLDocumentParserLibxml2.cpp:
3830         (WebCore::attributesStartElementNsHandler): Updated to use std::optional instead of
3831         a separate boolean for AttributeParseState.
3832         (WebCore::parseAttributes): Ditto. Also changed the return value to work the same way.
3833
3834 2017-11-19  Sam Weinig  <sam@webkit.org>
3835
3836         Clean up gradient code in preparation for conic gradients
3837         https://bugs.webkit.org/show_bug.cgi?id=179595
3838
3839         Reviewed by Darin Adler.
3840
3841         - Switches Gradient to use a Varient with type specific data structs and makes the 
3842           points / radii immutable.
3843         - Replaces CSSGradientValue::addStops with template function CSSGradientValue::computeStops
3844           which dispatches to a helper adoptor struct which is passed in for gradient type specific
3845           values, rather than switching on type in the function itself. In addition, the function no
3846           longer mutates a Gradient, but rather mutates type specific the data struct (e.g. Linear or
3847           Radial for now).
3848
3849         * css/CSSGradientValue.cpp:
3850         (WebCore::LinearGradientAdaptor::LinearGradientAdaptor):
3851         (WebCore::RadialGradientAdaptor::RadialGradientAdaptor):
3852
3853             Add helper structs for the now templatized CSSGradientValue::computeStops that
3854             implement type specific functionality.
3855
3856         (WebCore::CSSGradientValue::computeStops):
3857         
3858             Renamed from addStops. Now takes a GradientAdaptor wrapper which abstracts out
3859             the gradient type specific functionlity.
3860         
3861         (WebCore::CSSLinearGradientValue::createGradient):
3862         (WebCore::CSSRadialGradientValue::createGradient):
3863         (WebCore::CSSConicGradientValue::createGradient):
3864         
3865             Update to call computeStops and use new Gradient create function. 
3866         
3867         * css/CSSGradientValue.h:
3868         
3869             Update for new signature for computeStops.
3870         
3871         * html/canvas/CanvasGradient.cpp:
3872         (WebCore::CanvasGradient::CanvasGradient):
3873         
3874             Update to use new Gradient create function.
3875         
3876         * inspector/InspectorCanvas.cpp:
3877         (WebCore::InspectorCanvas::buildArrayForCanvasGradient):
3878         
3879             Update to get gradient point / radii information from the data accessor.
3880
3881         * platform/graphics/Gradient.cpp:
3882         (WebCore::Gradient::Gradient):
3883         
3884             Update constructors to the new data structs.
3885         
3886         (WebCore::Gradient::type const):
3887         
3888             Add helper to get the type of the varient, need for inspector code.
3889         
3890         (WebCore::Gradient::adjustParametersForTiledDrawing):
3891         (WebCore::Gradient::isZeroSize const):
3892         (WebCore::Gradient::hash const):
3893         
3894             Update to switch on the underlying variant to get data values.
3895         
3896         (WebCore::Gradient::addColorStop):
3897         
3898             Simplify by having one addColorStop call the other.
3899             
3900         (WebCore::Gradient::setSortedColorStops):
3901         
3902             Added. Replaces setStopsSorted. Used now that CSSGradientValue computes and sorts
3903             its color stops before creating the gradient.
3904
3905         * platform/graphics/Gradient.h:
3906         (WebCore::Gradient::create):
3907         
3908             Replace create functions with ones that take data structs.
3909         
3910         (WebCore::Gradient::data const):
3911
3912             Add accessor for the underlying variant.
3913
3914         (WebCore::Gradient::isRadial const): Deleted.
3915         
3916             Replaced by type accessor.
3917         
3918         (WebCore::Gradient::p0 const): Deleted.
3919         (WebCore::Gradient::p1 const): Deleted.
3920         (WebCore::Gradient::setP0): Deleted.
3921         (WebCore::Gradient::setP1): Deleted.
3922         (WebCore::Gradient::startRadius const): Deleted.
3923         (WebC