0080e7506970e2e3fc07af740238702f5daba8b4
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-07-24  Zan Dobersek  <zdobersek@igalia.com>
2
3         [CoordinatedGraphics] Remove unused GLDefs.h header
4         https://bugs.webkit.org/show_bug.cgi?id=174712
5
6         Reviewed by Michael Catanzaro.
7
8         * platform/graphics/opengl/GLDefs.h: Remove this unused header.
9         As far as my recollection goes it was used in the IPC-based
10         CoordinatedGraphics subsystem, which has been removed already.
11
12 2017-07-11  Frederic Wang  <fwang@igalia.com>
13
14         Add attribute allow-top-navigation-by-user-activation to iframe sandbox
15         https://bugs.webkit.org/show_bug.cgi?id=171327
16
17         Reviewed by Chris Dumez.
18
19         Tests: http/tests/security/frameNavigation/sandbox-ALLOWED-top-navigation-with-user-gesture-1.html
20                http/tests/security/frameNavigation/sandbox-ALLOWED-top-navigation-with-user-gesture-2.html
21                imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_allow_top_navigation_by_user_activation_without_user_gesture-expected.txt
22                imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_allow_top_navigation-3-expected.txt
23
24         * dom/Document.cpp:
25         (WebCore::Document::canNavigate): Case 2 of conformance verification is refined to match the
26         current specification: Top navigation is allowed when it is triggered by user activation and
27         when allow-top-navigation-by-user-activation is set. Because we have additional "security
28         origin" rules with respect to the specification we also add some early return to ensure that
29         navigation is really allowed for this new case.
30         * dom/SecurityContext.cpp:
31         (WebCore::SecurityContext::isSupportedSandboxPolicy): Add allow-top-navigation-by-user-activation flag.
32         (WebCore::SecurityContext::parseSandboxPolicy): Parse the new flag to allow top user
33         navigation by user activation. Also, make sure that allow-top-navigation allows such
34         navigation as defined by the specification.
35         * dom/SecurityContext.h: Declare new sandboxing flag.
36
37 2017-07-23  Wenson Hsieh  <wenson_hsieh@apple.com>
38
39         [iOS WK2] 5 DataInteractionTests are failing: observed selection rects after dropping don't match expected values
40         https://bugs.webkit.org/show_bug.cgi?id=174769
41         <rdar://problem/33478864>
42
43         Reviewed by Tim Horton.
44
45         These tests began failing after r219541, due to a change in behavior of whether or not we call
46         setIgnoreSelectionChanges(false, RevealSelection::No) or setIgnoreSelectionChanges(false, RevealSelection::Yes)
47         when performing a text editing drop.
48
49         Before r219541, we would not reveal the selection when performing an edit drag operation. This is because in
50         WebPage::performDragControllerAction, we would begin ignoring selection changes by calling
51         setIgnoreSelectionChanges(true). However, while taking a text indicator snapshot, we would stop ignoring
52         selection in TextIndicator::createWithRange due to us calling setIgnoreSelectionChanges(false,
53         RevealSelection::No) at the end of the function. Then, when we return to the scope of
54         WebPage::performDragControllerAction and try to setIgnoreSelectionChanges(false), this is a no-op because we've
55         already stopped ignoring selection changes.
56
57         After r219541, switching to using TemporarySelectionChange means that TextIndicator::createWithRange now means
58         we respect whether or not we were already ignoring selection before taking the snapshot, so we won't always
59         setIgnoreSelectionChanges(false) at the end. This means that selection changes will now be correctly ignored
60         when performing a drag operation, but this also means that we'll try to reveal the selection, since
61         WebPage::performDragControllerAction calls setIgnoreSelectionChanges(false), for which RevealSelection::Yes
62         is used by default.
63
64         Revealing the selection in WebPage::performDragControllerAction was unintended in the first place, so we should
65         revert to calling setIgnoreSelectionChanges(false, RevealSelection::No). To ensure this, we adopt
66         TemporarySelectionChange here and pass only TemporarySelectionOptionIgnoreSelectionChanges, so that we won't
67         additionally try to reveal selection after the drop. This is consistent with behavior prior to macOS 10.13 and
68         iOS 11. Additionally, this patch also moves the call to ignore selection change from WebKit into WebCore, so
69         that whether we ignore selection is consistent across both WebKit1 and WebKit2.
70
71         * page/DragController.cpp:
72         (WebCore::DragController::performDragOperation):
73
74 2017-07-23  Chris Dumez  <cdumez@apple.com>
75
76         Drop ExceptionCodeDescription class
77         https://bugs.webkit.org/show_bug.cgi?id=174757
78
79         Reviewed by Darin Adler.
80
81         Drop ExceptionCodeDescription class now that there is only one exception
82         type: DOMException. Instead, we now have static methods on DOMException
83         to get the name / message for a given exception code.
84
85         * CMakeLists.txt:
86         * Modules/indexeddb/shared/IDBError.cpp:
87         (WebCore::IDBError::name):
88         (WebCore::IDBError::message):
89         * Modules/quota/StorageErrorCallback.cpp:
90         (WebCore::StorageErrorCallback::CallbackTask::CallbackTask):
91         * WebCore.xcodeproj/project.pbxproj:
92         * bindings/js/JSDOMExceptionHandling.cpp:
93         (WebCore::createDOMException):
94         * dom/DOMAllInOne.cpp:
95         * dom/DOMException.cpp:
96         (WebCore::errorCodeFromName):
97         (WebCore::DOMException::create):
98         (WebCore::DOMException::DOMException):
99         (WebCore::DOMException::name):
100         (WebCore::DOMException::message):
101         * dom/DOMException.h:
102         * dom/ExceptionCodeDescription.cpp: Removed.
103         * dom/ExceptionCodeDescription.h: Removed.
104         * inspector/DOMEditor.cpp:
105         (WebCore::populateErrorString):
106         * inspector/InspectorDOMAgent.cpp:
107         (WebCore::InspectorDOMAgent::toErrorString):
108         * inspector/InspectorDOMStorageAgent.cpp:
109         (WebCore::InspectorDOMStorageAgent::setDOMStorageItem):
110
111 2017-07-22  Dan Bernstein  <mitz@apple.com>
112
113         Fixed building for macOS 10.12 with the macOS 10.13 SDK after r219644.
114
115         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
116         (WebCore::CDMSessionAVStreamSession::update): Suppress the objc-literal-conversion warning
117           in one place where we are calling a class method on a Class and the compiler can’t tell
118           which class it is, so it chooses wrong and emits a warning.
119
120 2017-07-22  Chris Dumez  <cdumez@apple.com>
121
122         Merge ExceptionBase into DOMException and drop custom toString
123         https://bugs.webkit.org/show_bug.cgi?id=174755
124
125         Reviewed by Sam Weinig.
126
127         Merge ExceptionBase into DOMException and drop custom toString, now that DOMException
128         is the only remaining exception type.
129
130         * CMakeLists.txt:
131         * Modules/mediastream/MediaStream.h:
132         * WebCore.xcodeproj/project.pbxproj:
133         * bindings/js/JSDOMExceptionHandling.cpp:
134         (WebCore::retrieveErrorMessage):
135         * dom/DOMAllInOne.cpp:
136         * dom/DOMException.cpp:
137         (WebCore::DOMException::DOMException):
138         (WebCore::DOMException::initializeDescription):
139         * dom/DOMException.h:
140         (WebCore::DOMException::code):
141         (WebCore::DOMException::name):
142         (WebCore::DOMException::message):
143         * dom/ExceptionBase.cpp: Removed.
144         * dom/ExceptionBase.h: Removed.
145
146 2017-07-14  Filip Pizlo  <fpizlo@apple.com>
147
148         It should be easy to decide how WebKit yields
149         https://bugs.webkit.org/show_bug.cgi?id=174298
150
151         Reviewed by Saam Barati.
152
153         No new tests because the WebCore change is just a change to how we #include things.
154
155         * inspector/InspectorPageAgent.h:
156         * inspector/TimelineRecordFactory.h:
157         * workers/Worker.h:
158         * workers/WorkerGlobalScopeProxy.h:
159         * workers/WorkerMessagingProxy.h:
160
161 2017-07-22  Said Abou-Hallawa  <sabouhallawa@apple.com>
162
163         REGRESSION(r219045): A partially loaded image may not be repainted when its complete frame finishes decoding
164         https://bugs.webkit.org/show_bug.cgi?id=174230
165
166         Reviewed by Simon Fraser.
167
168         Because of r219045, we now only repaint the CachedImageClinets which tried
169         to draw the image but they could not because they have to wait for the image
170         decoding to finish. This was done by keeping a HashSet of these clients 
171         and make CachedImage own it. This HashSet is cleared once the image frame
172         finishes decoding and all the waited clients are repainted.
173
174         But Multiple asynchronous image decoding requests are allowed for the same
175         frame if new data is added to the image source. If we tried to draw the 
176         same image twice before it finishes decoding the first request, we will
177         not be to record this second request since the HashSet will not add the
178         same client twice. When he second request finishes decoding, CachedImage
179         will not repaint any client since its HashSet is empty.
180
181         To fix this problem we can do the following. When an image frame finishes
182         decoding, CachedImage will keep its HashSet of pending drawing clients as
183         long as the image frame is a partially loaded frame.
184
185         * loader/cache/CachedImage.cpp:
186         (WebCore::CachedImage::CachedImageObserver::imageFrameAvailable):
187         (WebCore::CachedImage::imageFrameAvailable):
188         * loader/cache/CachedImage.h:
189         * platform/graphics/BitmapImage.cpp:
190         (WebCore::BitmapImage::destroyDecodedData):
191         (WebCore::BitmapImage::dataChanged):
192         (WebCore::BitmapImage::setCurrentFrameDecodingStatusIfNecessary):
193         (WebCore::BitmapImage::draw):
194         (WebCore::BitmapImage::internalStartAnimation):
195         (WebCore::BitmapImage::internalAdvanceAnimation):
196         (WebCore::BitmapImage::imageFrameAvailableAtIndex):
197         * platform/graphics/BitmapImage.h:
198         * platform/graphics/ImageFrame.cpp:
199         (WebCore::ImageFrame::decodingStatus):
200         * platform/graphics/ImageFrame.h: Move DecodingStatus out of this class
201         to ImageTypes.h to avoid adding other header files to ImageObvsever.h
202         * platform/graphics/ImageFrameCache.cpp:
203         (WebCore::ImageFrameCache::setNativeImage):
204         (WebCore::ImageFrameCache::cacheMetadataAtIndex):
205         (WebCore::ImageFrameCache::cacheNativeImageAtIndex):
206         (WebCore::ImageFrameCache::cacheNativeImageAtIndexAsync):
207         (WebCore::ImageFrameCache::requestFrameAsyncDecodingAtIndex):
208         (WebCore::ImageFrameCache::frameDecodingStatusAtIndex):
209         * platform/graphics/ImageFrameCache.h:
210         * platform/graphics/ImageObserver.h:
211         * platform/graphics/ImageSource.h:
212         (WebCore::ImageSource::frameDecodingStatusAtIndex):
213         * platform/graphics/ImageTypes.h:
214         * platform/image-decoders/bmp/BMPImageReader.cpp:
215         (WebCore::BMPImageReader::decodeBMP):
216         * platform/image-decoders/gif/GIFImageDecoder.cpp:
217         (WebCore::GIFImageDecoder::frameComplete):
218         (WebCore::GIFImageDecoder::initFrameBuffer):
219         * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
220         (WebCore::JPEGImageDecoder::outputScanlines):
221         (WebCore::JPEGImageDecoder::jpegComplete):
222         * platform/image-decoders/png/PNGImageDecoder.cpp:
223         (WebCore::PNGImageDecoder::rowAvailable):
224         (WebCore::PNGImageDecoder::pngComplete):
225         (WebCore::PNGImageDecoder::frameComplete):
226         * platform/image-decoders/webp/WEBPImageDecoder.cpp:
227         (WebCore::WEBPImageDecoder::decode):
228         * rendering/RenderBoxModelObject.cpp:
229         (WebCore::RenderBoxModelObject::decodingModeForImageDraw):
230
231 2017-07-22  Timothy Horton  <timothy_horton@apple.com>
232
233         Drag and Drop preview image for Twitter link is the wrong shape
234         ​https://bugs.webkit.org/show_bug.cgi?id=174731
235         <rdar://problem/33335616>
236
237         * dom/Range.cpp:
238         (WebCore::Range::absoluteRectsForRangeInText):
239         * page/TextIndicator.cpp:
240         (WebCore::initializeIndicator):
241         Apply some post-landing review feedback for r219756.
242
243 2017-07-21  Chris Dumez  <cdumez@apple.com>
244
245         Drop IDBDatabaseException class
246         https://bugs.webkit.org/show_bug.cgi?id=174743
247
248         Reviewed by Darin Adler.
249
250         Drop IDBDatabaseException class and use DOMException directly. IDBDatabaseException was
251         only an internal concept and was already exposed to the Web as a DOMException. This
252         simplifies the code a bit and will allow for further simplification in a follow-up patch.
253
254         No new tests, no Web-facing behavior change, except for some exception messages
255         being slightly different.
256
257         * CMakeLists.txt:
258         * Modules/indexeddb/IDBCursor.cpp:
259         (WebCore::IDBCursor::update):
260         (WebCore::IDBCursor::advance):
261         (WebCore::IDBCursor::continuePrimaryKey):
262         (WebCore::IDBCursor::continueFunction):
263         (WebCore::IDBCursor::deleteFunction):
264         * Modules/indexeddb/IDBDatabase.cpp:
265         (WebCore::IDBDatabase::createObjectStore):
266         (WebCore::IDBDatabase::transaction):
267         (WebCore::IDBDatabase::deleteObjectStore):
268         * Modules/indexeddb/IDBDatabaseError.h: Removed.
269         * Modules/indexeddb/IDBDatabaseException.cpp: Removed.
270         * Modules/indexeddb/IDBDatabaseException.h: Removed.
271         * Modules/indexeddb/IDBFactory.cpp:
272         (WebCore::IDBFactory::cmp):
273         * Modules/indexeddb/IDBIndex.cpp:
274         (WebCore::IDBIndex::setName):
275         (WebCore::IDBIndex::openCursor):
276         (WebCore::IDBIndex::openKeyCursor):
277         (WebCore::IDBIndex::count):
278         (WebCore::IDBIndex::doCount):
279         (WebCore::IDBIndex::get):
280         (WebCore::IDBIndex::doGet):
281         (WebCore::IDBIndex::getKey):
282         (WebCore::IDBIndex::doGetKey):
283         (WebCore::IDBIndex::getAll):
284         (WebCore::IDBIndex::getAllKeys):
285         * Modules/indexeddb/IDBKeyRange.cpp:
286         (WebCore::IDBKeyRange::only):
287         (WebCore::IDBKeyRange::lowerBound):
288         (WebCore::IDBKeyRange::upperBound):
289         (WebCore::IDBKeyRange::bound):
290         (WebCore::IDBKeyRange::includes):
291         * Modules/indexeddb/IDBObjectStore.cpp:
292         (WebCore::IDBObjectStore::setName):
293         (WebCore::IDBObjectStore::openCursor):
294         (WebCore::IDBObjectStore::openKeyCursor):
295         (WebCore::IDBObjectStore::get):
296         (WebCore::IDBObjectStore::getKey):
297         (WebCore::IDBObjectStore::putOrAdd):
298         (WebCore::IDBObjectStore::doDelete):
299         (WebCore::IDBObjectStore::deleteFunction):
300         (WebCore::IDBObjectStore::clear):
301         (WebCore::IDBObjectStore::createIndex):
302         (WebCore::IDBObjectStore::index):
303         (WebCore::IDBObjectStore::deleteIndex):
304         (WebCore::IDBObjectStore::count):
305         (WebCore::IDBObjectStore::doCount):
306         (WebCore::IDBObjectStore::getAll):
307         (WebCore::IDBObjectStore::getAllKeys):
308         * Modules/indexeddb/IDBOpenDBRequest.cpp:
309         (WebCore::IDBOpenDBRequest::fireErrorAfterVersionChangeCompletion):
310         * Modules/indexeddb/IDBRequest.cpp:
311         (WebCore::IDBRequest::result):
312         (WebCore::IDBRequest::error):
313         (WebCore::IDBRequest::uncaughtExceptionInEventHandler):
314         * Modules/indexeddb/IDBTransaction.cpp:
315         (WebCore::IDBTransaction::objectStore):
316         (WebCore::IDBTransaction::abort):
317         (WebCore::IDBTransaction::abortOnServerAndCancelRequests):
318         (WebCore::IDBTransaction::didCreateIndexOnServer):
319         (WebCore::IDBTransaction::putOrAddOnServer):
320         * Modules/indexeddb/server/IndexValueStore.cpp:
321         (WebCore::IDBServer::IndexValueStore::addRecord):
322         * Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
323         (WebCore::IDBServer::MemoryIDBBackingStore::beginTransaction):
324         (WebCore::IDBServer::MemoryIDBBackingStore::abortTransaction):
325         (WebCore::IDBServer::MemoryIDBBackingStore::commitTransaction):
326         (WebCore::IDBServer::MemoryIDBBackingStore::createObjectStore):
327         (WebCore::IDBServer::MemoryIDBBackingStore::deleteObjectStore):
328         (WebCore::IDBServer::MemoryIDBBackingStore::renameObjectStore):
329         (WebCore::IDBServer::MemoryIDBBackingStore::clearObjectStore):
330         (WebCore::IDBServer::MemoryIDBBackingStore::createIndex):
331         (WebCore::IDBServer::MemoryIDBBackingStore::deleteIndex):
332         (WebCore::IDBServer::MemoryIDBBackingStore::renameIndex):
333         (WebCore::IDBServer::MemoryIDBBackingStore::deleteRange):
334         (WebCore::IDBServer::MemoryIDBBackingStore::addRecord):
335         (WebCore::IDBServer::MemoryIDBBackingStore::getRecord):
336         (WebCore::IDBServer::MemoryIDBBackingStore::getAllRecords):
337         (WebCore::IDBServer::MemoryIDBBackingStore::getIndexRecord):
338         (WebCore::IDBServer::MemoryIDBBackingStore::getCount):
339         (WebCore::IDBServer::MemoryIDBBackingStore::generateKeyNumber):
340         (WebCore::IDBServer::MemoryIDBBackingStore::openCursor):
341         (WebCore::IDBServer::MemoryIDBBackingStore::iterateCursor):
342         * Modules/indexeddb/server/MemoryIndex.cpp:
343         (WebCore::IDBServer::MemoryIndex::putIndexKey):
344         * Modules/indexeddb/server/MemoryObjectStore.cpp:
345         (WebCore::IDBServer::MemoryObjectStore::createIndex):
346         (WebCore::IDBServer::MemoryObjectStore::deleteIndex):
347         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
348         (WebCore::IDBServer::SQLiteIDBBackingStore::getOrEstablishDatabaseInfo):
349         (WebCore::IDBServer::SQLiteIDBBackingStore::beginTransaction):
350         (WebCore::IDBServer::SQLiteIDBBackingStore::abortTransaction):
351         (WebCore::IDBServer::SQLiteIDBBackingStore::commitTransaction):
352         (WebCore::IDBServer::SQLiteIDBBackingStore::createObjectStore):
353         (WebCore::IDBServer::SQLiteIDBBackingStore::deleteObjectStore):
354         (WebCore::IDBServer::SQLiteIDBBackingStore::renameObjectStore):
355         (WebCore::IDBServer::SQLiteIDBBackingStore::clearObjectStore):
356         (WebCore::IDBServer::SQLiteIDBBackingStore::createIndex):
357         (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedHasIndexRecord):
358         (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedPutIndexKey):
359         (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedPutIndexRecord):
360         (WebCore::IDBServer::SQLiteIDBBackingStore::deleteIndex):
361         (WebCore::IDBServer::SQLiteIDBBackingStore::renameIndex):
362         (WebCore::IDBServer::SQLiteIDBBackingStore::keyExistsInObjectStore):
363         (WebCore::IDBServer::SQLiteIDBBackingStore::deleteUnusedBlobFileRecords):
364         (WebCore::IDBServer::SQLiteIDBBackingStore::deleteRecord):
365         (WebCore::IDBServer::SQLiteIDBBackingStore::deleteRange):
366         (WebCore::IDBServer::SQLiteIDBBackingStore::updateAllIndexesForAddRecord):
367         (WebCore::IDBServer::SQLiteIDBBackingStore::addRecord):
368         (WebCore::IDBServer::SQLiteIDBBackingStore::getBlobRecordsForObjectStoreRecord):
369         (WebCore::IDBServer::SQLiteIDBBackingStore::getRecord):
370         (WebCore::IDBServer::SQLiteIDBBackingStore::getAllObjectStoreRecords):
371         (WebCore::IDBServer::SQLiteIDBBackingStore::getAllIndexRecords):
372         (WebCore::IDBServer::SQLiteIDBBackingStore::getIndexRecord):
373         (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedGetIndexRecordForOneKey):
374         (WebCore::IDBServer::SQLiteIDBBackingStore::getCount):
375         (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedGetKeyGeneratorValue):
376         (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedSetKeyGeneratorValue):
377         (WebCore::IDBServer::SQLiteIDBBackingStore::generateKeyNumber):
378         (WebCore::IDBServer::SQLiteIDBBackingStore::revertGeneratedKeyNumber):
379         (WebCore::IDBServer::SQLiteIDBBackingStore::maybeUpdateKeyGeneratorNumber):
380         (WebCore::IDBServer::SQLiteIDBBackingStore::openCursor):
381         (WebCore::IDBServer::SQLiteIDBBackingStore::iterateCursor):
382         * Modules/indexeddb/server/SQLiteIDBTransaction.cpp:
383         (WebCore::IDBServer::SQLiteIDBTransaction::begin):
384         (WebCore::IDBServer::SQLiteIDBTransaction::commit):
385         (WebCore::IDBServer::SQLiteIDBTransaction::abort):
386         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
387         (WebCore::IDBServer::UniqueIDBDatabase::performCurrentOpenOperation):
388         (WebCore::IDBServer::UniqueIDBDatabase::deleteObjectStore):
389         (WebCore::IDBServer::UniqueIDBDatabase::renameObjectStore):
390         (WebCore::IDBServer::UniqueIDBDatabase::deleteIndex):
391         (WebCore::IDBServer::UniqueIDBDatabase::renameIndex):
392         (WebCore::IDBServer::UniqueIDBDatabase::performPutOrAdd):
393         (WebCore::IDBServer::UniqueIDBDatabase::commitTransaction):
394         (WebCore::IDBServer::UniqueIDBDatabase::abortTransaction):
395         * Modules/indexeddb/shared/IDBError.cpp:
396         (WebCore::IDBError::name):
397         (WebCore::IDBError::message):
398         (WebCore::IDBError::toDOMError):
399         * Modules/indexeddb/shared/IDBError.h:
400         (WebCore::IDBError::userDeleteError):
401         (WebCore::IDBError::isNull):
402         * WebCore.xcodeproj/project.pbxproj:
403         * bindings/js/JSDOMExceptionHandling.cpp:
404         (WebCore::createDOMException):
405
406         * dom/DOMException.cpp:
407         (WebCore::DOMException::initializeDescription):
408         Initialize description->code from using the actual error codes in the
409         coreExceptions table, instead of initializing it using |ec|. |ec| is
410         the index in the ExceptionCode enumeration and it matches the error
411         code only for legacy exceptions. New exceptions such as DataError
412         should have a code of 0. Without this change, w3c for IDB would start
413         failing.
414
415         * dom/ExceptionCodeDescription.cpp:
416         (WebCore::ExceptionCodeDescription::ExceptionCodeDescription):
417         * dom/ExceptionCodeDescription.h:
418
419 2017-07-21  Sam Weinig  <sam@webkit.org>
420
421         [WebIDL] Simplify XMLHttpRequest bindings by removing built-ins
422         https://bugs.webkit.org/show_bug.cgi?id=174740
423
424         Reviewed by Chris Dumez.
425
426         The behavior we were getting from XMLHttpRequest.js can be implemented
427         with the [CachedAttribute] extended attribute. This reduces the number
428         of JS -> C++ jumps required and makes the code more similar to other
429         bindings that need caching of an IDL any value.
430
431         * CMakeLists.txt:
432         * DerivedSources.make:
433         * xml/XMLHttpRequest.js: Removed.
434         Remove XMLHttpRequest.js.
435
436         * bindings/js/JSXMLHttpRequestCustom.cpp:
437         (WebCore::JSXMLHttpRequest::response):
438         (WebCore::JSXMLHttpRequest::retrieveResponse): Deleted.
439         * xml/XMLHttpRequest.idl:
440         Replace builtin with a [CachedAttribute] and [CustomGetter]
441         for the response property.
442
443 2017-07-21  Timothy Horton  <timothy_horton@apple.com>
444
445         Drag and Drop preview image for Twitter link is the wrong shape
446         https://bugs.webkit.org/show_bug.cgi?id=174731
447         <rdar://problem/33335616>
448
449         Reviewed by Zalan Bujtas.
450
451         TextIndicator uses Range::borderAndTextQuads and ::absoluteTextRects
452         in order to get the rects of the indicated text. Currently, these
453         functions do not respect clipping, so clipped-out text (e.g. as seen
454         inside links on Twitter) generates lots of meaningless indicated rects.
455
456         * page/TextIndicator.cpp:
457         (WebCore::estimatedBackgroundColorForRange):
458         (WebCore::hasAnyIllegibleColors):
459         Change adjustTextIndicatorDataOptionsForEstimatedColorsIfNecessary
460         to instead be hasAnyIllegibleColors, and referred to in the same place
461         as hasNonInlineOrReplacedElements, so that it follows the same
462         upgrade path (leaving textRects empty, so that it is later filled in
463         with the absoluteBoundingRect). This was a mistake in r219033, which
464         instead would end up painting all content, but filling in textRects
465         with the actual individual text rects.
466
467         This alone changes the behavior on Twitter from lots of jagged misplaced
468         rects to a too-large bounding rect. Combined with the following changes,
469         the bounding rect is reduced to the right size:
470
471         (WebCore::initializeIndicator):
472         Adopt the new Range::borderAndTextQuads and ::absoluteTextRects parameter
473         and opt-in to respecting clipping for text rects.
474
475         * dom/DOMRectList.cpp:
476         (WebCore::DOMRectList::DOMRectList):
477         * dom/DOMRectList.h:
478         (WebCore::DOMRectList::create):
479         Add a DOMRectList constructor and create() that take FloatRects, similar
480         to the one that takes FloatQuads, but without the boundingRect() calls.
481
482         * dom/Document.h:
483         * dom/Document.cpp:
484         (WebCore::Document::convertAbsoluteToClientRects):
485         Add convertAbsoluteToClientRects, similar to covertAbsoluteToClientQuads,
486         except acting on rects instead of quads.
487
488         * dom/Range.cpp:
489         (WebCore::Range::absoluteRectsForRangeInText):
490         (WebCore::Range::absoluteTextRects):
491         (WebCore::Range::getClientRects):
492         (WebCore::Range::borderAndTextRects):
493         (WebCore::Range::boundingRect):
494         (WebCore::Range::absoluteBoundingRect):
495         (WebCore::Range::borderAndTextQuads): Deleted.
496         * dom/Range.h:
497         Replace borderAndTextQuads with borderAndTextRects, because all callers
498         just ended up calling boundingBox() on the quads.
499
500         Factor absoluteRectsForRangeInText out of absoluteTextRects and
501         borderAndTextQuads, and teach it to optionally intersect the text rects
502         with their renderer's absoluteClippedOverflowRect.
503
504 2017-07-21  Per Arne Vollan  <pvollan@apple.com>
505
506         Round-tripping stroke-width styles through getComputedStyle cause the text to gain a stroke.
507         https://bugs.webkit.org/show_bug.cgi?id=174701
508         <rdar://problem/32903679>
509
510         Reviewed by Simon Fraser.
511
512         The initial value of stroke-color should be transparent, see https://www.w3.org/TR/fill-stroke-3/#stroke-color.
513         Also, there is no need to set the graphics context in text stroke mode, if the stroke color is not visible.
514
515         Test: fast/css/round-trip-stroke-width-using-computed-style.html
516
517         * rendering/TextPaintStyle.cpp:
518         (WebCore::updateGraphicsContext):
519         * rendering/style/RenderStyle.h:
520         (WebCore::RenderStyle::initialStrokeWidth):
521         (WebCore::RenderStyle::initialStrokeColor):
522         * rendering/style/StyleRareInheritedData.cpp:
523         (WebCore::StyleRareInheritedData::StyleRareInheritedData):
524
525 2017-07-21  Timothy Horton  <timothy_horton@apple.com>
526
527         Remove an inaccurate comment from RenderTextLineBoxes
528
529         * rendering/RenderTextLineBoxes.cpp:
530         (WebCore::RenderTextLineBoxes::absoluteRectsForRange):
531         This comment has been wrong for at least 4 years.
532
533 2017-07-21  Timothy Horton  <timothy_horton@apple.com>
534
535         TextIndicator::estimatedTextColorsForRange asserts inside HashSet code (inserting reserved value)
536         https://bugs.webkit.org/show_bug.cgi?id=174733
537
538         Reviewed by Wenson Hsieh.
539
540         * page/TextIndicator.cpp:
541         (WebCore::estimatedTextColorsForRange):
542         (WebCore::adjustTextIndicatorDataOptionsForEstimatedColorsIfNecessary):
543         RGBA32 isn't a valid hash key, because we have no traits that define the
544         empty or deleted values, nor do we have any bits we could feasibly
545         use -- the full range of RGBA32 is easy to reach with various colors.
546
547         Instead, hash Color directly.
548
549 2017-07-21  Nan Wang  <n_wang@apple.com>
550
551         AX: Expose form validation on iOS as hint
552         https://bugs.webkit.org/show_bug.cgi?id=174722
553         <rdar://problem/33459761>
554
555         Reviewed by Chris Fleizach.
556
557         Adding the validation message to the hint of the form control element.
558
559         Test: accessibility/ios-simulator/form-control-validation-message.html
560
561         * accessibility/AccessibilityObject.cpp:
562         (WebCore::AccessibilityObject::isShowingValidationMessage):
563         (WebCore::AccessibilityObject::validationMessage):
564         * accessibility/AccessibilityObject.h:
565         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
566         (-[WebAccessibilityObjectWrapper accessibilityHint]):
567         (-[WebAccessibilityObjectWrapper accessibilityIsShowingValidationMessage]):
568         * html/HTMLFormControlElement.cpp:
569         (WebCore::HTMLFormControlElement::isShowingValidationMessage):
570         * html/HTMLFormControlElement.h:
571
572 2017-07-21  Konstantin Tokarev  <annulen@yandex.ru>
573
574         [cmake][Mac] Unreviewed, fix linking WebKitSystemInterface
575
576         After r219560 link_directories() in PlatformXXX.cmake files does not
577         affect corresponding targets.
578
579         * PlatformMac.cmake:
580
581 2017-07-21  Sam Weinig  <sam@webkit.org>
582
583         [WebIDL] Remove the need for the side map of DeprecatedCSSOMValue roots
584         https://bugs.webkit.org/show_bug.cgi?id=174713
585
586         Reviewed by Andreas Kling.
587
588         We used to not want to bloat the size of CSSValues with a pointer to the
589         owner CSSStyleDeclaration, so, for GC purposes we need kept a mapping of
590         them on DOMWrapperWorld that only got set if a wrapper was made. Now that
591         we have DeprecatedCSSOMValue, a wrapper for CSSValue that only gets created
592         for the bindings, we no longer need the side table, and simply have the
593         DeprecatedCSSOMValue maintain a reference to the CSSStyleDeclaration.
594
595         * bindings/js/DOMWrapperWorld.h:
596         (WebCore::DOMWrapperWorld::wrappers):
597         Remove m_deprecatedCSSOMValueRoots and make m_wrappers private with a getter.
598
599         * bindings/js/JSCSSStyleDeclarationCustom.cpp:
600         (WebCore::JSCSSStyleDeclaration::getPropertyCSSValue): Deleted.
601         Remove custom implementation of getPropertyCSSValue, now that it no longer
602         needs to update m_deprecatedCSSOMValueRoots.
603
604         * bindings/js/JSDOMWindowBase.cpp:
605         (WebCore::JSDOMWindowBase::fireFrameClearedWatchpointsForWindow):
606         * bindings/js/JSDOMWrapperCache.h:
607         (WebCore::getCachedWrapper):
608         (WebCore::cacheWrapper):
609         (WebCore::uncacheWrapper):
610         * bindings/js/JSNodeCustom.cpp:
611         (WebCore::getOutOfLineCachedWrapper):
612         Use wrappers getter rather than direct member variable.
613
614         * bindings/js/JSDeprecatedCSSOMValueCustom.cpp:
615         (WebCore::JSDeprecatedCSSOMValueOwner::isReachableFromOpaqueRoots):
616         Rather than checking the side table for roots, now get the root
617         via the reference CSSStyleDeclaration.
618
619         (WebCore::JSDeprecatedCSSOMValueOwner::finalize): Deleted.
620         Remove custom finalize now that we don't have to remove ourself
621         from m_deprecatedCSSOMValueRoots.
622
623         * css/CSSStyleDeclaration.idl:
624         Remove [Custom] from getPropertyCSSValue.
625
626         * css/DeprecatedCSSOMValue.idl:
627         Remove [JSCustomFinalize].
628
629         * css/CSSComputedStyleDeclaration.cpp:
630         (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
631         * css/CSSImageValue.cpp:
632         (WebCore::CSSImageValue::createDeprecatedCSSOMWrapper):
633         * css/CSSImageValue.h:
634         * css/CSSPrimitiveValue.cpp:
635         (WebCore::CSSPrimitiveValue::createDeprecatedCSSOMPrimitiveWrapper):
636         * css/CSSPrimitiveValue.h:
637         * css/CSSStyleDeclaration.h:
638         * css/CSSValue.cpp:
639         (WebCore::CSSValue::createDeprecatedCSSOMWrapper):
640         * css/CSSValue.h:
641         * css/DeprecatedCSSOMCounter.h:
642         * css/DeprecatedCSSOMPrimitiveValue.cpp:
643         (WebCore::DeprecatedCSSOMPrimitiveValue::getCounterValue):
644         (WebCore::DeprecatedCSSOMPrimitiveValue::getRectValue):
645         (WebCore::DeprecatedCSSOMPrimitiveValue::getRGBColorValue):
646         * css/DeprecatedCSSOMPrimitiveValue.h:
647         (WebCore::DeprecatedCSSOMPrimitiveValue::create):
648         (WebCore::DeprecatedCSSOMPrimitiveValue::DeprecatedCSSOMPrimitiveValue):
649         * css/DeprecatedCSSOMRGBColor.h:
650         * css/DeprecatedCSSOMRect.h:
651         * css/DeprecatedCSSOMValue.h:
652         (WebCore::DeprecatedCSSOMValue::owner):
653         (WebCore::DeprecatedCSSOMValue::DeprecatedCSSOMValue):
654         (WebCore::DeprecatedCSSOMComplexValue::create):
655         (WebCore::DeprecatedCSSOMComplexValue::DeprecatedCSSOMComplexValue):
656         * css/DeprecatedCSSOMValueList.h:
657         (WebCore::DeprecatedCSSOMValueList::create):
658         (WebCore::DeprecatedCSSOMValueList::DeprecatedCSSOMValueList):
659         * css/PropertySetCSSStyleDeclaration.cpp:
660         (WebCore::PropertySetCSSStyleDeclaration::wrapForDeprecatedCSSOM):
661         * css/PropertySetCSSStyleDeclaration.h:
662         * svg/SVGElement.cpp:
663         (WebCore::SVGElement::getPresentationAttribute):
664         Pass owning CSSStyleDeclaration to DeprecatedCSSOMValue and derived classes.
665
666 2017-07-21  Andreas Kling  <akling@apple.com>
667
668         Use more references in event dispatch code
669         https://bugs.webkit.org/show_bug.cgi?id=174681
670
671         Reviewed by Geoffrey Garen.
672
673         Make EventListener::handleEvent() take a ScriptExecutionContext&, Event&.
674         Then make everything build again. Various null checks and assertions
675         disappear in the process.
676
677         * bindings/js/JSErrorHandler.cpp:
678         (WebCore::JSErrorHandler::handleEvent):
679         * bindings/js/JSErrorHandler.h:
680         * bindings/js/JSEventListener.cpp:
681         (WebCore::JSEventListener::initializeJSFunction):
682         (WebCore::JSEventListener::handleEvent):
683         (WebCore::eventHandlerAttribute):
684         * bindings/js/JSEventListener.h:
685         (WebCore::JSEventListener::jsFunction):
686         * bindings/js/JSLazyEventListener.cpp:
687         (WebCore::JSLazyEventListener::initializeJSFunction):
688         * bindings/js/JSLazyEventListener.h:
689         * dom/EventListener.h:
690         * dom/EventTarget.cpp:
691         (WebCore::EventTarget::fireEventListeners):
692         * html/HTMLPlugInElement.cpp:
693         (WebCore::HTMLPlugInElement::defaultEventHandler):
694         * html/ImageDocument.cpp:
695         (WebCore::ImageEventListener::handleEvent):
696         * inspector/CommandLineAPIHost.cpp:
697         (WebCore::listenerEntriesFromListenerInfo):
698         * inspector/InspectorDOMAgent.cpp:
699         (WebCore::InspectorDOMAgent::buildObjectForEventListener):
700         * inspector/InspectorIndexedDBAgent.cpp:
701         * platform/Widget.h:
702         (WebCore::Widget::handleEvent):
703         * platform/cocoa/WebPlaybackSessionModelMediaElement.h:
704         * platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
705         (WebCore::WebPlaybackSessionModelMediaElement::handleEvent):
706         * platform/cocoa/WebVideoFullscreenModelVideoElement.h:
707         * platform/cocoa/WebVideoFullscreenModelVideoElement.mm:
708         (WebVideoFullscreenModelVideoElement::handleEvent):
709         * svg/SVGTRefElement.cpp:
710         (WebCore::SVGTRefTargetEventListener::handleEvent):
711         * svg/animation/SVGSMILElement.cpp:
712         (WebCore::ConditionEventListener::handleEvent):
713         (WebCore::SVGSMILElement::handleConditionEvent):
714         * svg/animation/SVGSMILElement.h:
715
716 2017-07-21  Zalan Bujtas  <zalan@apple.com>
717
718         iBooks: Overlapping/missing content at beginning/end of paragraph.
719         https://bugs.webkit.org/show_bug.cgi?id=174717
720         <rdar://problem/33117912>
721
722         Reviewed by Simon Fraser.
723
724         By definiton simple and normal line layout should always produce the exact same lineboxes. It enables us not
725         to force repaint while swapping between these 2 line layouts.
726         However in certain cases (font size pixel rounding as an example) they don't agree on how much content fits the line and
727         that could result in missing/overlapping content due to the lack of repaint. 
728
729         Unable to test.
730
731         * rendering/RenderBlockFlow.cpp:
732         (WebCore::RenderBlockFlow::ensureLineBoxes):
733
734 2017-07-21  Chris Dumez  <cdumez@apple.com>
735
736         Drop make_dom_exceptions.pl script that we only have DOMException
737         https://bugs.webkit.org/show_bug.cgi?id=174699
738
739         Reviewed by Darin Adler.
740
741         Drop make_dom_exceptions.pl script that we only have DOMException.
742
743         * CMakeLists.txt:
744         * DerivedSources.make:
745         * WebCore.xcodeproj/project.pbxproj:
746         * WebCoreMacros.cmake:
747         * bindings/js/JSDOMExceptionHandling.cpp:
748         * css/FontFaceSet.cpp:
749         * dom/DOMAllInOne.cpp:
750         * dom/DOMExceptions.in: Removed.
751         * dom/ExceptionCodeDescription.cpp: Added.
752         (WebCore::ExceptionCodeDescription::ExceptionCodeDescription):
753         * dom/ExceptionCodeDescription.h: Added.
754         * dom/make_dom_exceptions.pl: Removed.
755         * inspector/WebInjectedScriptHost.cpp:
756         (WebCore::WebInjectedScriptHost::subtype):
757
758 2017-07-21  Said Abou-Hallawa  <sabouhallawa@apple.com>
759
760         [CG] An image should not invoke many system calls before confirming its format is supported
761         https://bugs.webkit.org/show_bug.cgi?id=174692
762
763         Reviewed by Tim Horton.
764
765         We should be careful when invoking system calls before confirming that the
766         image type is available and it is one of the whitelist formats. Otherwise
767         we will be calling the parsers of the unsupported formats.
768
769         * loader/cache/CachedImage.cpp:
770         (WebCore::CachedImage::setImageDataBuffer): The check isAllowedImageUTI()
771         is now done in ImageDecoder::encodedDataStatus() which will return Error
772         if there is an error in the data or "isAllowedImageUTI() returns false."
773
774         * platform/graphics/BitmapImage.cpp:
775         (WebCore::BitmapImage::dataChanged): Avoid calling canUseAsyncDecodingForLargeImages()
776         before confirming the image type is available and it's supported by WebKit.
777         canUseAsyncDecodingForLargeImages() tries to cache the first frame of the
778         image to know its size. Asking the ImageFrameCache to destroy its decoded
779         frames is not needed unless ImageFrameCache::decodedSize() is not zero.
780
781         * platform/graphics/cg/ImageDecoderCG.cpp:
782         (WebCore::ImageDecoder::encodedDataStatus): Avoid calling CGImageSourceGetStatus()
783         before knowing the UTI of the image. When knowing it, we call CGImageSourceGetStatus()
784         and if it returns kCGImageStatusIncomplete or kCGImageStatusComplete, we
785         check whether isAllowedImageUTI() or not. If isAllowedImageUTI() returns
786         false, return Error which will make the CachedImage cancel loading the 
787         rest of the image.
788
789 2017-07-21  Jeremy Jones  <jeremyj@apple.com>
790
791         AudioTrackPrivateMediaStreamCocoa shouldn't set AudioSession::setPreferredBufferSize
792         https://bugs.webkit.org/show_bug.cgi?id=174707
793         rdar://problem/33446809
794
795         Reviewed by Eric Carlson.
796
797         Manually tested for audio side effects.
798
799         AudioChannel::copyFrom fails when AudioChannel lengths don't match.
800
801         This happens because PlatformMediaSessionManager::updateSessionState() owns and sets
802         AudioSession::setPreferredBufferSize().
803
804         However, AudioTrackPrivateMediaStreamCocoa::createAudioUnit, when it creates an input
805         audio unit is setting AudioSession::setPreferredBufferSize() directly to its own arbitrary value.
806
807         AudioSession::setPreferredBufferSize() should be managed by the higher level 
808         PlatformMediaSessionManager, and not modified by audio unit creation, in order to keep harmony
809         within the audio pipeline.
810
811         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
812         (WebCore::AudioTrackPrivateMediaStreamCocoa::createAudioUnit):
813
814 2017-07-21  Jeremy Jones  <jeremyj@apple.com>
815
816         Noise when AudioChannel lengths don't match.
817         https://bugs.webkit.org/show_bug.cgi?id=174706
818         rdar://problem/33389856
819
820         Reviewed by Eric Carlson.
821
822         When AudioChannel lengths don't match, copyFrom() returns early leaving uninitialized data in the audio buffer.
823         This change zeros out the data, so there isn't objectionable noise sent to the speaker.
824
825         * platform/audio/AudioChannel.cpp:
826         (WebCore::AudioChannel::copyFrom):
827
828 2017-07-21  Sam Weinig  <sam@webkit.org>
829
830         [WebIDL] Make a few parameters non-nullable in inspector IDL files
831         https://bugs.webkit.org/show_bug.cgi?id=174719
832
833         Reviewed by Joseph Pecoraro.
834
835         * inspector/CommandLineAPIHost.cpp:
836         (WebCore::CommandLineAPIHost::databaseId):
837         (WebCore::CommandLineAPIHost::storageId):
838         * inspector/CommandLineAPIHost.h:
839         * inspector/CommandLineAPIHost.idl:
840         * inspector/InspectorDOMStorageAgent.cpp:
841         (WebCore::InspectorDOMStorageAgent::storageId):
842         * inspector/InspectorDOMStorageAgent.h:
843         * inspector/InspectorDatabaseAgent.cpp:
844         (WebCore::InspectorDatabaseAgent::databaseId):
845         * inspector/InspectorDatabaseAgent.h:
846         * inspector/InspectorFrontendHost.cpp:
847         (WebCore::InspectorFrontendHost::showContextMenu):
848         (WebCore::InspectorFrontendHost::dispatchEventAsContextMenuEvent):
849         * inspector/InspectorFrontendHost.h:
850         * inspector/InspectorFrontendHost.idl:
851         Remove nullability from arguments that should never be null.
852
853 2017-07-21  Brady Eidson  <beidson@apple.com>
854
855         Get rid of WebCore IconDatabase code.
856         https://bugs.webkit.org/show_bug.cgi?id=174700
857
858         Reviewed by Tim Horton.
859
860         No new tests (No behavior change).
861         
862         Tons of red.
863         Very little green.
864         No further explanation.
865
866         * CMakeLists.txt:
867         * WebCore.xcodeproj/project.pbxproj:
868         * dom/Document.cpp:
869         (WebCore::Document::implicitClose):
870         * history/HistoryItem.cpp:
871         (WebCore::HistoryItem::HistoryItem):
872         (WebCore::HistoryItem::~HistoryItem):
873         (WebCore::HistoryItem::reset):
874         (WebCore::HistoryItem::setURLString):
875         * inspector/InspectorNetworkAgent.cpp:
876         (WebCore::InspectorNetworkAgent::willSendRequest):
877         * loader/DocumentLoader.cpp:
878         (WebCore::DocumentLoader::~DocumentLoader):
879         (WebCore::DocumentLoader::startIconLoading):
880         (WebCore::DocumentLoader::iconLoadDecisionAvailable): Deleted.
881         (WebCore::iconLoadDecisionCallback): Deleted.
882         (WebCore::DocumentLoader::getIconLoadDecisionForIconURL): Deleted.
883         (WebCore::DocumentLoader::continueIconLoadWithDecision): Deleted.
884         (WebCore::iconDataCallback): Deleted.
885         (WebCore::DocumentLoader::getIconDataForIconURL): Deleted.
886         * loader/DocumentLoader.h:
887         (WebCore::DocumentLoader::linkIcons):
888         * loader/FrameLoader.cpp:
889         (WebCore::FrameLoader::FrameLoader):
890         (WebCore::FrameLoader::stop):
891         * loader/FrameLoader.h:
892         (WebCore::FrameLoader::subframeLoader):
893         (WebCore::FrameLoader::icon): Deleted.
894         * loader/FrameLoaderClient.h:
895         * loader/archive/cf/LegacyWebArchive.cpp:
896         (WebCore::LegacyWebArchive::create):
897         * loader/icon/IconController.cpp: Removed.
898         * loader/icon/IconController.h: Removed.
899         * loader/icon/IconDatabase.cpp: Removed.
900         * loader/icon/IconDatabase.h: Removed.
901         * loader/icon/IconDatabaseBase.cpp: Removed.
902         * loader/icon/IconDatabaseBase.h: Removed.
903         * loader/icon/IconDatabaseClient.h: Removed.
904         * loader/icon/IconLoader.cpp:
905         (WebCore::IconLoader::IconLoader):
906         (WebCore::IconLoader::startLoading):
907         (WebCore::IconLoader::notifyFinished):
908         * loader/icon/IconLoader.h:
909         * loader/icon/IconRecord.cpp: Removed.
910         * loader/icon/IconRecord.h: Removed.
911         * loader/icon/PageURLRecord.cpp: Removed.
912         * loader/icon/PageURLRecord.h: Removed.
913         * testing/Internals.cpp:
914         (WebCore::Internals::shortcutIconURLs):
915
916 2017-07-21  Chris Dumez  <cdumez@apple.com>
917
918         Rename DOMCoreException class to DOMException
919         https://bugs.webkit.org/show_bug.cgi?id=174698
920
921         Reviewed by Darin Adler.
922
923         Rename DOMCoreException class to DOMException to match its Web-exposed name.
924
925         * CMakeLists.txt:
926         * DerivedSources.cpp:
927         * DerivedSources.make:
928         * Modules/quota/StorageErrorCallback.cpp:
929         (WebCore::StorageErrorCallback::CallbackTask::CallbackTask):
930         * Modules/quota/StorageErrorCallback.h:
931         * Modules/quota/StorageErrorCallback.idl:
932         * WebCore.xcodeproj/project.pbxproj:
933         * bindings/js/JSDOMExceptionHandling.cpp:
934         (WebCore::retrieveErrorMessage):
935         (WebCore::createDOMException):
936         * bindings/scripts/CodeGeneratorJS.pm:
937         (GenerateOverloadDispatcher):
938         * css/FontFaceSet.cpp:
939         * css/FontFaceSet.h:
940         * dom/DOMAllInOne.cpp:
941         * dom/DOMException.cpp: Renamed from Source/WebCore/dom/DOMCoreException.cpp.
942         (WebCore::DOMException::create):
943         (WebCore::DOMException::DOMException):
944         (WebCore::DOMException::initializeDescription):
945         * dom/DOMException.h: Renamed from Source/WebCore/dom/DOMCoreException.h.
946         (WebCore::DOMException::create):
947         (WebCore::DOMException::DOMException):
948         * dom/DOMException.idl: Renamed from Source/WebCore/dom/DOMCoreException.idl.
949         * dom/DOMExceptions.in:
950         * dom/make_dom_exceptions.pl:
951         (generateImplementation):
952
953 2017-07-21  Sam Weinig  <sam@webkit.org>
954
955         Follow up to https://bugs.webkit.org/show_bug.cgi?id=174659.
956
957         * inspector/InspectorFrontendHost.idl:
958         Remove unnecessary JSGenerateToJSObject noticed in review.
959
960 2017-07-20  Chris Dumez  <cdumez@apple.com>
961
962         Drop legacy SVGException type
963         https://bugs.webkit.org/show_bug.cgi?id=174695
964
965         Reviewed by Darin Adler.
966
967         Drop legacy SVGException type and use DOMException instead, as per the latest
968         SVG specification. Both Chrome and Firefox no longer expose the SVGException
969         type.
970
971         * CMakeLists.txt:
972         * DerivedSources.cpp:
973         * DerivedSources.make:
974         * WebCore.xcodeproj/project.pbxproj:
975         * bindings/js/JSDOMExceptionHandling.cpp:
976         (WebCore::createDOMException):
977         * bindings/js/JSExceptionBase.cpp:
978         (WebCore::toExceptionBase):
979         * dom/DOMExceptions.in:
980         * svg/SVGAllInOne.cpp:
981         * svg/SVGCircleElement.cpp:
982         * svg/SVGException.cpp: Removed.
983         * svg/SVGException.h: Removed.
984         * svg/SVGException.idl: Removed.
985         * svg/SVGGraphicsElement.idl:
986         * svg/SVGLocatable.cpp:
987         (WebCore::SVGLocatable::getTransformToElement):
988         * svg/SVGMatrixValue.h:
989         * svg/SVGPathSegList.cpp:
990         (WebCore::SVGPathSegList::getItem):
991         (WebCore::SVGPathSegList::replaceItem):
992         (WebCore::SVGPathSegList::removeItem):
993         * svg/SVGPathSegList.h:
994         * svg/SVGPathSegList.idl:
995         * svg/properties/SVGAnimatedEnumerationPropertyTearOff.h:
996         * svg/properties/SVGListProperty.h:
997
998 2017-07-20  Chris Dumez  <cdumez@apple.com>
999
1000         Hook up ITP quirks to the needsSiteSpecificQuirks setting
1001         https://bugs.webkit.org/show_bug.cgi?id=174691
1002
1003         Reviewed by Darin Adler.
1004
1005         Hook up ITP quirks to the needsSiteSpecificQuirks setting to make it easier for
1006         Web-developers to test their fixes.
1007
1008         * loader/ResourceLoadObserver.cpp:
1009         (WebCore::shouldEnableSiteSpecificQuirks):
1010         (WebCore::areDomainsAssociated):
1011         (WebCore::ResourceLoadObserver::logFrameNavigation):
1012         (WebCore::resourceNeedsSSOQuirk):
1013         (WebCore::ResourceLoadObserver::logSubresourceLoading):
1014         (WebCore::ResourceLoadObserver::logWebSocketLoading):
1015
1016 2017-07-20  Matt Lewis  <jlewis3@apple.com>
1017
1018         Unreviewed, rolling out r219700.
1019
1020         This revision caused consistent timouts on iOS.
1021
1022         Reverted changeset:
1023
1024         "Turn tests at media/modern-media-controls/start-support back
1025         on"
1026         https://bugs.webkit.org/show_bug.cgi?id=174683
1027         http://trac.webkit.org/changeset/219700
1028
1029 2017-07-20  David Quesada  <david_quesada@apple.com>
1030
1031         Add SPI to notify WKNavigationDelegate about client redirects
1032         https://bugs.webkit.org/show_bug.cgi?id=174680
1033         rdar://problem/33184886
1034
1035         Reviewed by Brady Eidson.
1036
1037         * loader/FrameLoader.cpp:
1038         (WebCore::FrameLoader::performClientRedirect):
1039         * loader/FrameLoader.h:
1040         Add a convenience method for NavigationScheduler that handles a FrameLoadRequest
1041         as a client redirect. Currently this means loading the request and informing the
1042         client about it.
1043
1044         * loader/FrameLoaderClient.h:
1045         Add FrameLoaderClient::dispatchDidPerformClientRedirect() to inform the client when
1046         a client redirect occurs.
1047
1048         * loader/NavigationScheduler.cpp:
1049         Removed ScheduledURLNavigation::fire(). This class was never instantiated directly,
1050         and all subclasses override fire(), so this was unused code.
1051         For ScheduledRedirects and ScheduledLocationChange, use FrameLoader's new method to
1052         load the request as a client redirect.
1053
1054 2017-07-20  Chris Dumez  <cdumez@apple.com>
1055
1056         Drop legacy XPathException type
1057         https://bugs.webkit.org/show_bug.cgi?id=174679
1058
1059         Reviewed by Sam Weinig.
1060
1061         Drop legacy XPathException type and use DOMException instead. Both Firefox and Chrome
1062         no longer expose XPathException.
1063
1064         Test: fast/dom/DOMException/XPathException-obsolete.html
1065
1066         * CMakeLists.txt:
1067         * DerivedSources.cpp:
1068         * DerivedSources.make:
1069         * WebCore.xcodeproj/project.pbxproj:
1070         * bindings/js/JSDOMExceptionHandling.cpp:
1071         (WebCore::createDOMException):
1072         * bindings/js/JSExceptionBase.cpp:
1073         (WebCore::toExceptionBase):
1074         * dom/DOMExceptions.in:
1075         * xml/XPathException.cpp: Removed.
1076         * xml/XPathException.h: Removed.
1077         * xml/XPathException.idl: Removed.
1078         * xml/XPathExpression.cpp:
1079         (WebCore::XPathExpression::evaluate):
1080         * xml/XPathParser.cpp:
1081         (WebCore::XPath::Parser::parseStatement):
1082         * xml/XPathResult.cpp:
1083         (WebCore::XPathResult::convertTo):
1084         (WebCore::XPathResult::numberValue):
1085         (WebCore::XPathResult::stringValue):
1086         (WebCore::XPathResult::booleanValue):
1087         (WebCore::XPathResult::singleNodeValue):
1088         (WebCore::XPathResult::snapshotLength):
1089         (WebCore::XPathResult::iterateNext):
1090         (WebCore::XPathResult::snapshotItem):
1091
1092 2017-07-20  Chris Dumez  <cdumez@apple.com>
1093
1094         Unreviewed, rolling out r219706.
1095
1096         Broke iOS build
1097
1098         Reverted changeset:
1099
1100         "Drop legacy XPathException type"
1101         https://bugs.webkit.org/show_bug.cgi?id=174679
1102         http://trac.webkit.org/changeset/219706
1103
1104 2017-07-20  Chris Dumez  <cdumez@apple.com>
1105
1106         Drop legacy XPathException type
1107         https://bugs.webkit.org/show_bug.cgi?id=174679
1108
1109         Reviewed by Sam Weinig.
1110
1111         Drop legacy XPathException type and use DOMException instead. Both Firefox and Chrome
1112         no longer expose XPathException.
1113
1114         Test: fast/dom/DOMException/XPathException-obsolete.html
1115
1116         * CMakeLists.txt:
1117         * DerivedSources.cpp:
1118         * DerivedSources.make:
1119         * WebCore.xcodeproj/project.pbxproj:
1120         * bindings/js/JSDOMExceptionHandling.cpp:
1121         (WebCore::createDOMException):
1122         * bindings/js/JSExceptionBase.cpp:
1123         (WebCore::toExceptionBase):
1124         * dom/DOMExceptions.in:
1125         * xml/XPathException.cpp: Removed.
1126         * xml/XPathException.h: Removed.
1127         * xml/XPathException.idl: Removed.
1128         * xml/XPathExpression.cpp:
1129         (WebCore::XPathExpression::evaluate):
1130         * xml/XPathParser.cpp:
1131         (WebCore::XPath::Parser::parseStatement):
1132         * xml/XPathResult.cpp:
1133         (WebCore::XPathResult::convertTo):
1134         (WebCore::XPathResult::numberValue):
1135         (WebCore::XPathResult::stringValue):
1136         (WebCore::XPathResult::booleanValue):
1137         (WebCore::XPathResult::singleNodeValue):
1138         (WebCore::XPathResult::snapshotLength):
1139         (WebCore::XPathResult::iterateNext):
1140         (WebCore::XPathResult::snapshotItem):
1141
1142 2017-07-20  Chris Dumez  <cdumez@apple.com>
1143
1144         Regression(ITP): May get frequently logged out of wsj.com
1145         https://bugs.webkit.org/show_bug.cgi?id=174661
1146         <rdar://problem/32343256>
1147
1148         Reviewed by Geoffrey Garen.
1149
1150         Add the concept of associated domains in the ResourceLoadObserver. We
1151         previously ignore loads to and from the same domains. We now do the same
1152         if the to and from domains are associated (i.e. owned by the same entity).
1153
1154         For now, only add domains owned by Dow Jones & Company, Inc. to the list,
1155         to address login issues on wsj.com.
1156
1157         No new tests, verified manually on wsj.com.
1158
1159         * loader/ResourceLoadObserver.cpp:
1160         (WebCore::areDomainsAssociated):
1161         (WebCore::ResourceLoadObserver::logFrameNavigation):
1162         (WebCore::ResourceLoadObserver::logSubresourceLoading):
1163         (WebCore::ResourceLoadObserver::logWebSocketLoading):
1164
1165 2017-07-20  Chris Dumez  <cdumez@apple.com>
1166
1167         Replace calls to Vector::resize() with calls to more efficient shrink() / grow() when applicable
1168         https://bugs.webkit.org/show_bug.cgi?id=174660
1169
1170         Reviewed by Geoffrey Garen.
1171
1172         Replace calls to Vector::resize() with calls to more efficient shrink() / grow() when applicable.
1173         This essentially replaces a branch to figure out if the new size is less or greater than the
1174         current size by an assertion.
1175
1176         * Modules/gamepad/Gamepad.cpp:
1177         (WebCore::Gamepad::Gamepad):
1178         * Modules/webaudio/AudioContext.cpp:
1179         (WebCore::AudioContext::addReaction):
1180         * Modules/websockets/WebSocketChannel.cpp:
1181         (WebCore::WebSocketChannel::skipBuffer):
1182         * Modules/websockets/WebSocketDeflater.cpp:
1183         (WebCore::WebSocketDeflater::finish):
1184         * contentextensions/ContentExtensionCompiler.cpp:
1185         (WebCore::ContentExtensions::serializeSelector):
1186         * contentextensions/DFABytecodeCompiler.cpp:
1187         (WebCore::ContentExtensions::append):
1188         * crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp:
1189         (WebCore::gcryptEncrypt):
1190         (WebCore::gcryptDecrypt):
1191         * crypto/gcrypt/CryptoAlgorithmECDHGCrypt.cpp:
1192         (WebCore::gcryptDerive):
1193         * platform/gamepad/cocoa/GameControllerGamepadProvider.mm:
1194         (WebCore::GameControllerGamepadProvider::controllerDidConnect):
1195         * platform/gamepad/mac/HIDGamepadProvider.cpp:
1196         (WebCore::HIDGamepadProvider::deviceAdded):
1197         * platform/graphics/ImageBackingStore.h:
1198         (WebCore::ImageBackingStore::setSize):
1199         * platform/graphics/WOFFFileFormat.cpp:
1200         * platform/graphics/avfoundation/InbandMetadataTextTrackPrivateAVF.cpp:
1201         (WebCore::InbandMetadataTextTrackPrivateAVF::updatePendingCueEndTimes):
1202         (WebCore::InbandMetadataTextTrackPrivateAVF::flushPartialCues):
1203         * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
1204         (WebCore::InbandTextTrackPrivateAVF::resetCueValues):
1205         (WebCore::InbandTextTrackPrivateAVF::readNativeSampleBuffer):
1206         * platform/graphics/avfoundation/cf/InbandTextTrackPrivateAVCF.cpp:
1207         (WebCore::InbandTextTrackPrivateAVCF::readNativeSampleBuffer):
1208         * platform/graphics/cg/ImageBufferCG.cpp:
1209         (WebCore::cfData):
1210         * platform/image-decoders/bmp/BMPImageDecoder.cpp:
1211         (WebCore::BMPImageDecoder::frameBufferAtIndex):
1212         * platform/image-decoders/ico/ICOImageDecoder.cpp:
1213         (WebCore::ICOImageDecoder::decode):
1214         * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
1215         (WebCore::JPEGImageDecoder::frameBufferAtIndex):
1216         * platform/image-decoders/png/PNGImageDecoder.cpp:
1217         (WebCore::PNGImageDecoder::frameBufferAtIndex):
1218         (WebCore::PNGImageDecoder::readChunks):
1219         * platform/image-decoders/webp/WEBPImageDecoder.cpp:
1220         (WebCore::WEBPImageDecoder::frameBufferAtIndex):
1221         * platform/image-encoders/JPEGImageEncoder.cpp:
1222         (WebCore::compressRGBABigEndianToJPEG):
1223         * platform/text/DecodeEscapeSequences.h:
1224         (WebCore::URLEscapeSequence::decodeRun):
1225         * platform/text/SuffixTree.h:
1226         (WebCore::SuffixTree::Node::Node):
1227         * rendering/Grid.cpp:
1228         (WebCore::Grid::setNeedsItemsPlacement):
1229         * rendering/RenderTable.cpp:
1230         (WebCore::RenderTable::invalidateCachedColumns):
1231
1232 2017-07-20  Chris Dumez  <cdumez@apple.com>
1233
1234         Regression(ITP): Can no longer log in on abc.go.com
1235         https://bugs.webkit.org/show_bug.cgi?id=174533
1236         <rdar://problem/33325881>
1237
1238         Reviewed by Geoffrey Garen.
1239
1240         Add quirk for sp.auth.adobe.com which is used for SSO by web sites such as
1241         abc.go.com. This would otherwise cause adobe.com to be identified as a
1242         tracker and log in on abc.go.com would break.
1243
1244         No new tests, tested manually on abc.go.com.
1245
1246         * loader/ResourceLoadObserver.cpp:
1247         (WebCore::resourceNeedsSSOQuirk):
1248         (WebCore::ResourceLoadObserver::logSubresourceLoading):
1249
1250 2017-07-20  Antoine Quint  <graouts@apple.com>
1251
1252         Turn tests at media/modern-media-controls/start-support back on
1253         https://bugs.webkit.org/show_bug.cgi?id=174683
1254
1255         Reviewed by Dean Jackson.
1256
1257         Turning those tests back on revealed a small bug that is unlikely to really affect content
1258         on the Web. In the case where the size of the video is known right away, without the need
1259         for loading its metadata, as is the case in the start-support-click-to-start.html test with
1260         a local media resource, all queued layouts are flushed at once and we may call the layout()
1261         method of the left ButtonsContainer which originally is set to contain the play/pause button,
1262         which would remove the play/pause button from the center of the media. So before we potentially
1263         set the play/pause button as the central button, we first assign the default button set for
1264         the two ButtonsContainer instances and only add the play/pause button when we're not showing
1265         the prominent play/pause button.
1266
1267         * Modules/modern-media-controls/controls/inline-media-controls.js:
1268         (InlineMediaControls.prototype.layout):
1269         (InlineMediaControls.prototype._leftContainerButtons):
1270
1271 2017-07-20  Chris Dumez  <cdumez@apple.com>
1272
1273         Drop legacy FileException type
1274         https://bugs.webkit.org/show_bug.cgi?id=174676
1275
1276         Reviewed by Alex Christensen.
1277
1278         Drop legacy FileException type and use DOMException instead, as per the latest
1279         File API specification:
1280         - https://w3c.github.io/FileAPI/#ErrorAndException
1281
1282         Both Firefox and Chrome no longer expose FileException.
1283
1284         * CMakeLists.txt:
1285         * DerivedSources.cpp:
1286         * DerivedSources.make:
1287         * WebCore.xcodeproj/project.pbxproj:
1288         * bindings/js/JSDOMExceptionHandling.cpp:
1289         (WebCore::createDOMException):
1290         * dom/DOMExceptions.in:
1291         * fileapi/FileException.cpp: Removed.
1292         * fileapi/FileException.h: Removed.
1293         * fileapi/FileException.idl: Removed.
1294         * fileapi/FileReaderLoader.cpp:
1295         (WebCore::FileReaderLoader::FileReaderLoader):
1296         (WebCore::FileReaderLoader::failed):
1297         * fileapi/FileReaderLoader.h:
1298         (WebCore::FileReaderLoader::errorCode):
1299         * fileapi/FileReaderSync.cpp:
1300         (WebCore::errorCodeToExceptionCode):
1301         (WebCore::FileReaderSync::startLoading):
1302
1303 2017-07-20  Sam Weinig  <sam@webkit.org>
1304
1305         [WebIDL] Remove custom bindings for InspectorFrontendHost
1306         https://bugs.webkit.org/show_bug.cgi?id=174659
1307
1308         Reviewed by Chris Dumez.
1309
1310         * CMakeLists.txt:
1311         * WebCore.xcodeproj/project.pbxproj:
1312         * bindings/js/JSBindingsAllInOne.cpp:
1313         * bindings/js/JSInspectorFrontendHostCustom.cpp: Removed.
1314         Remove JSInspectorFrontendHostCustom.cpp.
1315
1316         * inspector/InspectorFrontendHost.cpp:
1317         (WebCore::populateContextMenu):
1318         (WebCore::InspectorFrontendHost::showContextMenu):
1319         * inspector/InspectorFrontendHost.h:
1320         * inspector/InspectorFrontendHost.idl:
1321         Re-implement showContextMenu by using an IDL defined ContextMenuItem dictionary
1322         and converting from that to a WebCore::ContextMenu in the implementation.
1323
1324 2017-07-20  Charlie Turner  <cturner@igalia.com>
1325
1326         [GTK] Layout Test http/tests/media/hls/hls-progress.html is failing
1327         https://bugs.webkit.org/show_bug.cgi?id=141469
1328
1329         Reviewed by Xabier Rodriguez-Calvar.
1330
1331         A work-around for getting progress information in a timely manner from
1332         live pipelines. We cannot rely on getting BUFFERING messages within
1333         the stalled time window (3s), so we have to poll for progress
1334         information somehow.
1335
1336         Makes the following pass reliably
1337          http/tests/media/hls/hls-audio-tracks-has-audio.html passed unexpectedly
1338          http/tests/media/hls/hls-audio-tracks.html passed unexpectedly
1339          http/tests/media/hls/hls-progress.html passed unexpectedly
1340
1341         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1342         (WebCore::findHLSQueue):
1343         (WebCore::isHLSProgressing):
1344         (WebCore::MediaPlayerPrivateGStreamer::fillTimerFired):
1345
1346 2017-07-20  Andreas Kling  <akling@apple.com>
1347
1348         Minor Node->Element type tightening fixes
1349         https://bugs.webkit.org/show_bug.cgi?id=174651
1350
1351         Reviewed by Sam Weinig.
1352
1353         Tighten up some Node* into Element* or even better, Element&.
1354
1355         * dom/Document.cpp:
1356         (WebCore::acceptsEditingFocus): Take a const Element&.
1357         (WebCore::Document::setFocusedElement):
1358         * editing/Editor.cpp:
1359         (WebCore::Editor::findEventTargetFrom): Return an Element*.
1360         (WebCore::Editor::findEventTargetFromSelection): Ditto.
1361         (WebCore::Editor::pasteAsPlainText):
1362         (WebCore::Editor::pasteAsFragment):
1363         (WebCore::Editor::dispatchCPPEvent):
1364         * editing/Editor.h:
1365         * page/DragController.cpp:
1366         (WebCore::DragController::dispatchTextInputEventFor):
1367
1368 2017-07-20  Brady Eidson  <beidson@apple.com>
1369
1370         WKHTTPCookieStore API tests fail on High Sierra.
1371         <rdar://problem/33410271> and https://bugs.webkit.org/show_bug.cgi?id=174666
1372
1373         Reviewed by Andy Estes.
1374
1375         Covered by existing API tests.
1376
1377         In r219567 I'd moved cookie storage observation off of NSHTTPCookieStorage and NSNotificationCenter
1378         to CFHTTPCookieStorage observation callbacks.
1379         
1380         This is because notifications were only sent for the default [NSHTTPCookieStorage sharedHTTPCookieStorage]
1381         and not any of the other ones we keep in flight.
1382         
1383         Unfortunately that SPI has been disabled in High Sierra.
1384         Fortunately we found a way we can get non-shared NSHTTPCookieStorages to send notifications that works everywhere.
1385         
1386         * platform/network/cocoa/CookieStorageObserver.h:
1387         * platform/network/cocoa/CookieStorageObserver.mm:
1388         (-[WebCookieObserverAdapter initWithObserver:]):
1389         (-[WebCookieObserverAdapter cookiesChangedNotificationHandler:]):
1390         (WebCore::CookieStorageObserver::create):
1391         (WebCore::CookieStorageObserver::CookieStorageObserver):
1392         (WebCore::CookieStorageObserver::~CookieStorageObserver):
1393         (WebCore::CookieStorageObserver::startObserving): Use a trick to call some SPI on non-shared NSHTTPCookieStorages
1394           to get them to send notifications.
1395         (WebCore::CookieStorageObserver::stopObserving):
1396         (WebCore::cookiesChanged): Deleted.
1397
1398         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
1399         (WebCore::NetworkStorageSession::cookieStorageObserver):
1400
1401 2017-07-20  Miguel Gomez  <magomez@igalia.com>
1402
1403         [GStreamer] Some layout tests issue "g_mutex_clear() called on uninitialised or locked mutex" and flaky crash in ~MediaPlayerPrivateGStreamerBase
1404         https://bugs.webkit.org/show_bug.cgi?id=173952
1405
1406         Reviewed by Carlos Garcia Campos.
1407
1408         Adjust MediaPlayerPrivateGStreamerBase to avoid concurrence problems with the GStreamer thread when
1409         destroying the object.
1410
1411         Covered by existent tests.
1412
1413         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1414         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
1415         (WebCore::MediaPlayerPrivateGStreamerBase::repaint):
1416         (WebCore::MediaPlayerPrivateGStreamerBase::cancelRepaint):
1417
1418 2017-07-19  Zan Dobersek  <zdobersek@igalia.com>
1419
1420         [EME] Push CDMInstance, CDMPrivate and associated types into the Platform layer
1421         https://bugs.webkit.org/show_bug.cgi?id=174496
1422
1423         Reviewed by Xabier Rodriguez-Calvar.
1424
1425         Move the CDMInstance and CDMPrivate interfaces into the platform layer, enabling
1426         implementations of specific key systems at that level, as well as integration with
1427         the MediaPlayerPrivate stack without any layering violations.
1428
1429         While the platform layer still uses the WebCore namespace, the two interface files
1430         have now been moved under the platform/encryptedmedia/ directory and out of the
1431         Modules/encryptedmedia/ directory where the Web-facing API implementation resides.
1432
1433         The two interfaces integrated closely with the Web-facing enumerations and
1434         dictionaries: MediaKeyMessageType, MediaKeySessionType, MediaKeyStatus,
1435         MediaKeySystemConfiguration, MediaKeySystemCapability, MediaKeysRequirement
1436         and MediaKeysRestrictions. Definitions of these types are also moved to the
1437         platform layer without any changes (apart from renaming), and the previous
1438         types now alias against the types now located in the platform layer.
1439
1440         No new tests -- no change in behavior.
1441
1442         * CMakeLists.txt:
1443         * Modules/encryptedmedia/CDM.cpp:
1444         * Modules/encryptedmedia/CDM.h:
1445         * Modules/encryptedmedia/MediaKeyMessageType.h:
1446         * Modules/encryptedmedia/MediaKeySessionType.h:
1447         * Modules/encryptedmedia/MediaKeyStatus.h:
1448         * Modules/encryptedmedia/MediaKeySystemAccess.cpp:
1449         * Modules/encryptedmedia/MediaKeySystemAccess.h:
1450         * Modules/encryptedmedia/MediaKeySystemConfiguration.h:
1451         * Modules/encryptedmedia/MediaKeySystemMediaCapability.h:
1452         * Modules/encryptedmedia/MediaKeysRequirement.h:
1453         * Modules/encryptedmedia/MediaKeysRestrictions.h:
1454         * platform/encryptedmedia/CDMInstance.h: Renamed from Source/WebCore/Modules/encryptedmedia/CDMInstance.h.
1455         * platform/encryptedmedia/CDMKeyStatus.h: Copied from Source/WebCore/Modules/encryptedmedia/MediaKeyStatus.h.
1456         * platform/encryptedmedia/CDMKeySystemConfiguration.h: Copied from Source/WebCore/Modules/encryptedmedia/MediaKeySystemConfiguration.h.
1457         * platform/encryptedmedia/CDMMediaCapability.h: Copied from Source/WebCore/Modules/encryptedmedia/MediaKeySystemMediaCapability.h.
1458         * platform/encryptedmedia/CDMMessageType.h: Copied from Source/WebCore/Modules/encryptedmedia/MediaKeyMessageType.h.
1459         * platform/encryptedmedia/CDMPrivate.h: Renamed from Source/WebCore/Modules/encryptedmedia/CDMPrivate.h.
1460         * platform/encryptedmedia/CDMRequirement.h: Copied from Source/WebCore/Modules/encryptedmedia/MediaKeysRequirement.h.
1461         * platform/encryptedmedia/CDMRestrictions.h: Copied from Source/WebCore/Modules/encryptedmedia/MediaKeysRestrictions.h.
1462         * platform/encryptedmedia/CDMSessionType.h: Copied from Source/WebCore/Modules/encryptedmedia/MediaKeySessionType.h.
1463
1464 2017-07-19  Zan Dobersek  <zdobersek@igalia.com>
1465
1466         Unreviewed follow-up to r219674.
1467
1468         * page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.cpp:
1469         Remove the AsyncScrollingCoordinator.h header include that was added by accident.
1470
1471 2017-07-19  Zan Dobersek  <zdobersek@igalia.com>
1472
1473         [CMake] Clean up Web Crypto build targets
1474         https://bugs.webkit.org/show_bug.cgi?id=174253
1475
1476         Reviewed by Alex Christensen.
1477
1478         Gather the common WebCrypto source files in CMakeLists.txt, including them
1479         in the build unconditionally and instead relying on ENABLE_SUBTLE_CRYPTO
1480         build guards to exclude the code from compilation if the feature is disabled.
1481
1482         PlatformGTK.cmake, PlatformMac.cmake and PlatformWPE.cmake can then remove
1483         duplicated build targets. PlatformMac.cmake still lists all the Mac-specific
1484         Web Crypto build targets.
1485
1486         PlatformGTK.cmake and PlatformWPE.cmake now include GCrypt.cmake if the
1487         USE_GCRYPT variable is enabled. Both ports at the moment enable that variable
1488         though as they by default leverage a libgcrypt-based CrpytoDigest implementation
1489         in the PAL library.
1490
1491         The new GCrypt.cmake file adds the libgcrypt-specific Web Crypto build targets to
1492         the build and also sets up libgcrypt include directiories and libraries.
1493
1494         No new tests -- no change in behavior.
1495
1496         * CMakeLists.txt:
1497         * PlatformGTK.cmake:
1498         * PlatformMac.cmake:
1499         * PlatformWPE.cmake:
1500         * platform/GCrypt.cmake: Added.
1501
1502 2017-07-19  Sam Weinig  <sam@webkit.org>
1503
1504         [WebIDL] Remove custom bindings for CommandLineAPIHost
1505         https://bugs.webkit.org/show_bug.cgi?id=174642
1506
1507         Reviewed by Joseph Pecoraro.
1508
1509         * CMakeLists.txt:
1510         * WebCore.xcodeproj/project.pbxproj:
1511         * bindings/js/JSBindingsAllInOne.cpp:
1512         * bindings/js/JSCommandLineAPIHostCustom.cpp: Removed.
1513         Remove JSCommandLineAPIHostCustom.cpp.
1514
1515         * bindings/js/JSDOMConvertObject.h:
1516         (WebCore::JSConverter<IDLObject>::convert):
1517         Add missing JSConverter specialization for IDLObject.
1518
1519         * inspector/CommandLineAPIHost.cpp:
1520         (WebCore::CommandLineAPIHost::inspect):
1521         (WebCore::listenerEntriesFromListenerInfo):
1522         (WebCore::CommandLineAPIHost::inspectedObject):
1523         (WebCore::CommandLineAPIHost::databaseId):
1524         (WebCore::CommandLineAPIHost::storageId):
1525         (WebCore::CommandLineAPIHost::inspectImpl): Deleted.
1526         (WebCore::CommandLineAPIHost::getEventListenersImpl): Deleted.
1527         (WebCore::CommandLineAPIHost::databaseIdImpl): Deleted.
1528         (WebCore::CommandLineAPIHost::storageIdImpl): Deleted.
1529         * inspector/CommandLineAPIHost.h:
1530         * inspector/CommandLineAPIHost.idl:
1531         Replace custom bindings with modern bindings affordances: dictionaries, records and sequences.
1532
1533 2017-07-19  Zan Dobersek  <zdobersek@igalia.com>
1534
1535         Unreviewed CoordGraphics build fix.
1536
1537         * page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.cpp:
1538         (WebCore::ScrollingCoordinatorCoordinatedGraphics::updateNodeViewportConstraints):
1539         This should be defined for the ScrollingCoordinatorCoordinatedGraphics class.
1540         Also fix the setFixedToViewport() call, fishing out the GraphicsLayer object from
1541         the ScrollingStateNode's LayerRepresentation.
1542         (WebCore::AsyncScrollingCoordinator::updateNodeViewportConstraints): Deleted.
1543
1544 2017-07-19  Chris Dumez  <cdumez@apple.com>
1545
1546         Drop SQLException type
1547         https://bugs.webkit.org/show_bug.cgi?id=174665
1548
1549         Reviewed by Sam Weinig.
1550
1551         Drop SQLException type. We never throw such exception. Also, Firefox
1552         and Chrome no longer expose this type.
1553
1554         * CMakeLists.txt:
1555         * DerivedSources.cpp:
1556         * DerivedSources.make:
1557         * Modules/webdatabase/SQLException.cpp: Removed.
1558         * Modules/webdatabase/SQLException.h: Removed.
1559         * Modules/webdatabase/SQLException.idl: Removed.
1560         * WebCore.xcodeproj/project.pbxproj:
1561         * bindings/js/JSDOMExceptionHandling.cpp:
1562         (WebCore::createDOMException):
1563         * bindings/js/JSExceptionBase.cpp:
1564         (WebCore::toExceptionBase):
1565         * dom/DOMExceptions.in:
1566
1567 2017-07-19  Wenson Hsieh  <wenson_hsieh@apple.com>
1568
1569         Unreviewed, tweak a comment above TemporarySelectionOptionIgnoreSelectionChanges in Editor.cpp.
1570
1571         The comment references the UI process, but it describes an entity in WebCore. This should have been generalized
1572         to instead refer to the client layer in general (i.e. WebKit1 or WebKit2).
1573
1574         * editing/Editor.h:
1575
1576 2017-07-19  Simon Fraser  <simon.fraser@apple.com>
1577
1578         getBoundingClientRects not updated for programmatic scrolls
1579         https://bugs.webkit.org/show_bug.cgi?id=174538
1580         rdar://problem/33049012
1581
1582         Reviewed by Tim Horton.
1583
1584         Baidu.com has two event handlers on its <input>, and both query the input location with getBoundingClientRect()
1585         and the current pageYOffset (via jQuery), then try to scroll the input to the top of the screen. The bug is that
1586         programmatic scrolls did not immediately update the layout viewport rect, so the second call to
1587         getBoundingClientRect() would return stale coordinates, triggering an extra scroll.
1588
1589         To fix this, undo the fix for r219320 which tried to keep getBoundingClientRect() current during unstable scroll
1590         updates by adding a shadow layout viewport rect. Instead, almost always update the layout viewport rect on
1591         FrameView, even during unstable visible rect updates, but not if content insets are being changed interactively,
1592         since changing viewport heights cause problems with bottom-fixed elements. Also, we need to compute a new layout
1593         viewport rect in FrameView::updateLayoutViewport() for programmatic scrolls.
1594
1595         However, always updating the layout viewport triggered issues with the scrolling tree. The scrolling state tree
1596         fossilizes layer positions relative to a specific viewport rect, and that relationship has to be maintained.
1597         There are code paths that recompute fixed/sticky viewport constraints when the layout viewport has changed but
1598         we haven't done layout or recomputed layer positions (e.g. updating viewport-constrained layers via
1599         updateScrollCoordinatedLayersAfterFlush()) and in these cases using a new layout viewport for those computations
1600         results in an inconsistent scrolling tree.
1601
1602         Fix this by not updating scrolling constraints every time we have to re-register scrolling nodes.
1603         updateScrollCoordinatedLayersAfterFlush() only needs to update the layer on the scrolling node (to handle
1604         tiled/non-tiled switches), so make updateScrollCoordinatedLayer() a little more fine-grained, and only update
1605         constraints when we've just computed layer geometry. This allows for different scrolling nodes to have
1606         constraints computed at different times, with different layout viewports, which happens.
1607
1608         Two additional fixes were required to make bottom-fixed bars behave correctly.
1609
1610         First, FrameView::computeLayoutViewportOrigin() had a bug where rounding of half-pixel values would cause it to
1611         fall into the if (visualViewport.height() > layoutViewport.height()) clause, but then fail to clamp for
1612         rubber-banding.
1613         
1614         Second, the FrameView::unscaledMaximumScrollPosition() was wrong after zooming on iOS, since it uses visibleSize()
1615         which is affected by page scale on iOS only (and the function wants scale-independent values). Fix with a hack that
1616         should be cleaned up via webkit.org/b/174648.
1617
1618         Tested by existing tests.
1619
1620         * page/FrameView.cpp:
1621         (WebCore::FrameView::computeUpdatedLayoutViewportRect):
1622         (WebCore::FrameView::computeLayoutViewportOrigin):
1623         (WebCore::FrameView::setLayoutViewportOverrideRect):
1624         (WebCore::FrameView::updateLayoutViewport):
1625         (WebCore::FrameView::unscaledMaximumScrollPosition):
1626         (WebCore::FrameView::documentToClientOffset):
1627         (WebCore::FrameView::setUnstableLayoutViewportRect): Deleted.
1628         * page/FrameView.h:
1629         * page/scrolling/AsyncScrollingCoordinator.cpp:
1630         (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):
1631         (WebCore::AsyncScrollingCoordinator::reconcileScrollingState):
1632         (WebCore::AsyncScrollingCoordinator::reconcileViewportConstrainedLayerPositions):
1633         (WebCore::AsyncScrollingCoordinator::updateNodeLayer):
1634         (WebCore::AsyncScrollingCoordinator::updateNodeViewportConstraints):
1635         (WebCore::AsyncScrollingCoordinator::updateViewportConstrainedNode): Deleted.
1636         * page/scrolling/AsyncScrollingCoordinator.h:
1637         * page/scrolling/ScrollingCoordinator.cpp:
1638         (WebCore::operator<<):
1639         * page/scrolling/ScrollingCoordinator.h:
1640         (WebCore::ScrollingCoordinator::reconcileScrollingState):
1641         (WebCore::ScrollingCoordinator::updateNodeLayer):
1642         (WebCore::ScrollingCoordinator::updateNodeViewportConstraints):
1643         (WebCore::ScrollingCoordinator::updateViewportConstrainedNode): Deleted.
1644         * page/scrolling/ScrollingStateFixedNode.cpp:
1645         (WebCore::ScrollingStateFixedNode::updateConstraints):
1646         * page/scrolling/ScrollingStateStickyNode.cpp:
1647         (WebCore::ScrollingStateStickyNode::updateConstraints):
1648         (WebCore::ScrollingStateStickyNode::reconcileLayerPositionForViewportRect):
1649         * page/scrolling/ScrollingTree.cpp:
1650         (WebCore::ScrollingTree::commitTreeState):
1651         * page/scrolling/mac/ScrollingTreeFixedNode.mm:
1652         (WebCore::ScrollingTreeFixedNode::updateLayersAfterAncestorChange):
1653         * page/scrolling/mac/ScrollingTreeStickyNode.mm:
1654         (WebCore::ScrollingTreeStickyNode::updateLayersAfterAncestorChange):
1655         * rendering/RenderLayerBacking.cpp:
1656         (WebCore::RenderLayerBacking::updateGeometry):
1657         * rendering/RenderLayerCompositor.cpp:
1658         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayersAfterFlush):
1659         (WebCore::RenderLayerCompositor::updateBacking):
1660         (WebCore::RenderLayerCompositor::fixedRootBackgroundLayerChanged):
1661         (WebCore::RenderLayerCompositor::requiresCompositingForPosition):
1662         (WebCore::RenderLayerCompositor::updateScrollCoordinatedStatus):
1663         (WebCore::RenderLayerCompositor::computeFixedViewportConstraints):
1664         (WebCore::RenderLayerCompositor::computeStickyViewportConstraints):
1665         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
1666         (WebCore::RenderLayerCompositor::didAddScrollingLayer):
1667         * rendering/RenderLayerCompositor.h:
1668
1669 2017-07-19  Megan Gardner  <megan_gardner@apple.com>
1670
1671         Don't write file URLs to iOS Pasteboard
1672         https://bugs.webkit.org/show_bug.cgi?id=174647
1673         <rdar://problem/33199730>
1674
1675         Reviewed by Wenson Hsieh.
1676
1677         Tests updated to reflect the changes. We are no longer vending file URLs in Drag & Drop and Copy/Paste.
1678
1679         * editing/ios/EditorIOS.mm:
1680         (WebCore::Editor::writeImageToPasteboard):
1681         * platform/ios/PlatformPasteboardIOS.mm:
1682         (WebCore::PlatformPasteboard::write):
1683
1684 2017-07-19  Myles C. Maxfield  <mmaxfield@apple.com>
1685
1686         Setting the minimum font size preference doesn’t affect absolute line-height values, so lines overlap
1687         https://bugs.webkit.org/show_bug.cgi?id=174406
1688
1689         Reviewed by Simon Fraser.
1690         <rdar://problem/10139227>
1691
1692         Reviewed by NOBODY.
1693
1694         When the minimumFontSize API preference is set, we will increase the font size without increasing
1695         the line height. If the content specifies line-height as an absolute value, there can be two
1696         unfortunate results:
1697
1698         - Adjacent lines in a paragraph can overlap
1699         - If the paragraph (or containin block or whatever) uses overflow: hidden, the first and last lines
1700         can be cut off and potentially indecipherable.
1701
1702         Instead, we should use the minimum font size preference as a signal that we should increase the
1703         line-height as well as the font-size. Eventually, we will want to increase it by an amount
1704         proportional to the increase in font-size (which can be due to minimumFontSize, minimumLogicalFontSize,
1705         text autosizing, etc.). However, because minimumLogicalFontSize is on by default, this would cause
1706         a behavior change on many webpages which use small text, so such a change would be too risky right now.
1707         Instead, we can pretend that minimumFontSize is the only cause that text increases, and use this as the
1708         only signal to boost the corresponding line-height.
1709
1710         Tests: fast/text/line-height-minimumFontSize-text-zoom.html
1711                fast/text/line-height-minimumFontSize-visual.html
1712                fast/text/line-height-minimumFontSize-zoom.html
1713                fast/text/line-height-minimumFontSize.html
1714                fast/text/line-height-minimumFontSize-autosize.html
1715
1716         * css/StyleBuilderCustom.h:
1717         (WebCore::computeBaseSpecifiedFontSize):
1718         (WebCore::computeLineHeightMultiplierDueToFontSize):
1719         (WebCore::StyleBuilderCustom::applyValueLineHeight):
1720         (WebCore::StyleBuilderCustom::applyValueFill):
1721         (WebCore::StyleBuilderCustom::applyValueStroke):
1722         (WebCore::StyleBuilderCustom::applyValueContent):
1723         * rendering/TextAutoSizing.cpp:
1724
1725 2017-07-18  Myles C. Maxfield  <mmaxfield@apple.com>
1726
1727         Setting the minimum font size preference doesn’t affect absolute line-height values, so lines overlap
1728         https://bugs.webkit.org/show_bug.cgi?id=174406
1729         <rdar://problem/10139227>
1730
1731         Reviewed by Simon Fraser.
1732
1733         When the minimumFontSize API preference is set, we will increase the font size without increasing
1734         the line height. If the content specifies line-height as an absolute value, there can be two
1735         unfortunate results:
1736
1737         - Adjacent lines in a paragraph can overlap
1738         - If the paragraph (or containin block or whatever) uses overflow: hidden, the first and last lines
1739         can be cut off and potentially indecipherable.
1740
1741         Instead, we should use the minimum font size preference as a signal that we should increase the
1742         line-height as well as the font-size. Eventually, we will want to increase it by an amount
1743         proportional to the increase in font-size (which can be due to minimumFontSize, minimumLogicalFontSize,
1744         text autosizing, etc.). However, because minimumLogicalFontSize is on by default, this would cause
1745         a behavior change on many webpages which use small text, so such a change would be too risky right now.
1746         Instead, we can pretend that minimumFontSize is the only cause that text increases, and use this as the
1747         only signal to boost the corresponding line-height.
1748
1749         Tests: fast/text/line-height-minimumFontSize-text-zoom.html
1750                fast/text/line-height-minimumFontSize-visual.html
1751                fast/text/line-height-minimumFontSize-zoom.html
1752                fast/text/line-height-minimumFontSize.html
1753                fast/text/line-height-minimumFontSize-autosize.html
1754
1755         * css/StyleBuilderCustom.h:
1756         (WebCore::computeBaseSpecifiedFontSize):
1757         (WebCore::computeLineHeightMultiplierDueToFontSize):
1758         (WebCore::StyleBuilderCustom::applyValueLineHeight):
1759         (WebCore::StyleBuilderCustom::applyValueFill):
1760         (WebCore::StyleBuilderCustom::applyValueStroke):
1761         (WebCore::StyleBuilderCustom::applyValueContent):
1762         * rendering/TextAutoSizing.cpp:
1763
1764 2017-07-19  Chris Dumez  <cdumez@apple.com>
1765
1766         DOMException should not have its own toString()
1767         https://bugs.webkit.org/show_bug.cgi?id=174630
1768
1769         Reviewed by Sam Weinig.
1770
1771         DOMException should not have its own toString() and should use the one from Error.prototype.toString()
1772         instead:
1773         - https://heycam.github.io/webidl/#idl-DOMException
1774
1775         No new tests, rebaselined existing tests.
1776
1777         * dom/DOMCoreException.idl:
1778
1779 2017-07-19  Antoine Quint  <graouts@apple.com>
1780
1781         [iOS] REGRESSION: Scrubbing media using built-in controls does not pause media
1782         https://bugs.webkit.org/show_bug.cgi?id=174650
1783         <rdar://problem/33401877>
1784
1785         Reviewed by Dean Jackson.
1786
1787         We would only pause when scrubbing on macOS because we only listened to "mousedown" events on the
1788         scrubber's backing <input> element to identify that the user had started interacting with the
1789         scrubber.
1790
1791         Implementing the same technique on iOS required a little more work than just listening to "touchstart"
1792         events on the same element. On top of that, we needed to make sure that we would only respond to
1793         "touchstart" events on the slider's thumb, and not on the track, since only on macOS should the user
1794         be able to click anywhere on the track to scrub. So we turn off pointer-events for the <input> on iOS
1795         only, and turn them back on specifically for the thumb.
1796
1797         There is also some finessing when dealing with touch events where we need to track the identifier of
1798         the touch that started the user interaction. So we keep track of it in an ivar and wait until we get
1799         a "touchend" event where the changedTouches list contains a touch with that same identifier to ensure
1800         the same touch that initiates and ends the scrubbing interaction.
1801
1802         Finally, we fix another issue that was uncovered while turning back on the ScrubbingSupport tests
1803         where we would not trash the cached _value ivar when we initiated scrubbing, which was important since
1804         we would mistakenly use the pre-srubbing value during a scrub.
1805
1806         * Modules/modern-media-controls/controls/slider.css:
1807         (.ios .slider > input):
1808         (.slider > input::-webkit-slider-thumb):
1809         * Modules/modern-media-controls/controls/slider.js:
1810         (Slider.prototype.handleEvent):
1811         (Slider.prototype._handleMousedownEvent):
1812         (Slider.prototype._interactionEndTarget):
1813         (Slider.prototype._handleTouchstartEvent):
1814         (Slider.prototype._valueWillStartChanging):
1815         (Slider.prototype._valueDidStopChanging):
1816         (Slider.prototype._handleMouseupEvent):
1817         (Slider.prototype._handleTouchendEvent):
1818
1819 2017-07-19  Nan Wang  <n_wang@apple.com>
1820
1821         AX: Web page reloaded when a node is labelling multiple childnodes
1822         https://bugs.webkit.org/show_bug.cgi?id=174655
1823
1824         Reviewed by Chris Fleizach.
1825
1826         When we are asking for the aria-labelledby attribute of a node and its
1827         sibling is also labelled by the same node, we get into an infinite loop
1828         in textUnderElement since we only ignore one child. Added checks for 
1829         siblings to avoid such loop.
1830
1831         Test: accessibility/mac/aria-labelledby-multiple-child-crash.html
1832
1833         * accessibility/AccessibilityNodeObject.cpp:
1834         (WebCore::AccessibilityNodeObject::textUnderElement):
1835
1836 2017-07-19  Andy Estes  <aestes@apple.com>
1837
1838         Use a cast to work around clang's false -Wobjc-literal-conversion warnings
1839         https://bugs.webkit.org/show_bug.cgi?id=174631
1840
1841         Reviewed by Dan Bernstein.
1842
1843         Instead of ignoring -Wobjc-literal-conversion, use a cast to work around rdar://problem/33383354.
1844
1845         * platform/ios/PlatformPasteboardIOS.mm:
1846         (WebCore::PlatformPasteboard::write):
1847
1848 2017-07-19  Chris Dumez  <cdumez@apple.com>
1849
1850         Make cross-origin properties enumerable
1851         https://bugs.webkit.org/show_bug.cgi?id=174576
1852
1853         Reviewed by Darin Adler.
1854
1855         Makes cross-origin properties enumerable on Window and Location objects
1856         as per:
1857         - https://github.com/whatwg/html/pull/2777
1858
1859         This simplifies our code quite a bit.
1860
1861         No new tests, updated existing tests.
1862
1863         * bindings/js/JSDOMWindowCustom.cpp:
1864         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
1865         (WebCore::JSDOMWindow::getOwnPropertySlotByIndex):
1866         (WebCore::JSDOMWindow::getOwnPropertyNames):
1867         * bindings/js/JSLocationCustom.cpp:
1868         (WebCore::getOwnPropertySlotCommon):
1869         (WebCore::JSLocation::getOwnPropertyNames):
1870         * bindings/scripts/CodeGeneratorJS.pm:
1871         (GenerateHeader):
1872
1873 2017-07-18  Carlos Alberto Lopez Perez  <clopez@igalia.com>
1874
1875         [EME] Build failure with Clang-3.8 on InitDataRegistry.cpp
1876         https://bugs.webkit.org/show_bug.cgi?id=174628
1877
1878         Reviewed by Žan Doberšek.
1879
1880         * Modules/encryptedmedia/InitDataRegistry.cpp:
1881         (WebCore::extractKeyIDsKeyids): Add an explicit cast to unsigned.
1882
1883 2017-07-19  Matt Lewis  <jlewis3@apple.com>
1884
1885         Unreviewed, rolling out r219646.
1886
1887         The test added are failing on all platforms
1888
1889         Reverted changeset:
1890
1891         "Setting the minimum font size preference doesn’t affect
1892         absolute line-height values, so lines overlap"
1893         https://bugs.webkit.org/show_bug.cgi?id=174406
1894         http://trac.webkit.org/changeset/219646
1895
1896 2017-07-19  Yusuke Suzuki  <utatane.tea@gmail.com>
1897
1898         [WTF] Implement WTF::ThreadGroup
1899         https://bugs.webkit.org/show_bug.cgi?id=174081
1900
1901         Reviewed by Mark Lam.
1902
1903         * page/ResourceUsageThread.h:
1904
1905 2017-07-18  Andy Estes  <aestes@apple.com>
1906
1907         [Xcode] Enable CLANG_WARN_RANGE_LOOP_ANALYSIS
1908         https://bugs.webkit.org/show_bug.cgi?id=174631
1909
1910         Reviewed by Tim Horton.
1911
1912         * Configurations/Base.xcconfig:
1913         * rendering/Grid.cpp:
1914         (WebCore::Grid::insert):
1915         * rendering/RenderTreeAsText.cpp:
1916         (WebCore::write):
1917         * rendering/SimpleLineLayoutCoverage.cpp:
1918         (WebCore::SimpleLineLayout::printSimpleLineLayoutCoverage):
1919
1920 2017-07-18  Yusuke Suzuki  <utatane.tea@gmail.com>
1921
1922         WTF::Thread should have the threads stack bounds.
1923         https://bugs.webkit.org/show_bug.cgi?id=173975
1924
1925         Reviewed by Mark Lam.
1926
1927         When creating WebThread, we first allocate WebCore::ThreadGlobalData in UI thread
1928         and share it with WebThread.
1929         The problem is that WebCore::ThreadGlobalData has CachedResourceRequestInitiators.
1930         It allocates AtomicString, which requires WTFThreadData.
1931
1932         In this patch, we call WTF::initializeThreading() before allocating WebCore::ThreadGlobalData.
1933         And we also call AtomicString::init() before calling WebCore::ThreadGlobalData since
1934         WebCore::ThreadGlobalData allocates AtomicString.
1935
1936         * platform/ios/wak/WebCoreThread.mm:
1937         (StartWebThread):
1938
1939 2017-07-18  Myles C. Maxfield  <mmaxfield@apple.com>
1940
1941         Setting the minimum font size preference doesn’t affect absolute line-height values, so lines overlap
1942         https://bugs.webkit.org/show_bug.cgi?id=174406
1943         <rdar://problem/10139227>
1944
1945         Reviewed by Simon Fraser.
1946
1947         When the minimumFontSize API preference is set, we will increase the font size without increasing
1948         the line height. If the content specifies line-height as an absolute value, there can be two
1949         unfortunate results:
1950
1951         - Adjacent lines in a paragraph can overlap
1952         - If the paragraph (or containin block or whatever) uses overflow: hidden, the first and last lines
1953         can be cut off and potentially indecipherable.
1954
1955         Instead, we should use the minimum font size preference as a signal that we should increase the
1956         line-height as well as the font-size. Eventually, we will want to increase it by an amount
1957         proportional to the increase in font-size (which can be due to minimumFontSize, minimumLogicalFontSize,
1958         text autosizing, etc.). However, because minimumLogicalFontSize is on by default, this would cause
1959         a behavior change on many webpages which use small text, so such a change would be too risky right now.
1960         Instead, we can pretend that minimumFontSize is the only cause that text increases, and use this as the
1961         only signal to boost the corresponding line-height.
1962
1963         Tests: fast/text/line-height-minimumFontSize-text-zoom.html
1964                fast/text/line-height-minimumFontSize-visual.html
1965                fast/text/line-height-minimumFontSize-zoom.html
1966                fast/text/line-height-minimumFontSize.html
1967                fast/text/line-height-minimumFontSize-autosize.html
1968
1969         * css/StyleBuilderCustom.h:
1970         (WebCore::computeBaseSpecifiedFontSize):
1971         (WebCore::computeLineHeightMultiplierDueToFontSize):
1972         (WebCore::StyleBuilderCustom::applyValueLineHeight):
1973         (WebCore::StyleBuilderCustom::applyValueFill):
1974         (WebCore::StyleBuilderCustom::applyValueStroke):
1975         (WebCore::StyleBuilderCustom::applyValueContent):
1976         * rendering/TextAutoSizing.cpp:
1977
1978 2017-07-18  Zalan Bujtas  <zalan@apple.com>
1979
1980         Media controls are missing content in fullscreen when document has scroll offset.
1981         https://bugs.webkit.org/show_bug.cgi?id=174644
1982         <rdar://problem/32415323>
1983
1984         Reviewed by Simon Fraser.
1985
1986         If a non-user initiated scrolling (result of resize for example) is processed asynchronously, it might
1987         leapfrog other, programatic scrollings and trigger unintentional scroll offsets (and turn into unwanted clippings). 
1988         This patch ensures that both resize and top content inset change are translated into programatic scrolling. 
1989
1990         Unable to test full screen video.
1991
1992         * page/FrameView.cpp:
1993         (WebCore::FrameView::setFrameRect):
1994         (WebCore::FrameView::topContentInsetDidChange):
1995
1996 2017-07-18  Andy Estes  <aestes@apple.com>
1997
1998         [Xcode] Enable CLANG_WARN_OBJC_LITERAL_CONVERSION
1999         https://bugs.webkit.org/show_bug.cgi?id=174631
2000
2001         Reviewed by Sam Weinig.
2002
2003         * Configurations/Base.xcconfig:
2004         * platform/ios/PlatformPasteboardIOS.mm:
2005         (WebCore::PlatformPasteboard::write):
2006
2007 2017-07-18  Ali Juma  <ajuma@chromium.org>
2008
2009         Align quirky number parsing with other browsers
2010         https://bugs.webkit.org/show_bug.cgi?id=155874
2011
2012         Reviewed by Simon Fraser.
2013
2014         Parse unit-less non-zero values for animation-duration and transition-duration
2015         as invalid time values in quirks mode.
2016
2017         Test: fast/css/animation-transition-duration-quirksmode.html
2018
2019         * css/parser/CSSPropertyParser.cpp:
2020         (WebCore::consumeAnimationValue):
2021
2022 2017-07-18  Chris Dumez  <cdumez@apple.com>
2023
2024         HysteresisActivity cannot be used in the UIProcess
2025         https://bugs.webkit.org/show_bug.cgi?id=174643
2026         <rdar://problem/33086442>
2027
2028         Reviewed by Tim Horton.
2029
2030         Port HysteresisActivity to RunLoop::Timer so that it can safely be used in
2031         the UIProcess as well.
2032
2033         * platform/HysteresisActivity.h:
2034
2035 2017-07-18  Joseph Pecoraro  <pecoraro@apple.com>
2036
2037         Web Inspector: Modernize InjectedScriptSource
2038         https://bugs.webkit.org/show_bug.cgi?id=173890
2039
2040         Reviewed by Brian Burg.
2041
2042         Covered by existing tests.
2043
2044         * inspector/CommandLineAPIModuleSource.js:
2045         (CommandLineAPIImpl.prototype.copy):
2046         (CommandLineAPIImpl.prototype._inspect):
2047         Use RemoteObject, a new parameter.
2048
2049 2017-07-18  Ryosuke Niwa  <rniwa@webkit.org>
2050
2051         REGRESSION(r218910): Crash when password field changes to text field
2052         https://bugs.webkit.org/show_bug.cgi?id=174560
2053
2054         Reviewed by Zalan Bujtas.
2055
2056         The crash was caused by textMarkerDataForFirstPositionInTextControl accessing a nullptr returned by getOrCreate.
2057         Unfortunately, in order to this fix bug while preserving the exact behavior would require synchronously creating
2058         a renderer for the editing host when the input type changed since we can't create an accessbility object out of
2059         a renderer-less node.
2060
2061         Instead, revert back to pre-r218910 behavior of always using the text control element's axID when notifying
2062         the value change. While this is inconsistent with the way editing commands report content changes, I've since
2063         learned that VoiceOver has code to deal with this exact situation.
2064
2065         Test: accessibility/mac/input-type-change-crash-2.html
2066
2067         * accessibility/AXObjectCache.cpp:
2068         (WebCore::AXObjectCache::textMarkerDataForFirstPositionInTextControl):
2069
2070 2017-07-18  Matt Baker  <mattbaker@apple.com>
2071
2072         Web Inspector: Refactoring: replace InspectorCanvasAgent::CanvasEntry with a helper class
2073         https://bugs.webkit.org/show_bug.cgi?id=174311
2074
2075         Reviewed by Devin Rousso.
2076
2077         This patch adds a helper class for tracking canvases and their data. The
2078         current approach of defining a helper structure in the agent's header is
2079         awkward to use and maintain, and won't scale well as more canvas instrumentation
2080         points and data are added.
2081
2082         * CMakeLists.txt:
2083         * WebCore.xcodeproj/project.pbxproj:
2084         New file.
2085
2086         * inspector/InspectorCanvas.cpp: Added.
2087         (WebCore::InspectorCanvas::create):
2088         (WebCore::InspectorCanvas::InspectorCanvas):
2089         (WebCore::InspectorCanvas::buildObjectForCanvas):
2090         * inspector/InspectorCanvas.h: Added.
2091
2092         * inspector/InspectorCanvasAgent.cpp:
2093         (WebCore::InspectorCanvasAgent::InspectorCanvasAgent):
2094         (WebCore::InspectorCanvasAgent::enable):
2095         (WebCore::InspectorCanvasAgent::requestNode):
2096         (WebCore::InspectorCanvasAgent::requestContent):
2097         (WebCore::InspectorCanvasAgent::requestCSSCanvasClientNodes):
2098         (WebCore::InspectorCanvasAgent::resolveCanvasContext):
2099         (WebCore::InspectorCanvasAgent::frameNavigated):
2100         (WebCore::InspectorCanvasAgent::didCreateCSSCanvas):
2101         (WebCore::InspectorCanvasAgent::didChangeCSSCanvasClientNodes):
2102         (WebCore::InspectorCanvasAgent::didCreateCanvasRenderingContext):
2103         (WebCore::InspectorCanvasAgent::didChangeCanvasMemory):
2104         (WebCore::InspectorCanvasAgent::canvasDestroyed):
2105         (WebCore::InspectorCanvasAgent::canvasDestroyedTimerFired):
2106         (WebCore::InspectorCanvasAgent::clearCanvasData):
2107         (WebCore::InspectorCanvasAgent::unbindCanvas):
2108         (WebCore::InspectorCanvasAgent::assertInspectorCanvas):
2109         (WebCore::InspectorCanvasAgent::findInspectorCanvas):
2110         (WebCore::InspectorCanvasAgent::getCanvasEntry): Deleted.
2111         (WebCore::InspectorCanvasAgent::buildObjectForCanvas): Deleted.
2112         * inspector/InspectorCanvasAgent.h:
2113
2114         * inspector/InspectorController.cpp:
2115         (WebCore::InspectorController::InspectorController):
2116         Remove unused constructor argument.
2117
2118 2017-07-18  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2119
2120         [Curl] Move detail implementation from ResourceHandle to ResourceHandleInternal
2121         https://bugs.webkit.org/show_bug.cgi?id=174641
2122
2123         After moving stuff from ResourceHandleManager to ResourceHandle on 
2124         https://bugs.webkit.org/show_bug.cgi?id=173630, still there're many violation
2125         remains between ResourceHandle and ResourceHandleInternal classes.
2126         Many of implementation detail should be move to ResourceHandleInternal
2127         to improve build speed.
2128
2129         Reviewed by Alex Christensen.
2130
2131         * platform/network/ResourceHandle.h:
2132         * platform/network/ResourceHandleInternal.h:
2133         (WebCore::ResourceHandleInternal::ResourceHandleInternal):
2134         * platform/network/curl/ResourceHandleCurl.cpp:
2135         (WebCore::ResourceHandleInternal::~ResourceHandleInternal):
2136         (WebCore::ResourceHandle::start):
2137         (WebCore::ResourceHandle::cancel):
2138         (WebCore::ResourceHandleInternal::initialize):
2139         (WebCore::ResourceHandleInternal::applyAuthentication):
2140         (WebCore::ResourceHandleInternal::setupPUT):
2141         (WebCore::ResourceHandleInternal::setupPOST):
2142         (WebCore::ResourceHandleInternal::setupFormData):
2143         (WebCore::ResourceHandle::platformSetDefersLoading):
2144         (WebCore::ResourceHandleInternal::didFinish):
2145         (WebCore::ResourceHandleInternal::didFail):
2146         (WebCore::ResourceHandleInternal::calculateWebTimingInformations):
2147         (WebCore::ResourceHandleInternal::handleLocalReceiveResponse):
2148         (WebCore::ResourceHandleInternal::willPrepareSendData):
2149         (WebCore::ResourceHandleInternal::didReceiveHeaderLine):
2150         (WebCore::ResourceHandleInternal::didReceiveAllHeaders):
2151         (WebCore::ResourceHandleInternal::didReceiveContentData):
2152         (WebCore::ResourceHandleInternal::readCallback):
2153         (WebCore::ResourceHandleInternal::headerCallback):
2154         (WebCore::ResourceHandleInternal::writeCallback):
2155         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
2156         (WebCore::ResourceHandleInternal::dispatchSynchronousJob):
2157         (WebCore::ResourceHandleInternal::handleDataURL):
2158         (WebCore::ResourceHandle::initialize): Deleted.
2159         (WebCore::ResourceHandle::applyAuthentication): Deleted.
2160         (WebCore::ResourceHandle::setupPUT): Deleted.
2161         (WebCore::ResourceHandle::setupPOST): Deleted.
2162         (WebCore::ResourceHandle::setupFormData): Deleted.
2163         (WebCore::ResourceHandle::didFinish): Deleted.
2164         (WebCore::ResourceHandle::didFail): Deleted.
2165         (WebCore::ResourceHandle::calculateWebTimingInformations): Deleted.
2166         (WebCore::ResourceHandle::handleLocalReceiveResponse): Deleted.
2167         (WebCore::ResourceHandle::willPrepareSendData): Deleted.
2168         (WebCore::ResourceHandle::didReceiveHeaderLine): Deleted.
2169         (WebCore::ResourceHandle::didReceiveAllHeaders): Deleted.
2170         (WebCore::ResourceHandle::didReceiveContentData): Deleted.
2171         (WebCore::ResourceHandle::readCallback): Deleted.
2172         (WebCore::ResourceHandle::headerCallback): Deleted.
2173         (WebCore::ResourceHandle::writeCallback): Deleted.
2174         (WebCore::ResourceHandle::dispatchSynchronousJob): Deleted.
2175         (WebCore::ResourceHandle::handleDataURL): Deleted.
2176
2177 2017-07-18  Andy Estes  <aestes@apple.com>
2178
2179         [Xcode] Enable CLANG_WARN_NON_LITERAL_NULL_CONVERSION
2180         https://bugs.webkit.org/show_bug.cgi?id=174631
2181
2182         Reviewed by Dan Bernstein.
2183
2184         * Configurations/Base.xcconfig:
2185
2186 2017-07-18  Antoine Quint  <graouts@apple.com>
2187
2188         [macOS] Mouse pointer does not hide during fullscreen playback
2189         https://bugs.webkit.org/show_bug.cgi?id=174638
2190         <rdar://problem/33244399>
2191
2192         Reviewed by Dean Jackson.
2193
2194         Test: media/modern-media-controls/css/webkit-cursor-visibility-auto-hide.html
2195
2196         The user-agent stylesheet sets the "-webkit-cursor-visibility" to "auto-hide" for fullscreen <video>
2197         elements. Since we reset the page styles, including UA styles, on .media-controls-container, we need
2198         to explicitly inherit this style property from the page to ensure the mouse pointer automatically
2199         hides in fullscreen.
2200
2201         * Modules/modern-media-controls/controls/media-controls.css:
2202         (.media-controls-container):
2203
2204 2017-07-18  Sam Weinig  <sam@webkit.org>
2205
2206         [WebIDL] Remove custom bindings for MockContentFilterSettings
2207         https://bugs.webkit.org/show_bug.cgi?id=174606
2208
2209         Reviewed by Andy Estes.
2210
2211         * PlatformMac.cmake:
2212         * WebCore.xcodeproj/project.pbxproj:
2213         * bindings/js/JSMockContentFilterSettingsCustom.cpp: Removed.
2214         Remove JSMockContentFilterSettingsCustom.
2215
2216         * testing/MockContentFilterSettings.h:
2217         * testing/MockContentFilterSettings.idl:
2218         Switch from constants to IDL enums to make the bindings and tests simpler.
2219
2220 2017-07-18  Sam Weinig  <sam@webkit.org>
2221
2222         [WebIDL] Replace some custom bindings code in JSCSSStyleDeclarationCustom.cpp with named getters/setters
2223         https://bugs.webkit.org/show_bug.cgi?id=174529
2224
2225         Reviewed by Chris Dumez.
2226
2227         * CMakeLists.txt:
2228         * WebCore.xcodeproj/project.pbxproj:
2229         * css/CSSAllInOne.cpp:
2230         Add CSSStyleDeclaration.cpp
2231
2232         * bindings/js/JSCSSStyleDeclarationCustom.cpp:
2233         Move getter / setter / getOwnProperties logic from here to CSSStyleDeclaration.cpp.
2234
2235         * bindings/scripts/CodeGeneratorJS.pm:
2236         (GenerateGetOwnPropertySlot):
2237         (GenerateGetOwnPropertySlotByIndex):
2238         (InstanceOverridesGetOwnPropertySlot):
2239         (GenerateHeader):
2240         Remove support for no longer needed [CustomGetOwnPropertySlotAndDescriptor].
2241         Add support for [PutOnlyForSupportedProperties], which allows named setters to behave
2242         a bit more like normal setters by allowing the implementation to note which properties
2243         are supported which in turn, allows the bindings to continue down the normal put path
2244         for unsupported properties. This is necessary to mimic the behavior of CSSStyleDeclaration
2245         which is using named setters in place hundreds of additional properties.
2246
2247         (InstanceOverridesDefineOwnProperty):
2248         Add [DefaultDefineOwnProperty] to allow disabling defineOwnProperty overriding that comes
2249         automatically with named setters. We need this for CSSStyleDeclaration since the named
2250         setter usage modeling real properties, not a dictionary style setter. We may want to 
2251         revisit this, and add support for DefineOwnProperty here, but this allows us to maintain
2252         the status quo.
2253
2254         (GenerateDefineOwnProperty):
2255         Fix the case when you have a named setter, an indexed getter, but no indexed setter. In that
2256         case, we would get a compile error, due to the index variable being unused.
2257
2258         * bindings/scripts/IDLAttributes.json:
2259         Remove support for no longer needed [CustomGetOwnPropertySlotAndDescriptor], add
2260         [PutOnlyForSupportedProperties] and [DefaultDefineOwnProperty].
2261
2262         * css/CSSStyleDeclaration.h:
2263         * css/CSSStyleDeclaration.cpp: Added.
2264         (WebCore::CSSStyleDeclaration::namedItem):
2265         (WebCore::CSSStyleDeclaration::setNamedItem):
2266         (WebCore::CSSStyleDeclaration::isSupportedPropertyName):
2267         (WebCore::CSSStyleDeclaration::supportedPropertyNames):
2268         Use standard getter / setter functions to implement CSS property name getting and setting.
2269         Convert from Identifier to AtomicString, which are now bridgeable.
2270
2271         * css/CSSStyleDeclaration.idl:
2272         Add named getter and setter. Remove [CustomGetOwnPropertyNames], [CustomGetOwnPropertySlotAndDescriptor]
2273         and [CustomPut], add [DefaultDefineOwnProperty].
2274
2275         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp: Added.
2276         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.h: Added.
2277         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp: Added.
2278         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.h: Added.
2279         * bindings/scripts/test/TestNamedSetterWithIndexedGetter.idl: Added.
2280         * bindings/scripts/test/TestNamedSetterWithIndexedGetterAndSetter.idl: Added.
2281         Add tests for improved behavior when using named setters with variations of indexed getters and setters as well.
2282
2283 2017-07-18  Antoine Quint  <graouts@apple.com>
2284
2285         [iOS] WebKit media controls are sometimes shown after exiting full screen on vimeo.com
2286         https://bugs.webkit.org/show_bug.cgi?id=174627
2287         <rdar://problem/33301005>
2288
2289         Reviewed by Dean Jackson, provisionally reviewed by Jeremy Jones.
2290
2291         On iOS 11, both the WebKit media controls and the Vimeo custom controls would appear sometimes when exiting
2292         from fullscreen when the video was playing and the user would tap the X button, which would pause the video
2293         as well as exit fullscreen.
2294
2295         The reason this happens is that the ControlsVisibilitySupport object, which governs whether the WebKit media
2296         controls should be displayed for a given video, woud listen to "pause" and "webkitfullscreenchange" events
2297         and determine whether to show the WebKit media controls. We listen to the "pause" event because when media
2298         pauses, and the video has the "controls" attribute set, we should show the controls and suspend the controls
2299         auto-hide timer. And we're interested in knowing when we enter and exit fullscreen because we want to override
2300         the "controls" attribute not being set when we enter fullscreen.
2301
2302         However, on iOS 11, it appears that the "webkitfullscreenchange" event is not reliably fired as the user enters
2303         and exits fullscreen, which is tracked by webkit.org/b/174626. So, when the user exits fullscreen, we would be
2304         informed of the video being paused via a "pause" event, but not of the video exiting fullscreen. And because
2305         media events are asynchronous, the "pause" event would sometimes be fired before we exited fullscreen, and when
2306         the _updateControls() would run, we would sometimes determine that we are in fullscreen still and determine
2307         that the WebKit media controls should be shown.
2308
2309         Of course, on iOS, the WebKit media controls are not shown and instead we delegate to AVKit to display media controls.
2310         So we could simply disregard this whole logic in iOS. But we choose to instead use the "webkitpresentationmodechanged"
2311         when the presentation mode API is supported, as is the case on iOS 11, to determine changes of media fullscreen state.
2312         This way, should we ever choose to support fullscreen media controls provided by WebKit on iOS, this logic is already
2313         correct and we write less platform-specific code.
2314
2315         This, alas, cannot be tested since we can't force the X button to be tapped within the AVKit fullscreen controls.
2316
2317         * Modules/modern-media-controls/media/controls-visibility-support.js:
2318         (ControlsVisibilitySupport.prototype.get mediaEvents):
2319         * Modules/modern-media-controls/media/media-controller.js:
2320         (MediaController):
2321         * Modules/modern-media-controls/media/start-support.js:
2322         (StartSupport.prototype.get mediaEvents):
2323
2324 2017-07-18  Matt Lewis  <jlewis3@apple.com>
2325
2326         Unreviewed, rolling out r219610.
2327
2328         This caused an api failure on all platforms for the test
2329         SnapshotImageLargeAsyncDecoding
2330
2331         Reverted changeset:
2332
2333         "Async image decoding for large images should be disabled
2334         after the first time a tile is painted"
2335         https://bugs.webkit.org/show_bug.cgi?id=174451
2336         http://trac.webkit.org/changeset/219610
2337
2338 2017-07-18  Devin Rousso  <drousso@apple.com>
2339
2340         Add CanvasRenderingContext2D::getTransform
2341         https://bugs.webkit.org/show_bug.cgi?id=174278
2342
2343         Reviewed by Dean Jackson.
2344
2345         Tests: fast/canvas/2d.getTransform.modification.html
2346                fast/canvas/2d.getTransform.newobject.html
2347                fast/canvas/2d.setTransform.matrix.html
2348
2349         * css/DOMMatrixReadOnly.h:
2350         Make DOMMatrixReadOnly::validateAndFixup public so that values of DOMMatrixInit are still
2351         usable without having to construct a DOMMatrixReadOnly. This is beneficial in the case that
2352         an exception is thrown, as the validateAndFixup check can happen without any allocations.
2353
2354         * html/canvas/CanvasRenderingContext2D.idl:
2355         * html/canvas/CanvasRenderingContext2D.h:
2356         * html/canvas/CanvasRenderingContext2D.cpp:
2357         (WebCore::CanvasRenderingContext2D::getTransform):
2358         (WebCore::CanvasRenderingContext2D::setTransform):
2359
2360 2017-07-18  Andy Estes  <aestes@apple.com>
2361
2362         [Xcode] Enable CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING
2363         https://bugs.webkit.org/show_bug.cgi?id=174631
2364
2365         Reviewed by Darin Adler.
2366
2367         * Configurations/Base.xcconfig:
2368
2369 2017-07-18  Jonathan Bedard  <jbedard@apple.com>
2370
2371         Unreviewed build fix after r219595
2372
2373         * platform/graphics/cocoa/FontDescriptionCocoa.cpp:
2374         (WebCore::makeNeverDestroyed): Remove duplicate makeNeverDestroyed definition.
2375         * platform/ios/DragImageIOS.mm:
2376         (WebCore::cascadeForSystemFont): Return correct FontCascade object.
2377         (WebCore::createDragImageForLink): Fix compiler error.
2378
2379 2017-07-18  Daniel Bates  <dabates@apple.com>
2380
2381         Cleanup: Remove AlternativeTextInfo and use Variant to represent alternative text info details
2382         https://bugs.webkit.org/show_bug.cgi?id=174604
2383
2384         I inadvertently did not commit some of my local changes.
2385
2386         * editing/AlternativeTextController.cpp:
2387         (WebCore::AlternativeTextController::startAlternativeTextUITimer):
2388         (WebCore::AlternativeTextController::stopAlternativeTextUITimer):
2389         (WebCore::AlternativeTextController::applyPendingCorrection):
2390         (WebCore::AlternativeTextController::hasPendingCorrection):
2391         (WebCore::AlternativeTextController::show):
2392         (WebCore::AlternativeTextController::handleCancelOperation):
2393         (WebCore::AlternativeTextController::dismiss):
2394         (WebCore::AlternativeTextController::dismissSoon):
2395         (WebCore::AlternativeTextController::applyAutocorrectionBeforeTypingIfAppropriate):
2396         (WebCore::AlternativeTextController::timerFired):
2397         (WebCore::AlternativeTextController::handleAlternativeTextUIResult):
2398         (WebCore::AlternativeTextController::respondToMarkerAtEndOfWord):
2399         (WebCore::AlternativeTextController::markerDescriptionForAppliedAlternativeText):
2400
2401 2017-07-17  Daniel Bates  <dabates@apple.com>
2402
2403         Cleanup: Remove AlternativeTextInfo and use Variant to represent alternative text info details
2404         https://bugs.webkit.org/show_bug.cgi?id=174604
2405
2406         Reviewed by Darin Adler.
2407
2408         Remove struct AlternativeTextInfo and represent the alternative text info as instance variables
2409         using Variant to hold either an autocorrection replacement string or the alternative dictation
2410         context.
2411
2412         Not functionality changed. So, no new tests.
2413
2414         * editing/AlternativeTextController.cpp: Remove header Event.h as it is ultimately included by TextEvent.h.
2415         (WebCore::AlternativeTextController::show): Update code as needed.
2416         (WebCore::AlternativeTextController::timerFired): Ditto.
2417         (WebCore::AlternativeTextController::alternativeTextClient): Substitute nullptr for 0.
2418         (WebCore::AlternativeTextController::respondToMarkerAtEndOfWord): Update code as needed.
2419         (WebCore::AutocorrectionAlternativeDetails::create): Deleted.
2420         (WebCore::AutocorrectionAlternativeDetails::replacementString): Deleted.
2421         (WebCore::AutocorrectionAlternativeDetails::AutocorrectionAlternativeDetails): Deleted.
2422         (WebCore::DictationAlternativeDetails::create): Deleted.
2423         (WebCore::DictationAlternativeDetails::dictationContext): Deleted.
2424         (WebCore::DictationAlternativeDetails::DictationAlternativeDetails): Deleted.
2425         * editing/AlternativeTextController.h: Remove header Range.h and forward declare Range. Include header
2426         Position.h and wtf/Variant.h. Sort forward declarations.
2427         (WebCore::AlternativeTextDetails::~AlternativeTextDetails): Deleted.
2428
2429 2017-07-18  Said Abou-Hallawa  <sabouhallawa@apple.com>
2430
2431         Async image decoding for large images should be disabled after the first time a tile is painted
2432         https://bugs.webkit.org/show_bug.cgi?id=174451
2433
2434         Reviewed by Simon Fraser.
2435
2436         Flashing because of DOM mutation can be fixed by disabling the asynchronous
2437         image decoding after the first time a tile was painted.
2438
2439         We can detect this by consulting the tile repaintCount. If it is zero, then
2440         it is safe to use asynchronous image decoded. If the tile repaintCount is
2441         greater than zero, we are not sure if the renderer rectangle has an image
2442         drawn in it already or not. In this case we have to use the synchronous
2443         image decoding to avoid causing a flash.
2444
2445         Tests: fast/images/async-image-background-change.html
2446                fast/images/async-image-src-change.html
2447                http/tests/multipart/multipart-async-image.html
2448
2449         * page/PageOverlayController.cpp:
2450         (WebCore::PageOverlayController::paintContents):
2451         * page/PageOverlayController.h:
2452         * page/linux/ResourceUsageOverlayLinux.cpp:
2453         * page/mac/ServicesOverlayController.h:
2454         * page/mac/ServicesOverlayController.mm:
2455         (WebCore::ServicesOverlayController::Highlight::paintContents):
2456         * platform/graphics/BitmapImage.h:
2457         * platform/graphics/GraphicsLayer.cpp:
2458         (WebCore::GraphicsLayer::paintGraphicsLayerContents):
2459         * platform/graphics/GraphicsLayer.h:
2460         * platform/graphics/GraphicsLayerClient.h:
2461         (WebCore::GraphicsLayerClient::paintContents):
2462         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
2463         (WebCore::LayerClient::platformCALayerPaintContents):
2464         * platform/graphics/ca/GraphicsLayerCA.cpp:
2465         (WebCore::GraphicsLayerCA::platformCALayerPaintContents):
2466         * platform/graphics/ca/GraphicsLayerCA.h:
2467         * platform/graphics/ca/PlatformCALayer.h:
2468         * platform/graphics/ca/PlatformCALayerClient.h:
2469         (WebCore::PlatformCALayerClient::platformCALayerRepaintCount):
2470         * platform/graphics/ca/TileCoverageMap.cpp:
2471         (WebCore::TileCoverageMap::platformCALayerPaintContents):
2472         * platform/graphics/ca/TileCoverageMap.h:
2473         * platform/graphics/ca/TileGrid.cpp:
2474         (WebCore::TileGrid::platformCALayerPaintContents):
2475         (WebCore::TileGrid::platformCALayerRepaintCount):
2476         * platform/graphics/ca/TileGrid.h:
2477         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
2478         (PlatformCALayer::drawLayerContents):
2479         * platform/graphics/ca/win/PlatformCALayerWin.cpp:
2480         (PlatformCALayer::drawLayerContents):
2481         * platform/graphics/ca/win/PlatformCALayerWinInternal.cpp:
2482         (PlatformCALayerWinInternal::displayCallback):
2483         * platform/graphics/ca/win/WebTiledBackingLayerWin.cpp:
2484         (WebTiledBackingLayerWin::displayCallback):
2485         * platform/graphics/mac/WebLayer.mm:
2486         (-[WebLayer drawInContext:]):
2487         (-[WebSimpleLayer drawInContext:]):
2488         * rendering/RenderBoxModelObject.cpp:
2489         (WebCore::RenderBoxModelObject::decodingModeForImageDraw):
2490         * rendering/RenderElement.h:
2491         * rendering/RenderLayerBacking.cpp:
2492         (WebCore::RenderLayerBacking::paintContents):
2493         * rendering/RenderLayerBacking.h:
2494         * rendering/RenderLayerCompositor.cpp:
2495         (WebCore::RenderLayerCompositor::paintContents):
2496         * rendering/RenderLayerCompositor.h:
2497         * testing/Internals.cpp:
2498         (WebCore::imageFromImageElement):
2499         (WebCore::bitmapImageFromImageElement):
2500         (WebCore::Internals::imageFrameIndex):
2501         (WebCore::Internals::setImageFrameDecodingDuration):
2502         (WebCore::Internals::resetImageAnimation):
2503         (WebCore::Internals::isImageAnimating):
2504         (WebCore::Internals::setClearDecoderAfterAsyncFrameRequestForTesting):
2505         (WebCore::Internals::imageDecodeCount):
2506         (WebCore::Internals::setLargeImageAsyncDecodingEnabledForTesting):
2507         * testing/Internals.h:
2508         * testing/Internals.idl:
2509
2510 2017-07-18  Chris Dumez  <cdumez@apple.com>
2511
2512         DOMException should have its properties on the prototype
2513         https://bugs.webkit.org/show_bug.cgi?id=174597
2514
2515         Reviewed by Alex Christensen.
2516
2517         DOMException should have its properties on the prototype, as other interfaces:
2518         - https://heycam.github.io/webidl/#idl-DOMException
2519
2520         No new tests, rebaselined existing tests.
2521
2522         * bindings/scripts/CodeGeneratorJS.pm:
2523         (InterfaceRequiresAttributesOnInstance):
2524
2525 2017-07-18  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2526
2527         [Curl] Unify ResourceHandleManager into CurlJobManager.
2528         https://bugs.webkit.org/show_bug.cgi?id=173991
2529
2530         Use CurlJobManager to make ResourceHandle run in background.
2531         CurlJobManager::start() now accept callback to manage life cycle
2532         of the resource easily in a same context.
2533         Actual management tasks of CurlJobManager is now private class
2534         in CurlJobManager which is better thread safeness.
2535         ResourceHandleManager is deleted at all.
2536
2537         Reviewed by Alex Christensen.
2538
2539         * platform/Curl.cmake:
2540         * platform/network/ResourceHandle.h:
2541         * platform/network/curl/CookieJarCurl.cpp:
2542         (WebCore::cookiesForSession):
2543         * platform/network/curl/CurlContext.cpp:
2544         (WebCore::CurlHandle::CurlHandle):
2545         (WebCore::CurlHandle::~CurlHandle):
2546         (WebCore::CurlHandle::errorDescription):
2547         (WebCore::CurlHandle::perform):
2548         (WebCore::CurlHandle::pause):
2549         (WebCore::CurlHandle::appendRequestHeaders):
2550         (WebCore::CurlHandle::appendRequestHeader):
2551         (WebCore::CurlHandle::enableRequestHeaders):
2552         (WebCore::CurlHandle::fetchCookieList):
2553         (WebCore::CurlHandle::getEffectiveURL):
2554         (WebCore::CurlHandle::setPrivateData): Deleted.
2555         (WebCore::CurlHandle::clearRequestHeaders): Deleted.
2556         (WebCore::CurlHandle::getCookieList): Deleted.
2557         (WebCore::CurlHandle::clearCookieList): Deleted.
2558         * platform/network/curl/CurlContext.h:
2559         (WebCore::CurlSList::CurlSList):
2560         (WebCore::CurlSList::~CurlSList):
2561         (WebCore::CurlSList::operator struct curl_slist** ):
2562         (WebCore::CurlSList::head):
2563         (WebCore::CurlSList::isEmpty):
2564         (WebCore::CurlSList::clear):
2565         (WebCore::CurlSList::append):
2566         (WebCore::CurlHandle::errorCode):
2567         (WebCore::CurlHandle::setErrorCode):
2568         (WebCore::CurlHandle::privateData):
2569         (WebCore::CurlHandle::setPrivateData):
2570         * platform/network/curl/CurlDownload.cpp:
2571         (WebCore::CurlDownload::start):
2572         (WebCore::CurlDownload::cancel):
2573         (WebCore::CurlDownload::addHeaders):
2574         (WebCore::CurlDownload::didReceiveData):
2575         (WebCore::CurlDownload::didFail):
2576         (WebCore::CurlDownload::handleCurlMsg): Deleted.
2577         * platform/network/curl/CurlDownload.h:
2578         * platform/network/curl/CurlJobManager.cpp:
2579         (WebCore::CurlJobList::append):
2580         (WebCore::CurlJobList::cancel):
2581         (WebCore::CurlJobList::complete):
2582         (WebCore::CurlJobList::isEmpty):
2583         (WebCore::CurlJobList::withJob):
2584         (WebCore::CurlJobList::withCurlHandle):
2585         (WebCore::CurlJob::invoke):
2586         (WebCore::CurlJobManager::add):
2587         (WebCore::CurlJobManager::cancel):
2588         (WebCore::CurlJobManager::callOnJobThread):
2589         (WebCore::CurlJobManager::startThreadIfNeeded):
2590         (WebCore::CurlJobManager::stopThreadIfNoMoreJobRunning):
2591         (WebCore::CurlJobManager::stopThread):
2592         (WebCore::CurlJobManager::updateJobs):
2593         (WebCore::CurlJobManager::workerThread):
2594         (WebCore::CurlJobManager::CurlJobManager): Deleted.
2595         (WebCore::CurlJobManager::~CurlJobManager): Deleted.
2596         (WebCore::CurlJobManager::remove): Deleted.
2597         (WebCore::CurlJobManager::getActiveCount): Deleted.
2598         (WebCore::CurlJobManager::getPendingCount): Deleted.
2599         (WebCore::CurlJobManager::stopThreadIfIdle): Deleted.
2600         (WebCore::CurlJobManager::updateHandleList): Deleted.
2601         (WebCore::CurlJobManager::addToCurl): Deleted.
2602         (WebCore::CurlJobManager::removeFromCurl): Deleted.
2603         * platform/network/curl/CurlJobManager.h:
2604         (WebCore::CurlJob::CurlJob):
2605         (WebCore::CurlJob::~CurlJob):
2606         (WebCore::CurlJob::operator=):
2607         (WebCore::CurlJob::curlHandle):
2608         (WebCore::CurlJob::ticket):
2609         (WebCore::CurlJob::finished):
2610         (WebCore::CurlJob::error):
2611         (WebCore::CurlJob::cancel):
2612         (WebCore::CurlJobManager::singleton):
2613         (WebCore::CurlJobManager::~CurlJobManager):
2614         (WebCore::CurlJobManager::isActiveJob):
2615         (WebCore::CurlJobManager::runThread): Deleted.
2616         (WebCore::CurlJobManager::setRunThread): Deleted.
2617         * platform/network/curl/ResourceError.h:
2618         (WebCore::ResourceError::ResourceError):
2619         * platform/network/curl/ResourceHandleCurl.cpp:
2620         (WebCore::ResourceHandle::~ResourceHandle):
2621         (WebCore::ResourceHandle::start):
2622         (WebCore::ResourceHandle::cancel):
2623         (WebCore::ResourceHandle::initialize):
2624         (WebCore::ResourceHandle::applyAuthentication):
2625         (WebCore::getFormElementsCount):
2626         (WebCore::ResourceHandle::setupPUT):
2627         (WebCore::ResourceHandle::setupPOST):
2628         (WebCore::ResourceHandle::setupFormData):
2629         (WebCore::ResourceHandle::setHostAllowsAnyHTTPSCertificate):
2630         (WebCore::ResourceHandle::setClientCertificateInfo):
2631         (WebCore::ResourceHandle::platformSetDefersLoading):
2632         (WebCore::ResourceHandle::didFinish):
2633         (WebCore::ResourceHandle::didFail):
2634         (WebCore::ResourceHandle::shouldUseCredentialStorage):
2635         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
2636         (WebCore::ResourceHandle::receivedCredential):
2637         (WebCore::ResourceHandle::receivedRequestToContinueWithoutCredential):
2638         (WebCore::ResourceHandle::receivedCancellation):
2639         (WebCore::ResourceHandle::calculateWebTimingInformations):
2640         (WebCore::ResourceHandle::handleLocalReceiveResponse):
2641         (WebCore::ResourceHandle::willPrepareSendData):
2642         (WebCore::ResourceHandle::didReceiveHeaderLine):
2643         (WebCore::ResourceHandle::didReceiveAllHeaders):
2644         (WebCore::ResourceHandle::didReceiveContentData):
2645         (WebCore::ResourceHandle::readCallback):
2646         (WebCore::ResourceHandle::headerCallback):
2647         (WebCore::ResourceHandle::writeCallback):
2648         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
2649         (WebCore::ResourceHandle::dispatchSynchronousJob):
2650         (WebCore::calculateWebTimingInformations): Deleted.
2651         (WebCore::handleLocalReceiveResponse): Deleted.
2652         (WebCore::writeCallback): Deleted.
2653         (WebCore::headerCallback): Deleted.
2654         (WebCore::readCallback): Deleted.
2655         (WebCore::setupFormData): Deleted.
2656         (WebCore::ResourceHandle::handleCurlMsg): Deleted.
2657         * platform/network/curl/ResourceHandleManager.cpp: Removed.
2658         * platform/network/curl/ResourceHandleManager.h: Removed.
2659
2660 2017-07-17  Konstantin Tokarev  <annulen@yandex.ru>
2661
2662         Unreviewed fix to Mac CMake build after r219474.
2663
2664         * PlatformMac.cmake:
2665
2666 2017-07-17  Konstantin Tokarev  <annulen@yandex.ru>
2667
2668         [cmake] Set library types before their targets are created
2669         https://bugs.webkit.org/show_bug.cgi?id=174600
2670
2671         Reviewed by Michael Catanzaro.
2672
2673         Since r219560 library targets are created before PlatformXXX.cmake
2674         files are processed, however library type must be passed in
2675         add_library() call and cannot be changed afterwards. Set these
2676         variables in OptionsXXX.cmake.
2677
2678         No new tests needed.
2679
2680         * PlatformMac.cmake:
2681
2682 2017-07-17  Yoshiaki Jitsukawa  <Yoshiaki.Jitsukawa@sony.com>
2683
2684         Move USE_AVFOUNDATION definition on Windows to wtf/Platform.h
2685         https://bugs.webkit.org/show_bug.cgi?id=174356
2686
2687         Reviewed by Brent Fulgham.
2688
2689         Move the definition of USE_AVFOUNDATION on Windows to wtf/platform.h
2690
2691         Rename WebCoreHeaderDetection.h to AVFoundationHeaderDetection.h
2692
2693         * AVFoundationSupport.py: Moved to Source/WTF/AVFoundationSupport.py.
2694         * DerivedSources.make:
2695         * PlatformWin.cmake:
2696         * config.h:
2697         * platform/graphics/ca/win/PlatformCALayerWin.cpp:
2698         * platform/graphics/ca/win/PlatformCALayerWinInternal.cpp:
2699
2700 2017-07-17  Sam Weinig  <sam@webkit.org>
2701
2702         [WebIDL] Remove custom bindings that require non-caching JS strings
2703         https://bugs.webkit.org/show_bug.cgi?id=174552
2704
2705         Reviewed by Darin Adler.
2706
2707         Adds two new types, UncachedString and OwnedString (both of which
2708         are simple structs that wrap a String) to communicate to the bindings
2709         layer which function to use when converting to a JS string.
2710
2711         * bindings/IDLTypes.h:
2712         (WebCore::IDLString::isNullValue):
2713         Add overloads of isNullValue for UncachedString and OwnedString.
2714
2715         * bindings/js/JSDOMConvertStrings.h:
2716         (WebCore::JSConverter<IDLDOMString>::convert):
2717         (WebCore::JSConverter<IDLByteString>::convert):
2718         (WebCore::JSConverter<IDLUSVString>::convert):
2719         Add overloads of convert for UncachedString that uses JSC::jsString 
2720         and for OwnedString that uses JSC::jsOwnedString.
2721
2722         * bindings/js/JSHTMLCanvasElementCustom.cpp:
2723         (WebCore::JSHTMLCanvasElement::toDataURL): Deleted.
2724         Remove custom binding for toDataURL.
2725
2726         * bindings/js/JSXMLHttpRequestCustom.cpp:
2727         (WebCore::JSXMLHttpRequest::retrieveResponse):
2728         (WebCore::JSXMLHttpRequest::responseText): Deleted.
2729         Remove custom binding for responseText. Replace the caller of the 
2730         binding function with a simple conversion that will do the same thing.
2731
2732         * bindings/js/StringAdaptors.h: Added.
2733         Add UncachedString and OwnedString adaptors.
2734
2735         * html/HTMLCanvasElement.cpp:
2736         (WebCore::HTMLCanvasElement::toDataURL):
2737         Move quality conversion here, matching toBlob and the spec. Return a UncachedString
2738         to instruct the bindings to use JSC::jsString and not JSC::jsStringWithCache.
2739
2740         (WebCore::HTMLCanvasElement::toBlob):
2741         Use asNumber() rather than toNumber(), since we just checked that it is a number.
2742
2743         * html/HTMLCanvasElement.h:
2744         Update header to account for returning an UncachedString.
2745
2746         * html/HTMLCanvasElement.idl:
2747         Remove [Custom] and make the signature of toDataURL match the spec (and what we have been doing).
2748
2749         * inspector/InspectorCanvasAgent.cpp:
2750         (WebCore::InspectorCanvasAgent::requestContent):
2751         Update to account for UncachedString.
2752
2753         * xml/XMLHttpRequest.cpp:
2754         (WebCore::XMLHttpRequest::responseText):
2755         * xml/XMLHttpRequest.h:
2756         Update responseText to return OwnedString. OwnedString instruct the bindings to 
2757         use JSC::jsOwnedString and not JSC::jsStringWithCache.
2758
2759         * xml/XMLHttpRequest.idl:
2760         Remove [CustomGetter].
2761
2762 2017-07-17  Daniel Bates  <dabates@apple.com>
2763
2764         Cleanup: Use OptionSet to represent marker types
2765         https://bugs.webkit.org/show_bug.cgi?id=174594
2766
2767         Reviewed by Darin Adler.
2768
2769         Remove class DocumentMarker::MarkerTypes that duplicates most of functionality of OptionSet
2770         and use OptionSet directly to represent a set of marker types.
2771
2772         No functionality changed. So, no new tests.
2773
2774         * dom/Document.cpp:
2775         (WebCore::Document::updateLayout):
2776         * dom/DocumentMarker.h:
2777         (WebCore::DocumentMarker::MarkerTypes::MarkerTypes): Deleted.
2778         (WebCore::DocumentMarker::MarkerTypes::contains): Deleted.
2779         (WebCore::DocumentMarker::MarkerTypes::intersects): Deleted.
2780         (WebCore::DocumentMarker::MarkerTypes::operator==): Deleted.
2781         (WebCore::DocumentMarker::MarkerTypes::add): Deleted.
2782         (WebCore::DocumentMarker::MarkerTypes::remove): Deleted.
2783         (WebCore::DocumentMarker::AllMarkers::AllMarkers): Deleted.
2784         * dom/DocumentMarkerController.cpp:
2785         (WebCore::DocumentMarkerController::possiblyHasMarkers):
2786         (WebCore::DocumentMarkerController::detach):
2787         (WebCore::DocumentMarkerController::removeMarkers):
2788         (WebCore::DocumentMarkerController::addMarker):
2789         (WebCore::DocumentMarkerController::copyMarkers):
2790         (WebCore::DocumentMarkerController::markersFor):
2791         (WebCore::DocumentMarkerController::markersInRange):
2792         (WebCore::DocumentMarkerController::removeMarkersFromList):
2793         (WebCore::DocumentMarkerController::repaintMarkers):
2794         (WebCore::DocumentMarkerController::shiftMarkers):
2795         (DocumentMarkerController::setMarkersActive):
2796         (DocumentMarkerController::hasMarkers):
2797         (DocumentMarkerController::clearDescriptionOnMarkersIntersectingRange):
2798         Update code as needed.
2799
2800         * dom/DocumentMarkerController.h:
2801         (WebCore::DocumentMarkerController::hasMarkers):
2802         Update code as needed.
2803
2804         * editing/AlternativeTextController.cpp:
2805         (WebCore::markerTypesForAutocorrection):
2806         (WebCore::markerTypesForReplacement):
2807         (WebCore::markerTypesForAppliedDictationAlternative):
2808         Marked as inline and returns an OptionSet<DocumentMarker::MarkerType>. It is unnecessary to use NeverDestroyed
2809         in these functions as constructing an OptionSet and copying/moving it is very efficient. Such operations are
2810         effectively equivalent to an integral assignment and copy of an integral value, respectively.
2811
2812         (WebCore::AlternativeTextController::applyAlternativeTextToRange):
2813         (WebCore::AlternativeTextController::respondToUnappliedSpellCorrection):
2814         (WebCore::AlternativeTextController::markCorrection):
2815         Update code as needed.
2816
2817         * editing/AlternativeTextController.h: While I am here, remove some unnecessary #includes and group
2818         forward declarations of structs.
2819         * editing/CompositeEditCommand.cpp:
2820         (WebCore::CompositeEditCommand::replaceTextInNodePreservingMarkers): Update code as needed.
2821         * editing/Editor.cpp:
2822         (WebCore::Editor::updateMarkersForWordsAffectedByEditing): Ditto.
2823         * editing/SpellChecker.cpp:
2824         (WebCore::SpellChecker::didCheckSucceed): Ditto.
2825         * page/ios/FrameIOS.mm:
2826         (WebCore::Frame::interpretationsForCurrentRoot): Ditto.
2827         * testing/Internals.cpp:
2828         (WebCore::markerTypesFrom): Ditto.
2829         (WebCore::Internals::markerCountForNode): Ditto.
2830         (WebCore::Internals::markerAt): Ditto.
2831
2832 2017-07-17  Devin Rousso  <drousso@apple.com>
2833
2834         Web Inspector: overlay page highlight doesn't disappear when a page is constantly updating
2835         https://bugs.webkit.org/show_bug.cgi?id=174468
2836
2837         Reviewed by Simon Fraser.
2838
2839         Do not allow the PageOverlay to start another fade animation of the same type if one has
2840         already started. As an example, if the PageOverlay is fading out, startFadeOutAnimation
2841         should just return.
2842
2843         * page/PageOverlay.cpp:
2844         (WebCore::PageOverlay::startFadeInAnimation):
2845         (WebCore::PageOverlay::startFadeOutAnimation):
2846
2847 2017-07-17  Darin Adler  <darin@apple.com>
2848
2849         Improve use of NeverDestroyed
2850         https://bugs.webkit.org/show_bug.cgi?id=174348
2851
2852         Reviewed by Sam Weinig.
2853
2854         * Modules/encryptedmedia/MediaKeySession.cpp: Removed unneeded include of
2855         NeverDestroyed.h.
2856
2857         * Modules/encryptedmedia/legacy/LegacyCDM.cpp:
2858         (WebCore::installedCDMFactories): Use makeNeverDestroyed and a lambda rather
2859         than a separate boolean for initialization.
2860
2861         * Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp:
2862         (WebCore::clearKeyVM): Removed unneeded use of NeverDestroyed to hold a
2863         RefPtr. Simple to just use leakRef instead.
2864
2865         * Modules/gamepad/GamepadManager.cpp: Added an include of NeverDestroyed.h.
2866
2867         * Modules/indexeddb/IDBTransaction.cpp: Removed unneeded include of
2868         NeverDestroyed.h.
2869         * Modules/indexeddb/server/MemoryObjectStore.cpp: Ditto.
2870
2871         * Modules/mediasession/MediaSessionManager.cpp: Moved include of
2872         NeverDestroyed.h here ...
2873         * Modules/mediasession/MediaSessionManager.h: ... from here.
2874
2875         * Modules/mediasource/MediaSourceRegistry.cpp: Moved include of
2876         NeverDestroyed.h here ...
2877         * Modules/mediasource/MediaSourceRegistry.h: ... from here.
2878
2879         * Modules/mediasource/SourceBuffer.cpp: Removed unneeded include of
2880         NeverDestroyed.h.
2881
2882         * Modules/plugins/QuickTimePluginReplacement.h: Initialize
2883         m_scriptObject in the class definition.
2884
2885         * Modules/plugins/QuickTimePluginReplacement.mm:
2886         (WebCore::QuickTimePluginReplacement::supportsMimeType): Use
2887         makeNeverDestroyed and the HashSet constructor instead of a loop.
2888         (WebCore::QuickTimePluginReplacement::supportsFileExtension): Ditto.
2889         (WebCore::QuickTimePluginReplacement::QuickTimePluginReplacement): Did a
2890         slight cleanup of the initializers.
2891         (WebCore::QuickTimePluginReplacement::~QuickTimePluginReplacement): Added
2892         a FIXME; unclear why there is code here at all.
2893
2894         * accessibility/AccessibilityRenderObject.cpp:
2895         (WebCore::AccessibilityRenderObject::inheritsPresentationalRole): Use
2896         makeNeverDestroyed and the Vector constructor instead of using empty
2897         vector checks and Vector::add. Use std::any_of rather than Vector::contains
2898         since we now are matching against pointers.
2899
2900         * bindings/scripts/CodeGeneratorJS.pm:
2901         (GenerateEnumerationImplementationContent): Use const NeverDestroyed.
2902
2903         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
2904         * bindings/scripts/test/JS/JSTestObj.cpp:
2905         * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
2906         * bindings/scripts/test/JS/JSTestStandaloneEnumeration.cpp:
2907         Regenerated.
2908
2909         * css/CSSProperty.cpp:
2910         (WebCore::borderDirections): Removed unnecesssary use of NeverDestroyed
2911         for a global object that has a trivial destructor.
2912
2913         * css/ElementRuleCollector.cpp:
2914         (WebCore::leftToRightDeclaration): Removed unneeded use of NeverDestroyed to hold a
2915         Ref. Simple to just use leakRef instead. Also use a lambda instead of an explicit
2916         isEmpty check each time this is called.
2917         (WebCore::rightToLeftDeclaration): Ditto.
2918
2919         * css/makeprop.pl: Removed unneeded include of NeverDestroyed.h and the
2920         uneeded global emptyShorthand. Constructing an empty StylePropertyShorthand
2921         is no less efficient than copying a global empty one was.
2922
2923         * dom/CustomElementReactionQueue.cpp: Added an include of NeverDestroyed.h.
2924
2925         * dom/DOMImplementation.cpp: Removed unneeded include of NeverDestroyed.h.
2926         * dom/InputEvent.cpp: Ditto.
2927
2928         * dom/Microtasks.cpp: Moved include of NeverDestroyed.h here ...
2929         * dom/Microtasks.h: ... from here.
2930
2931         * dom/MutationObserver.cpp: Added an include of NeverDestroyed.h.
2932
2933         * dom/ScopedEventQueue.cpp: Moved include of NeverDestroyed.h here ...
2934         * dom/ScopedEventQueue.h: ... from here. Added Forward.h.
2935
2936         * dom/ScriptElement.cpp:
2937         (WebCore::isLegacySupportedJavaScriptLanguage): Use makeNeverDestroyed
2938         and the HashSet constructor rather than an isEmpty check and a lot of
2939         add function calls. Also removed comments that don't have value any more,
2940         with dubious no longer relevant claims about the behavior of old web browsers.
2941         The function that calls this one already has sufficient comments about why we
2942         hope some day this function can be eliminated.
2943
2944         * dom/SecurityContext.cpp: Removed unneeded include of NeverDestroyed.h.
2945
2946         * dom/make_names.pl:
2947         (printFactoryCppFile): Instead of using a "populate" function, use a function
2948         that creates as HashMap. Then use const auto and makeNeverDestroyed.
2949         (printWrapperFactoryCppFile): Ditto.
2950
2951         * editing/AlternativeTextController.cpp:
2952         (WebCore::markerTypesForAutocorrection): Use makeNeverDestroyed
2953         and the Vector constructor rather than an isEmpty check and a lot of
2954         append function calls.
2955         (WebCore::markerTypesForReplacement): Ditto.
2956         (WebCore::markerTypesForAppliedDictationAlternative): Ditto.
2957
2958         * editing/EditingStyle.cpp:
2959         (WebCore::htmlElementEquivalents): Use const auto, makeNeverDestroyed,
2960         the Vector constructor, and new rather than make_unique. Changed return
2961         type to use const pointers rather than unique_ptr with non-const type.
2962         (WebCore::EditingStyle::conflictsWithImplicitStyleOfElement): Updated
2963         for the above change to htmlElementEquivalents.
2964         (WebCore::htmlAttributeEquivalents): Same approach as above.
2965         (WebCore::EditingStyle::conflictsWithImplicitStyleOfAttributes): Ditto.
2966         (WebCore::elementMatchesAndPropertyIsNotInInlineStyleDecl): Take
2967         references instead of pointers.
2968         (WebCore::EditingStyle::mergeInlineAndImplicitStyleOfElement): Updated
2969         for the above.
2970
2971         * editing/FormatBlockCommand.cpp:
2972         (WebCore::isElementForFormatBlock): Use const auto, makeNeverDestroyed,
2973         and the HashSet constructor rather than isEmpty and a lot of calls to add.
2974         * editing/RemoveFormatCommand.cpp:
2975         (WebCore::isElementForRemoveFormatCommand): Ditto.
2976
2977         * editing/ReplaceSelectionCommand.cpp:
2978         (WebCore::isProhibitedParagraphChild): Use const auto, makeNeverDestroyed,
2979         and a lambda, rather than isEmpty and a lot of calls to add.
2980
2981         * html/Autofill.cpp:
2982         (WebCore::fieldNameMap): Changed return type to be const. Use const auto,
2983         makeNeverDestroyed, a lambda, and an array of values rather than isEmpty
2984         and a lot of calls to add. Stopped doing the ConstructFromLiteral
2985         optimization here. (Easy to add it back if that is a mistake.)
2986
2987         * html/HTMLObjectElement.cpp:
2988         (WebCore::isRecognizedTagName): Use const auto, makeNeverDestroyed, and
2989         a lambda rather than isEmpty.
2990
2991         * html/HTMLStyleElement.cpp: Added include of NeverDestroyed.h.
2992
2993         * html/HTMLVideoElement.cpp: Removed uneeded include of NeverDestroyed.h.
2994
2995         * html/InputType.cpp:
2996         (WebCore::createInputTypeFactoryMap): Replaced the populate function
2997         with this create function.
2998         (WebCore::InputType::create): Use const auto and makeNeverDestroyed
2999         istead of isEmpty. Also put the map right where it is used so it's
3000         not initialized in code path where not needed.
3001
3002         * html/parser/HTMLParserIdioms.cpp: Removed uneeded include of
3003         NeverDestroyed.h.
3004
3005         * inspector/InspectorApplicationCacheAgent.cpp:
3006         (WebCore::InspectorApplicationCacheAgent::networkStateChanged):
3007         Merged into a single line.
3008
3009         * loader/ContentFilter.cpp:
3010         (WebCore::blockedPageURL): Use const auto and makeNeverDestroyed
3011         rather than std::call_once. Since this is a URL and has a non-thread-safe
3012         reference count, this was not thread safe before, so no need to use the
3013         more roundabout and less efficient idiom for its thread safety.
3014
3015         * loader/CrossOriginAccessControl.cpp:
3016         (WebCore::isOnAccessControlResponseHeaderWhitelist): Deleted.
3017         * loader/CrossOriginAccessControl.h: Deleted unused function
3018         isOnAccessControlResponseHeaderWhitelist.
3019
3020         * loader/EmptyClients.cpp: Use leakRef instead of NeverDestroyed<Ref>.
3021
3022         * loader/appcache/ApplicationCacheStorage.cpp: Removed unneeded include of
3023         NeverDestroyed.h.
3024         * page/CaptionUserPreferences.cpp: Ditto.
3025
3026         * page/DebugPageOverlays.cpp:
3027         (WebCore::touchEventRegionColors): Changed the return type to const, since
3028         the callers do not modify the map. Use const auto, makeNeverDestroyed, and
3029         a lambda rather than isEmpty and repeated calls to add.
3030
3031         * page/MainFrame.cpp: Removed unneeded include of NeverDestroyed.h.
3032
3033         * page/MemoryRelease.cpp:
3034         (WebCore::releaseMemory): Use a function directly instead of calling it
3035         inside a lambda.
3036
3037         * page/NavigatorBase.cpp:
3038         (WebCore::NavigatorBase::onLine): Updated to call
3039         NetworkStateNotifier::singleton.
3040
3041         * page/Page.cpp:
3042         (WebCore::allPages): Made this a function instead of a global to use the
3043         normal idiom for such globals.
3044         (WebCore::Page::forEachPage): Updated for change to allPages.
3045         (WebCore::networkStateChanged): Ditto. Also removed a bit of unnecessary
3046         churn by using const AtomicString& instead of AtomicString.
3047         (WebCore::Page::Page): Moved initialization of most data members to the
3048         class definition. Removed initialiation of allPages. Updated the use of
3049         NetworkStateNotifier for its new slightly changed  interface.
3050         (WebCore::Page::~Page): Updated for change to allPages.
3051         (WebCore::Page::clearPreviousItemFromAllPages): Ditto.
3052         (WebCore::Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment): Ditto.
3053         (WebCore::Page::refreshPlugins): Ditto.
3054
3055         * page/Page.h: Moved initialization of most data members here.
3056
3057         * page/PerformanceUserTiming.cpp: Removed many unneded includes.
3058         (WebCore::restrictedMarkFunction): Use const auto, makeNeverDestroyed, and
3059         a lambda instead of isEmpty. Also use an array rather than std::array and
3060         got rid fo the unneeded use of anonymous namespace since this is fine in
3061         the top level WebCore namespace.
3062         (WebCore::clearPerformanceEntries): Tweaked coding style.
3063         (WebCore::UserTiming::mark): Ditto.
3064         (WebCore::UserTiming::findExistingMarkStartTime): Got rid of double hash
3065         table lookup by using find instead of using contains followed by get.
3066         removed unneeded explicit cast to double. Tweaked coding style.
3067         (WebCore::convertToEntrySequence): Tweaked coding style.
3068         (WebCore::getEntrySequenceByName): Deleted.
3069         (WebCore::UserTiming::getMarks): Call get directly instead of getEntrySequenceByName.
3070         (WebCore::UserTiming::getMeasures): Ditto.
3071
3072         * page/RuntimeEnabledFeatures.cpp: Moved include of NeverDestroyed.h here ...
3073         * page/RuntimeEnabledFeatures.h: ... from here. Added Forward.h and Noncopyable.h.
3074
3075         * platform/LocalizedStrings.cpp: Removed unneeded include of NeverDestroyed.h.
3076
3077         * platform/MIMETypeRegistry.cpp:
3078         (WebCore::initializeSupportedImageMIMETypes): Added a missing const for a global
3079         constant array.
3080         (WebCore::initializeSupportedJavaScriptMIMETypes): Ditto.
3081         (WebCore::initializeSupportedNonImageMimeTypes): Ditto.
3082         (WebCore::typesForCommonExtension): Replaced the old mediaMIMETypeMap function
3083         with this one. Moved the common media types array here since it's only used here.
3084         Use const auto, makeNeverDestroyed, and a lambda instead of using an isEmpty check.
3085         Iterate the array using a mdoern for loop. Use HashMap::ensure to avoid the
3086         double hashing that the old code was doing. And moved the code to find an entry
3087         in the map in here from the client functions.
3088         (WebCore::MIMETypeRegistry::getMediaMIMETypeForExtension): Updated to use the
3089         typesForCommonExtension, and changed logic to use this first, and only call
3090         getMIMETypeForExtension for extensions not in the map. This gives the same
3091         result but should be slightly more efficient.
3092         (WebCore::MIMETypeRegistry::getMediaMIMETypesForExtension): Updated to use the
3093         typesForCommonExtension function. Comment about strategy is now in there.
3094         (WebCore::initializeUnsupportedTextMIMETypes): Added a missing const for a global
3095         constant array. Also started using ASCIILiteral.
3096
3097         * platform/MainThreadSharedTimer.cpp: Moved include of NeverDestroyed.h here ...
3098         * platform/MainThreadSharedTimer.h: ... from here. Added Forward.h.
3099
3100         * platform/SchemeRegistry.cpp:
3101         (WebCore::add): Added helper functions to keep code below simpler.
3102         (WebCore::makeNeverDestroyedSchemeSet): Ditto.
3103         (WebCore::allBuiltinSchemes): Use const auto, makeNeverDestroyed, a lambda,
3104         and the helper functions above, rather than isEmpty.
3105         (WebCore::builtinLocalURLSchemes): Use const auto, makeNeverDestroyed, and
3106         the HashSet constructor instead of isEmpty and add calls. Also changed the
3107         return type to be const.
3108         (WebCore::localURLSchemes): Copy the map using assignment instead of an
3109         isEmpty function and a loop with calls to add.
3110         (WebCore::builtinSecureSchemes): Use const auto, makeNeverDestroyed, and
3111         the Vector constructor rather than isEmpty, repeated calls to append,
3112         and shrinkToFit.
3113         (WebCore::secureSchemes): Use auto and makeNeverDestroyedSchemeSet rather
3114         than isEmpty and repeated calls to add.
3115         (WebCore::builtinSchemesWithUniqueOrigins): More of the same.
3116         (WebCore::schemesWithUniqueOrigins): Ditto.
3117         (WebCore::builtinEmptyDocumentSchemes): Ditto.
3118         (WebCore::emptyDocumentSchemes): Ditto.
3119         (WebCore::schemesForbiddenFromDomainRelaxation): Ditto.
3120         (WebCore::builtinCanDisplayOnlyIfCanRequestSchemes): Ditto.
3121         (WebCore::canDisplayOnlyIfCanRequestSchemes): Ditto.
3122         (WebCore::builtinCORSEnabledSchemes): Ditto.
3123         (WebCore::CORSEnabledSchemes): Ditto.
3124         (WebCore::SchemeRegistry::shouldTreatURLSchemeAsLocal): Replaced check for
3125         empty string with check for null string, since that's slightly more efficient
3126         for non-null, non-empty strings, and the hash table can handle empty strings
3127         just fine.
3128         (WebCore::SchemeRegistry::registerURLSchemeAsNoAccess): Added null check here.
3129         (WebCore::SchemeRegistry::shouldTreatURLSchemeAsNoAccess): Ditto.
3130         (WebCore::SchemeRegistry::registerURLSchemeAsDisplayIsolated): Ditto.
3131         (WebCore::SchemeRegistry::shouldTreatURLSchemeAsDisplayIsolated): Ditto.
3132         (WebCore::SchemeRegistry::registerURLSchemeAsSecure): Ditto.
3133         (WebCore::SchemeRegistry::shouldTreatURLSchemeAsSecure): Ditto.
3134         (WebCore::SchemeRegistry::registerURLSchemeAsEmptyDocument): Ditto.
3135         (WebCore::SchemeRegistry::shouldLoadURLSchemeAsEmptyDocument): Ditto.
3136         (WebCore::SchemeRegistry::setDomainRelaxationForbiddenForURLScheme): Ditto.
3137         (WebCore::SchemeRegistry::isDomainRelaxationForbiddenForURLScheme): Ditto.
3138         (WebCore::SchemeRegistry::canDisplayOnlyIfCanRequest): Ditto.
3139         (WebCore::SchemeRegistry::registerAsCanDisplayOnlyIfCanRequest): Ditto.
3140         (WebCore::SchemeRegistry::registerURLSchemeAsNotAllowingJavascriptURLs): Ditto.
3141         (WebCore::SchemeRegistry::shouldTreatURLSchemeAsNotAllowingJavascriptURLs): Ditto.
3142         (WebCore::SchemeRegistry::registerURLSchemeAsAllowingLocalStorageAccessInPrivateBrowsing): Ditto.
3143         (WebCore::SchemeRegistry::allowsLocalStorageAccessInPrivateBrowsing): Ditto.
3144         (WebCore::SchemeRegistry::registerURLSchemeAsAllowingDatabaseAccessInPrivateBrowsing): Ditto.
3145         (WebCore::SchemeRegistry::allowsDatabaseAccessInPrivateBrowsing): Ditto.
3146         (WebCore::SchemeRegistry::registerURLSchemeAsCORSEnabled): Ditto.
3147         (WebCore::SchemeRegistry::shouldTreatURLSchemeAsCORSEnabled): Ditto.
3148         (WebCore::SchemeRegistry::registerURLSchemeAsBypassingContentSecurityPolicy): Ditto.
3149         (WebCore::SchemeRegistry::removeURLSchemeRegisteredAsBypassingContentSecurityPolicy): Ditto.
3150         (WebCore::SchemeRegistry::schemeShouldBypassContentSecurityPolicy): Ditto.
3151         (WebCore::SchemeRegistry::registerURLSchemeAsAlwaysRevalidated): Ditto.
3152         (WebCore::SchemeRegistry::shouldAlwaysRevalidateURLScheme): Ditto.
3153         (WebCore::SchemeRegistry::registerURLSchemeAsCachePartitioned): Ditto.
3154         (WebCore::SchemeRegistry::shouldPartitionCacheForURLScheme): Ditto.
3155         (WebCore::SchemeRegistry::isUserExtensionScheme): Tweaked #if a bit.
3156         (WebCore::SchemeRegistry::isBuiltinScheme): Added null check.
3157
3158         * platform/cocoa/WebVideoFullscreenModelVideoElement.mm:
3159         (WebVideoFullscreenModelVideoElement::observedEventNames): Use const auto,
3160         makeNeverDestroyed, and the Vector constructor rather than a call to size
3161         and then append eacn time this funciton is called.
3162
3163         * platform/gamepad/cocoa/GameControllerGamepadProvider.h: Moved include of
3164         NeverDestroyed.h from here ...
3165         * platform/gamepad/cocoa/GameControllerGamepadProvider.mm: ... to here.
3166
3167         * platform/gamepad/mac/HIDGamepadProvider.cpp: Moved include of
3168         NeverDestroyed.h here ...
3169         * platform/gamepad/mac/HIDGamepadProvider.h: ... from here.
3170
3171         * platform/graphics/FontCascade.cpp:
3172         (WebCore::FontCascade::hasValidAverageCharWidth): Use const auto,
3173         makeNeverDestroyed, and the HashSet constructor.
3174
3175         * platform/graphics/ImageBuffer.cpp:
3176         (WebCore::ImageBuffer::transformColorSpace): Removed unneeded use of
3177         NeverDestroyed<Vector<int>> here, instead using const std::array.
3178
3179         * platform/graphics/ImageBuffer.h: Changed platformTransformColorSpace to take
3180         const std::array<uint8_t, 256>& instead of const Vector<int>&, since the whole
3181         pointer of the argument is that it's a table to map bytes onto other bytes.
3182
3183         * platform/graphics/MediaPlaybackTarget.h: Removed unneeded include of
3184         NeverDestroyed.h, unneeded unused noMediaPlaybackTargetContext function,
3185         and unneeded include of MediaPlaybackTargetContext.h, forward declaring instead.
3186         Made most functions in this class pure virtual instead of having default
3187         implementations.
3188
3189         * platform/graphics/avfoundation/MediaPlaybackTargetMac.h: Added include
3190         of MediaPlaybackTargetContext.h now that it was removed above.
3191
3192         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
3193         (WebCore::MediaPlayerPrivateAVFoundation::staticMIMETypeList): Use const auto,
3194         makeNeverDestroyed, and the HashSet constructor.
3195
3196         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3197         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::isAvailable): Reversed the sense
3198         of the boolean logic here to make this simpler and easier to read.
3199         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::getSupportedTypes): Changed
3200         the implementation here, which empties out the passed in hash set, to use
3201         the clear function rather than assignment from a global empty hash set. Added
3202         a FIXME because it seems peculiar that this would be considered OK.
3203         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::supportsType): Used ? : to make
3204         this a little more terse; I think it's clearer.
3205
3206         * platform/graphics/cairo/ImageBufferCairo.cpp:
3207         (WebCore::ImageBuffer::platformTransformColorSpace): Updated for change to
3208         argument type.
3209
3210         * platform/graphics/cg/ImageDecoderCG.cpp: Removed unneeded include of
3211         NeverDestroyed.h.
3212         (WebCore::appendImageSourceOption): Streamlined code using auto with
3213         adoptCF; there is no need to write out the type of the RetainPtr.
3214         (WebCore::imageSourceOptions): Instead of NeverDestroyed<RetainPtr>, just use
3215         const auto and leakRef.
3216         (WebCore::imageSourceAsyncOptions): Ditto.
3217
3218         * platform/graphics/gtk/GdkCairoUtilities.cpp:
3219         (WebCore::getDefaultCairoFontOptions): Instead of using LazyNeverDestroyed
3220         on a pointer, just use a global pointer. There is no need to use any kind
3221         of NeverDestroyed on a type with a trivial destructor such as a pointer.
3222
3223         * platform/graphics/ios/FontCacheIOS.mm:
3224         (WebCore::platformFontWithFamilySpecialCase): Instead of using
3225         NeverDestroyed<RetainPtr> just use a raw pointer global.
3226         * platform/graphics/mac/FontCacheMac.mm:
3227         (WebCore::platformFontWithFamilySpecialCase): Ditto.
3228
3229         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
3230         (WebCore::createFileTypesSet): Return the HashSet instead of adding to it.
3231         Use Objective-C for/in syntax for an NSArray, not C++ for syntax, although
3232         it seems the C++ syntax was working fine.
3233         (WebCore::mimeCommonTypesCache): Fixed return type so we won't copy the
3234         HashMap every time this function is called. Use const auto and makeNeverDestroyed
3235         instead of using a boolean to do one time initialization.
3236         (WebCore::mimeModernTypesCache): Ditto.
3237         (WebCore::MediaPlayerPrivateQTKit::disableUnsupportedTracks): Marked a
3238         constant array const.
3239
3240         * platform/ios/Device.cpp:
3241         (WebCore::deviceClass): Use a lambda to initialize a variable here instead
3242         of using std::call_once. This function does not need to be thread safe.
3243         (WebCore::deviceName): Use const NeverDestroyed instead of LazyNeverDestroyed
3244         and std::call_once. This function does not need to be thread safe.
3245
3246         * platform/ios/DragImageIOS.mm: Make defaultLinkIndicatorOptions be a
3247         constant instead of a variable.
3248         (WebCore::cascadeForSystemFont): Added helper function.
3249         (WebCore::createDragImageForLink): Use const auto and makeNeverDestroyed
3250         instead of LazyNeverDestroyed and dispatch_once. This code does not need
3251         to be thread safe since its arguments include, for example, a DOM element.
3252
3253         * platform/ios/LegacyTileLayerPool.h: Removed unneeded include of
3254         NeverDestroyed.h.
3255
3256         * platform/ios/QuickLook.mm:
3257         (WebCore::QLPreviewGetSupportedMIMETypesSet): Use a global raw pointer
3258         instead of NeverDestroyed<RetainPtr<NSSet>>.
3259         (WebCore::createQLPreviewProtocol): Deleted.
3260         (WebCore::QLPreviewProtocol): Use a global raw pointer instead of
3261         a NeverDestroyed<Vector<char>>. It's cleaner to use fastStrdup instead
3262         of appending to an array, and less wasteful of memory too.
3263
3264         * platform/ios/WebCoreMotionManager.mm: Removed unneeded include of
3265         NeverDestroyed.h.
3266         * platform/ios/WebSQLiteDatabaseTrackerClient.h: Ditto.
3267         * platform/mac/DragImageMac.mm: Ditto.
3268         * platform/mediastream/CaptureDeviceManager.cpp: Ditto.
3269         * platform/mediastream/RealtimeMediaSourceSupportedConstraints.cpp: Ditto.
3270
3271         * platform/mock/MockRealtimeMediaSource.cpp:
3272         (WebCore::MockRealtimeMediaSource::audioDevices): Use auto,
3273         makeNeverDestroyed, and a lambda instead of checking size each time.
3274         (WebCore::MockRealtimeMediaSource::videoDevices): Ditto.
3275
3276         * platform/mock/mediasource/MockMediaPlayerMediaSource.cpp:
3277         (WebCore::mimeTypeCache): Use const auto, makeNeverDestroyed, and the
3278         HashSet constructor instead of an explicit boolean to initialize.
3279
3280         * platform/network/BlobRegistryImpl.cpp:
3281         (WebCore::blobUtilityQueue): Use a global with a raw reference instead
3282         of a NeverDestroyed<Ref>.
3283
3284         * platform/network/NetworkStateNotifier.cpp:
3285         (WebCore::NetworkStateNotifier::singleton): Renamed this from
3286         networkStateNotifier. We must have missed this when we changed to use the
3287         singleton idiom consistently. Also changed to use normal NeverDestroyed
3288         rather than using LazyNeverDestroyed and call_once, because this is not
3289         used from multiple threads and has no special thread safety requirements.
3290         (WebCore::NetworkStateNotifier::NetworkStateNotifier): Moved the constructor
3291         here and construct the timer. Before the timer was used only on the Mac
3292         platform but now it is there for all platforms.
3293         (WebCore::NetworkStateNotifier::onLine): Moved function here from the header.
3294         It's a littlel less trivial than before because it now triggers a call to
3295         updateState as needed.
3296         (WebCore::NetworkStateNotifier::addListener): Renamed from
3297         addNetworkStateChangeListener since there is only one kind of listener and
3298         the old name was too wordy. Changed to call the new startObserving function,
3299         and guaranteed to call it onlh once. The platform-specific logic for iOS is
3300         now inside the iOS version of that function instead of here.
3301         (WebCore::NetworkStateNotifier::updateState): Moved here now that it is the
3302         same for all platforms. The actual state updating is done in a function named
3303         updateStateWithoutNotifying, which is implemented for each platform.
3304         (WebCore::NetworkStateNotifier::updateStateSoon): New function which takes
3305         advantage of the timer to coalesce network state updates.
3306         (WebCore::NetworkStateNotifier::updateStateWithoutNotifying): Empty stub
3307         version of this function.
3308         (WebCore::NetworkStateNotifier::startObserving): Ditto.
3309         (WebCore::NetworkStateNotifier::notifyNetworkStateChange): Deleted. Code from
3310         this has moved into updateState.
3311
3312         * platform/network/NetworkStateNotifier.h: Greatly cut down what part of this
3313         class is platform-specific.
3314
3315         * platform/network/ios/NetworkStateNotifierIOS.mm:
3316         (-[WebNetworkStateObserver initWithBlock:]): Simplified this class so it
3317         takes a block, rather than using a pointer to the C++ notifier and doing
3318         WebThreadRun.
3319         (-[WebNetworkStateObserver dealloc]): Ditto.
3320         (-[WebNetworkStateObserver networkStateChanged:]): Ditto.
3321         (WebCore::NetworkStateNotifier::updateStateWithoutNotifying):
3322         This now calls isNetworkReachable.
3323         (WebCore::NetworkStateNotifier::startObserving): Check the
3324         Settings::shouldOptOutOfNetworkStateObservation function, and if it's OK
3325         to observe, then create the observer. This code now takes care of the
3326         WebThreadRun and calls updateStateSoon.
3327         (WebCore::NetworkStateNotifier::NetworkStateNotifier): Deleted. The
3328         constructor is now platform independent.
3329         (WebCore::NetworkStateNotifier::~NetworkStateNotifier): Deleted. This
3330         object is never destroyed so we should not write a destructor for it.
3331         (WebCore::NetworkStateNotifier::registerObserverIfNecessary): Deleted.
3332         Replaced by startObserving.
3333         (WebCore::NetworkStateNotifier::onLine): Deleted. This function is now
3334         platform-independent.
3335         (WebCore::setOnLine): Deleted. The logic from this is now in
3336         updateState and updateStateWithoutNotifying.
3337
3338         * platform/network/mac/NetworkStateNotifierMac.cpp:
3339         (WebCore::NetworkStateNotifier::updateStateWithoutNotifying): Renamed
3340         this from updateState and tightened up the code a bit. Also changed
3341         to not assume anything. If there is an error, we leave m_isOnLine alone.
3342         Default behavior is now in the platform-independent code, and the default
3343         is to treat things as on-line if updateStateWithoutNotifying was called
3344         and it was never able to update the state even once.
3345         (WebCore::NetworkStateNotifier::startObserving): Moved most of the code
3346         from the constructor into this function.
3347         (WebCore::NetworkStateNotifier::dynamicStoreCallback): Deleted. This is
3348         now a lambda inside startObserving.
3349         (WebCore::NetworkStateNotifier::networkStateChangeTimerFired): Deleted.
3350         This function is now platform-independent and is named updateState.
3351
3352         * platform/network/win/NetworkStateNotifierWin.cpp:
3353         (WebCore::NetworkStateNotifier::updateStateWithoutNotifying): Renamed
3354         from updateState and tightened the code up a bit. Also changed
3355         to not assume anything. If there is an error, we leave m_isOnLine alone.
3356         Default behavior is now in the platform-independent code, and the default
3357         is to treat things as on-line if updateStateWithoutNotifying was called
3358         and it was never able to update the state even once.
3359         (WebCore::NetworkStateNotifier::addressChanged): Deleted.
3360         This function is now platform-independent and is named updateState.
3361         (WebCore::NetworkStateNotifier::addressChangeCallback): Renamed from
3362         addrChangeCallback. Simplified by using the singleton function instead
3363         of relying on the context pointer.
3364         (WebCore::NetworkStateNotifier::startObserving): Moved most of the code
3365         from the constructor here.
3366
3367         * platform/text/LocaleToScriptMappingDefault.cpp:
3368         (WebCore::scriptNameToCode): Use makeNeverDestroyed.
3369         (WebCore::localeToScriptCodeForFontSelection): Ditto.
3370
3371         * platform/text/ios/LocalizedDateCache.h: Moved include of
3372         NeverDestroyed.h from here ...
3373         * platform/text/ios/LocalizedDateCache.mm: ... to here.
3374
3375         * platform/wpe/RenderThemeWPE.cpp:
3376         (WebCore::RenderTheme::singleton): Use a theme that is never destroyed
3377         rather than Ref that is never destroyed.
3378
3379         * platform/wpe/RenderThemeWPE.h: Use friend NeverDestroyed rather than
3380         a create function since RenderTheme is no longer reference counted.
3381
3382         * rendering/RenderTheme.h: Made RenderTheme no longer reference counted.
3383
3384         * rendering/RenderThemeGtk.cpp:
3385         (WebCore::RenderThemeGtk::create): Deleted.
3386         (WebCore::RenderTheme::singleton): Use a theme that is never destroyed
3387         rather than Ref that is never destroyed.
3388
3389         * rendering/RenderThemeGtk.h: Use friend NeverDestroyed rather than
3390         a create function since RenderTheme is no longer reference counted.
3391         * rendering/RenderThemeIOS.h: Ditto.
3392
3393         * rendering/RenderThemeIOS.mm:
3394         (WebCore::RenderThemeIOS::create): Deleted.
3395         (WebCore::RenderTheme::singleton): Use a theme that is never destroyed
3396         rather than Ref that is never destroyed.
3397
3398         * rendering/RenderThemeMac.h: Use friend NeverDestroyed rather than
3399         a create function since RenderTheme is no longer reference counted.
3400         Also marked a lot of functions final rather than override and initialized
3401         data members in the class deifnition.
3402
3403         * rendering/RenderThemeMac.mm: Moved some SPI interfaces to the top of the
3404         file. They should really go into SPI headers.
3405         (-[WebCoreRenderThemeNotificationObserver init]): Removed the theme argument
3406         here because the theme is a singleton and we don't need a pointer to it.
3407         Add the observer here instead of doing it in the caller.
3408         (-[WebCoreRenderThemeNotificationObserver systemColorsDidChange:]): Call
3409         platformColorsDidChange through the singleton rather than using a pointer.
3410         (-[WebCoreTextFieldCell _coreUIDrawOptionsWithFrame:inView:includeFocus:]):
3411         Tightened up the code a bit by using CFAutorelease instead of using a
3412         combination of NSMakeCollectable, autorelease, and a typecast to accomplish
3413         the same thing.
3414         (WebCore::RenderTheme::singleton): Use a theme that is never destroyed
3415         rather than Ref that is never destroyed.
3416         (WebCore::RenderThemeMac::create): Deleted.
3417         (WebCore::RenderThemeMac::RenderThemeMac): Moved initialization into the
3418         class definition and observing into the WebCoreRenderThemeNotificationObserver
3419         init function.
3420         (WebCore::RenderThemeMac::~RenderThemeMac): Deleted. No need for this since
3421         the object will never be destroyed.
3422         (WebCore::RenderThemeMac::mediaControlsBase64StringForIconNameAndType):
3423         Removed an unnecessary conversion from C string literal to WTF::String and
3424         then to NSString. Instead, just use an NSString literal.
3425
3426         * rendering/RenderThemeWin.cpp:
3427         (WebCore::RenderThemeWin::create): Deleted.
3428         (WebCore::RenderTheme::singleton): Use a theme that is never destroyed
3429         rather than Ref that is never destroyed.
3430
3431         * rendering/RenderThemeWin.h: Use friend NeverDestroyed rather than
3432         a create function since RenderTheme is no longer reference counted.
3433
3434         * rendering/svg/RenderSVGResource.cpp:
3435         (WebCore::removeFromCacheAndInvalidateDependencies): Moved a global into
3436         the code where it is used.
3437
3438         * svg/SVGAnimatedLength.cpp: Removed unneeded include of NeverDestroyed.h.
3439
3440         * svg/SVGAnimationElement.cpp:
3441         (WebCore::SVGAnimationElement::isSupportedAttribute): Use const auto,
3442         makeNeverDestroyed, a lambda, and the new HashSet::add overload instead of
3443         an isEmpty check and lots of separate add function calls.
3444         * svg/SVGClipPathElement.cpp:
3445         (WebCore::SVGClipPathElement::isSupportedAttribute): Ditto.
3446         * svg/SVGComponentTransferFunctionElement.cpp:
3447         (WebCore::SVGComponentTransferFunctionElement::isSupportedAttribute): Ditto.
3448         * svg/SVGCursorElement.cpp:
3449         (WebCore::SVGCursorElement::isSupportedAttribute): Ditto.
3450
3451         * svg/SVGElement.cpp:
3452         (WebCore::createAttributeNameToCSSPropertyIDMap): Replaced the populate
3453         function with this create function.
3454         (WebCore::createAttributeNameToAnimatedPropertyTypeMap): Ditto.
3455         (WebCore::attributeNameToAnimatedPropertyTypeMap): Changed return type to
3456         const reference. Use const auto and makeNeverDestroyed instead of using
3457         isEmpty and a populate function.
3458         (WebCore::createCSSPropertyWithSVGDOMNameToAnimatedPropertyTypeMap):
3459         More of the same.
3460         (WebCore::cssPropertyWithSVGDOMNameToAnimatedPropertyTypeMap): Ditto.
3461         (WebCore::SVGElement::childShouldCreateRenderer): Use an array instead of
3462         a HashSet since we are checking against only 3 or 4 values.
3463         (WebCore::addQualifiedName): Deleted.
3464         (WebCore::SVGElement::animatableAttributeForName): Use const auto,
3465         makeNeverDestroyed, and a lambda to efficiently build the map in this function.
3466         (WebCore::SVGElement::cssPropertyIdForSVGAttributeName): Use const auto and
3467         makeNeverDestroyed instead of using isEmpty and a populate function.
3468
3469         * svg/SVGFilterElement.cpp:
3470         (WebCore::SVGFilterElement::isSupportedAttribute): Use const auto,
3471         makeNeverDestroyed, a lambda, and the new HashSet::add overload instead of
3472         an isEmpty check and lots of separate add function calls.
3473         * svg/SVGFilterPrimitiveStandardAttributes.cpp:
3474         (WebCore::SVGFilterPrimitiveStandardAttributes::isSupportedAttribute): Ditto.
3475         * svg/SVGForeignObjectElement.cpp:
3476         (WebCore::SVGForeignObjectElement::isSupportedAttribute): Ditto.
3477         * svg/SVGGElement.cpp:
3478         (WebCore::SVGGElement::isSupportedAttribute): Ditto.
3479         * svg/SVGGradientElement.cpp:
3480         (WebCore::SVGGradientElement::isSupportedAttribute): Ditto.
3481         * svg/SVGGraphicsElement.cpp:
3482         (WebCore::SVGGraphicsElement::isSupportedAttribute): Ditto.
3483         * svg/SVGImageElement.cpp:
3484         (WebCore::SVGImageElement::isSupportedAttribute): Ditto.
3485         * svg/SVGLangSpace.cpp:
3486         (WebCore::addWithAndWithoutXMLPrefix): Added helper. Uses xmlAtom instead
3487         of making our own NeverDestroyed local xmlPrefix.
3488         (WebCore::SVGLangSpace::addSupportedAttributes): Rewrote to use helper.
3489         * svg/SVGLineElement.cpp:
3490         (WebCore::SVGLineElement::isSupportedAttribute): Use const auto,
3491         makeNeverDestroyed, a lambda, and the new HashSet::add overload instead of
3492         an isEmpty check and lots of separate add function calls.
3493         * svg/SVGLinearGradientElement.cpp:
3494         (WebCore::SVGLinearGradientElement::isSupportedAttribute): Ditto.
3495         * svg/SVGMarkerElement.cpp:
3496         (WebCore::SVGMarkerElement::isSupportedAttribute): Ditto.
3497         * svg/SVGMaskElement.cpp:
3498         (WebCore::SVGMaskElement::isSupportedAttribute): Ditto.
3499         * svg/SVGPathElement.cpp:
3500         (WebCore::SVGPathElement::isSupportedAttribute): Ditto.
3501         * svg/SVGPatternElement.cpp:
3502         (WebCore::SVGPatternElement::isSupportedAttribute): Ditto.
3503         * svg/SVGRadialGradientElement.cpp:
3504         (WebCore::SVGRadialGradientElement::isSupportedAttribute): Ditto.
3505         * svg/SVGTextContentElement.cpp:
3506         (WebCore::SVGTextContentElement::isSupportedAttribute): Ditto.
3507         * svg/SVGTextPathElement.cpp:
3508         (WebCore::SVGTextPathElement::isSupportedAttribute): Ditto.
3509         * svg/animation/SVGSMILElement.cpp:
3510         (WebCore::SVGSMILElement::isSupportedAttribute): Ditto.
3511
3512         * testing/MockContentFilterSettings.h: Removed unneeded include of
3513         NeverDestroyed.h.
3514
3515         * testing/MockGamepadProvider.cpp: Moved include of
3516         NeverDestroyed.h here ...
3517         * testing/MockGamepadProvider.h: ... from here.
3518
3519         * testing/MockPreviewLoaderClient.h: Removed unneeded include of
3520         NeverDestroyed.h.
3521
3522         * workers/Worker.cpp:
3523         (WebCore::allWorkers): Changed this from a global to a function.
3524         (WebCore::Worker::networkStateChanged): Updated for above change and
3525         made this a member function.
3526         (WebCore::Worker::Worker): Updated for above change and
3527         change to NetworkStateNotifier.
3528         (WebCore::Worker::~Worker): Ditto.
3529         * workers/Worker.h: Made networkStateChanged a static member instead of
3530         a friend since that is a cleaner way to give it access to private member
3531         functions.
3532
3533         * xml/XPathFunctions.cpp:
3534         (WebCore::XPath::createFunctionMap): Use create instead of populate style.
3535         (WebCore::XPath::Function::create): Use const auto and makeNeverDestroyed
3536         instead of an isEmpty check.
3537
3538         * xml/XPathParser.cpp:
3539         (WebCore::XPath::createAxisNamesMap): Use create instead of populate style.
3540         (WebCore::XPath::parseAxisName): Use const auto and makeNeverDestroyed
3541         instead of an isEmpty check.
3542
3543 2017-07-17  Brady Eidson  <beidson@apple.com>
3544
3545         REGRESSION(r219298): imported/w3c/IndexedDB-private-browsing/idbfactory_open.html is crashing occassionaly (UniqueIDBDatabase being taken from the IDBServer set twice).
3546         <rdar://problem/33294987> and https://bugs.webkit.org/show_bug.cgi?id=174354
3547
3548         Reviewed by Alex Christensen.
3549
3550         No new tests (Covered by existing tests).
3551
3552         * Modules/indexeddb/server/IDBServer.cpp:
3553         (WebCore::IDBServer::IDBServer::postDatabaseTaskReply): Remove a now invalid ASSERT
3554         
3555         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
3556         (WebCore::IDBServer::UniqueIDBDatabase::scheduleShutdownForClose): Add a RELEASE_ASSERT.
3557         (WebCore::IDBServer::UniqueIDBDatabase::didDeleteBackingStore): Instead of an ad-hoc main thread dispatch, use the "schedule task reply" system
3558           to keep dispatch ordering in tact.
3559         (WebCore::IDBServer::UniqueIDBDatabase::postDatabaseTaskReply): Remove a now invalid ASSERT
3560         (WebCore::IDBServer::UniqueIDBDatabase::immediateCloseForUserDelete): Only take the owning pointer if the object doesn't already own itself.
3561
3562 2017-07-17  Wenson Hsieh  <wenson_hsieh@apple.com>
3563
3564         [iOS DnD] Web process uses too much memory when beginning a drag on a very large image
3565         https://bugs.webkit.org/show_bug.cgi?id=174585
3566         <rdar://problem/33302541>
3567
3568         Reviewed by Tim Horton.
3569
3570         Currently, attempting to drag a very large image fails, either due to us telling CoreGraphics to create an image
3571         buffer that is too large, or because the web process exceeds its memory limit and gets jetsamed. There are two
3572         places where we can optimize our memory use during the drag initialization sequence, and this patch improves
3573         both.
3574
3575         First, on iOS, we attempt to encode and send over a WebCore::Image in the PasteboardImage when writing to the
3576         item providers upon starting a drag. Currently, this Image is only used in the drag and drop codepath, in
3577         PlatformPasteboard::writeObjectRepresentations, to grab the size of the image being written for the purpose of
3578         specifying estimated display size. Serializing and deserializing an Image calls into Image::nativeImage, which
3579         attempts to draw the contents of the image into a buffer so that it can be shipped across to the UI process.
3580         Instead, we can simply compute the size in the web process while we already have the Image, and simply send that
3581         across. For copy/paste, this doesn't result in any behavior change, since we don't use the PasteboardImage's
3582         image in the first place.
3583
3584         Secondly, when starting a drag, we try to allocate create an image buffer the size of the WebCore::Image for the
3585         purpose of generating the drag preview. Instead, this patch establishes a limit on the size of this drag preview
3586         image, such that if the Image's size is larger, we'll scale down the drag preview image to be the maximum
3587         allowed size.
3588
3589         Test: DataInteractionTests.CanStartDragOnEnormousImage.
3590
3591         * editing/ios/EditorIOS.mm:
3592         (WebCore::Editor::writeImageToPasteboard):
3593         * platform/Pasteboard.h:
3594         * platform/graphics/GeometryUtilities.cpp:
3595         (WebCore::sizeWithAreaAndAspectRatio):
3596
3597         Introduce a new helper function to compute a size with the given aspect ratio and area.
3598
3599         * platform/graphics/GeometryUtilities.h:
3600         * platform/ios/DragImageIOS.mm:
3601         (WebCore::createDragImageFromImage):
3602         * platform/ios/PlatformPasteboardIOS.mm:
3603         (WebCore::PlatformPasteboard::writeObjectRepresentations):
3604
3605 2017-07-17  Michael Catanzaro  <mcatanzaro@igalia.com>
3606
3607         [CMake] Include most CMake modules from WebKitCommon.cmake
3608         https://bugs.webkit.org/show_bug.cgi?id=174546
3609
3610         Reviewed by Konstantin Tokarev.
3611
3612         * WebCoreMacros.cmake:
3613
3614 2017-07-17  Michael Catanzaro  <mcatanzaro@igalia.com>
3615
3616         [CMake] Macros in WebKitMacros.cmake should be prefixed with WEBKIT_ namespace
3617         https://bugs.webkit.org/show_bug.cgi?id=174547
3618
3619         Reviewed by Alex Christensen.
3620
3621         * CMakeLists.txt:
3622         * WebCoreMacros.cmake:
3623
3624 2017-07-17  Alex Christensen  <achristensen@webkit.org>
3625
3626         Modernize content extension code
3627         https://bugs.webkit.org/show_bug.cgi?id=174588
3628
3629         Reviewed by Sam Weinig.
3630
3631         No change in behavior.  Just use Ref instead of RefPtr where possible.
3632
3633         * contentextensions/ContentExtension.cpp:
3634         (WebCore::ContentExtensions::ContentExtension::create):
3635         * contentextensions/ContentExtension.h:
3636         * contentextensions/ContentExtensionsBackend.cpp:
3637         (WebCore::ContentExtensions::ContentExtensionsBackend::addContentExtension):
3638         (WebCore::ContentExtensions::ContentExtensionsBackend::actionsForResourceLoad):
3639         * contentextensions/ContentExtensionsBackend.h:
3640
3641 2017-07-17  Simon Fraser  <simon.fraser@apple.com>
3642
3643         clientX/clientY on TouchEvent.touches are wrong
3644         https://bugs.webkit.org/show_bug.cgi?id=174561
3645         rdar://problem/33336041
3646
3647         Reviewed by Tim Horton.
3648         
3649         Do some refactoring so that WebKitAdditions code that computes Touch coordinates can use
3650         the same code that MouseRelatedEvent uses.
3651         
3652         There is no behavior change in this patch, but the test exercises a behavior change in
3653         WebKitAdditions code.
3654
3655         Test: fast/events/touch/ios/touches-client-coords-after-zoom.html
3656
3657         * dom/MouseRelatedEvent.cpp:
3658         (WebCore::MouseRelatedEvent::init):
3659         (WebCore::MouseRelatedEvent::frameViewFromDOMWindow):
3660         (WebCore::MouseRelatedEvent::pagePointToClientPoint):
3661         (WebCore::MouseRelatedEvent::pagePointToAbsolutePoint):
3662         (WebCore::MouseRelatedEvent::initCoordinates):
3663         (WebCore::MouseRelatedEvent::documentToAbsoluteScaleFactor):
3664         (WebCore::MouseRelatedEvent::computePageLocation):
3665         (WebCore::MouseRelatedEvent::locationInRootViewCoordinates):
3666         (WebCore::MouseRelatedEvent::frameView): Deleted.
3667         * dom/MouseRelatedEvent.h:
3668
3669 2017-07-17  Jeremy Jones  <jeremyj@apple.com>
3670
3671         Add video fullscreen transition logging.
3672         https://bugs.webkit.org/show_bug.cgi?id=174474
3673
3674         Reviewed by Jer Noble.
3675
3676         No new tests, because there is no functional change.
3677
3678         This change just adds logging.
3679
3680         * html/HTMLVideoElement.cpp:
3681         (WebCore::HTMLVideoElement::webkitEnterFullscreen):
3682         (WebCore::HTMLVideoElement::webkitExitFullscreen):
3683         (WebCore::HTMLVideoElement::webkitSetPresentationMode):
3684
3685 2017-07-17  Chris Dumez  <cdumez@apple.com>
3686
3687         click event does not dispatch to parent when child target stops hit testing after mousedown
3688         https://bugs.webkit.org/show_bug.cgi?id=174564
3689         <rdar://problem/33340234>
3690
3691         Reviewed by Simon Fraser.
3692
3693         As per [1], if the mouse down node and the mouse release node differ, then we are supposed to
3694         fire the click event at their common ancestor, if such node exists. This patch implements this
3695         logic. This also aligns our behavior with Blink.
3696
3697         [1] https://w3c.github.io/uievents/#events-mouseevent-event-order
3698
3699         Test: fast/events/mouse-click-different-mouseDown-mouseUp-nodes.html
3700
3701         * page/EventHandler.cpp:
3702         (WebCore::targetNodeForClickEvent):
3703
3704 2017-07-17  Brady Eidson  <beidson@apple.com>
3705
3706         WKHTTPCookieStore observing only works on the default cookie store.
3707         <rdar://problem/33330724> and https://bugs.webkit.org/show_bug.cgi?id=174580
3708
3709         Reviewed by Sam Weinig.
3710
3711         Covered by new API tests.
3712         
3713         startObservingCookieChanges and stopObservingCookieChanges are passed a NetworkStorageSession to observe.
3714         On Mac/iOS, the passed-in storage session was ignored and the shared cookie storage was assumed.
3715         Let's fix that.
3716         
3717         Also, since using NSNotification based observing only works reliably for the shared cookie storage,
3718         switch to direct CFHTTPCookieStorageRef observing.
3719
3720         * WebCore.xcodeproj/project.pbxproj:
3721         
3722         * platform/network/NetworkStorageSession.h:
3723         
3724         * platform/network/cocoa/CookieStorageObserver.h: Added.
3725         * platform/network/cocoa/CookieStorageObserver.mm: Added.
3726         (WebCore::cookiesChanged):
3727         (WebCore::CookieStorageObserver::create):
3728         (WebCore::CookieStorageObserver::CookieStorageObserver):
3729         (WebCore::CookieStorageObserver::~CookieStorageObserver):
3730         (WebCore::CookieStorageObserver::startObserving):
3731         (WebCore::CookieStorageObserver::stopObserving):
3732         (WebCore::CookieStorageObserver::cookiesDidChange):
3733         
3734         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
3735         (WebCore::NetworkStorageSession::cookieStorageObserver):
3736         
3737         * platform/network/mac/CookieStorageMac.mm:
3738         (WebCore::startObservingCookieChanges):
3739         (WebCore::stopObservingCookieChanges):
3740         (-[WebCookieStorageObjCAdapter notifyCookiesChangedOnMainThread]): Deleted.
3741         (-[WebCookieStorageObjCAdapter cookiesChangedNotificationHandler:]): Deleted.
3742         (-[WebCookieStorageObjCAdapter startListeningForCookieChangeNotificationsWithCallback:]): Deleted.
3743         (-[WebCookieStorageObjCAdapter stopListeningForCookieChangeNotifications]): Deleted.
3744         
3745         * platform/spi/cf/CFNetworkSPI.h:
3746
3747 2017-07-17  Sam Weinig  <sam@webkit.org>
3748
3749         [WebIDL] Rename JSCSSValueCustom.cpp to JSDeprecatedCSSOMValueCustom.cpp to match the underlying class
3750         https://bugs.webkit.org/show_bug.cgi?id=174550
3751
3752         Reviewed by Brady Eidson.
3753
3754         * CMakeLists.txt:
3755         * WebCore.xcodeproj/project.pbxproj:
3756         * bindings/js/JSBindingsAllInOne.cpp:
3757         * bindings/js/JSCSSValueCustom.cpp: Removed.
3758         * bindings/js/JSDeprecatedCSSOMValueCustom.cpp: Renamed from bindings/js/JSCSSValueCustom.cpp.
3759         Rename file and update references.
3760
3761 2017-07-17  Antoine Quint  <graouts@apple.com>
3762
3763         REGRESSION: order of AirPlay and volume controls is inconsistent between <audio> and <video>
3764         https://bugs.webkit.org/show_bug.cgi?id=174581
3765         <rdar://problem/33297519>
3766
3767         Reviewed by Sam Weinig.
3768
3769         We had an inconsistency between <audio> and <video> controls for the relative order of the
3770         volume and AirPlay buttons. The <video> layout was correct (volume first and AirPlay after)
3771         and the <audio> layout now is the same.
3772
3773         * Modules/modern-media-controls/controls/inline-media-controls.js:
3774         (InlineMediaControls.prototype._rightContainerButtons):
3775
3776 2017-07-17  Konstantin Tokarev  <annulen@yandex.ru>
3777
3778         [CMake] Create targets before WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS is called
3779         https://bugs.webkit.org/show_bug.cgi?id=174557
3780
3781         Reviewed by Michael Catanzaro.
3782
3783         No new tests needed.
3784
3785         * CMakeLists.txt:
3786
3787 2017-07-17  Michael Catanzaro  <mcatanzaro@igalia.com>
3788
3789         Unreviewed, rolling out r219556.
3790
3791         Broke build without WebCrypto
3792
3793         Reverted changeset:
3794
3795         "[CMake] Clean up Web Crypto build targets"
3796         https://bugs.webkit.org/show_bug.cgi?id=174253
3797         http://trac.webkit.org/changeset/219556
3798
3799 2017-07-17  Antoine Quint  <graouts@apple.com>
3800
3801         Media controls draw behind captions
3802         https://bugs.webkit.org/show_bug.cgi?id=174579
3803         <rdar://problem/33295427>
3804
3805         Reviewed by Dean Jackson.
3806
3807         Ensure the captions container is added as a previous sibling to the controls container.
3808
3809         Test: media/modern-media-controls/media-controls/media-controls-display-above-captions.html
3810
3811         * Modules/modern-media-controls/media/media-controller.js:
3812         (MediaController):
3813
3814 2017-07-17  Zan Dobersek  <zdobersek@igalia.com>
3815
3816         [CMake] Clean up Web Crypto build targets
3817         https://bugs.webkit.org/show_bug.cgi?id=174253
3818
3819         Reviewed by Michael Catanzaro.
3820
3821         Gather the common WebCrypto source files in CMakeLists.txt, including them
3822         in the build unconditionally and instead relying on ENABLE_SUBTLE_CRYPTO
3823         build guards to exclude the code from compilation if the feature is disabled.
3824
3825         PlatformGTK.cmake, PlatformMac.cmake and PlatformWPE.cmake can then remove
3826         duplicated build targets. PlatformMac.cmake still lists all the Mac-specific
3827         Web Crypto build targets.
3828
3829         PlatformGTK.cmake and PlatformWPE.cmake now include GCrypt.cmake if the build
3830         was configured to enable the use of libgcrypt. The new CMake file adds the
3831         libgcrypt-specific Web Crypto build targets to the build if the feature was
3832         enabled, and also sets up libgcrypt include directiories and libraries.
3833
3834         No new tests -- no change in behavior.
3835
3836         * CMakeLists.txt:
3837         * PlatformGTK.cmake:
3838         * PlatformMac.cmake:
3839         * PlatformWPE.cmake:
3840         * platform/GCrypt.cmake: Added.
3841
3842 2017-07-16  Michael Catanzaro  <mcatanzaro@igalia.com>
3843
3844         -Wreorder warning caused by GraphicsContext3D cleanup
3845         https://bugs.webkit.org/show_bug.cgi?id=174511
3846
3847         Reviewed by Carlos Garcia Campos.
3848
3849         * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
3850         (WebCore::GraphicsContext3D::GraphicsContext3D):
3851         * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
3852         (WebCore::GraphicsContext3D::GraphicsContext3D):
3853
3854 2017-07-16  Antoine Quint  <graouts@apple.com>
3855
3856         Dismissing the captions panel using the mouse is too eager to remove the captions panel and media controls
3857         https://bugs.webkit.org/show_bug.cgi?id=174571
3858         <rdar://problem/33294968>
3859
3860         Reviewed by Eric Carlson.
3861
3862         We did several things wrong when dismissing the tracks panel:
3863
3864             - we did not check whether we were hosted in a shadow root when figuring if a click was on the tracks panel
3865             - we did not check whether we clicked over the media when dismissing the tracks panel
3866             - we did not check whether auto-hide was on before fading the media controls out when we clicked outside
3867               the media controls bounds
3868
3869         We now correctly account for all of those cases and implement the following behavior when clickng as the tracks
3870         panel is presented:
3871         
3872             - dismiss the panel if the click is outside of the panel
3873             - dismiss the panel and the media controls if the click is outside the video and the media controls have
3874               auto-hide on (ie. media is playing)
3875             - dismiss the panel and the media controls after the track selection animation is finished if a track is selected
3876
3877         Tests: media/modern-media-controls/tracks-panel/tracks-panel-up-click-outside-media-does-not-dimiss-media-controls-when-media-is-paused.html
3878                media/modern-media-controls/tracks-panel/tracks-panel-up-click-over-media-does-not-dimiss-media-controls-when-media-is-playing.html
3879
3880         * Modules/modern-media-controls/controls/media-controls.js:
3881         (MediaControls.prototype.hideTracksPanel): Only hide the media controls if we clicked outside of the media
3882         controls bounds and if we have auto-hide on when idle (ie. the media is playing).
3883         (MediaControls.prototype.isPointInControls): Add an option to specify whether the container should be
3884         considered when checking if a point is contained within the media controls bounds.
3885         * Modules/modern-media-controls/controls/tracks-panel.js:
3886         (TracksPanel.prototype._handleMousedown):
3887         (TracksPanel.prototype._isPointInTracksPanel): Correctly check whether the element that we started pressing
3888         on is contained within the tracks panel, accounting for the case where we are presented within a shadow root
3889         (ie. always when runing inside a Web page).
3890
3891 2017-07-16  Ali Juma  <ajuma@chromium.org>
3892
3893         DisallowUserAgentShadowContent moves out of non-UA shadow roots
3894         https://bugs.webkit.org/show_bug.cgi?id=165647
3895
3896         Reviewed by Ryosuke Niwa.
3897
3898         Make rect-based hit-testing include nodes in non-UA shadow trees when the
3899         HitTestRequest has type DisallowUserAgentShadowContent.
3900
3901         Test: fast/dom/nodesFromRect/nodesFromRect-shadow.html
3902
3903         * rendering/HitTestResult.cpp:
3904         (WebCore::HitTestResult::addNodeToRectBasedTestResult):
3905         * testing/Internals.cpp:
3906         (WebCore::Internals::nodesFromRect):
3907         * testing/Internals.h:
3908
3909 2017-07-16  Antoine Quint  <graouts@apple.com>
3910
3911         Clicking edges of media control buttons changes visual state of button (pressed) but doesn't execute action
3912         https://bugs.webkit.org/show_bug.cgi?id=174565
3913         <rdar://problem/33294833>
3914
3915         Reviewed by Dean Jackson.
3916
3917         WebCore doesn't dispatch a "click" event to a parent element when a child that was the original target when
3918         the "mousedown" occured is no longer hit-testing at the location where the mouse pointer is at when the "mouseup"
3919         occurs (see webkit.org/b/174564). Since button icons, which are a <picture> element that is a child of the
3920         <button> element for media controls buttons, shrink to 89% of their size when the ":active" pseudo-class matches,
3921         clicking on the edges of the media controls buttons would not trigger the expected action.
3922
3923         Test: media/modern-media-controls/button/button-click-on-edges.html
3924
3925         * Modules/modern-media-controls/controls/button.css:
3926         (button > picture):
3927
3928 2017-07-16  Said Abou-Hallawa  <sabouhallawa@apple.com>
3929
3930         Make the decision for asynchronously decoding an image be in one place
3931         https://bugs.webkit.org/show_bug.cgi?id=174479
3932
3933         Reviewed by Tim Horton.
3934
3935         Move all the logic of whether a large image should be asynchronously decoded 
3936         or not be in one place: RenderBoxModelObject::decodingModeForImageDraw().
3937