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