[GLib] Let WebCore know of low power situations
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-10-03  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
2
3         [GLib] Let WebCore know of low power situations
4         https://bugs.webkit.org/show_bug.cgi?id=177810
5
6         Reviewed by Carlos Garcia Campos.
7
8         WebCore can use knowledge of low power situations to throttle timers and avoid expensive
9         checks, lowering power usage. We can use upower's warning level to let WebCore know we are
10         in such a situation.
11
12         No tests as there is no way to mock upower.
13
14         * PlatformGTK.cmake: add new file.
15         * PlatformWPE.cmake: add new file.
16         * platform/LowPowerModeNotifier.cpp: use upower-glib to know about low power situations.
17         * platform/LowPowerModeNotifier.h: includes upower header as UpClient and UpDevice are not forward
18         declaration-friendly.
19         * platform/glib/LowPowerModeNotifierGLib.cpp: Added.
20         (WebCore::LowPowerModeNotifier::LowPowerModeNotifier):
21         (WebCore::LowPowerModeNotifier::updateState): update low power mode from warning-level.
22         (WebCore::LowPowerModeNotifier::warningLevelCallback): track upower's warning-level to know when
23         a low power situation occurs.
24         (WebCore::LowPowerModeNotifier::~LowPowerModeNotifier): stop tracking the warning-level signal.
25         (WebCore::LowPowerModeNotifier::isLowPowerModeEnabled const):
26
27 2017-10-04  Joanmarie Diggs  <jdiggs@igalia.com>
28
29         AX: [ATK] aria-pressed="mixed" should be exposed via ATK_STATE_INDETERMINATE
30         https://bugs.webkit.org/show_bug.cgi?id=177807
31
32         Reviewed by Chris Fleizach.
33
34         Include toggle buttons in the element types for which the mixed state is checked
35         and exposed via ATK_STATE_INDETERMINATE if found. Also only do the role checks when
36         AccessibilityObject::isIndeterminate() has returned false.
37
38         Test: accessibility/gtk/aria-pressed-mixed-value.html
39
40         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
41         (setAtkStateSetFromCoreObject):
42
43 2017-10-04  Joanmarie Diggs  <jdiggs@igalia.com>
44
45         AX: [ATK] ARIA tabpanel role should be exposed as ATK_ROLE_SCROLL_PANE
46         https://bugs.webkit.org/show_bug.cgi?id=177815
47
48         Reviewed by Chris Fleizach.
49
50         Change the mapping of TabPanelRole from ATK_ROLE_PANEL to ATK_ROLE_SCROLL_PANE.
51
52         No new tests because this mapping is already covered by aria-tab-roles.html and
53         roles-exposed.html. The platform expectations for each test have been updated.
54
55         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
56         (atkRole):
57
58 2017-10-03  Antti Koivisto  <antti@apple.com>
59
60         Use WeakPtr in RenderFullScreen
61         https://bugs.webkit.org/show_bug.cgi?id=177827
62
63         Reviewed by Zalan Bujtas.
64
65         Make Document::m_fullScreenRenderer RenderFullScreen::m_placeholder WeakPtrs
66         and get rid of the custom nulling code.
67
68         * dom/Document.cpp:
69         (WebCore::Document::destroyRenderTree):
70         (WebCore::Document::webkitWillEnterFullScreenForElement):
71         (WebCore::Document::webkitDidExitFullScreenForElement):
72         (WebCore::Document::setFullScreenRenderer):
73         (WebCore::Document::fullScreenRendererDestroyed): Deleted.
74         * dom/Document.h:
75         (WebCore::Document::fullScreenRenderer const):
76         * rendering/RenderFullScreen.cpp:
77         (WebCore::RenderFullScreen::RenderFullScreen):
78         (WebCore::RenderFullScreen::willBeDestroyed):
79         (WebCore::RenderFullScreen::createPlaceholder):
80         (WebCore::RenderFullScreenPlaceholder::willBeDestroyed): Deleted.
81         (WebCore::RenderFullScreen::setPlaceholder): Deleted.
82         * rendering/RenderFullScreen.h:
83
84 2017-10-03  Ryosuke Niwa  <rniwa@webkit.org>
85
86         Enable pasteboard custom data in macOS 10.12 and earlier
87         https://bugs.webkit.org/show_bug.cgi?id=177855
88
89         Reviewed by Wenson Hsieh.
90
91         Make customPasteboardDataEnabled return true on macOS 10.12 and earlier as long as the app is Safari.
92
93         * page/Settings.cpp:
94         (WebCore::Settings::customPasteboardDataEnabled):
95
96 2017-10-03  Jon Davis  <jond@apple.com>
97
98         Update several features to "Supported"
99         https://bugs.webkit.org/show_bug.cgi?id=177831
100
101         Reviewed by Alexey Proskuryakov.
102
103         Update Media Capture and Streams, Performance Observer, Resource Timing, User Timing, 
104         Web Cryptography, and WebRTC.
105
106         * features.json:
107
108 2017-10-03  Basuke Suzuki  <Basuke.Suzuki@sony.com>
109
110         [Curl] Reimplement CurlDownload with CurlRequest
111         https://bugs.webkit.org/show_bug.cgi?id=177779
112
113         Reviewed by Alex Christensen.
114
115         * platform/network/curl/CurlContext.cpp:
116         (WebCore::CurlHandle::enableAllowedProtocols):
117         (WebCore::CurlHandle::enableFollowLocation): Deleted.
118         (WebCore::CurlHandle::getEffectiveURL): Deleted.
119         * platform/network/curl/CurlContext.h:
120         * platform/network/curl/CurlDownload.cpp:
121         (WebCore::CurlDownload::~CurlDownload):
122         (WebCore::CurlDownload::init):
123         (WebCore::CurlDownload::start):
124         (WebCore::CurlDownload::cancel):
125         (WebCore::CurlDownload::createCurlRequest):
126         (WebCore::CurlDownload::curlDidReceiveResponse):
127         (WebCore::CurlDownload::curlDidReceiveBuffer):
128         (WebCore::CurlDownload::curlDidComplete):
129         (WebCore::CurlDownload::curlDidFailWithError):
130         (WebCore::CurlDownload::shouldRedirectAsGET):
131         (WebCore::CurlDownload::willSendRequest):
132         (WebCore::CurlDownload::getResponse const): Deleted.
133         (WebCore::CurlDownload::retain): Deleted.
134         (WebCore::CurlDownload::release): Deleted.
135         (WebCore::CurlDownload::setupTransfer): Deleted.
136         (WebCore::CurlDownload::didCompleteTransfer): Deleted.
137         (WebCore::CurlDownload::didCancelTransfer): Deleted.
138         (WebCore::CurlDownload::closeFile): Deleted.
139         (WebCore::CurlDownload::moveFileToDestination): Deleted.
140         (WebCore::CurlDownload::writeDataToFile): Deleted.
141         (WebCore::CurlDownload::didReceiveHeader): Deleted.
142         (WebCore::CurlDownload::didReceiveData): Deleted.
143         (WebCore::CurlDownload::didReceiveResponse): Deleted.
144         (WebCore::CurlDownload::didReceiveDataOfLength): Deleted.
145         (WebCore::CurlDownload::didFinish): Deleted.
146         (WebCore::CurlDownload::didFail): Deleted.
147         (WebCore::CurlDownload::writeCallback): Deleted.
148         (WebCore::CurlDownload::headerCallback): Deleted.
149         * platform/network/curl/CurlDownload.h:
150         (WebCore::CurlDownloadListener::didReceiveResponse):
151         * platform/network/curl/CurlRequest.cpp:
152         (WebCore::CurlRequest::didReceiveData):
153         (WebCore::CurlRequest::finalizeTransfer):
154         (WebCore::CurlRequest::enableDownloadToFile):
155         (WebCore::CurlRequest::getDownloadedFilePath):
156         (WebCore::CurlRequest::writeDataToDownloadFileIfEnabled):
157         (WebCore::CurlRequest::closeDownloadFile):
158         * platform/network/curl/CurlRequest.h:
159         (WebCore::CurlRequest::create):
160         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
161         (WebCore::ResourceHandleCurlDelegate::createCurlRequest):
162         * platform/network/curl/ResourceHandleCurlDelegate.h:
163
164 2017-10-03  Zalan Bujtas <zalan@apple.com>
165
166         Move scroll snap point unregistration from willBeRemovedFromTree to willBeDestroyed
167         https://bugs.webkit.org/show_bug.cgi?id=177830
168         <rdar://problem/34796065>
169
170         Reviewed by Antti Koivisto.
171
172         willBeRemovedFromTree is called conditionally, relying on unregistering objects in there is highly error prone.
173
174         Covered by existing tests.
175
176         * rendering/RenderBox.cpp:
177         (WebCore::RenderBox::willBeDestroyed):
178         (WebCore::RenderBox::willBeRemovedFromTree): Deleted.
179         * rendering/RenderBox.h:
180
181 2017-10-03  Joanmarie Diggs  <jdiggs@igalia.com>
182
183         AX: [ATK] ARIA menuitems should be exposed with ATK_ROLE_MENU_ITEM even when it's the child of group role
184         https://bugs.webkit.org/show_bug.cgi?id=177811
185
186         Reviewed by Chris Fleizach.
187
188         AccessibilityNodeObject::remapAriaRoleDueToParent() remaps ARIA menuitems to the
189         MenuButtonRole AccessibilityRole when the menuitem's parent is an ARIA group, but
190         the ATK code was not handling that remapped role value. As a result, the element
191         was being exposed as ATK_ROLE_UNKNOWN. Add MenuButtonRole to the AccessibilityRole
192         types exposed as ATK_ROLE_MENU_ITEM.
193
194         Test: accessibility/gtk/menu-with-group-child-tree.html
195
196         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
197         (atkRole):
198
199 2017-10-03  Joanmarie Diggs  <jdiggs@igalia.com>
200
201         AX: [ATK] aria-rowindex set on row element is not being exposed
202         https://bugs.webkit.org/show_bug.cgi?id=177821
203
204         Reviewed by Chris Fleizach.
205
206         Expose the value of aria-rowindex when set on a row as an object
207         attribute, as we already do when it's set on a cell.
208
209         Test: accessibility/gtk/aria-rowindex-on-row.html
210
211         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
212         (webkitAccessibleGetAttributes):
213
214 2017-10-03  Daniel Bates  <dabates@apple.com>
215
216         Share code to normalize an HTTP method
217         https://bugs.webkit.org/show_bug.cgi?id=177837
218
219         Reviewed by Andy Estes.
220
221         Currently we duplicate code in XMLHttpRequest and FetchRequest to normalize an HTTP method.
222         We should add a common helper function and update both classes to make use of it.
223
224         No functionality changed. So, no new tests.
225
226         * Modules/fetch/FetchRequest.cpp:
227         (WebCore::setMethod): Modified to use WebCore::normalizeHTTPMethod().
228         * platform/network/HTTPParsers.cpp:
229         (WebCore::normalizeHTTPMethod): Moved from XMLHttpRequest.cpp.
230         * platform/network/HTTPParsers.h:
231         * xml/XMLHttpRequest.cpp:
232         (WebCore::XMLHttpRequest::open): Modified to use WebCore::normalizeHTTPMethod().
233         (WebCore::XMLHttpRequest::uppercaseKnownHTTPMethod): Deleted; moved to HTTPParsers.cpp.
234         * xml/XMLHttpRequest.h:
235
236 2017-10-03  Daniel Bates  <dabates@apple.com>
237
238         Share code to determine a forbidden method
239         https://bugs.webkit.org/show_bug.cgi?id=177833
240
241         Reviewed by Andy Estes.
242
243         Currently we duplicate code in XMLHttpRequest and FetchRequest to determine if a method is
244         forbidden. We should add a common helper function and update both classes to make use of it.
245
246         No functionality changed. So, no new tests.
247
248         * Modules/fetch/FetchRequest.cpp:
249         (WebCore::setMethod): Modified to use WebCore::isForbiddenMethod().
250         * platform/network/HTTPParsers.cpp:
251         (WebCore::isForbiddenMethod): Added.
252         * platform/network/HTTPParsers.h:
253         * xml/XMLHttpRequest.cpp:
254         (WebCore::XMLHttpRequest::open): Modified to use WebCore::isForbiddenMethod().
255         (WebCore::XMLHttpRequest::isAllowedHTTPMethod): Deleted.
256         * xml/XMLHttpRequest.h:
257
258 2017-10-03  Zalan Bujtas  <zalan@apple.com>
259
260         RenderMenuList should not hold raw pointers
261         https://bugs.webkit.org/show_bug.cgi?id=177836
262
263         Reviewed by Antti Koivisto.
264
265         While both m_buttonText and m_innerBlock are child renderers of
266         the RenderMenuList, so the their lifecycles are supposed to tied
267         to the parent object, this patch removes some manual raw pointer managing.
268
269         Covered by existing tests.
270
271         * rendering/RenderMenuList.cpp:
272         (WebCore::RenderMenuList::RenderMenuList):
273         (WebCore::RenderMenuList::createInnerBlock):
274         (RenderMenuList::takeChild):
275         (RenderMenuList::setText):
276         * rendering/RenderMenuList.h:
277
278 2017-10-03  Timothy Horton  <timothy_horton@apple.com>
279
280         Include a few widespread WTF headers in WebCorePrefix.h
281         https://bugs.webkit.org/show_bug.cgi?id=173481
282
283         * WebCorePrefix.h:
284         Turn this off on Windows because it doesn't work; needs further investigation.
285
286 2017-10-03  Tim Horton  <timothy_horton@apple.com>
287
288         Include a few widespread WTF headers in WebCorePrefix.h
289         https://bugs.webkit.org/show_bug.cgi?id=173481
290
291         Reviewed by Alex Christensen.
292
293         * WebCorePrefix.h:
294         These are four of the headers that contribute the most pre-processed
295         source to the WebCore build. They (and their dependents) change infrequently
296         enough that a world rebuild of WebCore when they change seems like an
297         acceptable tradeoff for the ~9% reduction in WebCore build time that I
298         measure from this change.
299
300         We can't do this on macOS 10.12 because of https://bugs.llvm.org/show_bug.cgi?id=33520.
301
302 2017-10-03  Daniel Bates  <dabates@apple.com>
303
304         XMLHttpRequest.setRequestHeader() should allow Content-Transfer-Encoding header; remove
305         duplicate logic to check for a forbidden XHR header field
306         https://bugs.webkit.org/show_bug.cgi?id=177829
307
308         Reviewed by Alexey Proskuryakov.
309
310         Use isForbiddenHeaderName() (defined in HTTPParsers.h) to check if the header field specified
311         to XMLHttpRequest.setRequestHeader() is allowed. Among other benefits this makes the behavior
312         of XMLHttpRequest.setRequestHeader() more closely aligned with the behavior of this method in
313         the XHR standard, <https://xhr.spec.whatwg.org> (8 September 2017). In particular, XMLHttpRequest.setRequestHeader()
314         no longer forbids setting the header Content-Transfer-Encoding. This header has not been
315         considered a forbidden header since <https://www.w3.org/TR/2012/WD-XMLHttpRequest-20121206/>.
316
317         * xml/XMLHttpRequest.cpp:
318         (WebCore::XMLHttpRequest::setRequestHeader):
319         (WebCore::isForbiddenRequestHeader): Deleted.
320         (WebCore::XMLHttpRequest::isAllowedHTTPHeader): Deleted.
321         * xml/XMLHttpRequest.h:
322
323 2017-10-03  Commit Queue  <commit-queue@webkit.org>
324
325         Unreviewed, rolling out r222686, r222695, and r222698.
326         https://bugs.webkit.org/show_bug.cgi?id=177835
327
328         Caused LayoutTests to crash in
329         WebCore::TimerBase::setNextFireTime (Requested by ryanhaddad
330         on #webkit).
331
332         Reverted changesets:
333
334         "[Settings] Replace SettingsMacros.h with a generated base
335         class for Settings"
336         https://bugs.webkit.org/show_bug.cgi?id=177681
337         http://trac.webkit.org/changeset/222686
338
339         "[Settings] Enums should not be passed by const reference"
340         https://bugs.webkit.org/show_bug.cgi?id=177727
341         http://trac.webkit.org/changeset/222695
342
343         "[Settings] Move remaining simple settings to Settings.in"
344         https://bugs.webkit.org/show_bug.cgi?id=177730
345         http://trac.webkit.org/changeset/222698
346
347 2017-10-03  Jer Noble  <jer.noble@apple.com>
348
349         Implement quality-of-service tiers in WebCoreDecompressionSession
350         https://bugs.webkit.org/show_bug.cgi?id=177769
351
352         Reviewed by Dean Jackson.
353
354         VTDecompressionSession will suggest quality-of-service tiers to be used when decompression
355         can't keep up with playback speed. Use a simple exponential-moving-average heuristic to
356         determine when to move up and down the tiers.
357
358         Drive-by fix: When frames are so late that they miss the display deadline, mark them as
359         dropped rather than just delayed.
360
361         * platform/graphics/cocoa/WebCoreDecompressionSession.h:
362         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
363         (WebCore::WebCoreDecompressionSession::ensureDecompressionSessionForSample):
364         (WebCore::WebCoreDecompressionSession::decodeSample):
365         (WebCore::WebCoreDecompressionSession::handleDecompressionOutput):
366         (WebCore::WebCoreDecompressionSession::automaticDequeue):
367         (WebCore::WebCoreDecompressionSession::enqueueDecodedSample):
368         (WebCore::WebCoreDecompressionSession::resetQosTier):
369         (WebCore::WebCoreDecompressionSession::increaseQosTier):
370         (WebCore::WebCoreDecompressionSession::decreaseQosTier):
371         (WebCore::WebCoreDecompressionSession::updateQosWithDecodeTimeStatistics):
372         * platform/cocoa/VideoToolboxSoftLink.cpp:
373         * platform/cocoa/VideoToolboxSoftLink.h:
374
375 2017-10-03  Adrian Perez de Castro  <aperez@igalia.com>
376
377         [GTK] Support the "system" CSS font family
378         https://bugs.webkit.org/show_bug.cgi?id=177755
379
380         Reviewed by Carlos Garcia Campos.
381
382         Obtain the system UI font from the GtkSettings::gtk-font-name property
383
384         Test: platform/gtk/fonts/systemFont.html
385
386         * platform/graphics/freetype/FontCacheFreeType.cpp:
387         (WebCore::getFamilyNameStringFromFamily): Use defaultGtkSystemFont()
388         to handle -webkit-system-font and -webkit-system-ui.
389         (WebCore::isCommonlyUsedGenericFamily): Handle -webkit-system-font and
390         -webkit-system-ui as generic family names.
391         * platform/graphics/gtk/GtkUtilities.cpp:
392         (WebCore::defaultGtkSystemFont): Added.
393         * platform/graphics/gtk/GtkUtilities.h: Add prototype for defaultGtkSystemFont().
394
395 2017-10-03  Daniel Bates  <dabates@apple.com>
396
397         [XHR] Only exempt Dashboard widgets from XHR header restrictions
398         https://bugs.webkit.org/show_bug.cgi?id=177824
399         <rdar://problem/34384301>
400
401         Reviewed by Alexey Proskuryakov.
402
403         Currently we allow file URLs to set arbitrary XHR headers. In contrast, non-file URLs are
404         restricted from setting some XHR headers (e.g. COOKIE). Historically the relaxation for file
405         URL was for backwards compatibility to allow Dashboard widgets to work. Instead we should
406         apply the non-file URL policy to all URLs and only relax the policy for Dashboard widgets.
407
408         Tests: fast/xmlhttprequest/set-dangerous-headers-in-dashboard.html
409                fast/xmlhttprequest/set-dangerous-headers.html
410
411         * xml/XMLHttpRequest.cpp:
412         (WebCore::XMLHttpRequest::setRequestHeader):
413
414 2017-10-03  Fujii Hironori  <Hironori.Fujii@sony.com>
415
416         REGRESSION(r221909): Failing fast/text/international/iso-8859-8.html
417         https://bugs.webkit.org/show_bug.cgi?id=177364
418
419         Reviewed by Carlos Garcia Campos.
420
421         Range.getClientRects returned an incorrect rect for a last
422         collapsed space of RenderText in HarfBuzz port.
423
424         HarfBuzzShaper::selectionRect needs to return a valid value even
425         if the arguments 'from' and 'to' point to the just after the end
426         of the text run.
427
428         Tests: fast/text/international/iso-8859-8.html
429
430         * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
431         (WebCore::HarfBuzzShaper::shape): Do not check the return value of
432         fillGlyphBuffer.
433         (WebCore::HarfBuzzShaper::fillGlyphBuffer): Change the return
434         value type from bool to void.
435         (WebCore::HarfBuzzShaper::selectionRect): Set the rightmost
436         position to fromX if foundFromX is false.
437         * platform/graphics/harfbuzz/HarfBuzzShaper.h: Change the return
438         value type of fillGlyphBuffer from bool to void.
439
440 2017-10-03  JF Bastien  <jfbastien@apple.com>
441
442         WebAssembly: no VM / JS version of everything but Instance
443         https://bugs.webkit.org/show_bug.cgi?id=177473
444
445         Reviewed by Filip Pizlo.
446
447         * ForwardingHeaders/wasm/WasmModule.h: Added. This used to be
448         included in JSWebAssemblyModule.h.
449         * bindings/js/SerializedScriptValue.cpp: Update postMessage code
450         according to C++ API changes.
451
452 2017-10-03  Zalan Bujtas  <zalan@apple.com>
453
454         [AX] Do not trigger redundant layout on tables.
455         https://bugs.webkit.org/show_bug.cgi?id=177781
456         <rdar://problem/34777030>
457
458         Reviewed by Antti Koivisto.
459
460         RenderTable::forceSectionsRecalc() marks the RenderTable dirty and schedules a layout.
461         Every time AccessibilityTable asks for the table element (including during construction),
462         we end up triggering a layout. This call was added (r191357) to ensure RenderTable's m_firstBody is always
463         up-to-date (in case of anonymous wrapper table renderer). Instead of relying on the m_firstBody,
464         let's just use the first child to find the table element. The first child always points to a valid
465         renderer (or nullptr), while m_firstBody is the result of section computation.
466
467         Covered by existing tests.
468
469         * accessibility/AccessibilityTable.cpp:
470         (WebCore::AccessibilityTable::tableElement const):
471
472 2017-10-03  Daniel Bates  <dabates@apple.com>
473
474         [CSP] Check policy before opening a new window to a JavaScript URL
475         https://bugs.webkit.org/show_bug.cgi?id=176815
476         <rdar://problem/34400057>
477
478         Reviewed by Brent Fulgham.
479
480         Ensure that the Content Security Policy of the page allows navigation to a JavaScript URL
481         before opening a new window to it.
482
483         Test: http/tests/security/contentSecurityPolicy/window-open-javascript-url-blocked.html
484
485         * loader/FrameLoader.cpp:
486         (WebCore::createWindow):
487
488 2017-10-03  Joanmarie Diggs  <jdiggs@igalia.com>
489
490         AX: [ATK] ARIA drag-and-drop attribute values should be exposed via AtkObject attributes
491         https://bugs.webkit.org/show_bug.cgi?id=177763
492
493         Reviewed by Chris Fleizach.
494
495         Expose the values of aria-grabbed and aria-dropeffect via the "grabbed" and "dropeffect"
496         AtkObject attributes.
497
498         Test: accessibility/gtk/aria-drag-and-drop.html
499
500         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
501         (webkitAccessibleGetAttributes):
502
503 2017-10-03  Brent Fulgham  <bfulgham@apple.com>
504
505         Unreviewed test fix after r222779.
506
507         * testing/cocoa/WebArchiveDumpSupport.mm:
508         (WebCoreTestSupport::createCFURLResponseFromResponseData): Setting NSSecureCoding in this test code should be
509         done based on build system, just like it is in the actual WebArchive handling code.
510
511 2017-10-03  Youenn Fablet  <youenn@apple.com>
512
513         Clean-up RealtimeIncomingVideoSource
514         https://bugs.webkit.org/show_bug.cgi?id=177782
515
516         Reviewed by Alejandro G. Castro.
517
518         No change of behavior.
519         Removing code that is no longer needed.
520
521         * platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
522         (WebCore::RealtimeIncomingVideoSource::create):
523         (WebCore::RealtimeIncomingVideoSource::RealtimeIncomingVideoSource):
524         * platform/mediastream/mac/RealtimeIncomingVideoSource.h:
525
526 2017-10-03  Brent Fulgham  <bfulgham@apple.com>
527
528         [Mac] Use safer decoding practices for NSKeyedUnarchiver
529         https://bugs.webkit.org/show_bug.cgi?id=175887
530         <rdar://problem/33435281>
531
532         Reviewed by Daniel Bates.
533
534         * loader/archive/cf/LegacyWebArchiveMac.mm:
535         (WebCore::LegacyWebArchive::createResourceResponseFromMacArchivedData): Use NSSecureCoding to unarchive.
536         (WebCore::LegacyWebArchive::createPropertyListRepresentation): Ditto for archiving.
537         * testing/cocoa/WebArchiveDumpSupport.mm:
538         (WebCoreTestSupport::createCFURLResponseFromResponseData): Update to use NSSecureCoding if possible.
539
540 2017-10-03  Ryan Haddad  <ryanhaddad@apple.com>
541
542         Unreviewed, rolling out r222760.
543
544         This change caused LayoutTest crashes.
545
546         Reverted changeset:
547
548         "[Mac] Use safer decoding practices for NSKeyedUnarchiver"
549         https://bugs.webkit.org/show_bug.cgi?id=175887
550         http://trac.webkit.org/changeset/222760
551
552 2017-10-03  Michael Catanzaro  <mcatanzaro@igalia.com>
553
554         REGRESSION(r222392): [WPE][GTK] Many forms tests are failing due to broken event timestamps
555         https://bugs.webkit.org/show_bug.cgi?id=177449
556
557         Reviewed by Chris Dumez.
558
559         * platform/gtk/GtkUtilities.cpp:
560         (WebCore::wallTimeForEvent):
561         * platform/gtk/GtkUtilities.h:
562         (WebCore::wallTimeForEvent):
563         * platform/gtk/PlatformKeyboardEventGtk.cpp:
564         (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
565         * platform/gtk/PlatformMouseEventGtk.cpp:
566         (WebCore::PlatformMouseEvent::PlatformMouseEvent):
567         * platform/gtk/PlatformWheelEventGtk.cpp:
568         (WebCore::PlatformWheelEvent::PlatformWheelEvent):
569
570 2017-10-03  Youenn Fablet  <youenn@apple.com>
571
572         Use vector map routine in WebCore CacheStorage implementation
573         https://bugs.webkit.org/show_bug.cgi?id=177002
574
575         Reviewed by Darin Adler.
576
577         No change of behavior.
578         Replacing use of reserveInitialCapacity/uncheckedAppend by use of map.
579
580         * Modules/cache/CacheStorage.cpp:
581         (WebCore::copyCache):
582         (WebCore::CacheStorage::match):
583         (WebCore::CacheStorage::retrieveCaches):
584         (WebCore::CacheStorage::keys):
585         (WebCore::copyCaches): Deleted.
586         * Modules/cache/DOMCache.cpp:
587         (WebCore::DOMCache::matchAll):
588         (WebCore::copyRequestRef):
589         (WebCore::DOMCache::keys):
590         * Modules/cache/DOMCacheEngine.cpp:
591         (WebCore::DOMCacheEngine::isolateCacheInfo):
592         (WebCore::DOMCacheEngine::CacheInfos::isolatedCopy):
593         * Modules/cache/WorkerCacheStorageConnection.cpp:
594         (WebCore::recordsDataFromRecords):
595         (WebCore::recordsFromRecordsData):
596
597 2017-10-02  Myles C. Maxfield  <mmaxfield@apple.com>
598
599         Move LineEnding.{h,cpp} from WebCore/platform/text to wtf/text
600         https://bugs.webkit.org/show_bug.cgi?id=176575
601
602         Reviewed by Alex Christensen.
603
604         No new tests because there is no behavior change.
605
606         * WebCore.xcodeproj/project.pbxproj:
607         * fileapi/BlobBuilder.cpp:
608         * html/FormDataList.cpp:
609
610 2017-10-02  Joseph Pecoraro  <pecoraro@apple.com>
611
612         Web Inspector: Rename methods ending in *Json() as *JSON()
613         https://bugs.webkit.org/show_bug.cgi?id=177793
614
615         Reviewed by Matt Baker.
616
617         * inspector/InspectorNetworkAgent.cpp:
618         (WebCore::InspectorNetworkAgent::buildObjectForCachedResource):
619         (WebCore::InspectorNetworkAgent::willSendRequest):
620         (WebCore::InspectorNetworkAgent::didReceiveResponse):
621         * inspector/InspectorPageAgent.cpp:
622         (WebCore::InspectorPageAgent::resourceTypeJSON):
623         (WebCore::InspectorPageAgent::cachedResourceTypeJSON):
624         (WebCore::InspectorPageAgent::buildObjectForFrameTree):
625         (WebCore::InspectorPageAgent::resourceTypeJson): Deleted.
626         (WebCore::InspectorPageAgent::cachedResourceTypeJson): Deleted.
627         * inspector/InspectorPageAgent.h:
628
629 2017-10-02  Wenson Hsieh  <wenson_hsieh@apple.com>
630
631         REGRESSION(r222595): Intermittent crash while accessing DataTransferItemList
632         https://bugs.webkit.org/show_bug.cgi?id=177791
633         <rdar://problem/34781456>
634
635         Reviewed by Ryosuke Niwa.
636
637         DataTransfer::moveDragState() currently attempts to move the other DataTransfer's DataTransferItemList and
638         DragImageLoader as members of its own. This is incorrect, since both of these entities hold raw references of
639         some form to the other DataTransfer, yet they are held as unique_ptrs in the new DataTransfer. To fix this, we
640         (1) remove the line of code that moves the item list, since item lists will be lazily generated on the new
641         DataTransfer anyways, and (2) update the DataTransfer pointer on the old DataTransfer's DragImageLoader after
642         moving it to the new DataTransfer.
643
644         Test: editing/pasteboard/drag-end-crash-accessing-item-list.html
645
646         * dom/DataTransfer.cpp:
647         (WebCore::DragImageLoader::moveToDataTransfer):
648         (WebCore::DataTransfer::moveDragState):
649
650 2017-10-02  Chris Dumez  <cdumez@apple.com>
651
652         Rename computeSharedStringHash() overload taking a URL to computedVisitedLinkHash()
653         https://bugs.webkit.org/show_bug.cgi?id=177776
654
655         Reviewed by Alex Christensen.
656
657         * dom/VisitedLinkState.cpp:
658         (WebCore::linkHashForElement):
659         (WebCore::VisitedLinkState::determineLinkStateSlowCase):
660         * html/HTMLAnchorElement.h:
661         (WebCore::HTMLAnchorElement::visitedLinkHash const):
662         * platform/SharedStringHash.cpp:
663         (WebCore::computeVisitedLinkHash):
664         * platform/SharedStringHash.h:
665
666 2017-10-02  Joanmarie Diggs  <jdiggs@igalia.com>
667
668         AX: [ATK] The value of aria-level is not exposed on non-heading roles
669         https://bugs.webkit.org/show_bug.cgi?id=177775
670
671         Reviewed by Chris Fleizach.
672
673         Expose the value of aria-level via the "level" AtkObject attribute, as is currently
674         done for headings.
675
676         Test: accessibility/gtk/aria-level.html
677
678         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
679         (webkitAccessibleGetAttributes):
680
681 2017-10-02  Andy Estes  <aestes@apple.com>
682
683         [Payment Request] Validate payment method identifiers
684         https://bugs.webkit.org/show_bug.cgi?id=177794
685
686         Reviewed by Sam Weinig.
687
688         * Modules/paymentrequest/PaymentRequest.cpp:
689         (WebCore::isValidStandardizedPaymentMethodIdentifier):
690         (WebCore::isValidURLBasedPaymentMethodIdentifier):
691         (WebCore::convertAndValidatePaymentMethodIdentifier):
692         (WebCore::PaymentRequest::create):
693         * Modules/paymentrequest/PaymentRequest.h:
694
695 2017-10-02  Ryosuke Niwa  <rniwa@webkit.org>
696
697         Move more code into PasteboardCustomData
698         https://bugs.webkit.org/show_bug.cgi?id=177795
699
700         Reviewed by Wenson Hsieh.
701
702         Moved sharedBufferFromCustomData, customDataFromSharedBuffer, and customWebKitPasteboardDataType into
703         PasteboardCustomData as createSharedBuffer, fromSharedBuffer, and cocoaType respectively.
704
705         * platform/Pasteboard.cpp:
706         (WebCore::PasteboardCustomData::createSharedBuffer const): Renamed from sharedBufferFromCustomData.
707         (WebCore::PasteboardCustomData::fromSharedBuffer): Renamed from customDataFromSharedBuffer.
708         * platform/Pasteboard.h:
709         * platform/StaticPasteboard.cpp:
710         (WebCore::StaticPasteboard::commitToPasteboard): Now initializes with an empty origin string.
711         * platform/cocoa/PasteboardCocoa.mm:
712         (WebCore::PasteboardCustomData::cocoaType): Moved here from Pasteboard.h
713         (WebCore::Pasteboard::readStringInCustomData):
714         * platform/ios/PlatformPasteboardIOS.mm:
715         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const):
716         (WebCore::PlatformPasteboard::write):
717         * platform/ios/WebItemProviderPasteboard.mm:
718         (-[WebItemProviderPasteboard typeIdentifiersToLoadForRegisteredTypeIdentfiers:]):
719         * platform/mac/PlatformPasteboardMac.mm:
720         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const):
721         (WebCore::PlatformPasteboard::write):
722
723 2017-10-02  Brent Fulgham  <bfulgham@apple.com>
724
725         [Mac] Use safer decoding practices for NSKeyedUnarchiver
726         https://bugs.webkit.org/show_bug.cgi?id=175887
727         <rdar://problem/33435281>
728
729         Reviewed by Daniel Bates.
730
731         * loader/archive/cf/LegacyWebArchiveMac.mm:
732         (WebCore::LegacyWebArchive::createResourceResponseFromMacArchivedData): Use NSSecureCoding to unarchive.
733         (WebCore::LegacyWebArchive::createPropertyListRepresentation): Ditto for archiving.
734         * testing/cocoa/WebArchiveDumpSupport.mm:
735         (WebCoreTestSupport::createCFURLResponseFromResponseData): Update to use NSSecureCoding if possible.
736
737 2017-10-02  Daniel Bates  <dabates@apple.com>
738
739         Use InlineTextBox::lineFont() in more places
740         https://bugs.webkit.org/show_bug.cgi?id=177749
741
742         Reviewed by Zalan Bujtas.
743
744         Currently InlineTextBox::paint() calls InlineTextBox::lineFont() to compute the font for the
745         line and then passes this value to various paint helper functions. The computation is not
746         expensive and it is sufficient to have the individual paint helper functions compute it
747         directly. We should have the individual paint helper functions compute it directly. This
748         will help towards sharing more code throughout InlineTextBox by reducing the noise of
749         passing the font for the line.
750
751         No functionality changed. So, no new tests.
752
753         * rendering/InlineTextBox.cpp:
754         (WebCore::InlineTextBox::paint):
755         (WebCore::InlineTextBox::paintSelection):
756         (WebCore::InlineTextBox::paintTextSubrangeBackground):
757         (WebCore::InlineTextBox::paintCompositionBackground):
758         (WebCore::InlineTextBox::paintTextMatchMarker):
759         (WebCore::InlineTextBox::paintDecoration):
760         (WebCore::InlineTextBox::paintDocumentMarker):
761         (WebCore::InlineTextBox::paintDocumentMarkers):
762         * rendering/InlineTextBox.h:
763
764 2017-10-02  Basuke Suzuki  <Basuke.Suzuki@sony.com>
765
766         [Curl] Implement missing async method in RecourceHandle and make it actually async
767         https://bugs.webkit.org/show_bug.cgi?id=173964
768
769         Reviewed by Alex Christensen.
770
771         * platform/network/ResourceHandle.cpp:
772         (WebCore::ResourceHandle::continueWillSendRequest): Deleted.
773         (WebCore::ResourceHandle::continueDidReceiveResponse): Deleted.
774         (WebCore::ResourceHandle::continueCanAuthenticateAgainstProtectionSpace): Deleted.
775         * platform/network/curl/CurlRequest.cpp:
776         (WebCore::CurlRequest::start):
777         (WebCore::CurlRequest::cancel):
778         (WebCore::CurlRequest::suspend):
779         (WebCore::CurlRequest::resume):
780         (WebCore::CurlRequest::didReceiveHeader):
781         (WebCore::CurlRequest::didReceiveData):
782         (WebCore::CurlRequest::didCompleteTransfer):
783         (WebCore::CurlRequest::didCancelTransfer):
784         (WebCore::CurlRequest::finalizeTransfer):
785         (WebCore::CurlRequest::invokeDidReceiveResponseForFile):
786         (WebCore::CurlRequest::invokeDidReceiveResponse):
787         (WebCore::CurlRequest::completeDidReceiveResponse):
788         (WebCore::CurlRequest::setRequestPaused):
789         (WebCore::CurlRequest::setCallbackPaused):
790         (WebCore::CurlRequest::pausedStatusChanged):
791         (WebCore::CurlRequest::setPaused): Deleted.
792         * platform/network/curl/CurlRequest.h:
793         (WebCore::CurlRequest::needToInvokeDidReceiveResponse const):
794         (WebCore::CurlRequest::isPaused const):
795         * platform/network/curl/ResourceHandleCurl.cpp:
796         (WebCore::ResourceHandle::receivedRequestToContinueWithoutCredential):
797         (WebCore::ResourceHandle::continueDidReceiveResponse):
798         (WebCore::ResourceHandle::platformContinueSynchronousDidReceiveResponse):
799         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
800         (WebCore::ResourceHandleCurlDelegate::curlDidReceiveResponse):
801         (WebCore::ResourceHandleCurlDelegate::continueDidReceiveResponse):
802         (WebCore::ResourceHandleCurlDelegate::platformContinueSynchronousDidReceiveResponse):
803         (WebCore::ResourceHandleCurlDelegate::continueAfterDidReceiveResponse):
804         (WebCore::ResourceHandleCurlDelegate::shouldRedirectAsGET):
805         * platform/network/curl/ResourceHandleCurlDelegate.h:
806         * platform/network/curl/ResourceResponseCurl.cpp:
807         (WebCore::ResourceResponse::shouldRedirect):
808         (WebCore::ResourceResponse::isMovedPermanently const):
809         (WebCore::ResourceResponse::isFound const):
810         (WebCore::ResourceResponse::isSeeOther const):
811         (WebCore::ResourceResponse::isNotModified const):
812         (WebCore::ResourceResponse::isUnauthorized const):
813
814 2017-10-02  Ryosuke Niwa  <rniwa@webkit.org>
815
816         PasteImage tests are failing on debug builds
817         https://bugs.webkit.org/show_bug.cgi?id=177778
818
819         Reviewed by Wenson Hsieh.
820
821         After r222702, PlatformPasteboard is no longer responsible for adding "Files" as a type"
822         as DataTransfer takes care of it now. Removed the code to do this from PlatformPasteboardIOS.mm
823         and PlatformPasteboardMac.mm so that we don't fail assertions in debug builds.
824
825         * platform/ios/PlatformPasteboardIOS.mm:
826         (WebCore::safeTypeForDOMToReadAndWriteForPlatformType):
827         * platform/mac/PlatformPasteboardMac.mm:
828         (WebCore::safeTypeForDOMToReadAndWriteForPlatformType):
829         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const):
830
831 2017-10-02  Daniel Bates  <dabates@apple.com>
832
833         No need to truncate text after calling InlineTextBox::text()
834         https://bugs.webkit.org/show_bug.cgi?id=177748
835
836         Reviewed by Zalan Bujtas.
837
838         Following r222670 it is no longer necessary to explicitly truncate the text run length
839         as InlineTextBox::text() returns a text run with respect to the truncation of the text box.
840
841         No functionality changed. So, no new tests.
842
843         * rendering/InlineTextBox.cpp:
844         (WebCore::InlineTextBox::paint):
845
846 2017-10-02  Antti Koivisto  <antti@apple.com>
847
848         Add makeWeakPtr variant that takes pointer
849         https://bugs.webkit.org/show_bug.cgi?id=177767
850
851         Reviewed by Zalan Bujtas.
852
853         Use it.
854
855         * rendering/SelectionRangeData.h:
856         (WebCore::SelectionRangeData::Context::Context):
857
858 2017-10-02  Antti Koivisto  <antti@apple.com>
859
860         Make RenderPtr a type alias of std::unique_ptr
861         https://bugs.webkit.org/show_bug.cgi?id=177739
862
863         Reviewed by Sam Weinig.
864
865         It just needs a custom deleter.
866
867         * page/FrameView.h:
868         * rendering/RenderElement.cpp:
869         (WebCore::RenderElement::insertChildInternal):
870         * rendering/RenderMultiColumnFlow.cpp:
871         (WebCore::RenderMultiColumnFlow::fragmentedFlowDescendantInserted):
872         (WebCore::RenderMultiColumnFlow::handleSpannerRemoval):
873         * rendering/RenderObject.cpp:
874         (WebCore::RenderObjectDeleter::operator() const):
875         (WebCore::RenderObject::willBeDestroyed):
876         * rendering/RenderPtr.h:
877         (WebCore::createRenderer):
878         (WebCore::static_pointer_cast):
879
880             Make this safer with downcast.
881
882         (WebCore::RenderPtr::RenderPtr): Deleted.
883         (WebCore::RenderPtr::~RenderPtr): Deleted.
884         (WebCore::RenderPtr::get const): Deleted.
885         (WebCore::RenderPtr::operator* const): Deleted.
886         (WebCore::RenderPtr::operator-> const): Deleted.
887         (WebCore::RenderPtr::operator! const): Deleted.
888         (WebCore::RenderPtr::operator UnspecifiedBoolType const): Deleted.
889         (WebCore::RenderPtr::operator=): Deleted.
890         (WebCore::RenderPtr::swap): Deleted.
891         (WebCore::RenderPtr::operator==): Deleted.
892         (WebCore::RenderPtr::operator!=): Deleted.
893         (WebCore::RenderPtr<T>::clear): Deleted.
894         (WebCore::RenderPtr<T>::leakPtr): Deleted.
895         (WebCore::RenderPtr<T>::RenderPtr): Deleted.
896         (WebCore::=): Deleted.
897         (WebCore::swap): Deleted.
898         (WebCore::operator==): Deleted.
899         (WebCore::operator!=): Deleted.
900         (WebCore::getPtr): Deleted.
901         (WTF::HashTraits<WebCore::RenderPtr<T>>::emptyValue): Deleted.
902         (WTF::HashTraits<WebCore::RenderPtr<T>>::peek): Deleted.
903
904             We already have hash traits for std::unique_ptr.
905
906 2017-10-02  Joseph Pecoraro  <pecoraro@apple.com>
907
908         Web Inspector: Include Beacon and Ping requests in Network tab
909         https://bugs.webkit.org/show_bug.cgi?id=177641
910         <rdar://problem/33086839>
911
912         Reviewed by Chris Dumez.
913
914         Tests: http/tests/inspector/network/beacon-type.html
915                http/tests/inspector/network/ping-type.html
916
917         * Modules/beacon/NavigatorBeacon.cpp:
918         (WebCore::NavigatorBeacon::sendBeacon):
919         Fix a typo.
920
921         * loader/PingLoader.cpp:
922         (WebCore::PingLoader::startPingLoad):
923         * loader/cache/CachedResource.cpp:
924         (WebCore::CachedResource::load):
925         Include InspectorInstrumentation hooks for ping network loads.
926
927         * loader/LoaderStrategy.h:
928         * platform/network/PingHandle.h:
929         Include an optional ResourceResponse in the ping load completion callback.
930         If available this will be enough for Web Inspector to include details such
931         as the response statusCode.
932
933         * inspector/InspectorInstrumentation.cpp:
934         (WebCore::InspectorInstrumentation::willSendRequestOfTypeImpl):
935         (WebCore::InspectorInstrumentation::continueAfterPingLoaderImpl): Deleted.
936         * inspector/InspectorInstrumentation.h:
937         (WebCore::InspectorInstrumentation::willSendRequestOfType):
938         (WebCore::InspectorInstrumentation::continueAfterPingLoader): Deleted.
939         * inspector/InspectorNetworkAgent.cpp:
940         (WebCore::resourceTypeForCachedResource):
941         (WebCore::resourceTypeForLoadType):
942         (WebCore::InspectorNetworkAgent::willSendRequest):
943         (WebCore::InspectorNetworkAgent::willSendRequestOfType):
944         * inspector/InspectorNetworkAgent.h:
945         Make a general willSendRequestOfType hook when sending a request that does
946         not go through normal CachedResource loading. The Ping and Beacon requests
947         go through this process, we may also use this path for Preflight requests.
948
949         * inspector/InspectorPageAgent.cpp:
950         (WebCore::InspectorPageAgent::resourceTypeJson):
951         (WebCore::InspectorPageAgent::cachedResourceType):
952         * inspector/InspectorPageAgent.h:
953         Small refactoring.
954
955 2017-10-02  Zalan Bujtas  <zalan@apple.com>
956
957         SelectionRangeData should not hold raw RenderObject pointers
958         https://bugs.webkit.org/show_bug.cgi?id=177677
959         <rdar://problem/34763060>
960
961         Reviewed by Sam Weinig.
962
963         SelectionRangeData::Context start and end renderers' lifetime is not strictly tied
964         to the lifetime of SelectionRangeData.
965
966         Covered by existing tests.
967
968         * editing/FrameSelection.cpp:
969         (WebCore::FrameSelection::updateAppearance):
970         * platform/DragImage.cpp:
971         (WebCore::createDragImageForRange):
972         * rendering/SelectionRangeData.cpp:
973         (WebCore::isValidRendererForSelection):
974         (WebCore::collect):
975         (WebCore::SelectionRangeData::set):
976         (WebCore::SelectionRangeData::clear):
977         (WebCore::SelectionRangeData::repaint const):
978         (WebCore::SelectionRangeData::collectBounds const):
979         (WebCore::SelectionRangeData::apply):
980         * rendering/SelectionRangeData.h:
981         (WebCore::SelectionRangeData::Context::Context):
982         (WebCore::SelectionRangeData::Context::start const):
983         (WebCore::SelectionRangeData::Context::end const):
984         (WebCore::SelectionRangeData::Context::startPosition const):
985         (WebCore::SelectionRangeData::Context::endPosition const):
986         (WebCore::SelectionRangeData::Context::operator== const):
987         (WebCore::SelectionRangeData::start const):
988         (WebCore::SelectionRangeData::end const):
989         (WebCore::SelectionRangeData::startPosition const):
990         (WebCore::SelectionRangeData::endPosition const):
991
992 2017-10-02  Olivier Blin  <olivier.blin@softathome.com>
993
994         [WPE] Remove GnuTLS dependency
995         https://bugs.webkit.org/show_bug.cgi?id=177750
996
997         Reviewed by Michael Catanzaro.
998
999         libgcrypt is used by default instead of GnuTLS.
1000         See bug 163125
1001
1002         * PlatformWPE.cmake:
1003
1004 2017-10-02  Zalan Bujtas  <zalan@apple.com>
1005
1006         Addressing post-review comments after r222621
1007         https://bugs.webkit.org/show_bug.cgi?id=177610
1008
1009         Reviewed by Darin Adler.
1010
1011         * rendering/RenderMenuList.cpp:
1012         (RenderMenuList::didUpdateActiveOption):
1013
1014 2017-10-02  Daniel Bates  <dabates@apple.com>
1015
1016         Remove length argument from TextPainter::paint()
1017         https://bugs.webkit.org/show_bug.cgi?id=177758
1018
1019         Reviewed by Alex Christensen.
1020
1021         Have TextPainter.paint() use the length of the specified TextRun as opposed to
1022         taking an explicit argument for the length of the TextRun.
1023
1024         Following r222670 InlineTextBox creates a TextRun with respect to the truncated
1025         line. Prior to r222670 InlineTextBox did not do this and hence it had to pass both
1026         the TextRun and truncated length to TextPainter.paint() to have the line painted.
1027         Code that needs to paint a substring of a TextRun can still do so by using TextPainter.paintRange().
1028
1029         No functionality changed. So, no new tests.
1030
1031         * rendering/InlineTextBox.cpp:
1032         (WebCore::InlineTextBox::paint):
1033         * rendering/SimpleLineLayoutFunctions.cpp:
1034         (WebCore::SimpleLineLayout::paintFlow):
1035         * rendering/TextPainter.cpp:
1036         (WebCore::TextPainter::paint):
1037         * rendering/TextPainter.h:
1038
1039 2017-10-02  Fujii Hironori  <Hironori.Fujii@sony.com>
1040
1041         [curl] Crashes in CurlRequest::setupPUT()
1042         https://bugs.webkit.org/show_bug.cgi?id=177733
1043
1044         Reviewed by Alex Christensen.
1045
1046         Tests: http/tests/xmlhttprequest/xmlhttprequest-open-method-allowed.html
1047
1048         * platform/network/curl/CurlRequest.cpp:
1049         (WebCore::CurlRequest::setupPUT): Null-check the result of request.httpBody().
1050
1051 2017-10-02  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1052
1053         [CURL] Should handle redirects in WebCore
1054         https://bugs.webkit.org/show_bug.cgi?id=21242
1055
1056         Reviewed by Alex Christensen.
1057
1058         * platform/network/ResourceHandle.cpp:
1059         * platform/network/curl/CurlContext.cpp:
1060         (WebCore::CurlHandle::enableAutoReferer): Deleted.
1061         * platform/network/curl/CurlContext.h:
1062         * platform/network/curl/CurlRequest.cpp:
1063         (WebCore::CurlRequest::setupTransfer):
1064         (WebCore::CurlRequest::didReceiveHeader):
1065         (WebCore::CurlRequest::didReceiveData):
1066         * platform/network/curl/ResourceHandleCurl.cpp:
1067         (WebCore::ResourceHandle::start):
1068         (WebCore::ResourceHandle::continueDidReceiveResponse):
1069         (WebCore::ResourceHandle::continueWillSendRequest):
1070         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
1071         (WebCore::ResourceHandleCurlDelegate::curlDidReceiveResponse):
1072         (WebCore::ResourceHandleCurlDelegate::shouldRedirectAsGET):
1073         (WebCore::ResourceHandleCurlDelegate::willSendRequest):
1074         (WebCore::ResourceHandleCurlDelegate::continueWillSendRequest):
1075         (WebCore::ResourceHandleCurlDelegate::continueAfterWillSendRequest):
1076         * platform/network/curl/ResourceHandleCurlDelegate.h:
1077         * platform/network/curl/ResourceResponse.h:
1078         * platform/network/curl/ResourceResponseCurl.cpp:
1079         (WebCore::ResourceResponse::shouldRedirect):
1080         (WebCore::ResourceResponse::isMovedPermanently const):
1081         (WebCore::ResourceResponse::isFound const):
1082         (WebCore::ResourceResponse::isSeeOther const):
1083         (WebCore::ResourceResponse::isRedirection const): Deleted.
1084
1085 2017-10-02  Antti Koivisto  <antti@apple.com>
1086
1087         Crashes with guard malloc under RenderFullScreen::unwrapRenderer
1088         https://bugs.webkit.org/show_bug.cgi?id=177760
1089
1090         Unreviewed.
1091
1092         * rendering/RenderFullScreen.cpp:
1093         (WebCore::RenderFullScreen::unwrapRenderer):
1094
1095         The assert accesses 'this' after it has been deleted. It is not very valuable so remove the assert.
1096
1097 2017-10-02  Zan Dobersek  <zdobersek@igalia.com>
1098
1099         GraphicsContext: remove unused ENABLE(3D_TRANSFORMS) && USE(TEXTURE_MAPPER)
1100         https://bugs.webkit.org/show_bug.cgi?id=177757
1101
1102         Reviewed by Michael Catanzaro.
1103
1104         Remove three methods from the GraphicsContext class that were conditioned
1105         with the ENABLE(3D_TRANSFORMS) and USE(TEXTURE_MAPPER) guards. These aren't
1106         used anywhere at this point, but apparently used to be in the TextureMapper
1107         implementation.
1108
1109         * platform/graphics/GraphicsContext.h:
1110         * platform/graphics/cairo/GraphicsContextCairo.cpp:
1111         (WebCore::GraphicsContext::get3DTransform const): Deleted.
1112         (WebCore::GraphicsContext::concat3DTransform): Deleted.
1113         (WebCore::GraphicsContext::set3DTransform): Deleted.
1114
1115 2017-10-02  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
1116
1117         [GLib] NetworkStateNotifier implementation missing
1118         https://bugs.webkit.org/show_bug.cgi?id=177741
1119
1120         Reviewed by Carlos Garcia Campos.
1121
1122         No new tests. The DOM support is already being tested, but we would need a way
1123         of simulating a network outage to test GNetworkMonitor.
1124
1125         * PlatformGTK.cmake: add new file.
1126         * PlatformWPE.cmake: add new file.
1127         * platform/network/NetworkStateNotifier.cpp: no longer need the empty implementations, all platforms covered.
1128         * platform/network/NetworkStateNotifier.h:
1129         * platform/network/glib/NetworkStateNotifierGLib.cpp: Added.
1130         (WebCore::NetworkStateNotifier::updateStateWithoutNotifying): update the network state using GNetworkMonitor's availability.
1131         (WebCore::NetworkStateNotifier::networkChangedCallback): when network-changed is emitted, trigger a state update.
1132         (WebCore::NetworkStateNotifier::startObserving): watch GNetworkMonitor's network-changed signal.
1133
1134 2017-10-02  Olivier Blin  <olivier.blin@softathome.com>
1135
1136         Fix build with MathML disabled
1137         https://bugs.webkit.org/show_bug.cgi?id=177744
1138
1139         Reviewed by Michael Catanzaro.
1140
1141         These are regressions from r217549 (StyleResolver) and r221379 (RenderBlockFlow), which do not guard MathML usage.
1142
1143         * css/StyleResolver.cpp:
1144         (WebCore::hasEffectiveDisplayNoneForDisplayContents):
1145         * rendering/RenderBlockFlow.cpp:
1146         (WebCore::RenderBlockFlow::willCreateColumns const):
1147
1148 2017-10-02  Yusuke Suzuki  <utatane.tea@gmail.com>
1149
1150         Use ThreadIdentifier instead of thread::this_thread::get_id
1151         https://bugs.webkit.org/show_bug.cgi?id=177729
1152
1153         Reviewed by Sam Weinig.
1154
1155         We can use WTF::ThreadIdentifier instead of thread::this_thread::get_id
1156         to make use of ThreadIdentifier consistent in WebKit. In the other places,
1157         we use ThreadIdentifier for this debugging purpose. And this is the only
1158         place using thread::this_thread::get_id for the exact same purpose.
1159         Furthermore, thread::this_thread::get_id in Windows platform. So we prefer
1160         using ThreadIdentifier than thread::this_thread::get_id.
1161
1162         * Modules/webdatabase/DatabaseDetails.h:
1163         (WebCore::DatabaseDetails::DatabaseDetails):
1164         (WebCore::DatabaseDetails::threadID const):
1165         * Modules/webdatabase/DatabaseManager.cpp:
1166         (WebCore::DatabaseManager::detailsForNameAndOrigin):
1167
1168 2017-10-02  Antti Koivisto  <antti@apple.com>
1169
1170         Fix memory leaks in RenderMultiColumnFlow
1171         https://bugs.webkit.org/show_bug.cgi?id=177735
1172
1173         Reviewed by Zalan Bujtas.
1174
1175         * rendering/RenderMultiColumnFlow.cpp:
1176         (WebCore::RenderMultiColumnFlow::evacuateAndDestroy):
1177
1178             Switch from destroy() to removeFromParentAndDestroy() (they are currently equivalent in practice).
1179
1180         (WebCore::RenderMultiColumnFlow::fragmentedFlowDescendantInserted):
1181
1182             Destroy the placeholders instead of leaking them.
1183
1184         (WebCore::RenderMultiColumnFlow::handleSpannerRemoval):
1185
1186             Destroy the placeholder instead of leaking it.
1187
1188 2017-10-02  Charles Turner  <cturner@igalia.com>
1189
1190         Try to play AVC codec even if H.264 decoder only advertises byte-stream profile.
1191         https://bugs.webkit.org/show_bug.cgi?id=177550
1192
1193         GStreamer's element factory filters will claim they can't play videos with AVC
1194         codec strings, but the elements really are capable of playing them when filters
1195         like videoconvert are inserted by playbin. Videos of this variety are in the YouTube
1196         2018 EME conformance tests.
1197
1198         Also replace std::array with a stack array, this saves having to count
1199         the number of elements (the compiler does that now) and reduces braces.
1200
1201         Reviewed by Carlos Alberto Lopez Perez.
1202
1203         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
1204         (WebCore::codecSet):
1205
1206 2017-10-02  Tomas Popela  <tpopela@redhat.com>
1207
1208         [SOUP] Default kerberos authentication credentials are used in ephemeral (private) mode
1209         https://bugs.webkit.org/show_bug.cgi?id=177738
1210
1211         Reviewed by Carlos Garcia Campos.
1212
1213         If the session is ephemeral then don't enable the Negotiate support in
1214         our SoupSession.
1215
1216         * platform/network/soup/NetworkStorageSessionSoup.cpp: Pass the
1217         session ID if it's known to the SoupNetworkSession.
1218         (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession):
1219         (WebCore::NetworkStorageSession::getOrCreateSoupNetworkSession const):
1220         * platform/network/soup/SoupNetworkSession.cpp:
1221         (WebCore::SoupNetworkSession::SoupNetworkSession): If the session is
1222         ephemeral (based on given session ID) then don't activate the
1223         Negotiate support in SoupSession.
1224         * platform/network/soup/SoupNetworkSession.h:
1225         Change the constructor to accept the PAL::SessionID with the default
1226         value set to PAL::SessionID::emptySessionID.
1227
1228 2017-10-02  Joanmarie Diggs  <jdiggs@igalia.com>
1229
1230         REGRESSION(r222640) [GTK] Build broken with ATK 2.14
1231         https://bugs.webkit.org/show_bug.cgi?id=177634
1232
1233         Reviewed by Michael Catanzaro.
1234
1235         Use ATK_CHECK_VERSION to prevent the build failure.
1236
1237         No new tests. This fixes a downstream build failure.
1238
1239         * accessibility/atk/AXObjectCacheAtk.cpp:
1240         (WebCore::AXObjectCache::postPlatformNotification):
1241
1242 2017-10-01  Ryosuke Niwa  <rniwa@webkit.org>
1243
1244         Pasteboard shouldn't add "Files" as a type
1245         https://bugs.webkit.org/show_bug.cgi?id=177731
1246
1247         Reviewed by Wenson Hsieh.
1248
1249         Removed the platform specific code to add "Files" when there is a file present in platform's pasteboard.
1250         DataTransfer::types now adds "Files" automatically when Pasteboard::containsFiles returns true.
1251
1252         No new tests since there should be no behavioral change.
1253
1254         * dom/DataTransfer.cpp:
1255         (WebCore::DataTransfer::types const):
1256         * platform/gtk/PasteboardGtk.cpp:
1257         (WebCore::Pasteboard::typesForLegacyUnsafeBindings):
1258         * platform/ios/PasteboardIOS.mm:
1259         (WebCore::Pasteboard::addHTMLClipboardTypesForCocoaType):
1260         * platform/mac/PasteboardMac.mm:
1261         (WebCore::Pasteboard::addHTMLClipboardTypesForCocoaType):
1262         * platform/win/PasteboardWin.cpp:
1263         (WebCore::addMimeTypesForFormat): Removed the code to add "Text" and "URL" as separate types since
1264         this is not what the rest of ports do, and this type normalization is now taken care of by DataTransfer
1265         since r221063.
1266
1267 2017-10-02  Ryosuke Niwa  <rniwa@webkit.org>
1268
1269         Another attempt to fix Windows build after r222697.
1270
1271         * editing/FrameSelection.cpp:
1272         (WebCore::FrameSelection::updateAppearance):
1273         * platform/DragImage.cpp:
1274         (WebCore::createDragImageForRange):
1275         * rendering/SelectionRangeData.cpp:
1276         (WebCore::SelectionRangeData::clear):
1277         * rendering/SelectionRangeData.h:
1278         (WebCore::SelectionRangeData::Context::Context):
1279
1280 2017-10-02  Ryosuke Niwa  <rniwa@webkit.org>
1281
1282         Windows build fix attempt after r222697.
1283
1284         * platform/DragImage.cpp:
1285         (WebCore::createDragImageForRange):
1286
1287 2017-10-02  Ryosuke Niwa  <rniwa@webkit.org>
1288
1289         Merge readFilenames() and read(PasteboardFileReader)
1290         https://bugs.webkit.org/show_bug.cgi?id=177728
1291         <rdar://problem/34761725>
1292
1293         Reviewed by Sam Weinig.
1294
1295         Generalized PasteboardFileReader to return multiple files instead of just one file, and replaced the use
1296         of Pasteboard::readFilenames() with it. Because eliminates the need for finding the list of types to read
1297         as files in addition to file names, this patch also removes Pasteboard::typesTreatedAsFiles().
1298
1299         Note that Pasteboard::readFilenames() continues to exist in macOS and iOS as it's internally used by
1300         Pasteboard::read(PasteboardFileReader) in PasteboardCocoa.mm.
1301
1302         No new tests since there should be no behavioral change.
1303
1304         * dom/DataTransfer.cpp:
1305         (WebCore::DataTransfer::files const): Now makes a single call to Pasteboard::read(PasteboardFileReader)
1306         instead of reading filenames and then falling back to it. Also got rid of if-def for drag drop checks
1307         since forDrag() and forFileDrag() are always defined since r222688.
1308         (WebCore::PasteboardFileTypeReader): Added. Gets the list of all file types.
1309         (WebCore::PasteboardFileTypeReader::readFilename): Added. Gets the list of all file types.
1310         (WebCore::PasteboardFileTypeReader::readBuffer): Added. Gets the list of all file types.
1311         (WebCore::DataTransfer::hasFileOfType): Reimplemented using PasteboardFileTypeReader.
1312         * editing/WebCorePasteboardFileReader.cpp:
1313         (WebCore::WebCorePasteboardFileReader::readFilename): Added.
1314         (WebCore::WebCorePasteboardFileReader::readBuffer): Renamed from read.
1315         * editing/WebCorePasteboardFileReader.h:
1316         * platform/Pasteboard.h:
1317         (WebCore::PasteboardFileReader): Removed the constructor since we no longer specify a specific type to
1318         read off of pasteboard, and renamed the existing read function to readBuffer, and added a new variant
1319         which takes a filename.
1320         * platform/StaticPasteboard.h:
1321         * platform/cocoa/PasteboardCocoa.mm:
1322         (WebCore::imageTypeToFakeFilename): Return "image/png" for ImageType::TIFF (to do TIFF-to-PNG conversion;
1323         see r222656 for why this is needed) now that this function is used to convert directly from image type
1324         converted from cocoa type instead of the one reverse-converted from MIME type.
1325         (WebCore::mimeTypeToImageType): Deleted.
1326         (WebCore::Pasteboard::typesTreatedAsFiles): Deleted.
1327         (WebCore::Pasteboard::typesForLegacyUnsafeBindings): Use newly added readTypesWithSecurityCheck.
1328         (WebCore::convertTIFFToPNG): Extracted out of read(PasteboardFileReader).
1329         (WebCore::Pasteboard::read): Generalized to add filenames as well as image buffers as files. Because now
1330         we're concerting Cocoa types to ImageType, we no longer have to detect when TIFF-as-PNG conversion is
1331         happening here. We just treat ImageType::TIFF as PNG and do the conversion.
1332         (WebCore::Pasteboard::readStringInCustomData): Use newly added readBufferForTypeWithSecurityCheck.
1333         (WebCore::Pasteboard::readTypesWithSecurityCheck): Added.
1334         (WebCore::Pasteboard::readBufferForTypeWithSecurityCheck): Added.
1335         * platform/gtk/PasteboardGtk.cpp:
1336         (WebCore::Pasteboard::read): Implemented.
1337         (WebCore::Pasteboard::typesTreatedAsFiles): Deleted.
1338         (WebCore::Pasteboard::containsFiles): Implemented without calling readFilenames, which has been deleted.
1339         (WebCore::Pasteboard::readFilenames): Deleted.
1340         * platform/win/PasteboardWin.cpp:
1341         (WebCore::Pasteboard::typesTreatedAsFiles): Deleted.
1342         (WebCore::PasteboardFileCounter): Added. Used to counts the number of files in the pasteboard.
1343         (WebCore::PasteboardFileCounter::readFilename):
1344         (WebCore::PasteboardFileCounter::readBuffer):
1345         (WebCore::Pasteboard::containsFiles):
1346         (WebCore::Pasteboard::read): Moved the code to extract filenames out of readFilenames.
1347         (WebCore::Pasteboard::readFilenames): Deleted.
1348         * platform/wpe/PasteboardWPE.cpp:
1349         (WebCore::Pasteboard::typesTreatedAsFiles): Deleted.
1350         (WebCore::Pasteboard::readFilenames): Deleted.
1351
1352 2017-10-01  Sam Weinig  <sam@webkit.org>
1353
1354         [Settings] Move remaining simple settings to Settings.in
1355         https://bugs.webkit.org/show_bug.cgi?id=177730
1356
1357         Reviewed by Darin Adler.
1358
1359         - Adds new option type for Settings.in, 'getter', which allows you to specify
1360           a custom name for the setting's getter. For instance, the setting javaEnabled
1361           has a custom getter name, 'isJavaEnabled'.
1362         - Adds support for WTF::Seconds as a type of setting. Used by only 
1363           timeWithoutMouseMovementBeforeHidingControls at the moment.
1364         - Moves non-generated settings from Settings.h/cpp that don't require custom
1365           action when set, to Settings.in
1366
1367         * Scripts/GenerateSettings/GenerateInternalSettingsImplementationFile.py:
1368         * Scripts/GenerateSettings/GenerateSettingsHeaderFile.py:
1369         * Scripts/GenerateSettings/Settings.py:
1370
1371             Add support for 'getter' and the Seconds type.
1372
1373         * WebCore.xcodeproj/project.pbxproj:
1374         * platform/text/FontRenderingMode.h: Copied from Source/WebCore/platform/text/TextFlags.h.
1375         * platform/text/TextFlags.h:
1376         
1377             Add FontRenderingMode.h. Moved out of TextFlags.h to be accessible by
1378             the settings generator.
1379         
1380         * page/Settings.cpp:
1381         (WebCore::Settings::Settings):
1382         (WebCore::Settings::setJavaEnabled): Deleted.
1383         (WebCore::Settings::setJavaEnabledForLocalFiles): Deleted.
1384         (WebCore::Settings::setPreferMIMETypeForImages): Deleted.
1385         (WebCore::Settings::setForcePendingWebGLPolicy): Deleted.
1386         (WebCore::Settings::setNeedsAdobeFrameReloadingQuirk): Deleted.
1387         (WebCore::Settings::setFontRenderingMode): Deleted.
1388         (WebCore::Settings::fontRenderingMode const): Deleted.
1389         (WebCore::Settings::setShowTiledScrollingIndicator): Deleted.
1390         (WebCore::Settings::setFontFallbackPrefersPictographs): Deleted.
1391         (WebCore::Settings::setWebFontsAlwaysFallBack): Deleted.
1392         * page/Settings.h:
1393         (WebCore::Settings::isJavaEnabled const): Deleted.
1394         (WebCore::Settings::isJavaEnabledForLocalFiles const): Deleted.
1395         (WebCore::Settings::preferMIMETypeForImages const): Deleted.
1396         (WebCore::Settings::needsAcrobatFrameReloadingQuirk const): Deleted.
1397         (WebCore::Settings::showTiledScrollingIndicator const): Deleted.
1398         (WebCore::Settings::setTouchEventEmulationEnabled): Deleted.
1399         (WebCore::Settings::isTouchEventEmulationEnabled const): Deleted.
1400         (WebCore::Settings::setTimeWithoutMouseMovementBeforeHidingControls): Deleted.
1401         (WebCore::Settings::timeWithoutMouseMovementBeforeHidingControls const): Deleted.
1402         (WebCore::Settings::fontFallbackPrefersPictographs const): Deleted.
1403         (WebCore::Settings::webFontsAlwaysFallBack const): Deleted.
1404         (WebCore::Settings::setMediaKeysStorageDirectory): Deleted.
1405         (WebCore::Settings::mediaKeysStorageDirectory const): Deleted.
1406         (WebCore::Settings::setMediaDeviceIdentifierStorageDirectory): Deleted.
1407         (WebCore::Settings::mediaDeviceIdentifierStorageDirectory const): Deleted.
1408         (WebCore::Settings::applePayEnabled const): Deleted.
1409         (WebCore::Settings::setApplePayEnabled): Deleted.
1410         (WebCore::Settings::applePayCapabilityDisclosureAllowed const): Deleted.
1411         (WebCore::Settings::setApplePayCapabilityDisclosureAllowed): Deleted.
1412         (WebCore::Settings::isForcePendingWebGLPolicy const): Deleted.
1413         * page/Settings.in:
1414
1415             Moved hand-written settings to be Settings.in based.
1416
1417 2017-10-01  Zalan Bujtas  <zalan@apple.com>
1418
1419         RenderView does not need to be a SelectionSubtreeRoot
1420         https://bugs.webkit.org/show_bug.cgi?id=177713
1421
1422         Reviewed by Darin Adler and Antti Koivisto.
1423
1424         1. SelectionSubtreeRoot -> SelectionRangeData 
1425         2. Move all selection logic from RenderView to SelectionRangeData
1426         3. class RenderView : public SelectionSubtreeRoot -> SelectionRangeData m_selection;
1427         4. Remove redundant code
1428         5. General modernization
1429  
1430         No change in functionality.
1431
1432         * editing/FrameSelection.cpp:
1433         (WebCore::FrameSelection::setNeedsSelectionUpdate):
1434         (WebCore::DragCaretController::nodeWillBeRemoved):
1435         (WebCore::FrameSelection::respondToNodeModification):
1436         (WebCore::FrameSelection::prepareForDestruction):
1437         (WebCore::FrameSelection::focusedOrActiveStateChanged):
1438         (WebCore::FrameSelection::updateAppearance):
1439         (WebCore::FrameSelection::selectionBounds const):
1440         * page/FrameView.cpp:
1441         (WebCore::FrameView::paintContentsForSnapshot):
1442         * platform/DragImage.cpp:
1443         (WebCore::ScopedFrameSelectionState::ScopedFrameSelectionState):
1444         (WebCore::ScopedFrameSelectionState::~ScopedFrameSelectionState):
1445         (WebCore::createDragImageForRange):
1446         * rendering/InlineTextBox.cpp:
1447         (WebCore::InlineTextBox::selectionState):
1448         (WebCore::InlineTextBox::selectionStartEnd const):
1449         * rendering/RenderBlock.cpp:
1450         (WebCore::RenderBlock::isSelectionRoot const):
1451         * rendering/RenderObject.cpp:
1452         (WebCore::RenderObject::isSelectionBorder const):
1453         * rendering/RenderObject.h:
1454         * rendering/RenderReplaced.cpp:
1455         (WebCore::RenderReplaced::isSelected const):
1456         * rendering/RenderText.cpp:
1457         (WebCore::RenderText::collectSelectionRectsForLineBoxes):
1458         * rendering/RenderTextLineBoxes.cpp:
1459         (WebCore::RenderTextLineBoxes::setSelectionState):
1460         * rendering/RenderView.cpp:
1461         (WebCore::RenderView::RenderView):
1462         (WebCore::SelectionIterator::SelectionIterator): Deleted.
1463         (WebCore::SelectionIterator::current const): Deleted.
1464         (WebCore::SelectionIterator::next): Deleted.
1465         (WebCore::SelectionIterator::checkForSpanner): Deleted.
1466         (WebCore::rendererAfterPosition): Deleted.
1467         (WebCore::RenderView::selectionBounds const): Deleted.
1468         (WebCore::RenderView::subtreeSelectionBounds const): Deleted.
1469         (WebCore::RenderView::repaintSelection const): Deleted.
1470         (WebCore::RenderView::repaintSubtreeSelection const): Deleted.
1471         (WebCore::RenderView::setSelection): Deleted.
1472         (WebCore::isValidObjectForNewSelection): Deleted.
1473         (WebCore::RenderView::clearSubtreeSelection const): Deleted.
1474         (WebCore::RenderView::applySubtreeSelection): Deleted.
1475         (WebCore::RenderView::getSelection const): Deleted.
1476         (WebCore::RenderView::clearSelection): Deleted.
1477         * rendering/RenderView.h:
1478         * rendering/SelectionSubtreeRoot.cpp:
1479         (WebCore::rendererAfterPosition):
1480         (WebCore::SelectionIterator::SelectionIterator):
1481         (WebCore::SelectionIterator::current const):
1482         (WebCore::SelectionIterator::next):
1483         (WebCore::SelectionIterator::checkForSpanner):
1484         (WebCore::SelectionRangeData::SelectionRangeData):
1485         (WebCore::SelectionRangeData::set):
1486         (WebCore::SelectionRangeData::clear):
1487         (WebCore::SelectionRangeData::repaint const):
1488         (WebCore::SelectionRangeData::bounds const):
1489         (WebCore::SelectionRangeData::collectAndClear const):
1490         (WebCore::SelectionRangeData::apply):
1491         (WebCore::SelectionRangeData::isValidRendererForNewSelection const):
1492         (WebCore::SelectionSubtreeRoot::SelectionSubtreeRoot): Deleted.
1493         * rendering/SelectionSubtreeRoot.h:
1494         (WebCore::SelectionRangeData::Context::operator== const):
1495         (WebCore::SelectionRangeData::get const):
1496         (WebCore::SelectionRangeData::start const):
1497         (WebCore::SelectionRangeData::end const):
1498         (WebCore::SelectionRangeData::startPosition const):
1499         (WebCore::SelectionRangeData::endPosition const):
1500         (WebCore::SelectionSubtreeRoot::OldSelectionData::OldSelectionData): Deleted.
1501         (WebCore::SelectionSubtreeRoot::SelectionSubtreeData::SelectionSubtreeData): Deleted.
1502         (WebCore::SelectionSubtreeRoot::SelectionSubtreeData::selectionStart const): Deleted.
1503         (WebCore::SelectionSubtreeRoot::SelectionSubtreeData::selectionStartPos const): Deleted.
1504         (WebCore::SelectionSubtreeRoot::SelectionSubtreeData::selectionEnd const): Deleted.
1505         (WebCore::SelectionSubtreeRoot::SelectionSubtreeData::selectionEndPos const): Deleted.
1506         (WebCore::SelectionSubtreeRoot::SelectionSubtreeData::selectionStartEndPositions const): Deleted.
1507         (WebCore::SelectionSubtreeRoot::SelectionSubtreeData::clearSelection): Deleted.
1508         (WebCore::SelectionSubtreeRoot::selectionData): Deleted.
1509         (WebCore::SelectionSubtreeRoot::selectionData const): Deleted.
1510         (WebCore::SelectionSubtreeRoot::setSelectionData): Deleted.
1511
1512 2017-10-01  Sam Weinig  <sam@webkit.org>
1513
1514         [Settings] Enums should not be passed by const reference
1515         https://bugs.webkit.org/show_bug.cgi?id=177727
1516
1517         Reviewed by Darin Adler.
1518
1519         * Scripts/GenerateSettings/GenerateSettingsImplementationFile.py:
1520         * Scripts/GenerateSettings/GenerateSettingsHeaderFile.py:
1521         (printGetterAndSetter):
1522         
1523             Use the new typeIsAggregate predicate to determine whether to
1524             use const reference or not.
1525         
1526         (includeForSetting): Deleted.
1527
1528             Move includeForSetting to Settings.py with the rest of the Setting
1529             helpers.
1530
1531         * Scripts/GenerateSettings/Settings.py:
1532         (mapToIDLType):
1533         (typeIsPrimitive):
1534         (typeIsAggregate):
1535         
1536             Add predicate to determine if a setting's type is an aggregate (struct or class)
1537             or a primitive. Remove references to size_t, which is not used.
1538
1539 2017-10-01  Sam Weinig  <sam@webkit.org>
1540
1541         Add support for DOM aborting (https://dom.spec.whatwg.org/#aborting-ongoing-activities)
1542         https://bugs.webkit.org/show_bug.cgi?id=177718
1543
1544         Reviewed by Darin Adler.
1545
1546         Adds standalone support for AbortController and AbortSignal. No integration
1547         with other specs yet.
1548
1549         * CMakeLists.txt:
1550         * DerivedSources.make:
1551         * WebCore.xcodeproj/project.pbxproj:
1552         
1553             Add new files.
1554         
1555         * dom/AbortController.cpp: Added.
1556         * dom/AbortController.h: Added.
1557         * dom/AbortController.idl: Added.
1558         * dom/AbortSignal.cpp: Added.
1559         * dom/AbortSignal.h: Added.
1560         * dom/AbortSignal.idl: Added.
1561         
1562             Add basic support AbortController and AbortSignal.
1563         
1564         * dom/EventTargetFactory.in:
1565         
1566             Add AbortSignal to the list of EventTargets.
1567
1568 2017-10-01  Antti Koivisto  <antti@apple.com>
1569
1570         Use WeakPtr for first-letter memory management
1571         https://bugs.webkit.org/show_bug.cgi?id=177716
1572
1573         Reviewed by Darin Adler.
1574
1575         * rendering/RenderElement.cpp:
1576         (WebCore::RenderElement::destroyLeftoverChildren):
1577
1578             Remove first-letter special case.
1579             Use removeAndDestroyChild instead of calling destroy() directly. The latter should
1580             eventually stop calling takeChild and assert that the renderer is not in the tree.
1581
1582         * rendering/RenderTextFragment.cpp:
1583         (WebCore::RenderTextFragment::willBeDestroyed):
1584         (WebCore::RenderTextFragment::setText):
1585         * rendering/RenderTextFragment.h:
1586
1587             Use WeakPtr.
1588
1589 2017-10-01  Sam Weinig  <sam@webkit.org>
1590
1591         XMLHttpRequest's responseXML should be annotated with [Exposed=Window]
1592         https://bugs.webkit.org/show_bug.cgi?id=177714
1593
1594         Reviewed by Darin Adler.
1595
1596         Tests: imported/w3c/web-platform-tests/XMLHttpRequest/responseType-document-in-worker.html
1597                imported/w3c/web-platform-tests/XMLHttpRequest/responseXML-unavailable-in-worker.html
1598
1599         * xml/XMLHttpRequest.cpp:
1600         (WebCore::XMLHttpRequest::responseXML):
1601         
1602             Replace returning null for non-document contexts with an assertion now
1603             that the bindings layer ensures this doesn't get called.
1604         
1605         (WebCore::XMLHttpRequest::setResponseType):
1606         
1607             Match the spec and turn attempts to set a responseType of 'document' in
1608             non-documents contexts as a no-op.
1609         
1610         * xml/XMLHttpRequest.idl:
1611         
1612             Address FIXME and annotate responseXML with [Exposed=Window] now that it
1613             is supported.
1614
1615 2017-09-30  Ryosuke Niwa  <rniwa@webkit.org>
1616
1617         Don't reveal file URL when pasting an image
1618         https://bugs.webkit.org/show_bug.cgi?id=177710
1619         <rdar://problem/34757924>
1620
1621         Reviewed by Wenson Hsieh.
1622
1623         Fixed the bug by generalizing the code we had for drag & drop to hide string types when there is a file.
1624
1625         We don't hide string types when customPasteboardDataEnabled() is false to preserve the backwards compatiblity
1626         with apps that are relying on being able to read files URLs in the pasteboard.
1627
1628         Test: editing/pasteboard/paste-image-does-not-reveal-file-url.html
1629
1630         * dom/DataTransfer.cpp:
1631         (WebCore::DataTransfer::getData const): Pretend there is no string data when there is a file in the pasteboard
1632         custom pasteboard data is enabled.
1633         (WebCore::DataTransfer::setData): Ditto.
1634         (WebCore::DataTransfer::types const): Ditto.
1635         * dom/DataTransfer.h:
1636         (WebCore::DataTransfer::forDrag const): Added for when drag & drop support is disabled at compilation time.
1637         (WebCore::DataTransfer::forFileDrag const): Ditto.
1638         * platform/Pasteboard.h:
1639         * platform/StaticPasteboard.h:
1640         * platform/cocoa/PasteboardCocoa.mm:
1641         (WebCore::Pasteboard::containsFiles): Added.
1642         * platform/gtk/PasteboardGtk.cpp:
1643         (WebCore::Pasteboard::containsFiles): Added.
1644         * platform/win/PasteboardWin.cpp:
1645         (WebCore::Pasteboard::containsFiles): Added.
1646         * platform/wpe/PasteboardWPE.cpp:
1647         (WebCore::Pasteboard::containsFiles): Added.
1648         (WebCore::Pasteboard::readFilenames): Annotated this function with notImplemented().
1649
1650 2017-09-30  Sam Weinig  <sam@webkit.org>
1651
1652         [Settings] Replace SettingsMacros.h with a generated base class for Settings
1653         https://bugs.webkit.org/show_bug.cgi?id=177681
1654
1655         Reviewed by Darin Adler.
1656
1657         - Adds a SettingsGenerated class that Settings inherits from. The new class
1658           has the members and getters/setters for all the generated bindings.
1659         - Some default values for settings are literals in Settings.in, but rather
1660           constants or functions defined externally. These have all been moved to
1661           SettingsDefaultValues.h to allow for the script to include them all for
1662           SettingsGenerated.
1663         - Previously, a few enums were declared in Settings.h for use by Settings.
1664           Now that SettingsGenerated needs access, we standarize the same way that
1665           exists for the IDL generator; expecting the enum to be in a header of the
1666           same name.
1667
1668         * CMakeLists.txt:
1669         * DerivedSources.make:
1670         * WebCore.xcodeproj/project.pbxproj:
1671         * WebCoreMacros.cmake:
1672
1673             Add new files / generation steps.
1674         
1675         * Scripts/GenerateSettings.py:
1676         * Scripts/GenerateSettings/GenerateSettings.py:
1677         * Scripts/GenerateSettings/GenerateSettingsHeaderFile.py: Added.
1678         * Scripts/GenerateSettings/GenerateSettingsImplementationFile.py: Added.
1679         * Scripts/GenerateSettings/GenerateSettingsMacrosHeader.py: Removed.
1680         * Scripts/GenerateSettings/Settings.py:
1681         
1682             Replace script to generate SettingsMacros.h with scripts to generate a SettingsGenerated.{h,cpp}.
1683         
1684         * accessibility/ForcedAccessibilityValue.h: Added.
1685         * editing/EditableLinkBehavior.h: Added.
1686         * editing/EditingBehavior.h:
1687         * editing/EditingBehaviorType.h: Copied from editing/EditingBehaviorTypes.h.
1688         * editing/EditingBehaviorTypes.h: Removed.
1689         * editing/cocoa/DataDetection.h:
1690         * editing/cocoa/DataDetectorTypes.h: Added.
1691         * page/DebugOverlayRegions.h: Added.
1692         * page/FrameFlattening.h: Added.
1693         * page/PDFImageCachingPolicy.h: Added.
1694         * page/TextDirectionSubmenuInclusionBehavior.h: Added.
1695         * page/UserInterfaceDirectionPolicy.h: Added.
1696         * platform/text/TextDirection.h: Added.
1697         * platform/text/WritingMode.h:
1698
1699             Split out enums from Settings.h
1700
1701         * css/MediaQueryEvaluator.cpp:
1702
1703             Update for new name of ForcedAccessibilityValue.
1704
1705         * html/parser/HTMLParserOptions.cpp:
1706
1707             Update for new name of defaultMaximumHTMLParserDOMTreeDepth.
1708
1709         * page/Settings.cpp:
1710         * page/Settings.h:
1711         
1712             - Move defaults to SettingsDefaultValues.h (and SettingsDefaultValuesCocoa.mm for defaultTextAutosizingEnabled).
1713             - Move enums to their own files.
1714             - Inherit from SettingsGenerated.h
1715         
1716         * page/Settings.in:
1717         
1718             - Use new 'include' option for javaScriptRuntimeFlags setting to include <runtime/RuntimeFlags.h>,
1719               as it doesn't fit the normal idiomatic model.
1720             - Replace call to defaultMinimumZoomFontSize() with direct constant access.
1721
1722         * page/SettingsDefaultValues.h: Added.
1723         * page/cocoa/SettingsDefaultValuesCocoa.mm: Added.
1724
1725             Move default values from Settings to this new file.
1726
1727         * page/cocoa/SettingsCocoa.mm:
1728         
1729             Move defaultTextAutosizingEnabled() out of here and into SettingsDefaultValuesCocoa.mm.
1730         
1731         * style/StyleTreeResolver.cpp:
1732
1733             - Update for new scoping of defaultMaximumRenderTreeDepth.
1734             - Move defaultMaximumRenderTreeDepth from Settings here. This is the only use.
1735
1736         * testing/InternalSettings.cpp:
1737         (WebCore::InternalSettings::forcedColorsAreInvertedAccessibilityValue const):
1738         (WebCore::InternalSettings::setForcedColorsAreInvertedAccessibilityValue):
1739         (WebCore::InternalSettings::forcedDisplayIsMonochromeAccessibilityValue const):
1740         (WebCore::InternalSettings::setForcedDisplayIsMonochromeAccessibilityValue):
1741         (WebCore::InternalSettings::forcedPrefersReducedMotionAccessibilityValue const):
1742         (WebCore::InternalSettings::setForcedPrefersReducedMotionAccessibilityValue):
1743         (WebCore::settingsToInternalSettingsValue): Deleted.
1744         (WebCore::internalSettingsToSettingsValue): Deleted.
1745         * testing/InternalSettings.h:
1746         
1747             Replace duplicate definition of ForcedAccessibilityValue with a using declaration
1748             and simplify code now that it doesn't need to map between the two enums.
1749
1750 2017-09-30  Wenson Hsieh  <wenson_hsieh@apple.com>
1751
1752         [iOS WK2] API test EditorStateTests.ContentViewHasTextInContentEditableElement is a flaky failure
1753         https://bugs.webkit.org/show_bug.cgi?id=177698
1754
1755         Reviewed by Ryosuke Niwa.
1756
1757         The WebKit2 API test EditorStateTests.ContentViewHasTextInContentEditableElement is currently hitting
1758         intermittent failures on test runners. After inserting just an image in the editable element, we would expect
1759         that -hasText should return NO because the text content is an empty string, but we find that -hasText is YES.
1760         This is because we're bailing on an early return in computeEditableRootHasContentAndPlainText because the
1761         EditorState's PostLayoutData contains non-zero characters near the selection, which is incorrect.
1762
1763         However, upon closer inspection, this is due to a latent bug in the charactersAroundPosition helper function.
1764         This function attempts to compute characters before and after the current selection by initializing a Vector
1765         of size 3 with the relevant character data, and then sets oneAfter, oneBefore and twoBefore to the UChar32
1766         values in the vector. However, in the case where there are less than three characters, we end up assigning
1767         the uninitialized values in the vector to one or more of oneAfter, oneBefore and twoBefore, which causes the
1768         helper added in r222654 to bail early when it should not.
1769
1770         To fix this, we initialize the values in `characters` to 0 (which is the initial value for the 3 corresponding
1771         members in the PostLayoutData struct). We also turn `characters` into a UChar32 array on the stack, to avoid the
1772         heap allocations using a Vector<UChar32>.
1773
1774         No new tests; fixes a flaky API test.
1775
1776         * editing/VisibleUnits.cpp:
1777         (WebCore::charactersAroundPosition):
1778
1779 2017-09-30  Antti Koivisto  <antti@apple.com>
1780
1781         Add makeWeakPtr for easier WeakPtr construction
1782         https://bugs.webkit.org/show_bug.cgi?id=177706
1783
1784         Reviewed by Sam Weinig.
1785
1786         Use it in render tree.
1787
1788         * loader/SubframeLoader.cpp:
1789         (WebCore::SubframeLoader::loadPlugin):
1790         * page/FrameView.cpp:
1791         (WebCore::FrameView::updateEmbeddedObject):
1792         * rendering/RenderMultiColumnFlow.cpp:
1793         (WebCore::RenderMultiColumnFlow::fragmentedFlowDescendantInserted):
1794         * rendering/RenderObject.h:
1795         (WebCore::RenderObject::weakFactory const):
1796         (WebCore::RenderObject::createWeakPtr): Deleted.
1797         * rendering/RenderView.cpp:
1798         (WebCore::RenderView::RepaintRegionAccumulator::RepaintRegionAccumulator):
1799         * rendering/RenderWidget.cpp:
1800         (WebCore::RenderWidget::setWidgetGeometry):
1801         (WebCore::RenderWidget::setWidget):
1802         (WebCore::RenderWidget::updateWidgetPosition):
1803
1804 2017-09-30  Ryosuke Niwa  <rniwa@webkit.org>
1805
1806         Share more pasteboard code between iOS and macOS and remove dependency on Settings
1807         https://bugs.webkit.org/show_bug.cgi?id=177700
1808
1809         Reviewed by Wenson Hsieh.
1810
1811         Moved more code from PasteboardIOS.mm and PasteboardMac.mm into PasteboardCocoa.mm to share code.
1812
1813         This patch also removes the layering violation inadvertently introduced in r222595 whereby which
1814         Pasteboard code depends on Settings. To do this, this patch splits readStringForBindings is into
1815         readString and readStringInCustomData and typesForBindings into typesSafeForBindings and
1816         typesForLegacyUnsafeBindings, and moves the logic to decide whether a given type or string is read
1817         off of the native pasteboard entry or our custom data entry is moved to DataTransfer.
1818
1819         No new tests since there should be no behavioral change.
1820
1821         * dom/DataTransfer.cpp:
1822         (WebCore::DataTransfer::getData const): Moved the code to decide whether string is
1823         read off of custom data or native pasteboard from readStringForBindings.
1824         (WebCore::DataTransfer::types const): Ditto from typesForBindings.
1825         * platform/Pasteboard.cpp:
1826         (WebCore::Pasteboard::isSafeTypeForDOMToReadAndWrite): Moved into Pasteboard.
1827         * platform/Pasteboard.h:
1828         * platform/StaticPasteboard.cpp:
1829         (WebCore::StaticPasteboard::readString): Renamed from readStringForBindings.
1830         (WebCore::StaticPasteboard::readStringInCustomData): Added.
1831         (WebCore::StaticPasteboard::writeString):
1832         * platform/StaticPasteboard.h:
1833         * platform/cocoa/PasteboardCocoa.mm:
1834         (WebCore::Pasteboard::typesSafeForBindings): Extracted out of typesForBindings in PasteboardIOS.mm
1835         and PasteboardMac.mm.
1836         (WebCore::Pasteboard::typesForLegacyUnsafeBindings): Ditto.
1837         (WebCore::Pasteboard::readString): Ditto.
1838         (WebCore::Pasteboard::readStringInCustomData): Ditto.
1839         (WebCore::Pasteboard::writeCustomData): Moved here from PasteboardIOS.mm and PasteboardCocoa.mm.
1840         (WebCore::Pasteboard::changeCount const): Ditto.
1841         * platform/gtk/PasteboardGtk.cpp:
1842         (WebCore::Pasteboard::typesSafeForBindings): Added.
1843         (WebCore::Pasteboard::typesForLegacyUnsafeBindings): Renamed from readStringForBindings.
1844         (WebCore::Pasteboard::readString):
1845         (WebCore::Pasteboard::readStringInCustomData): Added.
1846         * platform/ios/PasteboardIOS.mm:
1847         (WebCore::Pasteboard::writeCustomData): Moved to PasteboardCocoa.mm.
1848         (WebCore::Pasteboard::changeCount const): Ditto.
1849         (WebCore::Pasteboard::readPlatformValueAsString): Moved into Pasteboard.
1850         (WebCore::Pasteboard::addHTMLClipboardTypesForCocoaType): Ditto.
1851         (WebCore::Pasteboard::readStringForBindings): Moved to PasteboardCocoa.mm.
1852         (WebCore::Pasteboard::typesForBindings): Ditto.
1853         * platform/ios/PlatformPasteboardIOS.mm:
1854         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const):
1855         * platform/mac/PasteboardMac.mm:
1856         (WebCore::Pasteboard::changeCount const): Moved to PasteboardCocoa.mm.
1857         (WebCore::Pasteboard::writeCustomData): Ditto.
1858         (WebCore::Pasteboard::readPlatformValueAsString): Moved into Pasteboard.
1859         (WebCore::Pasteboard::readStringForBindings): Moved to PasteboardCocoa.mm.
1860         (WebCore::Pasteboard::addHTMLClipboardTypesForCocoaType): Moved into Pasteboard.
1861         (WebCore::Pasteboard::typesForBindings): Moved to PasteboardCocoa.mm.
1862         * platform/mac/PlatformPasteboardMac.mm:
1863         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const):
1864         * platform/win/PasteboardWin.cpp:
1865         (WebCore::Pasteboard::typesSafeForBindings): Added.
1866         (WebCore::Pasteboard::typesForLegacyUnsafeBindings): Renamed from readStringForBindings.
1867         (WebCore::Pasteboard::readString): Renamed from readStringForBindings.
1868         (WebCore::Pasteboard::readStringInCustomData): Added.
1869         * platform/wpe/PasteboardWPE.cpp:
1870         (WebCore::Pasteboard::typesSafeForBindings): Added.
1871         (WebCore::PasteboardtypesForLegacyUnsafeBindings): Renamed from readStringForBindings.
1872         (WebCore::Pasteboard::readString): Renamed from readStringForBindings.
1873         (WebCore::Pasteboard::readStringInCustomData): Added.
1874
1875 2017-09-29  Antti Koivisto  <antti@apple.com>
1876
1877         Use smart pointers for creating, adding and removing renderers
1878         https://bugs.webkit.org/show_bug.cgi?id=177603
1879
1880         Reviewed by Zalan Bujtas.
1881
1882         With this patch RenderObject ownership is consistently managed using RenderPtrs. It also
1883         clarifies that in-tree renderers are always owned by the parent renderer.
1884
1885         - renderers are constructed with createRenderer<> which returns RenderPtr
1886         - addChild and related functions take RenderPtrs
1887         - removeChild is replaced with takeChild that returns a RenderPtr
1888         - only addChildInternal/takeChildInternal deal with raw ownder renderer pointers.
1889
1890         There are still a few exception left, noted below, to be fixed later.
1891
1892         * dom/Document.cpp:
1893         (WebCore::Document::webkitWillEnterFullScreenForElement):
1894         * rendering/RenderBlock.cpp:
1895         (WebCore::RenderBlock::addChildToContinuation):
1896         (WebCore::RenderBlock::addChild):
1897         (WebCore::RenderBlock::addChildIgnoringContinuation):
1898         (WebCore::RenderBlock::makeChildrenNonInline):
1899         (WebCore::RenderBlock::dropAnonymousBoxChild):
1900         (WebCore::RenderBlock::takeChild):
1901         (WebCore::RenderBlock::createAnonymousBlockWithStyleAndDisplay):
1902         (WebCore::RenderBlock::removeChild): Deleted.
1903         * rendering/RenderBlock.h:
1904         (WebCore::RenderBlock::createAnonymousWithParentRendererAndDisplay):
1905         (WebCore::RenderBlock::createAnonymousBoxWithSameTypeAs const):
1906         (WebCore::RenderBlock::createAnonymousBlock const):
1907         * rendering/RenderBlockFlow.cpp:
1908         (WebCore::RenderBlockFlow::addChild):
1909         (WebCore::RenderBlockFlow::takeChild):
1910         (WebCore::RenderBlockFlow::removeChild): Deleted.
1911         * rendering/RenderBlockFlow.h:
1912         * rendering/RenderBox.cpp:
1913         (WebCore::RenderBox::splitAnonymousBoxesAroundChild):
1914         * rendering/RenderBox.h:
1915         (WebCore::RenderBox::createAnonymousBoxWithSameTypeAs const):
1916         * rendering/RenderBoxModelObject.cpp:
1917         (WebCore::RenderBoxModelObject::moveChildTo):
1918         * rendering/RenderButton.cpp:
1919         (WebCore::RenderButton::addChild):
1920         (WebCore::RenderButton::takeChild):
1921         (WebCore::RenderButton::setText):
1922         (WebCore::RenderButton::removeChild): Deleted.
1923         * rendering/RenderButton.h:
1924         * rendering/RenderElement.cpp:
1925         (WebCore::RenderElement::addChild):
1926         (WebCore::RenderElement::takeChild):
1927         (WebCore::RenderElement::removeAndDestroyChild):
1928         (WebCore::RenderElement::destroyLeftoverChildren):
1929
1930             Keep the existing behavior and leak the firstLetter renderer. The comment claims they get destroyed by RenderTextFragment.
1931             To be cleaned up later.
1932
1933         (WebCore::RenderElement::insertChildInternal):
1934         (WebCore::RenderElement::takeChildInternal):
1935         (WebCore::RenderElement::handleDynamicFloatPositionChange):
1936         (WebCore::RenderElement::removeChild): Deleted.
1937         (WebCore::RenderElement::removeChildInternal): Deleted.
1938         * rendering/RenderElement.h:
1939         (WebCore::RenderElement::addChildIgnoringContinuation):
1940         * rendering/RenderFullScreen.cpp:
1941         (WebCore::RenderFullScreen::willBeDestroyed):
1942         (WebCore::RenderFullScreen::wrapNewRenderer):
1943         (WebCore::RenderFullScreen::wrapExistingRenderer):
1944
1945             Split wrapRenderer() into two functions, wrapNewRenderer() and wrapExistingRenderer().
1946             The first one deals with adding new renderers to the tree while the latter mutates
1947             existing render tree in-place.
1948
1949         (WebCore::RenderFullScreen::unwrapRenderer):
1950         (WebCore::RenderFullScreen::createPlaceholder):
1951         (WebCore::RenderFullScreen::wrapRenderer): Deleted.
1952         * rendering/RenderFullScreen.h:
1953         * rendering/RenderGrid.cpp:
1954         (WebCore::RenderGrid::addChild):
1955         (WebCore::RenderGrid::takeChild):
1956         (WebCore::RenderGrid::removeChild): Deleted.
1957         * rendering/RenderGrid.h:
1958         * rendering/RenderInline.cpp:
1959         (WebCore::RenderInline::addChild):
1960         (WebCore::RenderInline::addChildIgnoringContinuation):
1961         (WebCore::RenderInline::splitInlines):
1962         (WebCore::RenderInline::splitFlow):
1963         (WebCore::RenderInline::addChildToContinuation):
1964         (WebCore::RenderInline::childBecameNonInline):
1965         * rendering/RenderInline.h:
1966         * rendering/RenderMenuList.cpp:
1967         (WebCore::RenderMenuList::createInnerBlock):
1968         (RenderMenuList::addChild):
1969         (RenderMenuList::takeChild):
1970         (RenderMenuList::setText):
1971         (RenderMenuList::removeChild): Deleted.
1972         * rendering/RenderMenuList.h:
1973         * rendering/RenderMultiColumnFlow.cpp:
1974         (WebCore::RenderMultiColumnFlow::evacuateAndDestroy):
1975         (WebCore::RenderMultiColumnFlow::processPossibleSpannerDescendant):
1976         (WebCore::RenderMultiColumnFlow::fragmentedFlowDescendantInserted):
1977
1978             Keep the existing behavior and leak the placeholder renderer.
1979             To be cleaned up later.
1980
1981         (WebCore::RenderMultiColumnFlow::handleSpannerRemoval):
1982
1983             Keep the existing behavior and leak the placeholder renderer.
1984             To be cleaned up later.
1985
1986         * rendering/RenderMultiColumnSpannerPlaceholder.cpp:
1987         (WebCore::RenderMultiColumnSpannerPlaceholder::createAnonymous):
1988         * rendering/RenderMultiColumnSpannerPlaceholder.h:
1989         * rendering/RenderObject.cpp:
1990         (WebCore::RenderObject::removeFromParentAndDestroy):
1991         (WebCore::RenderObject::willBeDestroyed):
1992         (WebCore::RenderObject::destroy):
1993         (WebCore::RenderObject::removeFromParent): Deleted.
1994         * rendering/RenderObject.h:
1995         * rendering/RenderQuote.cpp:
1996         (WebCore::RenderQuote::updateTextRenderer):
1997         * rendering/RenderRuby.cpp:
1998         (WebCore::createAnonymousRubyInlineBlock):
1999         (WebCore::RenderRubyAsInline::addChild):
2000         (WebCore::RenderRubyAsInline::takeChild):
2001         (WebCore::RenderRubyAsBlock::addChild):
2002         (WebCore::RenderRubyAsBlock::takeChild):
2003         (WebCore::RenderRubyAsInline::removeChild): Deleted.
2004         (WebCore::RenderRubyAsBlock::removeChild): Deleted.
2005         * rendering/RenderRuby.h:
2006         * rendering/RenderRubyBase.cpp:
2007         (WebCore::RenderRubyBase::moveInlineChildren):
2008         * rendering/RenderRubyRun.cpp:
2009         (WebCore::RenderRubyRun::rubyBaseSafe):
2010         (WebCore::RenderRubyRun::addChild):
2011         (WebCore::RenderRubyRun::takeChild):
2012         (WebCore::RenderRubyRun::createRubyBase const):
2013         (WebCore::RenderRubyRun::staticCreateRubyRun):
2014         (WebCore::RenderRubyRun::removeChild): Deleted.
2015         * rendering/RenderRubyRun.h:
2016         * rendering/RenderTable.cpp:
2017         (WebCore::RenderTable::addChild):
2018         (WebCore::RenderTable::createTableWithStyle):
2019         (WebCore::RenderTable::createAnonymousWithParentRenderer):
2020         * rendering/RenderTable.h:
2021         (WebCore::RenderTable::createAnonymousBoxWithSameTypeAs const):
2022         * rendering/RenderTableCell.cpp:
2023         (WebCore::RenderTableCell::createTableCellWithStyle):
2024         (WebCore::RenderTableCell::createAnonymousWithParentRenderer):
2025         * rendering/RenderTableCell.h:
2026         (WebCore::RenderTableCell::createAnonymousBoxWithSameTypeAs const):
2027         * rendering/RenderTableRow.cpp:
2028         (WebCore::RenderTableRow::addChild):
2029         (WebCore::RenderTableRow::createTableRowWithStyle):
2030         (WebCore::RenderTableRow::createAnonymousWithParentRenderer):
2031         * rendering/RenderTableRow.h:
2032         (WebCore::RenderTableRow::createAnonymousBoxWithSameTypeAs const):
2033         * rendering/RenderTableSection.cpp:
2034         (WebCore::RenderTableSection::addChild):
2035         (WebCore::RenderTableSection::createTableSectionWithStyle):
2036         (WebCore::RenderTableSection::createAnonymousWithParentRenderer):
2037         * rendering/RenderTableSection.h:
2038         (WebCore::RenderTableSection::createAnonymousBoxWithSameTypeAs const):
2039         * rendering/mathml/RenderMathMLFenced.cpp:
2040         (WebCore::RenderMathMLFenced::makeFences):
2041         (WebCore::RenderMathMLFenced::addChild):
2042         * rendering/mathml/RenderMathMLFenced.h:
2043         * rendering/svg/RenderSVGContainer.cpp:
2044         (WebCore::RenderSVGContainer::addChild):
2045         (WebCore::RenderSVGContainer::takeChild):
2046         (WebCore::RenderSVGContainer::removeChild): Deleted.
2047         * rendering/svg/RenderSVGContainer.h:
2048         * rendering/svg/RenderSVGInline.cpp:
2049         (WebCore::RenderSVGInline::addChild):
2050         (WebCore::RenderSVGInline::takeChild):
2051         (WebCore::RenderSVGInline::removeChild): Deleted.
2052         * rendering/svg/RenderSVGInline.h:
2053         * rendering/svg/RenderSVGRoot.cpp:
2054         (WebCore::RenderSVGRoot::addChild):
2055         (WebCore::RenderSVGRoot::takeChild):
2056         (WebCore::RenderSVGRoot::removeChild): Deleted.
2057         * rendering/svg/RenderSVGRoot.h:
2058         * rendering/svg/RenderSVGText.cpp:
2059         (WebCore::RenderSVGText::addChild):
2060         (WebCore::RenderSVGText::takeChild):
2061         (WebCore::RenderSVGText::removeChild): Deleted.
2062         * rendering/svg/RenderSVGText.h:
2063         * style/RenderTreePosition.h:
2064         (WebCore::RenderTreePosition::insert):
2065         * style/RenderTreeUpdater.cpp:
2066         (WebCore::RenderTreeUpdater::createRenderer):
2067         (WebCore::createTextRenderer):
2068         * style/RenderTreeUpdaterFirstLetter.cpp:
2069         (WebCore::updateFirstLetterStyle):
2070         (WebCore::createFirstLetterRenderer):
2071         * style/RenderTreeUpdaterGeneratedContent.cpp:
2072         (WebCore::createContentRenderers):
2073         * style/RenderTreeUpdaterListItem.cpp:
2074         (WebCore::RenderTreeUpdater::ListItem::updateMarker):
2075         * style/RenderTreeUpdaterMultiColumn.cpp:
2076         (WebCore::RenderTreeUpdater::MultiColumn::createFragmentedFlow):
2077
2078 2017-09-29  Zalan Bujtas  <zalan@apple.com>
2079
2080         Remove redundant RenderObject::selectionRoot and dependencies
2081         https://bugs.webkit.org/show_bug.cgi?id=177696
2082
2083         Reviewed by Ryosuke Niwa.
2084
2085         There's only one selection root (RenderView).
2086
2087         * rendering/InlineTextBox.cpp:
2088         (WebCore::InlineTextBox::selectionState):
2089         (WebCore::InlineTextBox::selectionStartEnd const):
2090         * rendering/RenderObject.cpp:
2091         (WebCore::RenderObject::selectionRoot const): Deleted.
2092         (WebCore::RenderObject::selectionStartEnd const): Deleted.
2093         * rendering/RenderObject.h:
2094         * rendering/RenderReplaced.cpp:
2095         (WebCore::RenderReplaced::isSelected const):
2096         * rendering/RenderText.cpp:
2097         (WebCore::RenderText::collectSelectionRectsForLineBoxes):
2098         * rendering/RenderTextLineBoxes.cpp:
2099         (WebCore::RenderTextLineBoxes::setSelectionState):
2100         * rendering/RenderView.h:
2101         * rendering/SelectionSubtreeRoot.h:
2102
2103 2017-09-29  Chris Dumez  <cdumez@apple.com>
2104
2105         http/tests/preconnect/link-rel-preconnect-https.html is flaky
2106         https://bugs.webkit.org/show_bug.cgi?id=177673
2107
2108         Reviewed by Alex Christensen.
2109
2110         No new tests, unskipped test that is now passing consistently.
2111
2112         * loader/LinkLoader.cpp:
2113         (WebCore::LinkLoader::loadLink):
2114         * loader/LoaderStrategy.h:
2115
2116 2017-09-29  Daniel Bates  <dabates@apple.com>
2117
2118         Extract logic to compute text to render into common function
2119         https://bugs.webkit.org/show_bug.cgi?id=177607
2120
2121         Reviewed by Zalan Bujtas.
2122
2123         Currently we duplicate the logic to compute the text to render
2124         throughout InlineTextBox. Instead we should move this common
2125         code into a member function. This will allow us to audit the
2126         the code paths that render text and ensure such code paths
2127         account for hyphenation and combined text, if applicable.
2128
2129         Note that a TextRun does not own the text. The caller owns it.
2130
2131         No functionality changed. So, no new tests.
2132
2133         * rendering/InlineTextBox.cpp:
2134         (WebCore::InlineTextBox::localSelectionRect const): Modified to
2135         use text() and createTextRun() to compute the text to render
2136         and the text run for it.
2137         (WebCore::InlineTextBox::paint): Ditto.
2138         (WebCore::InlineTextBox::paintSelection): Ditto. Additionally query
2139         lineStyle() for the style of the line instead of requiring it to be
2140         passed as an argument.
2141         (WebCore::InlineTextBox::paintTextSubrangeBackground): Modified
2142         to use text() and createTextRun() to compute the text to render
2143         and the text run for it.
2144         (WebCore::InlineTextBox::paintDocumentMarker): Ditto.
2145         (WebCore::InlineTextBox::offsetForPosition const): Ditto.
2146         (WebCore::InlineTextBox::positionForOffset const): Ditto.
2147         (WebCore::InlineTextBox::createTextRun const): Added; formerly named constructTextRun.
2148         (WebCore::InlineTextBox::text const): Added.
2149         (WebCore::InlineTextBox::substringToRender const): Deleted.
2150         (WebCore::InlineTextBox::hyphenatedStringForTextRun const): Deleted.
2151         (WebCore::InlineTextBox::constructTextRun const): Deleted.
2152         * rendering/InlineTextBox.h:
2153         (WebCore::InlineTextBox::substringToRender): Deleted.
2154         (WebCore::InlineTextBox::hyphenatedStringForTextRun): Deleted.
2155         (WebCore::InlineTextBox::constructTextRun): Deleted; renamed to createTextRun.
2156
2157 2017-09-29  Zalan Bujtas  <zalan@apple.com>
2158
2159         Remove SelectionSubtreeRoot::RenderSubtreesMap
2160         https://bugs.webkit.org/show_bug.cgi?id=177685
2161
2162         Reviewed by Andy Estes.
2163
2164         This is in preparation of removing redundant SelectionSubtreeRoot.
2165         (Now that we removed regions, RenderView is the only selection root) 
2166
2167         No change in functionality.
2168
2169         * rendering/RenderView.cpp:
2170         (WebCore::RenderView::selectionBounds const):
2171         (WebCore::RenderView::subtreeSelectionBounds const):
2172         (WebCore::RenderView::repaintSelection const):
2173         (WebCore::RenderView::repaintSubtreeSelection const):
2174         (WebCore::RenderView::setSelection):
2175         (WebCore::isValidObjectForNewSelection):
2176         (WebCore::RenderView::clearSubtreeSelection const):
2177         (WebCore::RenderView::applySubtreeSelection):
2178         (WebCore::RenderView::updateSelectionForSubtrees): Deleted.
2179         * rendering/RenderView.h:
2180         * rendering/SelectionSubtreeRoot.h:
2181
2182 2017-09-29  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2183
2184         [Curl] Extract a features to manage HTTP communication from ResourceHandle
2185         https://bugs.webkit.org/show_bug.cgi?id=175148
2186
2187         Reviewed by Alex Christensen.
2188
2189         * platform/Curl.cmake:
2190         * platform/network/curl/CurlRequest.cpp: Added.
2191         (WebCore::CurlRequest::CurlRequest):
2192         (WebCore::CurlRequest::setUserPass):
2193         (WebCore::CurlRequest::start):
2194         (WebCore::CurlRequest::startWithJobManager):
2195         (WebCore::CurlRequest::cancel):
2196         (WebCore::CurlRequest::suspend):
2197         (WebCore::CurlRequest::resume):
2198         (WebCore::CurlRequest::callDelegate):
2199         (WebCore::CurlRequest::setupTransfer):
2200         (WebCore::CurlRequest::willSetupSslCtx):
2201         (WebCore::CurlRequest::willSendData):
2202         (WebCore::CurlRequest::didReceiveHeader):
2203         (WebCore::CurlRequest::didReceiveData):
2204         (WebCore::CurlRequest::didCompleteTransfer):
2205         (WebCore::CurlRequest::didCancelTransfer):
2206         (WebCore::CurlRequest::resolveBlobReferences):
2207         (WebCore::CurlRequest::setupPUT):
2208         (WebCore::CurlRequest::setupPOST):
2209         (WebCore::CurlRequest::setupFormData):
2210         (WebCore::CurlRequest::invokeDidReceiveResponseForFile):
2211         (WebCore::CurlRequest::invokeDidReceiveResponse):
2212         (WebCore::CurlRequest::setPaused):
2213         (WebCore::CurlRequest::willSetupSslCtxCallback):
2214         (WebCore::CurlRequest::willSendDataCallback):
2215         (WebCore::CurlRequest::didReceiveHeaderCallback):
2216         (WebCore::CurlRequest::didReceiveDataCallback):
2217         * platform/network/curl/CurlRequest.h: Added.
2218         (WebCore::CurlRequest::~CurlRequest):
2219         (WebCore::CurlRequest::setDelegate):
2220         (WebCore::CurlRequest::isSyncRequest):
2221         (WebCore::CurlRequest::getNetworkLoadMetrics):
2222         * platform/network/curl/CurlRequestDelegate.h: Added.
2223         * platform/network/curl/ResourceHandleCurl.cpp:
2224         (WebCore::ResourceHandle::cancel):
2225         (WebCore::ResourceHandle::platformSetDefersLoading):
2226         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
2227         (WebCore::ResourceHandle::receivedCredential):
2228         (WebCore::ResourceHandle::receivedRequestToContinueWithoutCredential):
2229         (WebCore::ResourceHandle::receivedCancellation):
2230         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
2231         (WebCore::ResourceHandleCurlDelegate::ResourceHandleCurlDelegate):
2232         (WebCore::ResourceHandleCurlDelegate::~ResourceHandleCurlDelegate):
2233         (WebCore::ResourceHandleCurlDelegate::start):
2234         (WebCore::ResourceHandleCurlDelegate::cancel):
2235         (WebCore::ResourceHandleCurlDelegate::setDefersLoading):
2236         (WebCore::ResourceHandleCurlDelegate::setAuthentication):
2237         (WebCore::ResourceHandleCurlDelegate::dispatchSynchronousJob):
2238         (WebCore::ResourceHandleCurlDelegate::createCurlRequest):
2239         (WebCore::ResourceHandleCurlDelegate::cancelledOrClientless):
2240         (WebCore::ResourceHandleCurlDelegate::curlDidReceiveResponse):
2241         (WebCore::ResourceHandleCurlDelegate::curlDidReceiveBuffer):
2242         (WebCore::ResourceHandleCurlDelegate::curlDidComplete):
2243         (WebCore::ResourceHandleCurlDelegate::curlDidFailWithError):
2244         (WebCore::ResourceHandleCurlDelegate::response):
2245         (WebCore::ResourceHandleCurlDelegate::getCredential):
2246         (WebCore::ResourceHandleCurlDelegate::retain): Deleted.
2247         (WebCore::ResourceHandleCurlDelegate::release): Deleted.
2248         (WebCore::ResourceHandleCurlDelegate::setupTransfer): Deleted.
2249         (WebCore::ResourceHandleCurlDelegate::didCompleteTransfer): Deleted.
2250         (WebCore::ResourceHandleCurlDelegate::didCancelTransfer): Deleted.
2251         (WebCore::ResourceHandleCurlDelegate::setupAuthentication): Deleted.
2252         (WebCore::ResourceHandleCurlDelegate::didReceiveAllHeaders): Deleted.
2253         (WebCore::ResourceHandleCurlDelegate::didReceiveContentData): Deleted.
2254         (WebCore::ResourceHandleCurlDelegate::handleLocalReceiveResponse): Deleted.
2255         (WebCore::ResourceHandleCurlDelegate::prepareSendData): Deleted.
2256         (WebCore::ResourceHandleCurlDelegate::didFinish): Deleted.
2257         (WebCore::ResourceHandleCurlDelegate::didFail): Deleted.
2258         (WebCore::ResourceHandleCurlDelegate::setupPOST): Deleted.
2259         (WebCore::ResourceHandleCurlDelegate::setupPUT): Deleted.
2260         (WebCore::ResourceHandleCurlDelegate::getFormElementsCount): Deleted.
2261         (WebCore::ResourceHandleCurlDelegate::setupFormData): Deleted.
2262         (WebCore::ResourceHandleCurlDelegate::applyAuthentication): Deleted.
2263         (WebCore::ResourceHandleCurlDelegate::getNetworkLoadMetrics): Deleted.
2264         (WebCore::ResourceHandleCurlDelegate::willSetupSslCtx): Deleted.
2265         (WebCore::ResourceHandleCurlDelegate::didReceiveHeader): Deleted.
2266         (WebCore::ResourceHandleCurlDelegate::didReceiveData): Deleted.
2267         (WebCore::ResourceHandleCurlDelegate::willSendData): Deleted.
2268         (WebCore::ResourceHandleCurlDelegate::willSetupSslCtxCallback): Deleted.
2269         (WebCore::ResourceHandleCurlDelegate::didReceiveHeaderCallback): Deleted.
2270         (WebCore::ResourceHandleCurlDelegate::didReceiveDataCallback): Deleted.
2271         (WebCore::ResourceHandleCurlDelegate::willSendDataCallback): Deleted.
2272         * platform/network/curl/ResourceHandleCurlDelegate.h:
2273
2274 2017-09-29  Chris Dumez  <cdumez@apple.com>
2275
2276         Split some logic out of VisitedLinkStore and make it reusable
2277         https://bugs.webkit.org/show_bug.cgi?id=177575
2278
2279         Reviewed by Alex Christensen.
2280
2281         Rename LinkHash to SharedStringHash to make it more reusable.
2282
2283         * CMakeLists.txt:
2284         * WebCore.xcodeproj/project.pbxproj:
2285         * css/StyleResolver.cpp:
2286         * dom/VisitedLinkState.cpp:
2287         (WebCore::linkHashForElement):
2288         (WebCore::VisitedLinkState::invalidateStyleForLink):
2289         (WebCore::VisitedLinkState::determineLinkStateSlowCase):
2290         * dom/VisitedLinkState.h:
2291         * html/HTMLAnchorElement.h:
2292         (WebCore::HTMLAnchorElement::visitedLinkHash const):
2293         * loader/EmptyClients.cpp:
2294         * loader/HistoryController.cpp:
2295         (WebCore::addVisitedLink):
2296         * page/Page.cpp:
2297         (WebCore::Page::invalidateStylesForLink):
2298         * page/Page.h:
2299         * page/VisitedLinkStore.cpp:
2300         (WebCore::VisitedLinkStore::invalidateStylesForLink):
2301         * page/VisitedLinkStore.h:
2302         * platform/SharedStringHash.cpp: Renamed from Source/WebCore/platform/LinkHash.cpp.
2303         (WebCore::needsTrailingSlash):
2304         (WebCore::computeSharedStringHashInline):
2305         (WebCore::computeSharedStringHash):
2306         * platform/SharedStringHash.h: Renamed from Source/WebCore/platform/LinkHash.h.
2307         (WebCore::SharedStringHashHash::hash):
2308         (WebCore::SharedStringHashHash::equal):
2309         (WebCore::SharedStringHashHash::avoidDeletedValue):
2310
2311 2017-09-29  Don Olmstead  <don.olmstead@sony.com>
2312
2313         [WinCairo] Fix build after rev 222610
2314         https://bugs.webkit.org/show_bug.cgi?id=177674
2315
2316         Reviewed by Per Arne Vollan.
2317
2318         No new tests. No change in behavior.
2319
2320         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
2321
2322 2017-09-29  Wenson Hsieh  <wenson_hsieh@apple.com>
2323
2324         [iOS] Remove unused pre-iOS 11 codepaths for writing to the pasteboard
2325         https://bugs.webkit.org/show_bug.cgi?id=177669
2326
2327         Reviewed by Tim Horton.
2328
2329         Now that PlatformPasteboardIOS codepaths for writing data on drag and copy have been unified to both use
2330         NSItemProviders, we can remove the legacy codepath that called -setItems on UIPasteboard, since nothing uses it
2331         any more. No change in behavior.
2332
2333         * platform/ios/PlatformPasteboardIOS.mm:
2334         (WebCore::PlatformPasteboard::write):
2335         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const):
2336         (WebCore::PlatformPasteboard::allowReadingURLAtIndex const):
2337         (WebCore::PlatformPasteboard::readURL):
2338         (WebCore::richTextRepresentationsForPasteboardWebContent): Deleted.
2339
2340 2017-09-28  Ryosuke Niwa  <rniwa@webkit.org>
2341
2342         Image pasting is not working on tineye.com / gmail.com / GitHub.com due to lack of support for DataTransfer.items
2343         https://bugs.webkit.org/show_bug.cgi?id=170449
2344         <rdar://problem/31432525>
2345
2346         Reviewed by Wenson Hsieh.
2347
2348         The bug was caused by image types in NSPasteboard or UIPasteboard not being treated as file items in dataTransfer.
2349         Because there is no Web API to get binary data out of dataTransfer unlike text data, we need to treat any image
2350         data as files even if they're entirely in the memory.
2351
2352         This patch introduces the notion of pasteboard types to be treated as files and expose them on dataTransfer.files
2353         as well as dataTransfer.items of type "file". Because in-memory images are stored as TIFF in macOS and websites
2354         don't typically support image/tiff, we convert all such in-memory TIFF images into PNG images ourselves for
2355         a better web compatibility. This is done inside read(PasteboardFileReader&) in PasteboardCocoa.mm.
2356
2357         Note that PasteboardFileReader cannot directly have RefPtr<File> as a member variable as code in WebCore/platform
2358         including Pasteboard code is not supposed to depend on WebCore types. WebCorePasteboardFileReader, a subclass of
2359         PasteboardFileReader was introduced to resolve this reverse dependency.
2360
2361         In addition, this patch removes the restriction on dataTransfer.items that it only includes files of the supported
2362         MIME types. This was unwarranted since 1. we don't have any restriction on what an user can drag & drop into a web
2363         page via input element so there is no security benefit in this, and 2. the user should be able to copy & paste
2364         whatever file he/she desires regardless of the MIME type on websites like Google Drive.
2365
2366         Tests: PasteImage
2367
2368         * CMakeLists.txt:
2369         * WebCore.xcodeproj/project.pbxproj:
2370         * WebCore/PlatformMac.cmake:
2371         * dom/DataTransfer.cpp:
2372         (WebCore::DataTransfer::types const): Now excludes image/gif, image/png, image/jpeg, and image/tiff.
2373         (WebCore::DataTransfer::files const): Add fake files we create for in-memory images but only when there are no real
2374         files in the pasteboard since it's expensive to copy image data across UI/Web processes to create a blob URL.
2375         * dom/DataTransferItemList.cpp:
2376         (WebCore::DataTransferItemList::ensureItems const): Just expose every file type. If the user had decided to paste
2377         a file, it's okay for the page to access that file regardless of whether it's a zip file, JPEG image, etc...
2378         * editing/WebCorePasteboardFileReader.cpp:
2379         (WebCorePasteboardFileReader::~WebCorePasteboardFileReader):
2380         (WebCorePasteboardFileReader::read):
2381         * editing/WebCorePasteboardFileReader.h:
2382         (WebCorePasteboardFileReader):
2383         * platform/Pasteboard.cpp:
2384         (WebCore::PasteboardImage::PasteboardImage): Moved from platform specific translation units.
2385         (WebCore::PasteboardImage::~PasteboardImage): Ditto.
2386         * platform/Pasteboard.h:
2387         (PasteboardFileReader): Added.
2388         (* platform/StaticPasteboard.h:
2389         (StaticPasteboard::typesForBindings): Added.
2390         (StaticPasteboard::typesTreatedAsFiles): Added. Returns an empty list we don't support the web content writing image
2391         files into pasteboard at the moment.
2392         * platform/cocoa/PasteboardCocoa.mm: Added.
2393         (WebCore::PasteboardWebContent::PasteboardWebContent): Moved from PasteboardMac.mm and PasteboardIOS.mm.
2394         (WebCore::PasteboardWebContent::~PasteboardWebContent):
2395         (WebCore::cocoaTypeToImageType): Added.
2396         (WebCore::imageTypeToMIMEType): Added. Pretends to have image/png when the Cocoa type is image/tiff since most of
2397         websites don't support image/tiff.
2398         (WebCore::imageTypeToFakeFilename): Added.
2399         (WebCore::mimeTypeToImageType): Added.
2400         (WebCore::Pasteboard::shouldTreatCocoaTypeAsFile): Added. Pasteboard::typesForBindings excludes the type for which
2401         this function returns true.
2402         (WebCore::Pasteboard::typesTreatedAsFiles): Returns the list of all in-memory image types in the pasteboard.
2403         (WebCore::Pasteboard::read): Added. On macOS, we convert TIFF to PNG for web compatibility. We don't do this rather
2404         memory intensive coercion on iOS where most of apps like Photos put PNG file into the pasteboard in the first place.
2405         * platform/gtk/PasteboardGtk.cpp:
2406         (WebCore::PasteboardImage::PasteboardImage): Deleted.
2407         (WebCore::PasteboardImage::~PasteboardImage): Deleted.
2408         (WebCore::Pasteboard::read):
2409         (WebCore::Pasteboard::typesForBindings): Renamed from types.
2410         (WebCore::Pasteboard::typesTreatedAsFiles):
2411         * platform/ios/PasteboardIOS.mm:
2412         (WebCore::addHTMLClipboardTypesForCocoaType):
2413         (WebCore::Pasteboard::typesForBindings):
2414         (WebCore::PasteboardWebContent::PasteboardWebContent): Deleted.
2415         (WebCore::PasteboardWebContent::~PasteboardWebContent): Deleted.
2416         (WebCore::PasteboardImage::PasteboardImage): Deleted.
2417         (WebCore::PasteboardImage::~PasteboardImage): Deleted.
2418         (WebCore::Pasteboard::types): Deleted.
2419         * platform/ios/PlatformPasteboardIOS.mm:
2420         (WebCore::safeTypeForDOMToReadAndWriteForPlatformType): Add "Files" to dataTransfer.types when there is an in-memory
2421         image type in the pasteboard.
2422         * platform/mac/PasteboardMac.mm:
2423         (WebCore::PasteboardWebContent::PasteboardWebContent): Deleted.
2424         (WebCore::PasteboardWebContent::~PasteboardWebContent): Deleted.
2425         (WebCore::PasteboardImage::PasteboardImage): Deleted.
2426         (WebCore::PasteboardImage::~PasteboardImage): Deleted.
2427         (WebCore::addHTMLClipboardTypesForCocoaType): Moved the check for the legacy NeXT plain text check here. Also add
2428         "Files" to dataTransfer.types when there is an in-memory image type in the pasteboard.
2429         (WebCore::Pasteboard::typesForBindings): Renamed from types.
2430         * platform/mac/PlatformPasteboardMac.mm:
2431         (WebCore::safeTypeForDOMToReadAndWriteForPlatformType): Ditto to add "Files".
2432         * platform/win/PasteboardWin.cpp:
2433         (WebCore::Pasteboard::typesForBindings): Renamed from types.
2434         (WebCore::Pasteboard::typesTreatedAsFiles):
2435         (WebCore::Pasteboard::read):
2436         * platform/wpe/PasteboardWPE.cpp:
2437         (WebCore::Pasteboard::typesForBindings): Renamed from types.
2438         (WebCore::Pasteboard::typesTreatedAsFiles):
2439         (WebCore::Pasteboard::read):
2440
2441 2017-09-29  Wenson Hsieh  <wenson_hsieh@apple.com>
2442
2443         [iOS WK2] Implement -[WKContentView hasText] for compatibility with the UITextInput protocol
2444         https://bugs.webkit.org/show_bug.cgi?id=177662
2445         <rdar://problem/33410373>
2446
2447         Reviewed by Tim Horton.
2448
2449         Adds a new TextIterator helper function to determine whether a Range has any plain text.
2450
2451         Tests: EditorStateTests.ContentViewHasTextInContentEditableElement
2452                EditorStateTests.ContentViewHasTextInTextarea
2453
2454         * editing/TextIterator.cpp:
2455         (WebCore::hasAnyPlainText):
2456
2457         Add a new helper to determine whether a Range contains any plain text. While inspired by and very similar to the
2458         plainText() helper function, this variant does not create a new string buffer when invoked, and is therefore
2459         more efficient for the purposes of determining whether there is any plain text at all.
2460
2461         * editing/TextIterator.h:
2462
2463 2017-09-29  Zalan Bujtas  <zalan@apple.com>
2464
2465         Add WeakPtr support to RenderObject.
2466         https://bugs.webkit.org/show_bug.cgi?id=177429
2467         <rdar://problem/34625212>
2468
2469         Reviewed by Dean Jackson.
2470
2471         This is in preparation to start using weak pointers extensively in rendering.
2472
2473         No change in functionality.
2474
2475         * loader/SubframeLoader.cpp:
2476         (WebCore::SubframeLoader::loadPlugin):
2477         * page/FrameView.cpp:
2478         (WebCore::FrameView::updateEmbeddedObject):
2479         * rendering/RenderMultiColumnFlow.cpp:
2480         (WebCore::RenderMultiColumnFlow::fragmentedFlowDescendantInserted):
2481         * rendering/RenderMultiColumnSpannerPlaceholder.h:
2482         * rendering/RenderObject.cpp:
2483         * rendering/RenderObject.h:
2484         (WebCore::RenderObject::createWeakPtr):
2485         * rendering/RenderView.cpp:
2486         (WebCore::RenderView::RepaintRegionAccumulator::RepaintRegionAccumulator):
2487         (WebCore::RenderView::RepaintRegionAccumulator::~RepaintRegionAccumulator):
2488         * rendering/RenderView.h:
2489         * rendering/RenderWidget.cpp:
2490         (WebCore::RenderWidget::setWidgetGeometry):
2491         (WebCore::RenderWidget::setWidget):
2492         (WebCore::RenderWidget::updateWidgetPosition):
2493         * rendering/RenderWidget.h:
2494         (WebCore::RenderWidget::createWeakPtr): Deleted.
2495
2496 2017-09-29  Enrique Ocaña González  <eocanha@igalia.com>
2497
2498         [GStreamer] Refactor media player to use MediaTime consistently
2499         https://bugs.webkit.org/show_bug.cgi?id=174817
2500
2501         Reviewed by Xabier Rodriguez-Calvar.
2502
2503         Make consistent use of the MediaTime class in the GStreamer media
2504         player implementations.
2505
2506         This patch is authored by Charlie Turner <cturner@igalia.com> plus
2507         some minor modifications by Enrique: migration of m_cachedPosition,
2508         usage of m_seekTime as MediaTime in the MSE player and more logging
2509         using toString().
2510
2511         Covered by existing tests.
2512
2513         * platform/graphics/gstreamer/GStreamerUtilities.cpp:
2514         (WebCore::toGstUnsigned64Time): Scales MediaTime to the precision used
2515         by GStreamer and returns a value compatible with GstClockTime.
2516         (WebCore::toGstClockTime): Deleted.
2517         * platform/graphics/gstreamer/GStreamerUtilities.h:
2518         (WebCore::toGstClockTime): Inlined, now it takes MediaTime and converts
2519         to GstClockTime.
2520         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2521         Several changes to use MediaTime instead of float and to log MediaTime
2522         values converting them toString().
2523         (WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer):
2524         (WebCore::MediaPlayerPrivateGStreamer::load):
2525         (WebCore::MediaPlayerPrivateGStreamer::playbackPosition const):
2526         (WebCore::MediaPlayerPrivateGStreamer::durationMediaTime const):
2527         (WebCore::MediaPlayerPrivateGStreamer::currentMediaTime const):
2528         (WebCore::MediaPlayerPrivateGStreamer::seek): Uses MediaTime.
2529         (WebCore::MediaPlayerPrivateGStreamer::doSeek):
2530         (WebCore::MediaPlayerPrivateGStreamer::updatePlaybackRate):
2531         (WebCore::MediaPlayerPrivateGStreamer::buffered const):
2532         (WebCore::MediaPlayerPrivateGStreamer::fillTimerFired):
2533         (WebCore::MediaPlayerPrivateGStreamer::maxMediaTimeSeekable const):
2534         (WebCore::MediaPlayerPrivateGStreamer::maxTimeLoaded const):
2535         (WebCore::MediaPlayerPrivateGStreamer::didLoadingProgress const):
2536         (WebCore::MediaPlayerPrivateGStreamer::asyncStateChangeDone):
2537         (WebCore::MediaPlayerPrivateGStreamer::updateStates):
2538         (WebCore::MediaPlayerPrivateGStreamer::didEnd):
2539         (WebCore::MediaPlayerPrivateGStreamer::durationChanged):
2540         (WebCore::MediaPlayerPrivateGStreamer::maxTimeSeekable const): Deleted.
2541         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: Changed
2542         seek(), playBackposition(), m_cachedPosition, m_durationAtEOS,
2543         m_seekTime and m_timeOfOverlappingSeek to be of MediaTime type.
2544         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
2545         Prefer the methods based on MediaTime over those based on fload/double.
2546         (WebCore::MediaPlayerPrivateGStreamerBase::maxTimeLoaded const):
2547         * platform/graphics/gstreamer/mse/GStreamerMediaSample.cpp:
2548         (WebCore::GStreamerMediaSample::offsetTimestampsBy): toGstClockTime()
2549         now can handle MediaTime.
2550         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
2551         Several changes to use MediaTime instead of float and to log MediaTime
2552         values converting them toString().
2553         (WebCore::MediaPlayerPrivateGStreamerMSE::seek):
2554         (WebCore::MediaPlayerPrivateGStreamerMSE::notifySeekNeedsDataForTime):
2555         (WebCore::MediaPlayerPrivateGStreamerMSE::doSeek):
2556         (WebCore::MediaPlayerPrivateGStreamerMSE::maybeFinishSeek):
2557         (WebCore::MediaPlayerPrivateGStreamerMSE::isTimeBuffered const):
2558         (WebCore::MediaPlayerPrivateGStreamerMSE::durationChanged):
2559         (WebCore::MediaPlayerPrivateGStreamerMSE::currentMediaTime const):
2560         (WebCore::MediaPlayerPrivateGStreamerMSE::maxTimeSeekable const):
2561         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
2562         seek() now takes a MediaTime argument.
2563         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
2564         (WebCore::PlaybackPipeline::enqueueSample): Use MediaTime values in
2565         MediaSample.
2566         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
2567         (webKitMediaSrcQueryWithParent): Use MediaTime values in
2568         durationMediaTime().
2569
2570 2017-09-28  Sam Weinig  <sam@webkit.org>
2571
2572         Re-write Settings generation in python for some reason
2573         https://bugs.webkit.org/show_bug.cgi?id=177621
2574
2575         Reviewed by Tim Horton.
2576
2577         Re-writes and splits up generation of InternalSettingsGenerated.{h|cpp|idl}
2578         and SettingsMacros.h in python in preparation for larger changes.
2579
2580         * DerivedSources.make:
2581         * Scripts/GenerateSettings: Added.
2582         * Scripts/GenerateSettings.py: Added.
2583         * Scripts/GenerateSettings/GenerateInternalSettingsHeaderFile.py: Added.
2584         * Scripts/GenerateSettings/GenerateInternalSettingsIDLFile.py: Added.
2585         * Scripts/GenerateSettings/GenerateInternalSettingsImplementationFile.py: Added.
2586         * Scripts/GenerateSettings/GenerateSettings.py: Added.
2587         * Scripts/GenerateSettings/GenerateSettingsMacrosHeader.py: Added.
2588         * Scripts/GenerateSettings/Settings.py: Added.
2589         * Scripts/GenerateSettings/__init__.py: Added.
2590         * WebCore.xcodeproj/project.pbxproj:
2591         * page/make_settings.pl: Removed.
2592
2593 2017-09-28  Don Olmstead  <don.olmstead@sony.com>
2594
2595         Simplify PLATFORM ifdefs within Editor around writing selections
2596         https://bugs.webkit.org/show_bug.cgi?id=177624
2597
2598         Reviewed by Alex Christensen.
2599
2600         No new tests. No change in behavior.
2601
2602         * editing/Editor.cpp:
2603         (WebCore::Editor::performCutOrCopy):
2604         (WebCore::Editor::copyImage):
2605         * editing/Editor.h:
2606
2607 2017-09-28  Joanmarie Diggs  <jdiggs@igalia.com>
2608
2609         AX: [ATK] object:state-changed notifications missing for multiple ARIA attributes
2610         https://bugs.webkit.org/show_bug.cgi?id=177542
2611
2612         Add new notification types to AXObjectCache in order to support the notifications
2613         needed, post the notifications to all platforms, emit the signals for ATK.
2614
2615         Reviewed by Chris Fleizach.
2616
2617         Tests: accessibility/gtk/aria-disabled-changed-notification.html
2618                accessibility/gtk/aria-expanded-changed-notification.html
2619                accessibility/gtk/aria-pressed-changed-notification.html
2620                accessibility/gtk/aria-readonly-changed-notification.html
2621                accessibility/gtk/aria-required-changed-notification.html
2622
2623         * accessibility/AXObjectCache.cpp:
2624         (WebCore::AXObjectCache::handleAttributeChanged):
2625         * accessibility/AXObjectCache.h:
2626         * accessibility/atk/AXObjectCacheAtk.cpp:
2627         (WebCore::AXObjectCache::postPlatformNotification):
2628
2629 2017-09-28  Daniel Bates  <dabates@apple.com>
2630
2631         Remove TextRun::setCharactersLength() and TextRun::charactersLength()
2632         https://bugs.webkit.org/show_bug.cgi?id=177620
2633
2634         Reviewed by Zalan Bujtas.
2635
2636         The purpose of TextRun::setCharactersLength() and TextRun::charactersLength() predate the
2637         use of WidthIterator to safely iterate over characters in a TextRun that may contain
2638         surrogate halves due to how it was created (without thought of surrogate pairs). Historically
2639         TextRun::charactersLength() complemented TextRun::length() and represented the length of the
2640         text to render ignoring and respecting truncation, respectively. We not longer need either
2641         of these member functions with the advent of WidthIterator.
2642
2643         No functionality changed. So, no new tests.
2644
2645         * platform/graphics/ComplexTextController.cpp:
2646         (WebCore::TextLayout::constructTextRun):
2647         * platform/graphics/TextRun.cpp: Remove one unsigned field from ExpectedTextRunSize as we
2648         reduced the size of TextRun with the removal of TextRun::m_charactersLength.
2649         * platform/graphics/TextRun.h:
2650         (WebCore::TextRun::TextRun):
2651         (WebCore::TextRun::charactersLength const): Deleted.
2652         (WebCore::TextRun::setCharactersLength): Deleted.
2653         * rendering/InlineTextBox.cpp:
2654         (WebCore::InlineTextBox::constructTextRun const):
2655         * rendering/InlineTextBox.h:
2656         (WebCore::InlineTextBox::constructTextRun): Deleted overload that took const RenderStyle& style
2657         and StringView.
2658         * rendering/RenderText.cpp:
2659         (WebCore::RenderText::widthFromCache const):
2660         (WebCore::maxWordFragmentWidth):
2661         (WebCore::RenderText::computePreferredLogicalWidths):
2662         (WebCore::RenderText::width const):
2663         * rendering/line/BreakingContext.h:
2664         (WebCore::textWidth):
2665         (WebCore::tryHyphenating):
2666         * rendering/svg/SVGInlineTextBox.cpp:
2667         (WebCore::SVGInlineTextBox::constructTextRun const):
2668         * rendering/svg/SVGTextMetrics.cpp:
2669         (WebCore::SVGTextMetrics::constructTextRun):
2670         * rendering/svg/SVGTextMetricsBuilder.cpp:
2671         (WebCore::SVGTextMetricsBuilder::currentCharacterStartsSurrogatePair const): Use TextRun::length().
2672         (WebCore::SVGTextMetricsBuilder::advance): Ditto.
2673
2674 2017-09-28  Tim Horton  <timothy_horton@apple.com>
2675
2676         Remove constant() in favor of env()
2677         https://bugs.webkit.org/show_bug.cgi?id=177581
2678         <rdar://problem/34701321>
2679
2680         Reviewed by Dean Jackson.
2681
2682         No new tests, removing a feature.
2683
2684         * css/CSSValueKeywords.in:
2685         * css/CSSVariableData.cpp:
2686         (WebCore::CSSVariableData::checkVariablesForCyclesWithRange const):
2687         (WebCore::CSSVariableData::resolveTokenRange const):
2688         * css/parser/CSSVariableParser.cpp:
2689         (WebCore::classifyBlock):
2690
2691 2017-09-28  Brent Fulgham  <bfulgham@apple.com>
2692
2693         Add ports 6679 and 6697 (IRC SSL) to port blacklist
2694         https://bugs.webkit.org/show_bug.cgi?id=177544
2695         <rdar://problem/34666525>
2696
2697         Reviewed by Alex Christensen.
2698
2699         Test: security/block-test.html
2700
2701         * platform/URL.cpp:
2702         (WebCore::portAllowed): Also block port 6679.
2703
2704 2017-09-28  Chris Dumez  <cdumez@apple.com>
2705
2706         Unreviewed, speculative Windows build fix after r222613.
2707
2708         * dom/StringCallback.idl:
2709
2710 2017-09-28  Zalan Bujtas  <zalan@apple.com>
2711
2712         Small cleanup in RenderMenuList::didUpdateActiveOption
2713         https://bugs.webkit.org/show_bug.cgi?id=177610
2714
2715         Reviewed by Dean Jackson.
2716
2717         No change in functionality.
2718
2719         * rendering/RenderMenuList.cpp:
2720         (WebCore::RenderMenuList::RenderMenuList):
2721         (RenderMenuList::didUpdateActiveOption):
2722         * rendering/RenderMenuList.h:
2723
2724 2017-09-28  Ross Kirsling  <ross.kirsling@sony.com>
2725
2726         [PAL] Move HysteresisActivity into PAL
2727         https://bugs.webkit.org/show_bug.cgi?id=177516
2728
2729         Reviewed by Alex Christensen.
2730
2731         * WebCore.xcodeproj/project.pbxproj:
2732         * platform/UserActivity.cpp:
2733         (WebCore::UserActivity::UserActivity):
2734         (WebCore::UserActivity::hysteresisUpdated):
2735         * platform/UserActivity.h:
2736         * platform/graphics/cairo/BackingStoreBackendCairoImpl.cpp:
2737         (WebCore::BackingStoreBackendCairoImpl::BackingStoreBackendCairoImpl):
2738         * platform/graphics/cairo/BackingStoreBackendCairoImpl.h:
2739         * platform/ios/WebSQLiteDatabaseTrackerClient.h:
2740         * platform/ios/WebSQLiteDatabaseTrackerClient.mm:
2741         (WebCore::WebSQLiteDatabaseTrackerClient::WebSQLiteDatabaseTrackerClient):
2742         (WebCore::WebSQLiteDatabaseTrackerClient::hysteresisUpdated):
2743
2744 2017-09-28  Chris Dumez  <cdumez@apple.com>
2745
2746         Add support for <link rel=preconnect>
2747         https://bugs.webkit.org/show_bug.cgi?id=177474
2748         <rdar://problem/33141380>
2749
2750         Reviewed by Alex Christensen.
2751
2752         Add support for <link rel=preconnect>:
2753         - https://w3c.github.io/resource-hints/#preconnect
2754
2755         It is currently only enabled for WK2 on MacOS High Sierra+
2756         and iOS 11+.
2757
2758         Tests: fast/dom/HTMLLinkElement/preconnect-support.html
2759                http/tests/preconnect/link-rel-preconnect-http.html
2760                http/tests/preconnect/link-rel-preconnect-https.html
2761
2762         * bindings/js/JSDOMExceptionHandling.h:
2763         * bindings/scripts/CodeGeneratorJS.pm:
2764         (GenerateCallbackHeaderContent):
2765         * bindings/scripts/IDLAttributes.json:
2766         * dom/Document.cpp:
2767         (WebCore::Document::addConsoleMessage):
2768         (WebCore::Document::setConsoleMessageListener):
2769         * dom/Document.h:
2770         * dom/StringCallback.idl:
2771         * html/DOMTokenList.cpp:
2772         (WebCore::DOMTokenList::DOMTokenList):
2773         (WebCore::DOMTokenList::supports):
2774         * html/DOMTokenList.h:
2775         (WebCore::DOMTokenList::DOMTokenList):
2776         * html/HTMLAnchorElement.cpp:
2777         (WebCore::HTMLAnchorElement::relList):
2778         * html/HTMLIFrameElement.cpp:
2779         (WebCore::HTMLIFrameElement::sandbox):
2780         * html/HTMLLinkElement.cpp:
2781         (WebCore::HTMLLinkElement::parseAttribute):
2782         (WebCore::HTMLLinkElement::relList):
2783         * html/LinkRelAttribute.cpp:
2784         (WebCore::LinkRelAttribute::LinkRelAttribute):
2785         (WebCore::LinkRelAttribute::isSupported):
2786         * html/LinkRelAttribute.h:
2787         * html/parser/HTMLPreloadScanner.cpp:
2788         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
2789         * loader/LinkLoader.cpp:
2790         (WebCore::LinkLoader::loadLinksFromHeader):
2791         (WebCore::LinkLoader::loadLink):
2792         * loader/LoaderStrategy.h:
2793         * page/Settings.in:
2794         * testing/Internals.cpp:
2795         (WebCore::Internals::Internals):
2796         (WebCore::Internals::setConsoleMessageListener):
2797         * testing/Internals.h:
2798         * testing/Internals.idl:
2799
2800 2017-09-28  Zalan Bujtas  <zalan@apple.com>
2801
2802         AX: Defer RenderListBox selectionChanged event until after layout is done.
2803         https://bugs.webkit.org/show_bug.cgi?id=177589
2804         <rdar://problem/34705785>
2805
2806         Reviewed by Chris Fleizach.
2807
2808         Defer AX update when the selection changed event is followed by a layout.
2809
2810         Covered by existing tests.
2811
2812         * accessibility/AXObjectCache.cpp:
2813         (WebCore::AXObjectCache::remove):
2814         (WebCore::AXObjectCache::performDeferredCacheUpdate):
2815         (WebCore::AXObjectCache::deferSelectedChildrenChangedIfNeeded):
2816         * accessibility/AXObjectCache.h:
2817         (WebCore::AXObjectCache::deferSelectedChildrenChangedIfNeeded):
2818         * rendering/RenderListBox.cpp:
2819         (WebCore::RenderListBox::selectionChanged):
2820
2821 2017-09-28  Zan Dobersek  <zdobersek@igalia.com>
2822
2823         [Cairo] Remove the cairo_glyph_t complexity from GlyphBuffer
2824         https://bugs.webkit.org/show_bug.cgi?id=177598
2825
2826         Reviewed by Carlos Garcia Campos.
2827
2828         Remove the decade-old use of cairo_glyph_t as the underlying type for
2829         Glyph. The former spans 24 bytes in size, while the latte is just 2
2830         bytes. The x and y coordinate attributes of cairo_glyph_t were only
2831         used in FontCascade::drawGlyphs() implementation, where they were
2832         overridden even if the same GlyphBuffer object was used here repeatedly.
2833
2834         FontCascade::drawGlyphs() now creates a new Vector<cairo_glyph_t> object
2835         and fills it only with the glyph index and coordinates data for glyphs
2836         that will actually be drawn. This will likely in the future be leveraged
2837         to pack the necessary data and perform the drawing operations in
2838         parallelized tasks. GlyphBuffer usages that before required USE(CAIRO)
2839         special-casing can now be simplified.
2840
2841         This also removes the need for <cairo.h> header inclusion in the
2842         GlyphBuffer.h header. This further removes Cairo header inclusion in
2843         roughly 600 build targets.
2844
2845         No new tests -- no change in behavior.
2846
2847         * platform/graphics/FontCascade.cpp:
2848         (WebCore::FontCascade::widthForSimpleText const):
2849         * platform/graphics/GlyphBuffer.h:
2850         (WebCore::GlyphBuffer::glyphAt const):
2851         (WebCore::GlyphBuffer::add):
2852         * platform/graphics/cairo/FontCairo.cpp:
2853         (WebCore::drawGlyphsToContext):
2854         (WebCore::drawGlyphsShadow):
2855         (WebCore::FontCascade::drawGlyphs):
2856         * platform/graphics/displaylists/DisplayListItems.cpp:
2857         (WebCore::DisplayList::DrawGlyphs::generateGlyphBuffer const):
2858
2859 2017-09-28  Wenson Hsieh  <wenson_hsieh@apple.com>
2860
2861         Unreviewed, rolling out r222606.
2862
2863         The debug assertion hit in these API tests should be fixed by
2864         r222608.
2865
2866         Reverted changeset:
2867
2868         "REGRESSION(r222595): Assertion failure in
2869         _preLoadedDataConformingToType"
2870         https://bugs.webkit.org/show_bug.cgi?id=177599
2871         http://trac.webkit.org/changeset/222606
2872
2873 2017-09-28  Wenson Hsieh  <wenson_hsieh@apple.com>
2874
2875         [iOS WK2] DataTransfer DataInteractionTests debug assert under -_preLoadedDataConformingToType:forItemProviderAtIndex:
2876         https://bugs.webkit.org/show_bug.cgi?id=177594
2877
2878         Reviewed by Tim Horton.
2879
2880         Currently, some API tests added in r222595 currently hit debug assertions under -preloadedDataConformingToType:
2881         forItemProviderAtIndex:. This is because the page may call DataTransfer.types, which now calls into
2882         PlatformPasteboard::typesSafeForDOMToReadAndWrite(). This calls on the AbstractPasteboard (either the
2883         UIPasteboard or WebItemProviderPasteboard, in the case of drag and drop) to fetch the custom WebKit pasteboard
2884         data blob, if it exists. For WebItemProviderPasteboard, this ends up calling into -[WebItemProviderPasteboard
2885         _preLoadedDataConformingToType:forItemProviderAtIndex:], which was previously only called after loading data off
2886         of the item providers. There's an existing sanity check in this preloaded data helper to make sure that the
2887         number of load results is equal to the number of item providers loaded from, but this sanity check only makes
2888         sense *after* the drop has happened, not before, since we should only attempt to read dropped data after any
2889         data at all has been dropped.
2890
2891         We need to check whether or not this custom data blob exists in PlatformPasteboard::typesSafeForDOMToReadAndWrite
2892         to fetch the list of DOM-exposed types to propagate back to the page. So to fix this, we make the helper methods
2893         for fetching dropped data (-dataForPasteboardType:inItemSet: and -valuesForPasteboardType:inItemSet:) fail
2894         gracefully when invoked prior to drop, when PlatformPasteboard::typesSafeForDOMToReadAndWrite is invoked.
2895
2896         No new tests; fixes iOS drag and drop API tests that currently hit this debug assertion.
2897
2898         * platform/ios/WebItemProviderPasteboard.mm:
2899         (-[WebItemProviderPasteboard dataForPasteboardType:inItemSet:]):
2900         (-[WebItemProviderPasteboard valuesForPasteboardType:inItemSet:]):
2901
2902 2017-09-28  Ryosuke Niwa  <rniwa@webkit.org>
2903
2904         REGRESSION(r222595): Assertion failure in _preLoadedDataConformingToType
2905         https://bugs.webkit.org/show_bug.cgi?id=177599
2906
2907         Temporarily remove the debug assertion to make API tests not crash since the relevant API tests are passing.
2908
2909         * platform/ios/WebItemProviderPasteboard.mm:
2910         (-[WebItemProviderPasteboard _preLoadedDataConformingToType:forItemProviderAtIndex:]):
2911
2912 2017-09-27  Fujii Hironori  <Hironori.Fujii@sony.com>
2913
2914         [REGRESSION] word-spacing property is incorrectly applied
2915         https://bugs.webkit.org/show_bug.cgi?id=142086
2916         <rdar://problem/19985240>
2917
2918         Reviewed by Zalan Bujtas.
2919
2920         word-spacing property isn't applied to text nodes with starting
2921         with '\n' if the kerning enabled. In Bug 165796, only ' ' and '\t'
2922         are treated for word-spacing, but '\n'. It should be treated as
2923         well.
2924
2925         Test: fast/text/word-space-between-inlines.html
2926
2927         * rendering/RenderBlockLineLayout.cpp:
2928         (WebCore::setLogicalWidthForTextRun): Use
2929         FontCascade::treatAsSpace() instead of checking explicitly by
2930         comparing with ' ' and '\t'.
2931
2932 2017-09-27  Zan Dobersek  <zdobersek@igalia.com>
2933
2934         [Cairo] Remove unnecessary cairo.h includes
2935         https://bugs.webkit.org/show_bug.cgi?id=177540
2936
2937         Reviewed by Carlos Garcia Campos.
2938
2939         Drop unnecessary includes of the cairo.h header from the Font.h,
2940         FontPlatformData.h and Pattern.h headers. For the former two the
2941         header isn't required, while in the last one we can use a forward
2942         declaration for the cairo_pattern_t type instead of including
2943         the whole Cairo headers to have that available.
2944
2945         * platform/graphics/Font.h:
2946         * platform/graphics/FontPlatformData.h:
2947         * platform/graphics/Pattern.h:
2948
2949 2017-09-27  Zan Dobersek  <zdobersek@igalia.com>
2950
2951         [Cairo] Drop cairo_matrix_t conversion operators for AffineTransform, TransformationMatrix
2952         https://bugs.webkit.org/show_bug.cgi?id=177539
2953
2954         Reviewed by Carlos Garcia Campos.
2955
2956         Remove the cairo_matrix_t conversion operators from the AffineTransform
2957         and TransformationMatrix classes. These are rarely used, but enforce
2958         including the cairo.h header in both headers, which leads to the Cairo
2959         headers being included in around 800 build targets.
2960
2961         Instead, the toCairoMatrix() function is added to CairoUtilities.h that
2962         creates a cairo_matrix_t object for the given AffineTransform. No
2963         toCairoMatrix() is needed for TransformationMatrix since objects of
2964         that type aren't converted to cairo_matrix_t anywhere in the codebase.
2965
2966         This patch excludes unnecessary Cairo headers from about 550 build
2967         targets (with those headers being included in the other affected 250
2968         targets by some other header inclusion chain). CairoUtilities.h header
2969         is now included where necessary to make toCairoMatrix() available, and
2970         duplicated cairo.h inclusions are removed.
2971
2972         No new tests -- no change in behavior.
2973
2974         * editing/gtk/EditorGtk.cpp: Explicitly include <cairo.h> since it's
2975         necessary for Cairo operations used there.
2976         * platform/Cairo.cmake:
2977         * platform/graphics/cairo/CairoUtilities.cpp:
2978         (WebCore::drawPatternToCairoContext):
2979         (WebCore::toCairoMatrix):
2980         * platform/graphics/cairo/CairoUtilities.h:
2981         * platform/graphics/cairo/GradientCairo.cpp:
2982         (WebCore::Gradient::platformGradient):
2983         (WebCore::Gradient::setPlatformGradientSpaceTransform):
2984         * platform/graphics/cairo/GraphicsContextCairo.cpp:
2985         (WebCore::GraphicsContext::concatCTM):
2986         (WebCore::GraphicsContext::setCTM):
2987         * platform/graphics/cairo/PathCairo.cpp: No need to include AffineTransform.h.
2988         (WebCore::Path::addPath):
2989         (WebCore::Path::transform):
2990         * platform/graphics/cairo/PatternCairo.cpp: Ditto.
2991         (WebCore::Pattern::createPlatformPattern const):
2992         * platform/graphics/cairo/TransformationMatrixCairo.cpp: Removed.
2993         * platform/graphics/transforms/AffineTransform.h:
2994         * platform/graphics/transforms/TransformationMatrix.h:
2995
2996 2017-09-27  Alex Christensen  <achristensen@webkit.org>
2997
2998         Add WKContentRuleList notify action type
2999         https://bugs.webkit.org/show_bug.cgi?id=177013
3000         <rdar://problem/31073936>
3001
3002         Reviewed by Darin Adler.
3003
3004         Covered by new API tests.
3005
3006         * contentextensions/ContentExtensionActions.h:
3007         (WebCore::ContentExtensions::hasStringArgument):
3008         * contentextensions/ContentExtensionCompiler.cpp:
3009         (WebCore::ContentExtensions::resolvePendingDisplayNoneActions):
3010         (WebCore::ContentExtensions::serializeActions):
3011         * contentextensions/ContentExtensionError.cpp:
3012         (WebCore::ContentExtensions::contentExtensionErrorCategory):
3013         * contentextensions/ContentExtensionError.h:
3014         * contentextensions/ContentExtensionParser.cpp:
3015         (WebCore::ContentExtensions::loadAction):
3016         * contentextensions/ContentExtensionRule.cpp:
3017         (WebCore::ContentExtensions::Action::deserialize):
3018         (WebCore::ContentExtensions::Action::deserializeType):
3019         (WebCore::ContentExtensions::Action::serializedLength):
3020         * contentextensions/ContentExtensionRule.h:
3021         (WebCore::ContentExtensions::Action::Action):
3022         * contentextensions/ContentExtensionsBackend.cpp:
3023         (WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForLoad):
3024         (WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForPingLoad):
3025         (WebCore::ContentExtensions::applyBlockedStatusToRequest):
3026         * loader/FrameLoader.cpp:
3027         (WebCore::FrameLoader::loadResourceSynchronously):
3028         * loader/PingLoader.cpp:
3029         (WebCore::processContentExtensionRulesForLoad):
3030         * loader/ResourceLoader.cpp:
3031         (WebCore::ResourceLoader::willSendRequestInternal):
3032         * loader/cache/CachedResourceLoader.cpp:
3033         (WebCore::CachedResourceLoader::requestResource):
3034         * loader/cache/CachedResourceRequest.cpp:
3035         (WebCore::CachedResourceRequest::applyBlockedStatus):
3036         * loader/cache/CachedResourceRequest.h:
3037         * page/ChromeClient.h:
3038
3039 2017-09-27  Wenson Hsieh  <wenson_hsieh@apple.com>
3040
3041         Unreviewed, fix the internal build after r222596 and r222595.
3042
3043         Guarding code in PlatformPasteboardIOS.mm TARGET_OS_IPHONE did not have the intended effect.
3044
3045         * platform/ios/PlatformPasteboardIOS.mm:
3046         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const):
3047         (WebCore::PlatformPasteboard::write):
3048
3049 2017-09-27  Wenson Hsieh  <wenson_hsieh@apple.com>
3050
3051         Unreviewed, fix the internal build after r222595.
3052
3053         Add missing iOS compiler guards.
3054
3055         * platform/ios/PlatformPasteboardIOS.mm:
3056         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const):
3057         (WebCore::PlatformPasteboard::write):
3058
3059 2017-09-27  Wenson Hsieh  <wenson_hsieh@apple.com>
3060
3061         Drag event DataTransfer has unexpected types "dyn.ah62d4..."
3062         https://bugs.webkit.org/show_bug.cgi?id=172526
3063         <rdar://problem/32396081>
3064
3065         Reviewed by Ryosuke Niwa.
3066
3067         Currently, the pasteboard types we expose to web content are simply the types that appear on the platform
3068         pasteboard (i.e. the general NSPasteboard on Mac, and either the general UIPasteboard or a UIDragSession's
3069         NSItemProviders on iOS). This leads to DataTransfer.types exposing many private pasteboard types written by apps
3070         around the system to the page, such as dynamic UTIs, CorePasteboardFlavorTypes, or the "Apple WebKit dummy
3071         pasteboard type". These are not only confusing and not useful for web content (since they mostly hold values of
3072         empty string anyways), but can additionally pose privacy concerns by exposing information meant only for native
3073         applications to unvetted web content.
3074
3075         To address this problem, other browsers (e.g. Chrome and Firefox on Mac) white-list MIME types in DataTransfer's
3076         list of types. By default, when dragging or copying, these are "text/plain", "text/html" and "text/uri-list".
3077         However, this policy alone is insufficient, because the page may also supply its own types, in which case our
3078         naive whitelist would prevent us from delivering them to the page. To address this additional constraint, both
3079         Chrome and Firefox write any custom data supplied by the page to custom pasteboard UTIs
3080         (org.chromium.drag-dummy-type and org.mozilla.custom-clipdata, respectively). The corresponding data is a map
3081         of custom UTI => custom data supplied by the page; upon drop or paste, this mapping is consulted if the page
3082         calls getData() with a custom UTI.
3083
3084         This patch adopts this same approach in WebKit, and introduces the com.apple.WebKit.custom-pasteboard-data UTI
3085         (refer to per-method comments below for more information). These changes are covered by 18 new layout and API
3086         tests, as well as existing drag-and-drop tests.
3087
3088         Tests: editing/pasteboard/data-transfer-get-data-on-drop-custom.html
3089                editing/pasteboard/data-transfer-get-data-on-drop-plain-text.html
3090                editing/pasteboard/data-transfer-get-data-on-drop-rich-text.html
3091                editing/pasteboard/data-transfer-get-data-on-drop-url.html
3092                editing/pasteboard/data-transfer-get-data-on-paste-custom.html
3093                editing/pasteboard/data-transfer-get-data-on-paste-plain-text.html
3094                editing/pasteboard/data-transfer-get-data-on-paste-rich-text.html
3095                DataInteractionTests.DataTransferGetDataWhenDroppingPlainText
3096                DataInteractionTests.DataTransferGetDataWhenDroppingCustomData
3097                DataInteractionTests.DataTransferGetDataWhenDroppingURL
3098                DataInteractionTests.DataTransferGetDataWhenDroppingImageWithFileURL
3099                DataInteractionTests.DataTransferGetDataWhenDroppingRespectsPresentationStyle
3100                DataInteractionTests.DataTransferSetDataCannotWritePlatformTypes
3101                DataInteractionTests.DataTransferGetDataCannotReadPrivatePlatformTypes
3102                UIPasteboardTests.DataTransferGetDataWhenPastingURL
3103                UIPasteboardTests.DataTransferGetDataWhenPastingPlatformRepresentations
3104                UIPasteboardTests.DataTransferSetDataCannotWritePlatformTypes
3105                UIPasteboardTests.DataTransferGetDataCannotReadPrivatePlatformTypes
3106
3107         * CMakeLists.txt:
3108
3109         Add Pasteboard.cpp to the WebCore CMakeList.
3110
3111         * WebCore.xcodeproj/project.pbxproj:
3112         * dom/DataTransfer.cpp:
3113         (WebCore::DataTransfer::getData const):
3114         (WebCore::DataTransfer::createForDragStartEvent):
3115
3116         Make a new static helper function to create a StaticPasteboard-backed DataTransfer when dispatching a dragstart
3117         event. Any data supplied by the page will be written to the static pasteboard of this DataTransfer.
3118
3119         (WebCore::DataTransfer::moveDragState):
3120
3121         Add a new helper on DataTransfer to transfer the data required to initiate a drag from one DataTransfer to
3122         another. This is used in EventHandler to transfer the contents of the temporary DataTransfer modified by the
3123         page during the dragstart event over to the DataTransfer used for the rest of the drag initiation codepath,
3124         which is actually connected to the platform. This includes committing the contents of the other
3125         DataTransfer's StaticPasteboard to the new platform-connected Pasteboard.
3126
3127         (WebCore::DataTransfer::hasDragImage const):
3128         * dom/DataTransfer.h:
3129         * editing/cocoa/EditorCocoa.mm:
3130         (WebCore::Editor::selectionInHTMLFormat):
3131         (WebCore::Editor::writeSelectionToPasteboard):
3132         (WebCore::Editor::writeSelection):
3133
3134         Write an additional HTML markup string on iOS. We already do this for Mac, but this data previously had no use
3135         on iOS. This is needed for to vend the "text/html" representation to the page on iOS when pasting.
3136
3137         * editing/mac/EditorMac.mm:
3138         (WebCore::Editor::selectionInHTMLFormat): Deleted.
3139         * editing/wpe/EditorWPE.cpp:
3140         (WebCore::createFragmentFromPasteboardData):
3141         * page/EventHandler.cpp:
3142         (WebCore::EventHandler::dispatchDragStartEventOnSourceElement):
3143
3144         Renamed from dispatchDragStartEvent to dispatchDragStartEventOnSourceElement. Additionally, simplified the logic
3145         significantly, so that we now just check to see if the StaticPasteboard exposed to the page has any data,
3146         instead of using platform-dependent logic to compare changeCounts. We can do this because StaticPasteboard is
3147         guaranteed to only contain content that the page has supplied during the dragstart event, since it is empty
3148         upon initialization and cannot be written to by the rest of the platform.
3149
3150         (WebCore::EventHandler::handleDrag):
3151
3152         Tweak dispatchDragStartEvent to take a DataTransfer to expose to bindings; at the call site in handleDrag,
3153         create a new DataTransfer backed by a StaticPasteboard that the page may mutate over the course of the dragstart
3154         event. After dispatching to the page, move the dragging information present on the drag start DataTransfer over
3155         to the DragState's DataTransfer. If the drag image has not been set, compute and set the default drag image
3156         element on the DragState's DataTransfer.
3157
3158         (WebCore::EventHandler::dispatchDragStartEvent): Deleted.
3159         * page/EventHandler.h:
3160         * page/Settings.cpp:
3161         (WebCore::Settings::customPasteboardDataEnabled):
3162         * page/Settings.h:
3163         (WebCore::Settings::setCustomPasteboardDataEnabled):
3164         * page/ios/EventHandlerIOS.mm:
3165         (WebCore::EventHandler::createDraggingDataTransfer const): Deleted.
3166         * page/mac/EventHandlerMac.mm:
3167         (WebCore::EventHandler::createDraggingDataTransfer const): Deleted.
3168         * page/win/EventHandlerWin.cpp:
3169         (WebCore::EventHandler::createDraggingDataTransfer const): Deleted.
3170
3171         Remove this helper on both iOS and Mac. This only called createForDrag() before, with the addition of clearing
3172         the platform pasteboard prior to returning. Now that a StaticPasteboard is used when starting a drag, we clear
3173         out the platform pasteboard in platform-invariant code in EventHandler::handleDrag, so these helpers are no
3174         longer useful.
3175
3176         * platform/Pasteboard.cpp: Added.
3177         (WebCore::isSafeTypeForDOMToReadAndWrite):
3178
3179         Add a new helper to determine whether or not a pasteboard type is one of the standard DOM-exposed types. These
3180         are "text/plain", "text/html" and "text/uri-list".
3181
3182         (WebCore::sharedBufferFromCustomData):
3183         (WebCore::customDataFromSharedBuffer):
3184
3185         Add helper methods to serialize and deserialize custom data. The serialized data blob consists of: (1)
3186         versioning information, (2) a dictionary mapping each custom type to a value, and (3) a full list of types
3187         written by the page, in the order they were written.
3188
3189         * platform/Pasteboard.h:
3190
3191         Rename Pasteboard::readString to Pasteboard::readStringForBindings, to reflect that the string being read and
3192         the given type are exposed to and from the DOM.
3193
3194         * platform/PasteboardStrategy.h:
3195         * platform/PasteboardWriterData.h:
3196         * platform/PlatformPasteboard.h:
3197         * platform/StaticPasteboard.cpp:
3198
3199         Split m_stringContents out into m_platformData and m_customData. The former contains type-to-data entries for
3200         the DOM-exposed types, while the second contains entries that don't belong in the former.
3201
3202         (WebCore::StaticPasteboard::hasData):
3203         (WebCore::StaticPasteboard::readStringForBindings):
3204         (WebCore::StaticPasteboard::writeString):
3205         (WebCore::StaticPasteboard::clear):
3206         (WebCore::StaticPasteboard::commitToPasteboard):
3207
3208         Rather than propagate each entry to the client layer one at a time, populate a new PasteboardCustomData struct
3209         and send it to the client layer in one go. This new struct consists of an array of types in the order they were
3210         written by the page, a dictionary of public types (types we want to write directly to the platform pasteboard)
3211         and private types (custom types we want to package under our custom data blob).
3212
3213         (WebCore::StaticPasteboard::readString): Deleted.
3214         * platform/StaticPasteboard.h:
3215         * platform/glib/EventHandlerGLib.cpp:
3216         (WebCore::EventHandler::createDraggingDataTransfer const): Deleted.
3217         * platform/gtk/PasteboardGtk.cpp:
3218         (WebCore::Pasteboard::readStringForBindings):
3219         (WebCore::Pasteboard::writeCustomData):
3220         (WebCore::Pasteboard::readString): Deleted.
3221         * platform/gtk/PlatformPasteboardGtk.cpp:
3222         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const):
3223         (WebCore::PlatformPasteboard::write):
3224
3225         Add stub implementations for new custom pasteboard data methods.
3226
3227         * platform/ios/AbstractPasteboard.h:
3228         * platform/ios/PasteboardIOS.mm:
3229         (WebCore::Pasteboard::writeCustomData):
3230
3231         Add new plumbing to ship a custom data (PasteboardCustomData) struct from WebCore to the client layer.
3232
3233         (WebCore::cocoaTypeFromHTMLClipboardType):
3234         (WebCore::readPlatformValueAsString):
3235         (WebCore::Pasteboard::readStringForBindings):
3236         (WebCore::Pasteboard::types):
3237
3238         Rewritten to ask the client layer for DOM-exposed types rather than all types, in the case where custom
3239         pasteboard data is enabled in Settings.
3240
3241         (WebCore::Pasteboard::readString): Deleted.
3242         * platform/ios/PlatformPasteboardIOS.mm:
3243         (WebCore::PlatformPasteboard::bufferForType):
3244         (WebCore::PlatformPasteboard::getPathnamesForType const):
3245         (WebCore::PlatformPasteboard::numberOfFiles const):
3246         (WebCore::PlatformPasteboard::platformPasteboardTypeForSafeTypeForDOMToReadAndWrite):
3247
3248         Add a new helper to map DOM-safe pasteboard types to their platform counterparts.
3249
3250         (WebCore::PlatformPasteboard::write):
3251         (WebCore::safeTypeForDOMToReadAndWriteForPlatformType):
3252
3253         Add a new helper to map platform pasteboard types to their DOM-safe counterparts.
3254
3255         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const):
3256
3257         Fetch a list of DOM-exposed types. On iOS, for drag and drop, we have the additional constraint of not being
3258         able to read any data before the drop happens. This is problematic, since the page needs to know the list of
3259         types during 'dragover' events. To support this, we instead keep the array of types in the teamData property of
3260         the generated item provider, which is immediately available, even when dragging across different apps. Note that
3261         we still need to check if the pasteboard contains the full custom data blob here to handle the case where we
3262         copy on Mac and perform a continuity paste on iOS, since teamData does not exist on Mac.
3263
3264         (WebCore::PlatformPasteboard::readString):
3265
3266         Tweak to account for how UIPasteboard may return data blobs when reading values.
3267
3268         (WebCore::PlatformPasteboard::getPathnamesForType): Deleted.
3269         (WebCore::PlatformPasteboard::numberOfFiles): Deleted.
3270         * platform/ios/WebItemProviderPasteboard.h:
3271         * platform/ios/WebItemProviderPasteboard.mm:
3272         (-[WebItemProviderRegistrationInfoList itemProvider]):
3273         (+[WebItemProviderLoadResult loadResultWithItemProvider:typesToLoad:]):
3274         (-[WebItemProviderLoadResult initWithItemProvider:typesToLoad:]):
3275         (-[WebItemProviderLoadResult typesToLoad]):
3276         (-[WebItemProviderLoadResult setFileURL:forType:]):
3277         (-[WebItemProviderLoadResult itemProvider]):
3278         (-[WebItemProviderPasteboard setItemProviders:]):
3279         (-[WebItemProviderPasteboard dataForPasteboardType:]):
3280         (-[WebItemProviderPasteboard typeIdentifiersToLoadForRegisteredTypeIdentfiers:]):
3281         (-[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:synchronousTimeout:]):
3282         (+[WebItemProviderLoadResult emptyLoadResult]): Deleted.
3283         (+[WebItemProviderLoadResult loadResultWithFileURLMap:presentationStyle:]): Deleted.
3284         (-[WebItemProviderLoadResult initWithFileURLMap:presentationStyle:]): Deleted.
3285         (-[WebItemProviderPasteboard typeIdentifierToLoadForRegisteredTypeIdentfiers:]): Deleted.
3286
3287         In the case of drag and drop on iOS, we cannot load any data prior to performing the drop; additionally, any
3288         attempts to load data immediately after the drop is performed in the UI process will fail. This means any and
3289         all data that the web process may require in the future when handling the drop must be loaded out of the item
3290         providers and saved when the drop is being handled in the UI process.
3291
3292         Currently, we only load the highest fidelity type we can handle (or, if we don't know what we can handle, we
3293         select the highest fidelity representation conforming to "public.content"). This is a problematic for supporting
3294         DataTransfer.getData() on drop on iOS, because the page can ask for any of the three web-exposed types. To
3295         address this, we refactor WebItemProviderPasteboard to support loading multiple representations per item being
3296         dropped. At minimum, we will load anything conforming to "public.html", "public.plain-text", "public.url", and
3297         the new "com.apple.WebKit.custom-pasteboard-data" so we have means to answer any question that the page could
3298         ask via DataTransfer.getData(). We additonally load the highest fidelity supported (or content-conformant) type,
3299         if it has not already been loaded as a result of the former.
3300
3301         To make this possible, we refactor WebItemProviderLoadResult to take an item provider and a list of types to
3302         load. -doAfterLoadingProvidedContentIntoFileURLs:synchronousTimeout: then creates a list of load results and
3303         uses each one to represent the results of loading data from its item provider (i.e. a map of UTI => file URL).
3304
3305         * platform/mac/PasteboardMac.mm:
3306         (WebCore::Pasteboard::writeCustomData):
3307         (WebCore::cocoaTypeFromHTMLClipboardType):
3308         (WebCore::readPlatformValueAsString):
3309         (WebCore::Pasteboard::readStringForBindings):
3310
3311         Change readStringForBindings (formerly, readString) so that if support for custom pasteboard data is enabled,
3312         we only allow reading directly from the platform pasteboard if the given type is DOM-safe; otherwise, we consult
3313         the custom data blob, if it exists. Otherwise, if support for custom pasteboard data is disabled, we fall back
3314         to our current behavior.
3315
3316         (WebCore::Pasteboard::types):
3317         (WebCore::Pasteboard::readString): Deleted.
3318         * platform/mac/PlatformPasteboardMac.mm:
3319         (WebCore::PlatformPasteboard::numberOfFiles const):
3320         (WebCore::PlatformPasteboard::getPathnamesForType const):
3321         (WebCore::PlatformPasteboard::stringForType):
3322         (WebCore::safeTypeForDOMToReadAndWriteForPlatformType):
3323         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const):
3324
3325         Add support for reading DOM-exposed types and fetching DOM-exposed data off of the pasteboard. The overall idea
3326         here is similar to iOS, though implementation details vary (e.g. no item provider support).
3327
3328         (WebCore::PlatformPasteboard::write):
3329         (WebCore::PlatformPasteboard::platformPasteboardTypeForSafeTypeForDOMToReadAndWrite):
3330         (WebCore::PlatformPasteboard::numberOfFiles): Deleted.
3331         (WebCore::PlatformPasteboard::getPathnamesForType): Deleted.
3332         * platform/win/PasteboardWin.cpp:
3333         (WebCore::Pasteboard::readStringForBindings):
3334         (WebCore::Pasteboard::writeCustomData):
3335         (WebCore::Pasteboard::readString): Deleted.
3336         * platform/wpe/PasteboardWPE.cpp:
3337         (WebCore::Pasteboard::readStringForBindings):
3338         (WebCore::Pasteboard::writeCustomData):
3339         (WebCore::Pasteboard::readString): Deleted.
3340         * platform/wpe/PlatformPasteboardWPE.cpp:
3341         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const):
3342         (WebCore::PlatformPasteboard::write):
3343         * testing/InternalSettings.cpp:
3344         (WebCore::InternalSettings::Backup::Backup):
3345         (WebCore::InternalSettings::Backup::restoreTo):
3346         (WebCore::InternalSettings::setCustomPasteboardDataEnabled):
3347
3348         Add a new internal settings hook for layout tests to opt in to using custom pasteboard data. By default, custom
3349         pasteboard data is enabled only in Safari, or on applications linked on or after certain releases of iOS and
3350         macOS.
3351
3352         * testing/InternalSettings.h:
3353         * testing/InternalSettings.idl:
3354
3355 2017-09-27  Zalan Bujtas  <zalan@apple.com>
3356
3357         Deferred image size change makes image-load-on-delay.html flaky.
3358         https://bugs.webkit.org/show_bug.cgi?id=177520
3359         <rdar://problem/34674299>
3360
3361         Reviewed by Dean Jackson.
3362
3363         Only defer recomputeIsIgnored when the image change actually triggers layout. 
3364
3365         * accessibility/AXObjectCache.cpp:
3366         (WebCore::rendererNeedsDeferredUpdate):
3367         (WebCore::AXObjectCache::deferRecomputeIsIgnoredIfNeeded):
3368         (WebCore::AXObjectCache::deferTextChangedIfNeeded):
3369         * accessibility/AXObjectCache.h:
3370         (WebCore::AXObjectCache::deferRecomputeIsIgnoredIfNeeded):
3371         * rendering/RenderImage.cpp:
3372         (WebCore::RenderImage::imageChanged):
3373
3374 2017-09-27  Tim Horton  <timothy_horton@apple.com>
3375
3376         Try to fix the Mac CMake build
3377
3378         * PlatformMac.cmake:
3379
3380 2017-09-27  Myles C. Maxfield  <mmaxfield@apple.com>
3381
3382         Minimum font size may cause elements to have an infinite line-height
3383         https://bugs.webkit.org/show_bug.cgi?id=177573
3384         <rdar://problem/34573792>
3385
3386         Reviewed by Dan Bernstein.
3387
3388         When minimum font size is specified, we were trying to preserve the ratio of specified font-size
3389         and specified line-height in order to boost the computed font size proportionately to the font-size
3390         boost. However, this doesn't work when the specified font-size is 0, because the ratio between
3391         line-height and font-size is infinite.
3392
3393         The most straightforward solution is just to make small font-sizes opt out of the line-height
3394         adjustment because the result would be too big.
3395
3396         Test: fast/text/line-height-minimumFontSize-text-small-font-size.html