Simple line layout: Small tweaks to improve performance.
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-01-30  Zalan Bujtas  <zalan@apple.com>
2
3         Simple line layout: Small tweaks to improve performance.
4         https://bugs.webkit.org/show_bug.cgi?id=167611
5         <rdar://problem/30274294>
6
7         Reviewed by Simon Fraser.
8
9         This is ~10% progression on the attached test case (paragraphs with non-redundant content).
10         median: 102.08 runs/s -> median: 114.25 runs/s
11
12         * rendering/SimpleLineLayout.cpp:
13         (WebCore::SimpleLineLayout::LineState::appendFragmentAndCreateRunIfNeeded):
14         * rendering/SimpleLineLayoutFlowContents.cpp:
15         (WebCore::SimpleLineLayout::initializeSegments):
16         (WebCore::SimpleLineLayout::FlowContents::FlowContents):
17         * rendering/SimpleLineLayoutFlowContents.h:
18         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
19         (WebCore::SimpleLineLayout::TextFragmentIterator::nextNonWhitespacePosition):
20         (WebCore::SimpleLineLayout::TextFragmentIterator::skipToNextPosition):
21         * rendering/SimpleLineLayoutTextFragmentIterator.h:
22
23 2017-01-30  Chris Dumez  <cdumez@apple.com>
24
25         Drop legacy constants on Event interface
26         https://bugs.webkit.org/show_bug.cgi?id=167602
27
28         Reviewed by Sam Weinig.
29
30         Drop legacy constants on Event interface:
31         MOUSEDOWN, MOUSEUP, MOUSEOVER, MOUSEOUT, MOUSEMOVE, MOUSEDRAG,
32         CLICK, DBLCLICK, KEYDOWN, KEYUP, KEYPRESS, DRAGDROP, FOCUS,
33         BLUR, SELECT, and CHANGE.
34
35         Those constants are not used for anything, they are not in the
36         specification and Chrome / Firefox do not have them.
37
38         No new tests, rebaselined existing test.
39
40         * dom/Event.idl:
41
42 2017-01-30  Simon Fraser  <simon.fraser@apple.com>
43
44         [iOS] position:fixed inside touch-scrollable overflow is mispositioned
45         https://bugs.webkit.org/show_bug.cgi?id=167604
46         rdar://problem/29500273
47
48         Reviewed by Zalan Bujtas.
49         
50         For layers inside touch-scrollable overflow, RenderLayerBacking::computeParentGraphicsLayerRect() needs
51         to account for the offset from the ancestor compositing layer's origin, to handle scrollable elements with
52         box-shadow, for example.
53         
54         Also make the compositing log output a little easier to read.
55
56         Test: compositing/scrolling/fixed-inside-scroll.html
57
58         * rendering/RenderLayerBacking.cpp:
59         (WebCore::RenderLayerBacking::computeParentGraphicsLayerRect):
60         * rendering/RenderLayerCompositor.cpp:
61         (WebCore::RenderLayerCompositor::logLayerInfo):
62
63 2017-01-30  Jer Noble  <jer.noble@apple.com>
64
65         NULL-deref crash at PlatformMediaSession::endInterruption
66         https://bugs.webkit.org/show_bug.cgi?id=167595
67
68         Reviewed by Eric Carlson.
69
70         Use the same, NULL-aware forEachSession() iterator rather than iterating over m_sessions directly.
71
72         * platform/audio/PlatformMediaSessionManager.cpp:
73         (WebCore::PlatformMediaSessionManager::beginInterruption):
74         (WebCore::PlatformMediaSessionManager::endInterruption):
75
76 2017-01-30  Myles C. Maxfield  <mmaxfield@apple.com>
77
78         Correct spacing regression on inter-element complex path shaping on some fonts
79         https://bugs.webkit.org/show_bug.cgi?id=166013
80
81         Reviewed by Simon Fraser.
82
83         This patch brings the implementation of ComplexTextController in-line with the
84         design at https://trac.webkit.org/wiki/ComplexTextController. Previously,
85         ComplexTextController had a few problems:
86         - The total width computed by ComplexTextController didn't match the width if
87         you iterated over the entire string and added up the advances
88         - FontCascade::getGlyphsAndAdvancesForComplexText() tried to compensate for
89         the above by construing the concepts of paint advances as distinct from layout
90         advances
91         - Initial advances were considered part of layout sometimes and part of painting
92         other times, depending on which function reports the information
93         - For RTL runs, the wrong origin was added to the initial advance, and the origin
94         should have been subtracted instead of added
95
96         This patch exhaustively updates every function in ComplexTextController to be
97         consistent with the design linked to above. This design solves all of these
98         problems.
99
100         Tests: ComplexTextControllerTest.InitialAdvanceWithLeftRunInRTL
101                ComplexTextControllerTest.InitialAdvanceInRTL
102                ComplexTextControllerTest.InitialAdvanceWithLeftRunInLTR
103                ComplexTextControllerTest.InitialAdvanceInLTR
104                ComplexTextControllerTest.InitialAdvanceInRTLNoOrigins
105                ComplexTextControllerTest.LeadingExpansion
106                ComplexTextControllerTest.VerticalAdvances
107
108         * platform/graphics/GlyphBuffer.h:
109         (WebCore::GlyphBuffer::setLeadingExpansion): Deleted. No longer necessary.
110         (WebCore::GlyphBuffer::leadingExpansion): Deleted. Ditto.
111         * platform/graphics/cocoa/FontCascadeCocoa.mm:
112         (WebCore::FontCascade::adjustSelectionRectForComplexText): Removed use of
113         unnecessary leadingExpansion().
114         (WebCore::FontCascade::getGlyphsAndAdvancesForComplexText): This function needs
115         to compute paint advances, which means that it can't base this information off
116         of layout advances. This function uses the trick mentioned at the end of the
117         above link to compute the paint offset of an arbitrary glyph in the middle of
118         an RTL run.
119         * platform/graphics/mac/ComplexTextController.cpp:
120         (WebCore::ComplexTextController::computeExpansionOpportunity): Refactored for
121         testing.
122         (WebCore::ComplexTextController::ComplexTextController): Ditto.
123         (WebCore::ComplexTextController::finishConstruction): Ditto.
124         (WebCore::ComplexTextController::offsetForPosition): This function operates on
125         layout advances, and the initial layout advance is already added into the
126         m_adjustedBaseAdvances vector by adjustGlyphsAndAdvances(). Therefore, there is
127         no need to add it again here.
128         (WebCore::ComplexTextController::advance): This function had completely busted
129         logic about the relationship between initial advances and the first origin in
130         each run. Because of the fortunate choice of only representing layout advances 
131         in m_adjustedBaseAdvances, this entire block can be removed and the raw paint
132         initial advance can be reported to the GlyphBuffer. Later in the function, we
133         have to update the logic about how to compute a paint advance given a layout
134         advance and some origins. In particular, there are two tricky pieces here: 1.
135         The layout advance for the first glyph is equal to (initial advance - first
136         origin + first Core Text advance, so computing the paint offset must cancel out
137         the initial layout offset, and 2. the last paint advance in a run must actually
138         end up at the position of the first glyph in the next run, so the next run's
139         initial advance must be queried.
140         (WebCore::ComplexTextController::adjustGlyphsAndAdvances): Previously, we
141         represented an initial advance of a successive run by just adding it to the
142         previous run's last advance. However, this is incompatible with the new model
143         presented in the link above, so we remove this section. We also have to add in
144         the logic that the layout advance for the first glyph is equal to the formula
145         presented above.
146         * platform/graphics/mac/ComplexTextController.h:
147         (WebCore::ComplexTextController::ComplexTextRun::initialAdvance): Adjust comment
148         to reflect reality.
149         (WebCore::ComplexTextController::leadingExpansion): Deleted.
150
151 2017-01-30  Simon Fraser  <simon.fraser@apple.com>
152
153         Fixed elements should not rubber-band in WK2, nor remain at negative offsets
154         https://bugs.webkit.org/show_bug.cgi?id=167484
155         rdar://problem/29453068
156
157         Reviewed by Dean Jackson.
158
159         There were various problems with the layout rect computation:
160         1. It ignored the scrollBehaviorForFixedElements() which we use to avoid rubber-banding fixed
161            elements in WK2, but allow in WK1, so make use of that.
162         2. Sometimes layouts/paints of fixed elements would be triggered when coalesced calls to
163            AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll() failed to
164            copy the layoutViewportOrigin to the scheduled update.
165         3. The layout viewport could be left with a negative top/left after rubber-banding.
166         
167         Also add a way to do unconstrained scrollTo(), so that a test can call window.scrollTo(-10, -10) to
168         simulate rubberbanding.
169
170         Tests: fast/visual-viewport/rubberbanding-viewport-rects-header-footer.html
171                fast/visual-viewport/rubberbanding-viewport-rects.html
172
173         * page/FrameView.cpp:
174         (WebCore::FrameView::computeLayoutViewportOrigin): Handle ScrollBehaviorForFixedElements, incorporating it
175         into logic that clamps layoutViewportOrigin between min/max when rubberbanding is not allowed, or not in progress.
176         (WebCore::FrameView::updateLayoutViewport): Pass in scrollBehaviorForFixedElements().
177         (WebCore::FrameView::visibleDocumentRect): The clamping here was preventing the visible rect from
178         escaping the document bounds, which caused fixed elements to bounce with rubber-banding, so remove the clamping,
179         and fix the logic to allow rubber-banding while taking headers and footers into account.
180         * page/FrameView.h:
181         * page/scrolling/AsyncScrollingCoordinator.cpp:
182         (WebCore::AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll): layoutViewportOrigin has to
183         be pushed onto the scheduled update, just like scroll position.
184         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
185         (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition): Pass in m_behaviorForFixed.
186         * platform/ScrollView.cpp:
187         (WebCore::ScrollView::ScrollView):
188         (WebCore::ScrollView::adjustScrollPositionWithinRange):
189         (WebCore::ScrollView::setScrollOffset):
190         * platform/ScrollView.h:
191         (WebCore::ScrollView::setAllowsUnclampedScrollPositionForTesting):
192         (WebCore::ScrollView::allowsUnclampedScrollPosition):
193         * testing/InternalSettings.cpp:
194         (WebCore::InternalSettings::setAllowUnclampedScrollPosition):
195         * testing/InternalSettings.h:
196         * testing/InternalSettings.idl:
197
198 2017-01-30  Wenson Hsieh  <wenson_hsieh@apple.com>
199
200         Web content process crashes when initiating a drag on a very large image
201         https://bugs.webkit.org/show_bug.cgi?id=167564
202
203         Reviewed by Beth Dakin.
204
205         If we begin dragging an image element that is too large to show the cached image for, we will show an image file
206         icon instead of the cached image. This may return null if createDragImageIconForCachedImageFilename is
207         unimplemented, so in the meantime, we should not assume that dragImage will always exist before calling into
208         doSystemDrag in doImageDrag and bail from the drag operation if that is the case.
209
210         * page/DragController.cpp:
211         (WebCore::DragController::doImageDrag):
212
213 2017-01-30  Chris Dumez  <cdumez@apple.com>
214
215         Update DiagnosticLoggingClient::logDiagnosticMessageWithValue() to take in the value as a double
216         https://bugs.webkit.org/show_bug.cgi?id=167536
217
218         Reviewed by Darin Adler.
219
220         Update DiagnosticLoggingClient::logDiagnosticMessageWithValue() to take in the value as a double
221         instead of a string. The value needs to be numeric and the current API is error-prone.
222
223         * html/HTMLMediaElement.cpp:
224         (WebCore::HTMLMediaElement::mediaPlayerEngineFailedToLoad):
225         * loader/EmptyClients.cpp:
226         * page/DiagnosticLoggingClient.h:
227
228 2017-01-30  Ryan Haddad  <ryanhaddad@apple.com>
229
230         Unreviewed, rollout r211235 Pointer lock events should be delivered directly to the target element.
231
232         The LayoutTest for this change is frequently failing.
233
234         * page/EventHandler.cpp:
235         (WebCore::EventHandler::handleMousePressEvent):
236         (WebCore::EventHandler::handleMouseDoubleClickEvent):
237         (WebCore::EventHandler::handleMouseMoveEvent):
238         (WebCore::EventHandler::handleMouseReleaseEvent):
239         (WebCore::EventHandler::handleMouseForceEvent):
240         (WebCore::EventHandler::handleWheelEvent):
241         * page/PointerLockController.cpp:
242         (WebCore::PointerLockController::isLocked): Deleted.
243         (WebCore::PointerLockController::dispatchLockedWheelEvent): Deleted.
244         * page/PointerLockController.h:
245
246 2017-01-30  Antoine Quint  <graouts@apple.com>
247
248         LayoutTest media/modern-media-controls/media-controller/media-controller-auto-hide-mouse-leave-after-play.html is flaky
249         https://bugs.webkit.org/show_bug.cgi?id=167254
250         <rdar://problem/30259293>
251
252         Reviewed by Dean Jackson.
253
254         When we would identify that we need to prolong an existing auto-hide timer, when the previous
255         auto-hide timer was marked as non-cancelable, calling _cancelAutoHideTimer() would not actually
256         cancel the previous timer, which would let it fire and hide the controls bar. We now have two
257         methods, _cancelAutoHideTimer() which always cancels the current auto-hide timer, and
258         _cancelNonEnforcedAutoHideTimer() which is used from all other existing call sites, which only
259         cancels the current auto-hide timer if it was marked as cancelable. This, and revised timing in
260         the test itself, make media/modern-media-controls/media-controller/media-controller-auto-hide-
261         mouse-leave-after-play.html a lot more reliable.
262
263         We also make a small drive-by fix where we ensure the "autoHideDelay" property is set first so
264         that setting other members which may set a timer do not used an undefined value for the auto-hide
265         timer delay.
266
267         * Modules/modern-media-controls/controls/controls-bar.js:
268         (ControlsBar.prototype.set visible):
269         (ControlsBar.prototype.handleEvent):
270         (ControlsBar.prototype._cancelNonEnforcedAutoHideTimer):
271         (ControlsBar.prototype._cancelAutoHideTimer):
272
273 2017-01-30  Carlos Garcia Campos  <cgarcia@igalia.com>
274
275         REGRESSION(r202615?): [GStreamer] ASSERTION FAILED: isMainThread() in WebCore::BuiltinResourceHandleConstructorMap& WebCore::builtinResourceHandleConstructorMap()
276         https://bugs.webkit.org/show_bug.cgi?id=167003
277
278         Reviewed by Michael Catanzaro.
279
280         Add a way to create a ResourceHandle for a given SoupNetworkSession and use it in the GStreamer streaming client
281         to ensure both the session and the handle are created and destroyed in the secondary thread. This way we also
282         avoid using the default session for downloading HLS fragments.
283
284         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
285         (ResourceHandleStreamingClient::ResourceHandleStreamingClient): Create a SoupNetworkSession and pass it to ResourceHandle::create().
286         * platform/network/ResourceHandle.h: Add create and constructor to receive a SoupNetworkSession.
287         * platform/network/ResourceHandleInternal.h: Add SoupNetworkSession member.
288         * platform/network/soup/ResourceHandleSoup.cpp:
289         (WebCore::ResourceHandleInternal::soupSession): Return the SoupNetworkSession if not nullptr.
290         (WebCore::ResourceHandle::create): Create a ResourceHandle without trying to use any builtin constructor and
291         using the given SoupNetworkSession.
292         (WebCore::ResourceHandle::ResourceHandle): Set the SoupNetworkSession if early request validations didn't fail.
293
294 2017-01-30  Youenn Fablet  <youennf@gmail.com>
295
296         [WebRTC] Add support for libwebrtc data channel
297         https://bugs.webkit.org/show_bug.cgi?id=167489
298
299         Reviewed by Alex Christensen.
300
301         Partially covered by webrtc/datachannel/basic.html but not yet enabled on bots.
302
303         Introducing LibWebRTCDataChannelHandler as the integration layer between WebCore (RTCDataChannel)
304         and libwebrtc (DataChannelObserver).
305
306         * Modules/mediastream/RTCDataChannel.cpp:
307         (WebCore::RTCDataChannel::create):
308         (WebCore::RTCDataChannel::RTCDataChannel):
309         (WebCore::RTCDataChannel::bufferedAmount):
310         (WebCore::RTCDataChannel::bufferedAmountIsDecreasing):
311         * Modules/mediastream/RTCDataChannel.h:
312         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp: Added.
313         (WebCore::LibWebRTCDataChannelHandler::~LibWebRTCDataChannelHandler):
314         (WebCore::LibWebRTCDataChannelHandler::setClient):
315         (WebCore::LibWebRTCDataChannelHandler::sendStringData):
316         (WebCore::LibWebRTCDataChannelHandler::sendRawData):
317         (WebCore::LibWebRTCDataChannelHandler::close):
318         (WebCore::LibWebRTCDataChannelHandler::OnStateChange):
319         (WebCore::LibWebRTCDataChannelHandler::OnMessage):
320         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h:
321         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
322         (WebCore::LibWebRTCMediaEndpoint::OnRemoveStream):
323         (WebCore::LibWebRTCMediaEndpoint::addDataChannel):
324         (): Deleted.
325         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
326         (WebCore::LibWebRTCPeerConnectionBackend::createDataChannelHandler):
327         * dom/EventNames.h:
328         * platform/mediastream/RTCDataChannelHandler.h:
329         * platform/mediastream/RTCDataChannelHandlerClient.h:
330         * platform/mock/RTCDataChannelHandlerMock.h:
331
332 2017-01-30  Carlos Garcia Campos  <cgarcia@igalia.com>
333
334         Several web timing tests crash in GTK+ and AppleWin bots
335         https://bugs.webkit.org/show_bug.cgi?id=167577
336
337         Reviewed by Ryosuke Niwa.
338
339         The problem is that entry is used in both the key, to get name, and in the value with WTFMove. So, the name is
340         invalidated by the move. It could be fixed by simply copying the name, instead of using entry->name, but I think
341         that code could be simplified using HashMap::ensure and then we don't need any string copy, nor even the static
342         insertPerformanceEntry().
343
344         Fix crashes in several imported/w3c/web-platform-tests/user-timing/ tests.
345
346         * page/PerformanceUserTiming.cpp:
347         (WebCore::UserTiming::mark):
348         (WebCore::UserTiming::measure):
349         (WebCore::insertPerformanceEntry): Deleted.
350
351 2017-01-30  Carlos Garcia Campos  <cgarcia@igalia.com>
352
353         [Threaded Compositor] Crash in GraphicsContext3D::deleteTexture when destroying TextureMapperPlatformLayerProxy
354         https://bugs.webkit.org/show_bug.cgi?id=167575
355
356         Reviewed by Žan Doberšek.
357
358         We should clear all the buffers on invalidate to ensure we don't have textures alive after CoordinatedGraphicsScene::purgeGLResources().
359
360         Fix crash in media/video-poster-background.html.
361
362         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
363         (WebCore::TextureMapperPlatformLayerProxy::invalidate): Clear current, pending and all used buffers.
364
365 2017-01-29  Carlos Garcia Campos  <cgarcia@igalia.com>
366
367         [Threaded Compositor] Crash on WebCore::GLContext::version()
368         https://bugs.webkit.org/show_bug.cgi?id=167559
369
370         Reviewed by Michael Catanzaro.
371
372         Fixes crashes in several media tests.
373
374         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
375         (WebCore::TextureMapperPlatformLayerProxy::invalidate): Clear m_compositorThreadUpdateTimer and call the update function.
376
377 2017-01-29  Nan Wang  <n_wang@apple.com>
378
379         AX: WKContentView needs to implement UITextInput methods to make speak selection highlighting work
380         https://bugs.webkit.org/show_bug.cgi?id=166955
381
382         Reviewed by Ryosuke Niwa.
383
384         Created a new version of Range::collectSelectionRect() that returns rects for each
385         line, so that Speak Selection doesn't need to handle searching for soft line breaks.
386         Also added a variant of findPlainText to search for the closest matched range to the given position.
387
388         Test: editing/text-iterator/range-of-string-closest-to-position.html
389
390         * dom/Range.cpp:
391         (WebCore::Range::collectSelectionRectsWithoutUnionInteriorLines):
392         (WebCore::Range::collectSelectionRects):
393         * dom/Range.h:
394         * editing/TextIterator.cpp:
395         (WebCore::findPlainTextMatches):
396         (WebCore::updateSearchBuffer):
397         (WebCore::findIteratorOptions):
398         (WebCore::rangeMatches):
399         (WebCore::findClosestPlainText):
400         (WebCore::findPlainText):
401         (WebCore::findPlainTextOffset): Deleted.
402         * editing/TextIterator.h:
403         * editing/htmlediting.h:
404         * testing/Internals.cpp:
405         (WebCore::Internals::rangeOfStringNearLocation):
406         * testing/Internals.h:
407         * testing/Internals.idl:
408
409 2017-01-29  Andy Estes  <aestes@apple.com>
410
411         [QuickLook] Add a WebPreference to enable saving QuickLook documents in WebKitLegacy
412         https://bugs.webkit.org/show_bug.cgi?id=167563
413         <rdar://problem/30253207>
414
415         Reviewed by Andreas Kling.
416
417         * loader/ios/QuickLook.h: Removed unused declarations.
418         (WebCore::QuickLookHandle::firstRequestURL): Deleted.
419         * loader/ios/QuickLook.mm:
420         (WebCore::removeQLPreviewConverterForURL): Stopped deleting the temporary file here; that's
421         now done in QuickLookDocumentWriter.
422         (addQLPreviewConverterWithFileForURL): Changed from an exported function to a static
423         function since it's now only called inside QuickLook.mm.
424         (WebCore::QuickLookHandle::QuickLookHandle): Stopped initializing m_firstRequestURL.
425         (WebCore::addQLPreviewConverterWithFileForURL): Deleted.
426         (WebCore::qlPreviewConverterFileNameForURL): Deleted.
427         (WebCore::qlPreviewConverterUTIForURL): Deleted.
428         (WebCore::QuickLookHandle::previewRequestURL): Deleted.
429         (WebCore::QuickLookHandle::converter): Deleted.
430
431 2017-01-29  Zalan Bujtas  <zalan@apple.com>
432
433         Simple line layout: PerformanceTests/Layout/simple-line-layout-innertext.html regressed at r211108
434         https://bugs.webkit.org/show_bug.cgi?id=167562
435
436         Reviewed by Antti Koivisto.
437
438         Apparently RunResolver::Run::constructStringForHyphenIfNeeded() is in a superhot codepath.
439         The Run should not have any additional members anyway, so let's construct the hyphenated
440         string on demand.
441         Progression on simple-line-layout-innertext.html is from ~34runs/sec back to ~50runs/sec.
442
443         Covered by existing text.
444
445         * rendering/RenderTreeAsText.cpp:
446         (WebCore::writeSimpleLine):
447         * rendering/SimpleLineLayoutFunctions.cpp:
448         (WebCore::SimpleLineLayout::paintFlow):
449         * rendering/SimpleLineLayoutResolver.cpp:
450         (WebCore::SimpleLineLayout::RunResolver::Run::Run):
451         (WebCore::SimpleLineLayout::RunResolver::Run::textWithHyphen):
452         (WebCore::SimpleLineLayout::RunResolver::Run::text):
453         (WebCore::SimpleLineLayout::RunResolver::Run::constructStringForHyphenIfNeeded): Deleted.
454         * rendering/SimpleLineLayoutResolver.h:
455
456 2017-01-28  Tim Horton  <timothy_horton@apple.com>
457
458         Don't flash a tap highlight for the entirety of an editable WKWebView
459         https://bugs.webkit.org/show_bug.cgi?id=167486
460         <rdar://problem/30193996>
461
462         Reviewed by Dan Bernstein.
463
464         * dom/Document.h:
465         Export.
466
467 2017-01-28  Wenson Hsieh  <wenson_hsieh@apple.com>
468
469         Check USE(APPLE_INTERNAL_SDK) instead of specific headers when importing from WebKitAdditions
470         https://bugs.webkit.org/show_bug.cgi?id=167555
471
472         Reviewed by Dan Bernstein.
473
474         Instead of guarding #import <WebKitAdditions/*> on the existence of the imported file, consult
475         USE(APPLE_INTERNAL_SDK) instead.
476
477         * page/ios/EventHandlerIOS.mm:
478         * platform/ios/DragImageIOS.mm:
479         * platform/ios/PasteboardIOS.mm:
480         * platform/mac/DragDataMac.mm:
481
482 2017-01-28  Yoav Weiss  <yoav@yoav.ws>
483
484         Add Link Preload as an off-by-default experimental feature menu item.
485         https://bugs.webkit.org/show_bug.cgi?id=167201
486
487         Reviewed by Ryosuke Niwa.
488
489         Removed the explicit setting of the Link Preload experimental feature,
490         as it is now on by default for testing.
491
492         No new tests as this just removes methods from settings.
493
494         * testing/InternalSettings.cpp:
495         (WebCore::InternalSettings::Backup::Backup):
496         (WebCore::InternalSettings::Backup::restoreTo):
497         * testing/InternalSettings.h:
498         * testing/InternalSettings.idl:
499
500 2017-01-28  Joseph Pecoraro  <pecoraro@apple.com>
501
502         Fix typo in error message
503         https://bugs.webkit.org/show_bug.cgi?id=167554
504
505         Reviewed by Sam Weinig.
506
507         * bindings/scripts/CodeGenerator.pm:
508         (GetEnumByType):
509
510 2017-01-28  Antoine Quint  <graouts@apple.com>
511
512         [Modern Media Controls] REGRESSION: Video stops playing after going into Full Screen in media documents
513         https://bugs.webkit.org/show_bug.cgi?id=167552
514         <rdar://problem/29601646>
515
516         Reviewed by Eric Carlson.
517
518         In the case of media documents, there is a built-in behavior, implemented in MediaDocument::defaultEventHandler(),
519         that toggles playback when clicking or double-clicking the video. We disable this behavior by adding a "click" event
520         handler on the entire media shadow root and calling "preventDefault()".
521
522         Test: media/modern-media-controls/media-documents/click-on-video-should-not-pause.html
523
524         * Modules/modern-media-controls/media/media-controller.js:
525         (MediaController):
526         (MediaController.prototype.handleEvent):
527         (MediaController.prototype._containerWasClicked):
528
529 2017-01-28  Dan Bernstein  <mitz@apple.com>
530
531         [Xcode] Clean up PAL and WebCore’s build settings a little
532         https://bugs.webkit.org/show_bug.cgi?id=167292
533
534         Reviewed by Sam Weinig.
535
536         * Configurations/Base.xcconfig: Simplified the definition of
537           GCC_WARN_64_TO_32_BIT_CONVERSION, removed the unused build setting PREBINDING, removed
538           a duplicate definition of GCC_GENERATE_DEBUGGING_SYMBOLS, and removed definitions specific
539           to OS X versions that are no longer supported.
540
541         * Configurations/DebugRelease.xcconfig: Removed definitions specific to OS X versions
542           that are no longer supported.
543
544 2017-01-28  Zalan Bujtas  <zalan@apple.com>
545
546         Resolve beforeChild's render tree position before calling addChildIgnoringContinuation.
547         https://bugs.webkit.org/show_bug.cgi?id=167540
548         <rdar://problem/30126535>
549
550         Reviewed by Simon Fraser.
551
552         Use the actual render tree position for the beforeChild when inside a flow thread.
553
554         Test: fast/multicol/assert-on-continuation-with-spanner.html
555
556         * rendering/RenderBlockFlow.cpp:
557         (WebCore::RenderBlockFlow::addChild):
558         * rendering/RenderInline.cpp:
559         (WebCore::RenderInline::addChild):
560         * rendering/RenderMultiColumnFlowThread.cpp:
561         (WebCore::RenderMultiColumnFlowThread::resolveMovedChild):
562
563 2017-01-28  Andreas Kling  <akling@apple.com>
564
565         Avoid synchronous style recalc in dispatchUnloadEvents().
566         <https://webkit.org/b/167551>
567
568         Reviewed by Antti Koivisto.
569
570         It shouldn't be necessary to force a synchronous style resolution in an unloading document.
571         This call has been here since the import of KHTMLPart.
572
573         * loader/FrameLoader.cpp:
574         (WebCore::FrameLoader::dispatchUnloadEvents):
575
576 2017-01-28  Andreas Kling  <akling@apple.com>
577
578         REGRESSION(r196383): Automatic shrink-to-fit of RuleSet no longer works.
579         <https://webkit.org/b/167543>
580
581         Reviewed by Antti Koivisto.
582
583         Re-enable the automatic shrink-to-fit optimization in RuleSet.
584         This was disabled accidentally, which I discovered while investigating
585         the memory footprint of extension stylesheets.
586
587         * css/RuleSet.h:
588
589 2017-01-28  Antti Koivisto  <antti@apple.com>
590
591         Give scripts 'high' load priority
592         https://bugs.webkit.org/show_bug.cgi?id=167550
593
594         Reviewed by Andreas Kling.
595
596         For historical reasons it is currently 'medium', same as web fonts and some other non-parsing blocking things.
597
598         * loader/cache/CachedResource.cpp:
599         (WebCore::CachedResource::defaultPriorityForResourceType):
600
601 2017-01-28  Joseph Pecoraro  <pecoraro@apple.com>
602
603         Add User Timing Experimental Feature
604         https://bugs.webkit.org/show_bug.cgi?id=167542
605         <rdar://problem/22746307>
606
607         Reviewed by Ryosuke Niwa.
608
609         * page/RuntimeEnabledFeatures.h:
610         (WebCore::RuntimeEnabledFeatures::performanceTimelineEnabled):
611         * page/Performance.idl:
612         * page/PerformanceEntry.idl:
613         Make a better RuntimeEnabledFeature named "PerformanceTiming" which
614         is enabled if either UserTiming or ResourceTiming is enabled. This
615         will then expose the APIs that are only useful when at least one of
616         the APIs are available.
617
618         * page/PerformanceEntry.cpp:
619         (WebCore::PerformanceEntry::name): Deleted.
620         (WebCore::PerformanceEntry::entryType): Deleted.
621         (WebCore::PerformanceEntry::startTime): Deleted.
622         (WebCore::PerformanceEntry::duration): Deleted.
623         * page/PerformanceEntry.h:
624         (WebCore::PerformanceEntry::name):
625         (WebCore::PerformanceEntry::entryType):
626         (WebCore::PerformanceEntry::startTime):
627         (WebCore::PerformanceEntry::duration):
628         Inline simple accessors.
629
630         * page/PerformanceUserTiming.cpp:
631         (WebCore::UserTiming::measure):
632         Fix a bug introduced by ExceptionOr refactoring.
633
634         (WebCore::UserTiming::clearMarks):
635         (WebCore::UserTiming::clearMeasures):
636         (WebCore::clearPerformanceEntries):
637         (WebCore::clearPeformanceEntries): Deleted.
638         Fix method name typo.
639
640 2017-01-27  Dan Bernstein  <mitz@apple.com>
641
642         Ignore Xcode’s project.xcworkspace and userdata directories in this new project like we do
643         in other projects.
644
645         * PAL/PAL.xcodeproj: Added property svn:ignore.
646
647 2017-01-27  Andy Estes  <aestes@apple.com>
648
649         Fix the iOS build when USE(QUICK_LOOK) is disabled.
650
651         * testing/Internals.cpp:
652         (WebCore::Internals::setQuickLookPassword):
653         * testing/Internals.h:
654
655 2017-01-27  Yusuke Suzuki  <utatane.tea@gmail.com>
656
657         setTimeout / setInterval's string execution should inherit SourceOrigin correctly
658         https://bugs.webkit.org/show_bug.cgi?id=167097
659
660         Reviewed by Darin Adler.
661
662         Tests: js/dom/modules/import-from-set-interval.html
663                js/dom/modules/import-from-set-timeout.html
664
665         * bindings/js/ScriptController.cpp:
666         (WebCore::ScriptController::executeScriptInWorld):
667
668 2017-01-27  Yusuke Suzuki  <utatane.tea@gmail.com>
669
670         Merge CachedModuleScript and LoadableModuleScript
671         https://bugs.webkit.org/show_bug.cgi?id=167500
672
673         Reviewed by Darin Adler.
674
675         CachedModuleScript becomes duplicate with LoadableModuleScript.
676         And CachedModuleScript does not offer any meaningful functionality
677         to LoadableModuleScript.
678         This patch merges CachedModuleScript to LoadableModuleScript.
679
680         No behavior change.
681
682         * CMakeLists.txt:
683         * WebCore.xcodeproj/project.pbxproj:
684         * bindings/js/CachedModuleScript.cpp: Removed.
685         * bindings/js/CachedModuleScript.h: Removed.
686         * bindings/js/CachedModuleScriptClient.h: Removed.
687         * bindings/js/JSBindingsAllInOne.cpp:
688         * bindings/js/ScriptController.cpp:
689         (WebCore::ScriptController::loadModuleScriptInWorld):
690         (WebCore::ScriptController::loadModuleScript):
691         (WebCore::ScriptController::linkAndEvaluateModuleScriptInWorld):
692         (WebCore::ScriptController::linkAndEvaluateModuleScript):
693         (WebCore::ScriptController::setupModuleScriptHandlers):
694         * bindings/js/ScriptController.h:
695         * dom/LoadableModuleScript.cpp:
696         (WebCore::LoadableModuleScript::create):
697         (WebCore::LoadableModuleScript::LoadableModuleScript):
698         (WebCore::LoadableModuleScript::~LoadableModuleScript):
699         (WebCore::LoadableModuleScript::isLoaded):
700         (WebCore::LoadableModuleScript::error):
701         (WebCore::LoadableModuleScript::wasCanceled):
702         (WebCore::LoadableModuleScript::notifyLoadCompleted):
703         (WebCore::LoadableModuleScript::notifyLoadFailed):
704         (WebCore::LoadableModuleScript::notifyLoadWasCanceled):
705         (WebCore::LoadableModuleScript::execute):
706         (WebCore::LoadableModuleScript::load):
707         (WebCore::LoadableModuleScript::notifyFinished): Deleted.
708         * dom/LoadableModuleScript.h:
709         * dom/ScriptElement.cpp:
710         (WebCore::ScriptElement::executeModuleScript):
711         * dom/ScriptElement.h:
712
713 2017-01-27  Michael Saboff  <msaboff@apple.com>
714
715         JSCustomElementInterface::invokeCallback can be called with a null callback because Weak<>
716         https://bugs.webkit.org/show_bug.cgi?id=167522
717
718         Reviewed by Filip Pizlo.
719
720         Added all provided callbacks to the global object with a private name the same way 
721         that the constructor was added.  This will keep these callbacks from being GC'ed.
722
723         * bindings/js/JSCustomElementRegistryCustom.cpp:
724         (WebCore::JSCustomElementRegistry::define):
725
726 2017-01-27  Myles C. Maxfield  <mmaxfield@apple.com>
727
728         [Cocoa] Prepare ComplexTextController for unit testing
729         https://bugs.webkit.org/show_bug.cgi?id=167493
730
731         Reviewed by Simon Fraser.
732
733         Addressing post-review comments from Simon Fraser.
734
735         * platform/graphics/FontCascade.h:
736         * platform/graphics/mac/ComplexTextController.h:
737         (WebCore::ComplexTextController::ComplexTextRun::createForTesting):
738         * platform/graphics/mac/ComplexTextControllerCoreText.h:
739         (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun):
740
741 2017-01-27  Simon Fraser  <simon.fraser@apple.com>
742
743         Element with a backdrop-filter and a mask may not correctly mask the backdrop
744         https://bugs.webkit.org/show_bug.cgi?id=167456
745         rdar://problem/29320059
746
747         Reviewed by Antoine Quint.
748
749         If a layer had a backdrop filter, but also corner radii that triggered using a mask layer,
750         then the call to updateClippingStrategy() in GraphicsLayerCA::updateBackdropFiltersRect() would
751         set the backdrop layer's mask, but GraphicsLayerCA::updateMaskLayer() would promptly then set
752         the mask layer back to nil.
753
754         Fix by having GraphicsLayerCA::updateMaskLayer() put the mask on the structural layer, if there
755         is one. We always have a structural layer with backdrops, so this will mask both the layer
756         and the backdrop.
757
758         Test: css3/filters/backdrop/backdrop-filter-uneven-corner-radii.html
759
760         * platform/graphics/ca/GraphicsLayerCA.cpp:
761         (WebCore::GraphicsLayerCA::updateMaskLayer):
762         * platform/graphics/mac/WebLayer.mm:
763         (-[CALayer _descriptionWithPrefix:]): Dump the mask layer.
764
765 2017-01-27  Chris Dumez  <cdumez@apple.com>
766
767         Fix remaining bad uses of logDiagnosticMessageWithValue()
768         https://bugs.webkit.org/show_bug.cgi?id=167526
769
770         Reviewed by Alex Christensen.
771
772         Drop unused keys, add new ones.
773
774         * page/DiagnosticLoggingKeys.cpp:
775         (WebCore::DiagnosticLoggingKeys::networkCacheFailureReasonKey):
776         (WebCore::DiagnosticLoggingKeys::networkCacheUnusedReasonKey):
777         (WebCore::DiagnosticLoggingKeys::networkCacheReuseFailureKey):
778         (WebCore::DiagnosticLoggingKeys::backNavigationDeltaKey):
779         (WebCore::DiagnosticLoggingKeys::userZoomActionKey):
780         (WebCore::DiagnosticLoggingKeys::deltaKey): Deleted.
781         (WebCore::DiagnosticLoggingKeys::backNavigationKey): Deleted.
782         (WebCore::DiagnosticLoggingKeys::requestKey): Deleted.
783         (WebCore::DiagnosticLoggingKeys::unusableCachedEntryKey): Deleted.
784         (WebCore::DiagnosticLoggingKeys::userKey): Deleted.
785         (WebCore::DiagnosticLoggingKeys::zoomedKey): Deleted.
786         (WebCore::DiagnosticLoggingKeys::notInCacheKey): Deleted.
787         * page/DiagnosticLoggingKeys.h:
788
789 2017-01-27  Myles C. Maxfield  <mmaxfield@apple.com>
790
791         Proclaim that we are considering font-display, rhythmic sizing, and text decoration level 4
792         https://bugs.webkit.org/show_bug.cgi?id=167340
793
794         Reviewed by Saam Barati.
795
796         * features.json:
797
798 2017-01-27  Chris Dumez  <cdumez@apple.com>
799
800         Fix diagnostic logging under loader/
801         https://bugs.webkit.org/show_bug.cgi?id=167512
802
803         Reviewed by Alex Christensen.
804
805         Fix diagnostic logging under loader/. We should not be using logDiagnosticLoggingWithValue()
806         without a numeric value.
807
808         * loader/ResourceLoader.cpp:
809         (WebCore::logResourceResponseSource):
810         * loader/SubresourceLoader.cpp:
811         (WebCore::logResourceLoaded):
812         * loader/cache/CachedResourceLoader.cpp:
813         (WebCore::logMemoryCacheResourceRequest):
814         (WebCore::CachedResourceLoader::requestResource):
815         (WebCore::logRevalidation):
816         * page/DiagnosticLoggingKeys.cpp:
817         (WebCore::DiagnosticLoggingKeys::memoryCacheEntryDecisionKey):
818         (WebCore::DiagnosticLoggingKeys::memoryCacheUsageKey):
819         (WebCore::DiagnosticLoggingKeys::cachedResourceRevalidationReasonKey):
820         (WebCore::DiagnosticLoggingKeys::resourceLoadedKey):
821         (WebCore::DiagnosticLoggingKeys::resourceResponseSourceKey):
822         * page/DiagnosticLoggingKeys.h:
823
824 2017-01-27  Chris Dumez  <cdumez@apple.com>
825
826         Fix diagnostic logging in media code
827         https://bugs.webkit.org/show_bug.cgi?id=167510
828
829         Reviewed by Alex Christensen.
830
831         Fix diagnostic logging in media code. It should not use logDiagnosticMessageWithValue()
832         with a non-numeric value.
833
834         * html/HTMLMediaElement.cpp:
835         (WebCore::HTMLMediaElement::loadResource):
836         (WebCore::HTMLMediaElement::updatePlayState):
837
838 2017-01-27  Myles C. Maxfield  <mmaxfield@apple.com>
839
840         [Cocoa] Prepare ComplexTextController for unit testing
841         https://bugs.webkit.org/show_bug.cgi?id=167493
842
843         Reviewed by Dean Jackson.
844
845         ComplexTextController has three phases:
846         1. Interrogate Core Text about some text
847         2. Compute layout advances and paint advances from the information retrieved from
848         Core Text
849         3. Iterate through the layout advances or paint advances.
850
851         This patch tests phases 2 and 3 by chopping ComplexTextController between
852         phases 1 and 2, and injecting foreign metrics from a unit test. These metrics
853         have been gathered from real-world uses; however, a layout test is not appropriate
854         because the fonts which produced these metrics are not licensed appropriately.
855         The tests can enforce the correct behavior by using ComplexTextController's
856         public API.
857
858         This is in preparation for https://bugs.webkit.org/show_bug.cgi?id=166013.
859         However, the fix for that bug is quite large, so I've split out this smaller piece
860         to ease the reviewing burden. The tests I've added are disabled for now (because
861         they fail), but will be enabled by the fix to that bug.
862
863         No new tests because there is no behavior change.
864
865         * WebCore.xcodeproj/project.pbxproj:
866         * platform/graphics/FontCascade.h:
867         * platform/graphics/FontDescription.h:
868         * platform/graphics/mac/ComplexTextController.cpp:
869         (WebCore::ComplexTextController::ComplexTextController):
870         (WebCore::ComplexTextController::finishConstruction):
871         * platform/graphics/mac/ComplexTextController.h:
872         (WebCore::ComplexTextController::ComplexTextRun::createForTesting):
873         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
874         (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun):
875
876 2017-01-27  Zalan Bujtas  <zalan@apple.com>
877
878         Simple line layout: Do not bail out on -webkit-line-box-contain: block glyphs unless text overflows vertically.
879         https://bugs.webkit.org/show_bug.cgi?id=167481
880         <rdar://problem/30180150>
881
882         Reviewed by Antti Koivisto.
883
884         Since -webkit-line-box-contain: glyphs requires variable line height support, we can use simple line layout
885         only when each line happen to have the same height ('block' property value is set, glyphs do not overflow the block line height).  
886
887         Test: fast/text/simple-line-layout-line-box-contain-glyphs.html
888
889         * rendering/SimpleLineLayout.cpp:
890         (WebCore::SimpleLineLayout::canUseForText):
891         (WebCore::SimpleLineLayout::canUseForFontAndText):
892         (WebCore::SimpleLineLayout::canUseForStyle):
893         (WebCore::SimpleLineLayout::printReason):
894
895 2017-01-27  Chris Dumez  <cdumez@apple.com>
896
897         Fix PageCache diagnostic logging
898         https://bugs.webkit.org/show_bug.cgi?id=167508
899
900         Reviewed by Sam Weinig.
901
902         Fix PageCache diagnostic logging. It should not call logDiagnosticMessageWithValue()
903         with a non-numeric value. Use logDiagnosticMessage() instead.
904
905         * history/PageCache.cpp:
906         (WebCore::logPageCacheFailureDiagnosticMessage):
907         (WebCore::canCacheFrame):
908         * page/DiagnosticLoggingKeys.cpp:
909         (WebCore::DiagnosticLoggingKeys::pageCacheFailureKey):
910         (WebCore::DiagnosticLoggingKeys::successKey): Deleted.
911         (WebCore::DiagnosticLoggingKeys::failureKey): Deleted.
912         * page/DiagnosticLoggingKeys.h:
913
914 2017-01-27  Devin Rousso  <dcrousso+webkit@gmail.com>
915
916         Styles should not show background-repeat-x/y, or -webkit-mask-repeat-x/y
917         https://bugs.webkit.org/show_bug.cgi?id=167255
918
919         Reviewed by Joseph Pecoraro.
920
921         Test: inspector/css/css-property.html
922
923         * css/makeprop.pl:
924         (addProperty):
925         Add a generated function `isInternalCSSProperty` that checks the given CSSPropertyID against
926         a derived list of properties from CSSProperties.json with "internal-only".
927
928         * inspector/InspectorCSSAgent.cpp:
929         (WebCore::InspectorCSSAgent::getSupportedCSSProperties):
930         * inspector/InspectorStyleSheet.cpp:
931         (WebCore::InspectorStyle::styleWithProperties):
932         Only pass CSS property payloads to the frontend if they are not internal.
933
934 2017-01-27  Antti Koivisto  <antti@apple.com>
935
936         Implement Cache-control: immutable
937         https://bugs.webkit.org/show_bug.cgi?id=167497
938
939         Reviewed by Chris Dumez.
940
941         Cache-control value 'immutable' indicates that a subresource does not change and so does not need to be
942         revalidated on a normal reload. This can significantly speed up reloads and reduce network traffic.
943
944         It is has been implemented in Firefox and is already used by Facebook.
945
946         https://tools.ietf.org/html/draft-mcmanus-immutable-00
947         https://hacks.mozilla.org/2017/01/using-immutable-caching-to-speed-up-the-web/
948
949         This patch implements Cache-control: immutable for memory cache only. A disk cache implementation
950         doesn't seem necessary as the resource is basically always expected to be in memory cache on reload.
951
952         Immutable is only supported for https as suggested by the draft specification (and Gecko implementation).
953
954         Test: http/tests/cache/cache-control-immutable-http.html
955               http/tests/cache/cache-control-immutable-https.html
956
957         * loader/cache/CachedResource.cpp:
958         (WebCore::CachedResource::makeRevalidationDecision):
959
960             On normal reloads (CachePolicyRevalidate) of https resources check for 'Cache-control: immutable'.
961             If the resource is not expired don't revalidate it.
962
963         * platform/network/CacheValidation.cpp:
964         (WebCore::parseCacheControlDirectives):
965         * platform/network/CacheValidation.h:
966         * platform/network/ResourceResponseBase.cpp:
967         (WebCore::ResourceResponseBase::cacheControlContainsImmutable):
968         * platform/network/ResourceResponseBase.h:
969
970 2017-01-27  Youenn Fablet  <youennf@gmail.com>
971
972         [WebRTC] Use MediaEndPointPeerConnection if not using libwebrtc
973         https://bugs.webkit.org/show_bug.cgi?id=167504
974
975         Reviewed by Alex Christensen.
976
977         No change of behavior.
978
979         * Modules/mediastream/MediaEndpointPeerConnection.cpp: If libwebrtc, we should use libwebrtc peer connection backend.
980
981 2017-01-27  Ryan Haddad  <ryanhaddad@apple.com>
982
983         Rebaseline bindings tests after r211238.
984
985         Unreviewed test gardening.
986
987         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
988         (WebCore::JSTestDOMJIT::visitChildren):
989         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
990         (WebCore::JSTestEventTarget::visitChildren):
991         * bindings/scripts/test/JS/JSTestNode.cpp:
992         (WebCore::JSTestNode::visitChildren):
993
994 2017-01-25  Sergio Villar Senin  <svillar@igalia.com>
995
996         [css-grid] Move Grid class out of RenderGrid
997         https://bugs.webkit.org/show_bug.cgi?id=167418
998
999         Reviewed by Antti Koivisto.
1000
1001         The RenderGrid should be able to use different implementations of
1002         the Grid class. The latter is big enough to be in its own file. That
1003         would help on the effort of moving the grid track sizing algorithm
1004         out of RenderGrid too.
1005
1006         No new tests required as we're just moving code.
1007
1008         * CMakeLists.txt:
1009         * rendering/Grid.cpp: Added.
1010         (WebCore::Grid::Grid):
1011         (WebCore::Grid::numTracks):
1012         (WebCore::Grid::ensureGridSize):
1013         (WebCore::Grid::insert):
1014         (WebCore::Grid::setSmallestTracksStart):
1015         (WebCore::Grid::smallestTrackStart):
1016         (WebCore::Grid::gridItemArea):
1017         (WebCore::Grid::setGridItemArea):
1018         (WebCore::Grid::setAutoRepeatTracks):
1019         (WebCore::Grid::autoRepeatTracks):
1020         (WebCore::Grid::setAutoRepeatEmptyColumns):
1021         (WebCore::Grid::setAutoRepeatEmptyRows):
1022         (WebCore::Grid::hasAutoRepeatEmptyTracks):
1023         (WebCore::Grid::isEmptyAutoRepeatTrack):
1024         (WebCore::Grid::autoRepeatEmptyTracks):
1025         (WebCore::Grid::gridItemSpan):
1026         (WebCore::Grid::setNeedsItemsPlacement):
1027         (WebCore::GridIterator::GridIterator):
1028         (WebCore::GridIterator::nextGridItem):
1029         (WebCore::GridIterator::isEmptyAreaEnough):
1030         (WebCore::GridIterator::nextEmptyGridArea):
1031         * rendering/Grid.h: Added.
1032         * rendering/RenderGrid.cpp:
1033         (WebCore::RenderGrid::computeEmptyTracksForAutoRepeat):
1034         (WebCore::RenderGrid::Grid::numTracks): Deleted.
1035         (WebCore::RenderGrid::Grid::ensureGridSize): Deleted.
1036         (WebCore::RenderGrid::Grid::insert): Deleted.
1037         (WebCore::RenderGrid::Grid::setSmallestTracksStart): Deleted.
1038         (WebCore::RenderGrid::Grid::smallestTrackStart): Deleted.
1039         (WebCore::RenderGrid::Grid::gridItemArea): Deleted.
1040         (WebCore::RenderGrid::Grid::setGridItemArea): Deleted.
1041         (WebCore::RenderGrid::Grid::setAutoRepeatTracks): Deleted.
1042         (WebCore::RenderGrid::Grid::autoRepeatTracks): Deleted.
1043         (WebCore::RenderGrid::Grid::setAutoRepeatEmptyColumns): Deleted.
1044         (WebCore::RenderGrid::Grid::setAutoRepeatEmptyRows): Deleted.
1045         (WebCore::RenderGrid::Grid::hasAutoRepeatEmptyTracks): Deleted.
1046         (WebCore::RenderGrid::Grid::isEmptyAutoRepeatTrack): Deleted.
1047         (WebCore::RenderGrid::Grid::autoRepeatEmptyTracks): Deleted.
1048         (WebCore::RenderGrid::Grid::gridItemSpan): Deleted.
1049         (WebCore::RenderGrid::Grid::setNeedsItemsPlacement): Deleted.
1050         (WebCore::RenderGrid::GridIterator::GridIterator): Deleted.
1051         (WebCore::RenderGrid::GridIterator::nextGridItem): Deleted.
1052         (WebCore::RenderGrid::GridIterator::isEmptyAreaEnough): Deleted.
1053         (WebCore::RenderGrid::GridIterator::nextEmptyGridArea): Deleted.
1054         * rendering/RenderGrid.h:
1055
1056 2017-01-27  Yusuke Suzuki  <utatane.tea@gmail.com>
1057
1058         Implement dynamic-import for WebCore
1059         https://bugs.webkit.org/show_bug.cgi?id=166926
1060
1061         Reviewed by Ryosuke Niwa.
1062
1063         This patch introduces browser side dynamic-import implementation.
1064         The dynamic-import is new ES feature which is now stage 3.
1065         The JSC shell already implements it.
1066
1067         The dynamic-import allows us to kick module loading in a dynamic manner.
1068         For example, you can write,
1069
1070             await module = import(`${HOST}/hello.js`);
1071
1072         The dynamic `import` operator (this is not a function) returns a promise with
1073         module namespace object if the module loading succeeds. Otherwise, it returns
1074         a rejected promise.
1075
1076         And importantly, this feature allows us to kick module loading from classic script.
1077         Previously, module loading can be only used from <script type="module"> tag. And
1078         all the module loading is done statically.
1079
1080         * CMakeLists.txt:
1081         * WebCore.xcodeproj/project.pbxproj:
1082         * bindings/js/CachedModuleScriptLoader.cpp:
1083         (WebCore::CachedModuleScriptLoader::load):
1084         * bindings/js/CachedScriptFetcher.cpp:
1085         (WebCore::CachedScriptFetcher::create):
1086         (WebCore::CachedScriptFetcher::requestModuleScript):
1087         requestModuleScript function is used only when loading a new module script.
1088         So, LoadableClassicScript should use requestScriptWithCache to load itself.
1089         We pass String() for cross origin mode for null cross origin attribute as
1090         specified.
1091
1092         (WebCore::CachedScriptFetcher::requestScriptWithCache):
1093         * bindings/js/CachedScriptFetcher.h:
1094         (WebCore::CachedScriptFetcher::CachedScriptFetcher):
1095         * bindings/js/JSDOMWindowBase.cpp:
1096         (WebCore::JSDOMWindowBase::moduleLoaderImportModule):
1097         * bindings/js/JSDOMWindowBase.h:
1098         * bindings/js/JSLazyEventListener.cpp:
1099         (WebCore::JSLazyEventListener::initializeJSFunction):
1100         * bindings/js/ScriptController.cpp:
1101         (WebCore::ScriptController::executeScript):
1102         * bindings/js/ScriptModuleLoader.cpp:
1103         (WebCore::resolveModuleSpecifier):
1104         Extract the part of resolving module specifier to a static function to use
1105         it in ScriptModuleLoader::resolve and ScriptModuleLoader::importModule.
1106
1107         (WebCore::ScriptModuleLoader::resolve):
1108         (WebCore::rejectPromise):
1109         (WebCore::ScriptModuleLoader::importModule):
1110         New hook moduleLoaderImportModule is implemented. This hook is called when
1111         `import` operator is used. This hook is responsible to
1112             1. resolve the module name to obtain module specifier. (like, resolve the
1113                 relative URL to get absolute URL.)
1114             2. kick module loading with the resolved specifier.
1115         When resolving the module name, the referrer information is needed.
1116         For example, "./script.js" will be resolved to "http://example.com/script.js" if
1117         the referrer module specifier is "http://example.com/".
1118         If `import("./script.js")` is executed in the classic script
1119         src="http://example.com/test.js", it starts loading "http://example.com/script.js".
1120         So the information of the caller of `import` operator is necessary here.
1121         This appropriate referrer is propagated by SourceOrigin.
1122
1123         * bindings/js/ScriptModuleLoader.h:
1124         * dom/InlineClassicScript.h:
1125         * dom/LoadableClassicScript.cpp:
1126         (WebCore::LoadableClassicScript::load):
1127         * dom/LoadableClassicScript.h:
1128         * dom/LoadableModuleScript.h:
1129         * dom/LoadableScript.h:
1130         (WebCore::LoadableScript::LoadableScript):
1131         (WebCore::LoadableScript::isClassicScript): Deleted.
1132         (WebCore::LoadableScript::isModuleScript): Deleted.
1133         * dom/ScriptElement.h:
1134         * dom/ScriptElementCachedScriptFetcher.cpp: Copied from Source/WebCore/dom/InlineClassicScript.h.
1135         (WebCore::ScriptElementCachedScriptFetcher::requestModuleScript):
1136         This requestModuleScript will be used when the script tag (or modules imported from the script tag) uses `import` operator.
1137         In classic scripts, `crossorigin` mode always becomes "omit" while module scripts
1138         propagate the original `crossorigin` value.
1139
1140         * dom/ScriptElementCachedScriptFetcher.h: Copied from Source/WebCore/bindings/js/CachedScriptFetcher.h.
1141         (WebCore::ScriptElementCachedScriptFetcher::crossOriginMode):
1142         (WebCore::ScriptElementCachedScriptFetcher::ScriptElementCachedScriptFetcher):
1143
1144 2017-01-26  Chris Dumez  <cdumez@apple.com>
1145
1146         Revert r210474 it is no longer needed
1147         https://bugs.webkit.org/show_bug.cgi?id=167487
1148
1149         Reviewed by Daniel Bates.
1150
1151         Revert r210474 it is no longer needed after r211254.
1152
1153         * dom/Document.cpp:
1154         (WebCore::Document::canNavigate):
1155         * html/HTMLAnchorElement.cpp:
1156         (WebCore::HTMLAnchorElement::handleClick):
1157         * html/HTMLLinkElement.cpp:
1158         (WebCore::HTMLLinkElement::handleClick):
1159         * loader/FrameLoader.cpp:
1160         (WebCore::FrameLoader::urlSelected):
1161         (WebCore::FrameLoader::submitForm):
1162         (WebCore::FrameLoader::loadFrameRequest):
1163         * mathml/MathMLElement.cpp:
1164         (WebCore::MathMLElement::defaultEventHandler):
1165         * svg/SVGAElement.cpp:
1166         (WebCore::SVGAElement::defaultEventHandler):
1167
1168 2017-01-26  Youenn Fablet  <youennf@gmail.com>
1169
1170         [WebRTC] Implement WebRTC PeerConnection backend based on libwebrtc
1171         https://bugs.webkit.org/show_bug.cgi?id=167289
1172
1173         Reviewed by Alex Christensen.
1174
1175         Introducing an initial implementation of WebRTC peer connection backend based on LibWebRTC.
1176         This is done behind a compilation flag which is off by default, until the implementation is ready.
1177
1178         The backend implements the PeerConnectionBackend API.
1179         The implementation is split into LibWebRTCPeerConnectionBackend which contains mostly generic code and
1180         passes the real work to LibWebRTCMediaEndpoint.
1181         The latter class is implementing the API using LibWebRTC.
1182
1183         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: Added.
1184         (WebCore::LibWebRTCMediaEndpoint::LibWebRTCMediaEndpoint):
1185         (WebCore::sessionDescriptionType):
1186         (WebCore::LibWebRTCMediaEndpoint::doSetLocalDescription):
1187         (WebCore::LibWebRTCMediaEndpoint::doSetRemoteDescription):
1188         (WebCore::LibWebRTCMediaEndpoint::addPendingIceCandidates):
1189         (WebCore::streamId):
1190         (WebCore::LibWebRTCMediaEndpoint::doCreateOffer):
1191         (WebCore::LibWebRTCMediaEndpoint::doCreateAnswer):
1192         (WebCore::LibWebRTCMediaEndpoint::getStats):
1193         (WebCore::LibWebRTCMediaEndpoint::StatsCollector::StatsCollector):
1194         (WebCore::LibWebRTCMediaEndpoint::StatsCollector::OnStatsDelivered):
1195         (WebCore::signalingState):
1196         (WebCore::LibWebRTCMediaEndpoint::OnSignalingChange):
1197         (WebCore::trackId):
1198         (WebCore::createMediaStreamTrack):
1199         (WebCore::LibWebRTCMediaEndpoint::addStream):
1200         (WebCore::LibWebRTCMediaEndpoint::OnAddStream):
1201         (WebCore::LibWebRTCMediaEndpoint::OnRemoveStream):
1202         (WebCore::LibWebRTCMediaEndpoint::OnDataChannel):
1203         (WebCore::LibWebRTCMediaEndpoint::stop):
1204         (WebCore::LibWebRTCMediaEndpoint::OnRenegotiationNeeded):
1205         (WebCore::iceConnectionState):
1206         (WebCore::LibWebRTCMediaEndpoint::OnIceConnectionChange):
1207         (WebCore::LibWebRTCMediaEndpoint::OnIceGatheringChange):
1208         (WebCore::LibWebRTCMediaEndpoint::OnIceCandidate):
1209         (WebCore::LibWebRTCMediaEndpoint::OnIceCandidatesRemoved):
1210         (WebCore::LibWebRTCMediaEndpoint::createSessionDescriptionSucceeded):
1211         (WebCore::LibWebRTCMediaEndpoint::createSessionDescriptionFailed):
1212         (WebCore::LibWebRTCMediaEndpoint::setLocalSessionDescriptionSucceeded):
1213         (WebCore::LibWebRTCMediaEndpoint::setLocalSessionDescriptionFailed):
1214         (WebCore::LibWebRTCMediaEndpoint::setRemoteSessionDescriptionSucceeded):
1215         (WebCore::LibWebRTCMediaEndpoint::setRemoteSessionDescriptionFailed):
1216         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h: Added.
1217         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: Added.
1218         (WebCore::createLibWebRTCPeerConnectionBackend):
1219         (WebCore::libWebRTCProvider):
1220         (WebCore::LibWebRTCPeerConnectionBackend::LibWebRTCPeerConnectionBackend):
1221         (WebCore::configurationFromMediaEndpointConfiguration):
1222         (WebCore::LibWebRTCPeerConnectionBackend::setConfiguration):
1223         (WebCore::LibWebRTCPeerConnectionBackend::getStats):
1224         (WebCore::LibWebRTCPeerConnectionBackend::doSetLocalDescription):
1225         (WebCore::LibWebRTCPeerConnectionBackend::doSetRemoteDescription):
1226         (WebCore::LibWebRTCPeerConnectionBackend::doCreateOffer):
1227         (WebCore::LibWebRTCPeerConnectionBackend::doCreateAnswer):
1228         (WebCore::LibWebRTCPeerConnectionBackend::doStop):
1229         (WebCore::LibWebRTCPeerConnectionBackend::doAddIceCandidate):
1230         (WebCore::LibWebRTCPeerConnectionBackend::markAsNeedingNegotiation):
1231         (WebCore::LibWebRTCPeerConnectionBackend::createReceiver):
1232         (WebCore::LibWebRTCPeerConnectionBackend::createDataChannelHandler):
1233         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h: Added.
1234         * WebCore.xcodeproj/project.pbxproj:
1235
1236 2017-01-26  Chris Dumez  <cdumez@apple.com>
1237
1238         Crash when navigating back to a page in PacheCache when one of its frames has been removed
1239         https://bugs.webkit.org/show_bug.cgi?id=167421
1240         <rdar://problem/30188490>
1241
1242         Reviewed by Darin Adler.
1243
1244         Disallow page caching of a page if:
1245         1. The main window has an opener (i.e. it was opened via window.open)
1246         2. It has ever used window.open()
1247
1248         This is because allowing page caching in this case would allow such
1249         windows to script each other even after one of them entered Page
1250         Cache. Allowing this is dangerous and easily causes crashes.
1251
1252         This is a short term workaround until we find a better solution to
1253         the problem. One issue is this workaround is that navigating back
1254         to a page that has an opener or used window.open() will not longer
1255         get the page from PageCache. As a result, state may be lost upon
1256         navigating back. However, we never guarantee that pages get page
1257         cached, and Chrome does not have a PageCache.
1258
1259         Tests: fast/history/page-cache-after-window-open.html
1260                fast/history/page-cache-back-navigation-crash.html
1261                fast/history/page-cache-with-opener.html
1262
1263         * dom/Document.cpp:
1264         (WebCore::Document::hasEverCalledWindowOpen):
1265         (WebCore::Document::markHasCalledWindowOpen):
1266         * dom/Document.h:
1267         * history/PageCache.cpp:
1268         (WebCore::canCachePage):
1269         * page/DOMWindow.cpp:
1270         (WebCore::DOMWindow::createWindow):
1271         * page/DiagnosticLoggingKeys.cpp:
1272         (WebCore::DiagnosticLoggingKeys::hasCalledWindowOpenKey):
1273         (WebCore::DiagnosticLoggingKeys::hasOpenerKey):
1274         * page/DiagnosticLoggingKeys.h:
1275         * page/Page.cpp:
1276         (WebCore::Page::openedByWindowOpen):
1277         * page/Page.h:
1278         * page/Settings.in:
1279
1280 2017-01-26  Youenn Fablet  <youennf@gmail.com>
1281
1282         [WebRTC] Add a LibWebRTC mock for testing
1283         https://bugs.webkit.org/show_bug.cgi?id=167429
1284
1285         Reviewed by Alex Christensen.
1286
1287         Covered by updated tests although feature is behind a flag, off by default.
1288         MockLibWebRTCPeerConnection will allow us testing the code above the WebRTC implementation above LibWebRTC,
1289         without reyling on it and controlling the way that the peer connections will behave.
1290         Adding support for mock factory to create real peer connections in case where we want to do full testing through the local loopback.
1291
1292         Tests: fast/mediastream/getUserMedia-webaudio.html
1293                webrtc/datachannel/basic.html
1294                webrtc/video.html
1295
1296         * WebCore.xcodeproj/project.pbxproj:
1297         * testing/Internals.cpp:
1298         (WebCore::Internals::Internals):
1299         (WebCore::Internals::useMockRTCPeerConnectionFactory):
1300         * testing/Internals.h:
1301         * testing/Internals.idl:
1302         * testing/MockLibWebRTCPeerConnection.cpp: Added.
1303         (WebCore::useMockRTCPeerConnectionFactory):
1304         (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::MockLibWebRTCPeerConnectionForIceCandidates):
1305         (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::gotLocalDescription):
1306         (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::MockLibWebRTCPeerConnectionForIceConnectionState):
1307         (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::gotLocalDescription):
1308         (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory):
1309         (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection):
1310         (WebCore::MockLibWebRTCPeerConnectionFactory::CreateLocalMediaStream):
1311         (WebCore::MockLibWebRTCPeerConnection::SetLocalDescription):
1312         (WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription):
1313         (WebCore::MockLibWebRTCPeerConnection::CreateDataChannel):
1314         (WebCore::MockLibWebRTCPeerConnection::AddStream):
1315         (WebCore::MockLibWebRTCPeerConnection::RemoveStream):
1316         (WebCore::MockLibWebRTCPeerConnection::CreateOffer):
1317         (WebCore::MockLibWebRTCPeerConnection::CreateAnswer):
1318         * testing/MockLibWebRTCPeerConnection.h: Added.
1319         (WebCore::MockLibWebRTCPeerConnection::~MockLibWebRTCPeerConnection):
1320         (WebCore::MockLibWebRTCPeerConnection::MockLibWebRTCPeerConnection):
1321         (WebCore::MockLibWebRTCPeerConnection::local_streams):
1322         (WebCore::MockLibWebRTCPeerConnection::remote_streams):
1323         (WebCore::MockLibWebRTCPeerConnection::CreateDtmfSender):
1324         (WebCore::MockLibWebRTCPeerConnection::GetStats):
1325         (WebCore::MockLibWebRTCPeerConnection::local_description):
1326         (WebCore::MockLibWebRTCPeerConnection::remote_description):
1327         (WebCore::MockLibWebRTCPeerConnection::AddIceCandidate):
1328         (WebCore::MockLibWebRTCPeerConnection::RegisterUMAObserver):
1329         (WebCore::MockLibWebRTCPeerConnection::signaling_state):
1330         (WebCore::MockLibWebRTCPeerConnection::ice_connection_state):
1331         (WebCore::MockLibWebRTCPeerConnection::ice_gathering_state):
1332         (WebCore::MockLibWebRTCPeerConnection::StopRtcEventLog):
1333         (WebCore::MockLibWebRTCPeerConnection::Close):
1334         (WebCore::MockLibWebRTCPeerConnection::gotLocalDescription):
1335         (WebCore::MockLibWebRTCIceCandidate::MockLibWebRTCIceCandidate):
1336         (WebCore::MockLibWebRTCAudioTrack::MockLibWebRTCAudioTrack):
1337         (WebCore::MockLibWebRTCVideoTrack::MockLibWebRTCVideoTrack):
1338         (WebCore::MockLibWebRTCDataChannel::MockLibWebRTCDataChannel):
1339         (WebCore::MockLibWebRTCPeerConnectionFactory::create):
1340
1341 2017-01-26  Jeremy Jones  <jeremyj@apple.com>
1342
1343         Page should be able to request pointer lock without user gesture if it relinquished it without a user gesture
1344         https://bugs.webkit.org/show_bug.cgi?id=167126
1345
1346         Reviewed by Jon Lee.
1347
1348         Enabled pointer-lock/locked-element-removed-from-dom.html for WK2.
1349         Not enable in WK1 because of https://bugs.webkit.org/show_bug.cgi?id=167127
1350
1351         This change allows a page to lock the pointer again without a user gesture if it was unlocked by
1352         the page and not by the user. See https://www.w3.org/TR/2016/REC-pointerlock-20161027/ 5.1 Methods
1353
1354         * page/PointerLockController.cpp:
1355
1356         When a document acquires pointer lock with a user gesture, that document is allowed to request pointer lock again
1357         until the user takes an action to end pointer lock. We know it is a user action because user actions always
1358         call requestPointerUnlockAndForceCursorVisible().
1359
1360         When the page requests a pointer unlock (via requestPointerUnlock), that document is allowed to continue to relock
1361         the page. This continues until there is either an unlock request form the user 
1362         via requestPointerUnlockAndForceCursorVisible or a didLosePointerLock without a pointer unlock request.
1363
1364         (WebCore::PointerLockController::PointerLockController):
1365         (WebCore::PointerLockController::requestPointerLock):
1366         (WebCore::PointerLockController::requestPointerUnlock):
1367         (WebCore::PointerLockController::requestPointerUnlockAndForceCursorVisible):
1368         (WebCore::PointerLockController::elementRemoved):
1369         (WebCore::PointerLockController::documentDetached):
1370         (WebCore::PointerLockController::didAcquirePointerLock):
1371         (WebCore::PointerLockController::didLosePointerLock):
1372         (WebCore::PointerLockController::clearElement):
1373         * page/PointerLockController.h:
1374
1375 2017-01-26  Andy Estes  <aestes@apple.com>
1376
1377         [QuickLook] REGRESSION (WebKit2): Requests are made to invalid x-apple-ql-id: URLs
1378         https://bugs.webkit.org/show_bug.cgi?id=167453
1379
1380         Reviewed by Brent Fulgham.
1381
1382         Requests to x-apple-ql-id: URLs should be filtered by
1383         -[QLPreviewConverter safeRequestForRequest:]. This method checks that the URL is one of the
1384         ones generated for the current preview, and changes it to "about:" if it isn't.
1385
1386         WebCore::safeQLURLForDocumentURLAndResourceURL() was responsible for finding the
1387         QLPreviewConverter instance to use by looking it up in an NSMutableDictionary using the
1388         document URL as a key. In WebKit1, this dictionary was populated by the
1389         QuickLookHandleClient when new QuickLookHandles were created, but the WebKit2
1390         QuickLookHandleClient never did this. As a result, requests to invalid URLs were not being
1391         rewritten.
1392
1393         An easy way to load a QuickLook document with invalid URLs is to create an HTML file with a
1394         Microsoft Office extension (e.g. .xls); QuickLook, iWork, and Office support opening HTML
1395         files with Office document extensions. In r207155 we applied a Content Security Policy to
1396         QuickLook documents that only allows x-apple-ql-id: resources to load. This blocked
1397         cross-origin requests from loading, but same-origin requests to URLs that weren't generated
1398         by QLPreviewConverter were still allowed to load.
1399
1400         This change blocks these URLs by calling -[QLPreviewConverter safeRequestForRequest:] in a
1401         way that works for both WebKit1 and WebKit2.
1402
1403         After implementing QuickLook for WebKit2, we found a bug when loading HTML-as-Office
1404         documents (webkit.org/b/135651) that presented as a nil MIME type in the preview
1405         NSURLResponse returned by QLPreviewConverter. Unfortunately r172159 papered over the actual
1406         bug by failing to load previews with nil MIME types.
1407
1408         The real issue was that we were asking for the preview response before QuickLook had
1409         received enough data to determine a MIME type, so this change also removes the bad fix from
1410         r172159 and instead waits until QuickLook has converted the document to ask for its preview
1411         response. This restores the ability to load HTML files with Office document extensions.
1412         These two fixes are combined in a single patch because I don't know how to create an invalid
1413         QuickLook URL for testing without loading an HTML-as-Office document.
1414
1415         Test: quicklook/invalid-ql-id-url.html
1416
1417         * loader/ResourceLoader.cpp:
1418         (WebCore::ResourceLoader::willSendRequestInternal): Called
1419         QuickLookHandle::willSendRequest() if m_documentLoader has a QuickLookHandle.
1420         * loader/cache/CachedResource.cpp:
1421         (WebCore::CachedResource::load): Removed the call to
1422         WebCore::safeQLURLForDocumentURLAndResourceURL().
1423         * loader/ios/QuickLook.h: Removed safeQLURLForDocumentURLAndResourceURL() and declared
1424         QuickLookHandle::willSendRequest().
1425         * loader/ios/QuickLook.mm: Removed _previewResponse and _hasFailed ivars from
1426         WebPreviewConverter.
1427         (-[WebPreviewConverter initWithResourceLoader:resourceResponse:quickLookHandle:]): Stopped
1428         setting _previewResponse.
1429         (-[WebPreviewConverter _sendDidReceiveResponseIfNecessary]): Only emptied _bufferedDataArray
1430         if we haven't already called -_sendDidReceiveResponseIfNecessary; removed the check for a
1431         nil _previewResponse MIME type; accessed -[QLPreviewConverter previewResponse] now that the
1432         document has been converted and asserted its MIME type is non-nil.
1433         (-[WebPreviewConverter connection:didReceiveData:lengthReceived:]): Removed _hasFailed check.
1434         (-[WebPreviewConverter connectionDidFinishLoading:]): Ditto.
1435         (isQuickLookPasswordError): Moved the check for password failure errors to here from
1436         -connection:didFailWithError: for better readability.
1437         (-[WebPreviewConverter connection:didFailWithError:]): Removed _hasFailed check and used
1438         more early returns.
1439         (WebCore::QuickLookHandle::willSendRequest): Filtered the request through
1440         -[QLPreviewConverter safeRequestWithRequest:] if the request URL's scheme is x-apple-ql-id:.
1441         (WebCore::safeQLURLForDocumentURLAndResourceURL): Deleted.
1442
1443 2017-01-26  Keith Miller  <keith_miller@apple.com>
1444
1445         classInfo should take a VM so it is not materialized from the object on each call
1446         https://bugs.webkit.org/show_bug.cgi?id=167424
1447
1448         Rubber Stamped by Michael Saboff.
1449
1450         Previously, classInfo() would get the VM from the target's
1451         MarkedBlock.  Most callers already have a VM on hand, so it is
1452         wasteful to compute the VM from the marked block every time. This
1453         patch refactors some of the most common callers of classInfo(),
1454         jsDynamicCast and inherits to take a VM as well.
1455
1456         * Modules/fetch/FetchBody.cpp:
1457         (WebCore::FetchBody::extract):
1458         * Modules/plugins/QuickTimePluginReplacement.mm:
1459         (WebCore::QuickTimePluginReplacement::installReplacement):
1460         * bindings/js/IDBBindingUtilities.cpp:
1461         (WebCore::createIDBKeyFromValue):
1462         * bindings/js/JSCommandLineAPIHostCustom.cpp:
1463         (WebCore::JSCommandLineAPIHost::getEventListeners):
1464         (WebCore::JSCommandLineAPIHost::databaseId):
1465         (WebCore::JSCommandLineAPIHost::storageId):
1466         * bindings/js/JSCryptoAlgorithmDictionary.cpp:
1467         (WebCore::JSCryptoAlgorithmDictionary::parseAlgorithmIdentifier):
1468         (WebCore::createRsaKeyGenParams):
1469         * bindings/js/JSCryptoCustom.cpp:
1470         (WebCore::JSCrypto::getRandomValues):
1471         * bindings/js/JSCryptoOperationData.cpp:
1472         (WebCore::cryptoOperationDataFromJSValue):
1473         * bindings/js/JSCustomElementInterface.cpp:
1474         (WebCore::constructCustomElementSynchronously):
1475         (WebCore::JSCustomElementInterface::upgradeElement):
1476         * bindings/js/JSDOMBinding.cpp:
1477         (WebCore::valueToDate):
1478         (WebCore::reportException):
1479         (WebCore::retrieveErrorMessage):
1480         * bindings/js/JSDOMBinding.h:
1481         (WebCore::castThisValue):
1482         (WebCore::toPossiblySharedArrayBufferView):
1483         (WebCore::toUnsharedArrayBufferView):
1484         (WebCore::toPossiblySharedInt8Array):
1485         (WebCore::toPossiblySharedInt16Array):
1486         (WebCore::toPossiblySharedInt32Array):
1487         (WebCore::toPossiblySharedUint8Array):
1488         (WebCore::toPossiblySharedUint8ClampedArray):
1489         (WebCore::toPossiblySharedUint16Array):
1490         (WebCore::toPossiblySharedUint32Array):
1491         (WebCore::toPossiblySharedFloat32Array):
1492         (WebCore::toPossiblySharedFloat64Array):
1493         (WebCore::toUnsharedInt8Array):
1494         (WebCore::toUnsharedInt16Array):
1495         (WebCore::toUnsharedInt32Array):
1496         (WebCore::toUnsharedUint8Array):
1497         (WebCore::toUnsharedUint8ClampedArray):
1498         (WebCore::toUnsharedUint16Array):
1499         (WebCore::toUnsharedUint32Array):
1500         (WebCore::toUnsharedFloat32Array):
1501         (WebCore::toUnsharedFloat64Array):
1502         (WebCore::toRefNativeArray):
1503         * bindings/js/JSDOMConstructor.h:
1504         (WebCore::JSDOMConstructorNotConstructable<JSClass>::finishCreation):
1505         (WebCore::JSDOMConstructor<JSClass>::finishCreation):
1506         (WebCore::JSDOMNamedConstructor<JSClass>::finishCreation):
1507         (WebCore::JSBuiltinConstructor<JSClass>::finishCreation):
1508         * bindings/js/JSDOMConvert.h:
1509         (WebCore::Converter<IDLInterface<T>>::convert):
1510         (WebCore::Converter<IDLXPathNSResolver<T>>::convert):
1511         * bindings/js/JSDOMGlobalObject.cpp:
1512         (WebCore::JSDOMGlobalObject::finishCreation):
1513         (WebCore::JSDOMGlobalObject::scriptExecutionContext):
1514         * bindings/js/JSDOMIterator.h:
1515         (WebCore::IteratorTraits>::next):
1516         (WebCore::IteratorTraits>::finishCreation):
1517         * bindings/js/JSDOMWindowBase.cpp:
1518         (WebCore::JSDOMWindowBase::finishCreation):
1519         (WebCore::toJSDOMWindow):
1520         * bindings/js/JSDOMWindowBase.h:
1521         * bindings/js/JSDOMWindowCustom.cpp:
1522         (WebCore::jsDOMWindowWebKit):
1523         (WebCore::JSDOMWindow::toWrapped):
1524         * bindings/js/JSDOMWindowShell.cpp:
1525         (WebCore::JSDOMWindowShell::finishCreation):
1526         (WebCore::JSDOMWindowShell::toWrapped):
1527         * bindings/js/JSDOMWindowShell.h:
1528         * bindings/js/JSDocumentCustom.cpp:
1529         (WebCore::cachedDocumentWrapper):
1530         (WebCore::JSDocument::createTouchList):
1531         * bindings/js/JSDynamicDowncast.h:
1532         (WebCore::JSDynamicCastTrait::cast):
1533         (WebCore::JSDynamicCastTrait<JSNode>::cast):
1534         (WebCore::JSDynamicCastTrait<JSElement>::cast):
1535         (WebCore::JSDynamicCastTrait<JSDocument>::cast):
1536         (WebCore::JSDynamicCastTrait<JSEvent>::cast):
1537         (WebCore::jsDynamicDowncast):
1538         * bindings/js/JSEventListener.cpp:
1539         (WebCore::JSEventListener::handleEvent):
1540         * bindings/js/JSEventTargetCustom.cpp:
1541         (WebCore::JSEventTarget::toWrapped):
1542         (WebCore::jsEventTargetCast):
1543         * bindings/js/JSEventTargetCustom.h:
1544         (WebCore::BindingCaller<JSEventTarget>::callOperation):
1545         * bindings/js/JSExceptionBase.cpp:
1546         (WebCore::toExceptionBase):
1547         * bindings/js/JSExceptionBase.h:
1548         * bindings/js/JSInspectorFrontendHostCustom.cpp:
1549         (WebCore::populateContextMenuItems):
1550         (WebCore::JSInspectorFrontendHost::showContextMenu):
1551         * bindings/js/JSNodeCustom.cpp:
1552         (WebCore::JSNode::insertBefore):
1553         (WebCore::JSNode::replaceChild):
1554         (WebCore::JSNode::removeChild):
1555         (WebCore::JSNode::appendChild):
1556         (WebCore::JSNode::pushEventHandlerScope):
1557         * bindings/js/JSPluginElementFunctions.cpp:
1558         (WebCore::pluginElementPropertyGetter):
1559         * bindings/js/JSReadableStreamPrivateConstructors.cpp:
1560         (WebCore::constructJSReadableStreamDefaultReader):
1561         * bindings/js/JSReadableStreamSourceCustom.cpp:
1562         (WebCore::startReadableStream):
1563         (WebCore::JSReadableStreamSource::start):
1564         (WebCore::pullReadableStream):
1565         * bindings/js/JSSubtleCryptoCustom.cpp:
1566         (WebCore::toCryptoKey):
1567         (WebCore::jsSubtleCryptoFunctionEncryptPromise):
1568         (WebCore::jsSubtleCryptoFunctionDecryptPromise):
1569         (WebCore::jsSubtleCryptoFunctionSignPromise):
1570         (WebCore::jsSubtleCryptoFunctionVerifyPromise):
1571         (WebCore::jsSubtleCryptoFunctionDigestPromise):
1572         (WebCore::jsSubtleCryptoFunctionWrapKeyPromise):
1573         (WebCore::jsSubtleCryptoFunctionUnwrapKeyPromise):
1574         * bindings/js/JSTrackCustom.cpp:
1575         (WebCore::toTrack): Deleted.
1576         * bindings/js/JSTrackCustom.h:
1577         * bindings/js/JSWebKitSubtleCryptoCustom.cpp:
1578         (WebCore::JSWebKitSubtleCrypto::encrypt):
1579         (WebCore::JSWebKitSubtleCrypto::decrypt):
1580         (WebCore::JSWebKitSubtleCrypto::sign):
1581         (WebCore::JSWebKitSubtleCrypto::verify):
1582         (WebCore::JSWebKitSubtleCrypto::exportKey):
1583         (WebCore::JSWebKitSubtleCrypto::wrapKey):
1584         (WebCore::JSWebKitSubtleCrypto::unwrapKey):
1585         * bindings/js/JSWorkerGlobalScopeBase.cpp:
1586         (WebCore::JSWorkerGlobalScopeBase::finishCreation):
1587         (WebCore::toJSDedicatedWorkerGlobalScope):
1588         (WebCore::toJSWorkerGlobalScope):
1589         * bindings/js/JSWorkerGlobalScopeBase.h:
1590         * bindings/js/JSXMLHttpRequestCustom.cpp:
1591         (WebCore::JSXMLHttpRequest::send):
1592         * bindings/js/JSXPathNSResolverCustom.cpp:
1593         (WebCore::JSXPathNSResolver::toWrapped):
1594         * bindings/js/ScriptController.cpp:
1595         (WebCore::ScriptController::setupModuleScriptHandlers):
1596         * bindings/js/ScriptModuleLoader.cpp:
1597         (WebCore::ScriptModuleLoader::fetch):
1598         (WebCore::ScriptModuleLoader::evaluate):
1599         * bindings/js/ScriptState.cpp:
1600         (WebCore::domWindowFromExecState):
1601         (WebCore::scriptExecutionContextFromExecState):
1602         * bindings/js/SerializedScriptValue.cpp:
1603         (WebCore::CloneSerializer::isArray):
1604         (WebCore::CloneSerializer::isMap):
1605         (WebCore::CloneSerializer::isSet):
1606         (WebCore::CloneSerializer::dumpArrayBufferView):
1607         (WebCore::CloneSerializer::dumpIfTerminal):
1608         (WebCore::CloneSerializer::serialize):
1609         (WebCore::CloneDeserializer::CloneDeserializer):
1610         (WebCore::CloneDeserializer::readArrayBufferView):
1611         (WebCore::CloneDeserializer::readTerminal):
1612         (WebCore::transferArrayBuffers):
1613         (WebCore::SerializedScriptValue::create):
1614         * bindings/js/StructuredClone.cpp:
1615         (WebCore::structuredCloneArrayBuffer):
1616         (WebCore::structuredCloneArrayBufferView):
1617         * bindings/js/WorkerScriptController.cpp:
1618         (WebCore::WorkerScriptController::evaluate):
1619         * bindings/scripts/CodeGeneratorJS.pm:
1620         (GenerateHeader):
1621         (GenerateOverloadedFunctionOrConstructor):
1622         (GenerateImplementation):
1623         * bindings/scripts/test/JS/JSInterfaceName.cpp:
1624         (WebCore::JSInterfaceName::finishCreation):
1625         (WebCore::jsInterfaceNameConstructor):
1626         (WebCore::setJSInterfaceNameConstructor):
1627         (WebCore::JSInterfaceName::toWrapped):
1628         * bindings/scripts/test/JS/JSInterfaceName.h:
1629         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
1630         (WebCore::JSTestActiveDOMObject::finishCreation):
1631         (WebCore::BindingCaller<JSTestActiveDOMObject>::castForAttribute):
1632         (WebCore::BindingCaller<JSTestActiveDOMObject>::castForOperation):
1633         (WebCore::jsTestActiveDOMObjectConstructor):
1634         (WebCore::setJSTestActiveDOMObjectConstructor):
1635         (WebCore::JSTestActiveDOMObject::toWrapped):
1636         * bindings/scripts/test/JS/JSTestActiveDOMObject.h:
1637         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
1638         (WebCore::JSTestCEReactions::finishCreation):
1639         (WebCore::BindingCaller<JSTestCEReactions>::castForAttribute):
1640         (WebCore::BindingCaller<JSTestCEReactions>::castForOperation):
1641         (WebCore::jsTestCEReactionsConstructor):
1642         (WebCore::setJSTestCEReactionsConstructor):
1643         (WebCore::JSTestCEReactions::toWrapped):
1644         * bindings/scripts/test/JS/JSTestCEReactions.h:
1645         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
1646         (WebCore::JSTestCEReactionsStringifier::finishCreation):
1647         (WebCore::BindingCaller<JSTestCEReactionsStringifier>::castForAttribute):
1648         (WebCore::BindingCaller<JSTestCEReactionsStringifier>::castForOperation):
1649         (WebCore::jsTestCEReactionsStringifierConstructor):
1650         (WebCore::setJSTestCEReactionsStringifierConstructor):
1651         (WebCore::JSTestCEReactionsStringifier::toWrapped):
1652         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.h:
1653         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
1654         (WebCore::JSTestClassWithJSBuiltinConstructor::finishCreation):
1655         (WebCore::jsTestClassWithJSBuiltinConstructorConstructor):
1656         (WebCore::setJSTestClassWithJSBuiltinConstructorConstructor):
1657         (WebCore::JSTestClassWithJSBuiltinConstructor::toWrapped):
1658         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.h:
1659         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
1660         (WebCore::JSTestCustomConstructorWithNoInterfaceObject::finishCreation):
1661         (WebCore::jsTestCustomConstructorWithNoInterfaceObjectConstructor):
1662         (WebCore::setJSTestCustomConstructorWithNoInterfaceObjectConstructor):
1663         (WebCore::JSTestCustomConstructorWithNoInterfaceObject::toWrapped):
1664         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.h:
1665         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
1666         (WebCore::JSTestCustomNamedGetter::finishCreation):
1667         (WebCore::BindingCaller<JSTestCustomNamedGetter>::castForOperation):
1668         (WebCore::jsTestCustomNamedGetterConstructor):
1669         (WebCore::setJSTestCustomNamedGetterConstructor):
1670         (WebCore::JSTestCustomNamedGetter::toWrapped):
1671         * bindings/scripts/test/JS/JSTestCustomNamedGetter.h:
1672         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
1673         (WebCore::JSTestDOMJIT::finishCreation):
1674         (WebCore::BindingCaller<JSTestDOMJIT>::castForAttribute):
1675         (WebCore::BindingCaller<JSTestDOMJIT>::castForOperation):
1676         (WebCore::jsTestDOMJITConstructor):
1677         (WebCore::setJSTestDOMJITConstructor):
1678         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
1679         (WebCore::JSTestEventConstructor::finishCreation):
1680         (WebCore::BindingCaller<JSTestEventConstructor>::castForAttribute):
1681         (WebCore::jsTestEventConstructorConstructor):
1682         (WebCore::setJSTestEventConstructorConstructor):
1683         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
1684         (WebCore::JSTestEventTarget::finishCreation):
1685         (WebCore::BindingCaller<JSTestEventTarget>::castForOperation):
1686         (WebCore::jsTestEventTargetConstructor):
1687         (WebCore::setJSTestEventTargetConstructor):
1688         (WebCore::JSTestEventTarget::toWrapped):
1689         * bindings/scripts/test/JS/JSTestEventTarget.h:
1690         * bindings/scripts/test/JS/JSTestException.cpp:
1691         (WebCore::JSTestException::finishCreation):
1692         (WebCore::BindingCaller<JSTestException>::castForAttribute):
1693         (WebCore::jsTestExceptionConstructor):
1694         (WebCore::setJSTestExceptionConstructor):
1695         (WebCore::JSTestException::toWrapped):
1696         * bindings/scripts/test/JS/JSTestException.h:
1697         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
1698         (WebCore::JSTestGenerateIsReachable::finishCreation):
1699         (WebCore::jsTestGenerateIsReachableConstructor):
1700         (WebCore::setJSTestGenerateIsReachableConstructor):
1701         (WebCore::JSTestGenerateIsReachable::toWrapped):
1702         * bindings/scripts/test/JS/JSTestGenerateIsReachable.h:
1703         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
1704         (WebCore::JSTestGlobalObject::finishCreation):
1705         (WebCore::BindingCaller<JSTestGlobalObject>::castForAttribute):
1706         (WebCore::BindingCaller<JSTestGlobalObject>::castForOperation):
1707         (WebCore::jsTestGlobalObjectConstructor):
1708         (WebCore::setJSTestGlobalObjectConstructor):
1709         (WebCore::JSTestGlobalObject::toWrapped):
1710         * bindings/scripts/test/JS/JSTestGlobalObject.h:
1711         * bindings/scripts/test/JS/JSTestInterface.cpp:
1712         (WebCore::JSTestInterface::finishCreation):
1713         (WebCore::BindingCaller<JSTestInterface>::castForAttribute):
1714         (WebCore::BindingCaller<JSTestInterface>::castForOperation):
1715         (WebCore::jsTestInterfaceConstructor):
1716         (WebCore::setJSTestInterfaceConstructor):
1717         (WebCore::JSTestInterface::toWrapped):
1718         * bindings/scripts/test/JS/JSTestInterface.h:
1719         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp:
1720         (WebCore::JSTestInterfaceLeadingUnderscore::finishCreation):
1721         (WebCore::BindingCaller<JSTestInterfaceLeadingUnderscore>::castForAttribute):
1722         (WebCore::jsTestInterfaceLeadingUnderscoreConstructor):
1723         (WebCore::setJSTestInterfaceLeadingUnderscoreConstructor):
1724         (WebCore::JSTestInterfaceLeadingUnderscore::toWrapped):
1725         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.h:
1726         * bindings/scripts/test/JS/JSTestIterable.cpp:
1727         (WebCore::JSTestIterable::finishCreation):
1728         (WebCore::BindingCaller<JSTestIterable>::castForOperation):
1729         (WebCore::jsTestIterableConstructor):
1730         (WebCore::setJSTestIterableConstructor):
1731         (WebCore::JSTestIterable::toWrapped):
1732         * bindings/scripts/test/JS/JSTestIterable.h:
1733         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
1734         (WebCore::JSTestJSBuiltinConstructor::finishCreation):
1735         (WebCore::BindingCaller<JSTestJSBuiltinConstructor>::castForAttribute):
1736         (WebCore::BindingCaller<JSTestJSBuiltinConstructor>::castForOperation):
1737         (WebCore::jsTestJSBuiltinConstructorConstructor):
1738         (WebCore::setJSTestJSBuiltinConstructorConstructor):
1739         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
1740         (WebCore::JSTestMediaQueryListListener::finishCreation):
1741         (WebCore::BindingCaller<JSTestMediaQueryListListener>::castForOperation):
1742         (WebCore::jsTestMediaQueryListListenerConstructor):
1743         (WebCore::setJSTestMediaQueryListListenerConstructor):
1744         (WebCore::JSTestMediaQueryListListener::toWrapped):
1745         * bindings/scripts/test/JS/JSTestMediaQueryListListener.h:
1746         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
1747         (WebCore::JSTestNamedConstructor::finishCreation):
1748         (WebCore::jsTestNamedConstructorConstructor):
1749         (WebCore::setJSTestNamedConstructorConstructor):
1750         (WebCore::JSTestNamedConstructor::toWrapped):
1751         * bindings/scripts/test/JS/JSTestNamedConstructor.h:
1752         * bindings/scripts/test/JS/JSTestNode.cpp:
1753         (WebCore::JSTestNode::finishCreation):
1754         (WebCore::BindingCaller<JSTestNode>::castForAttribute):
1755         (WebCore::BindingCaller<JSTestNode>::castForOperation):
1756         (WebCore::jsTestNodeConstructor):
1757         (WebCore::setJSTestNodeConstructor):
1758         * bindings/scripts/test/JS/JSTestObj.cpp:
1759         (WebCore::JSTestObj::finishCreation):
1760         (WebCore::BindingCaller<JSTestObj>::castForAttribute):
1761         (WebCore::BindingCaller<JSTestObj>::castForOperation):
1762         (WebCore::jsTestObjConstructor):
1763         (WebCore::setJSTestObjConstructor):
1764         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod):
1765         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter):
1766         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithDistinguishingUnion):
1767         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWith2DistinguishingUnions):
1768         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithNonDistinguishingUnion):
1769         (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableUnion):
1770         (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableNonDistinguishingParameter):
1771         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction):
1772         (WebCore::JSTestObj::toWrapped):
1773         * bindings/scripts/test/JS/JSTestObj.h:
1774         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
1775         (WebCore::JSTestOverloadedConstructorsConstructor::construct):
1776         (WebCore::JSTestOverloadedConstructors::finishCreation):
1777         (WebCore::jsTestOverloadedConstructorsConstructor):
1778         (WebCore::setJSTestOverloadedConstructorsConstructor):
1779         (WebCore::JSTestOverloadedConstructors::toWrapped):
1780         * bindings/scripts/test/JS/JSTestOverloadedConstructors.h:
1781         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
1782         (WebCore::JSTestOverloadedConstructorsWithSequence::finishCreation):
1783         (WebCore::jsTestOverloadedConstructorsWithSequenceConstructor):
1784         (WebCore::setJSTestOverloadedConstructorsWithSequenceConstructor):
1785         (WebCore::JSTestOverloadedConstructorsWithSequence::toWrapped):
1786         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.h:
1787         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
1788         (WebCore::JSTestOverrideBuiltins::finishCreation):
1789         (WebCore::BindingCaller<JSTestOverrideBuiltins>::castForOperation):
1790         (WebCore::jsTestOverrideBuiltinsConstructor):
1791         (WebCore::setJSTestOverrideBuiltinsConstructor):
1792         (WebCore::JSTestOverrideBuiltins::toWrapped):
1793         * bindings/scripts/test/JS/JSTestOverrideBuiltins.h:
1794         * bindings/scripts/test/JS/JSTestSerialization.cpp:
1795         (WebCore::JSTestSerialization::finishCreation):
1796         (WebCore::BindingCaller<JSTestSerialization>::castForAttribute):
1797         (WebCore::BindingCaller<JSTestSerialization>::castForOperation):
1798         (WebCore::jsTestSerializationConstructor):
1799         (WebCore::setJSTestSerializationConstructor):
1800         (WebCore::JSTestSerialization::toWrapped):
1801         * bindings/scripts/test/JS/JSTestSerialization.h:
1802         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
1803         (WebCore::JSTestSerializedScriptValueInterface::finishCreation):
1804         (WebCore::BindingCaller<JSTestSerializedScriptValueInterface>::castForAttribute):
1805         (WebCore::BindingCaller<JSTestSerializedScriptValueInterface>::castForOperation):
1806         (WebCore::jsTestSerializedScriptValueInterfaceConstructor):
1807         (WebCore::setJSTestSerializedScriptValueInterfaceConstructor):
1808         (WebCore::JSTestSerializedScriptValueInterface::toWrapped):
1809         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h:
1810         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
1811         (WebCore::JSTestTypedefs::finishCreation):
1812         (WebCore::BindingCaller<JSTestTypedefs>::castForAttribute):
1813         (WebCore::BindingCaller<JSTestTypedefs>::castForOperation):
1814         (WebCore::jsTestTypedefsConstructor):
1815         (WebCore::setJSTestTypedefsConstructor):
1816         (WebCore::JSTestTypedefs::toWrapped):
1817         * bindings/scripts/test/JS/JSTestTypedefs.h:
1818         * bridge/c/CRuntimeObject.cpp:
1819         (JSC::Bindings::CRuntimeObject::finishCreation):
1820         * bridge/c/c_instance.cpp:
1821         (JSC::Bindings::CRuntimeMethod::finishCreation):
1822         (JSC::Bindings::CInstance::invokeMethod):
1823         * bridge/c/c_utility.cpp:
1824         (JSC::Bindings::convertValueToNPVariant):
1825         * bridge/objc/ObjCRuntimeObject.mm:
1826         (JSC::Bindings::ObjCRuntimeObject::finishCreation):
1827         * bridge/objc/WebScriptObject.mm:
1828         (-[WebScriptObject setValue:forKey:]):
1829         (+[WebScriptObject _convertValueToObjcValue:originRootObject:rootObject:]):
1830         * bridge/objc/objc_instance.mm:
1831         (ObjCRuntimeMethod::finishCreation):
1832         (ObjcInstance::invokeMethod):
1833         * bridge/objc/objc_runtime.mm:
1834         (JSC::Bindings::ObjcFallbackObjectImp::finishCreation):
1835         (JSC::Bindings::callObjCFallbackObject):
1836         * bridge/runtime_array.cpp:
1837         (JSC::RuntimeArray::finishCreation):
1838         (JSC::RuntimeArray::lengthGetter):
1839         * bridge/runtime_method.cpp:
1840         (JSC::RuntimeMethod::finishCreation):
1841         (JSC::RuntimeMethod::lengthGetter):
1842         (JSC::callRuntimeMethod):
1843         * bridge/runtime_object.cpp:
1844         (JSC::Bindings::RuntimeObject::finishCreation):
1845         (JSC::Bindings::callRuntimeObject):
1846         (JSC::Bindings::callRuntimeConstructor):
1847         * css/FontFace.cpp:
1848         (WebCore::FontFace::create):
1849         * html/HTMLMediaElement.cpp:
1850         (WebCore::controllerJSValue):
1851         (WebCore::HTMLMediaElement::updateCaptionContainer):
1852         (WebCore::HTMLMediaElement::didAddUserAgentShadowRoot):
1853         * inspector/InspectorController.cpp:
1854         (WebCore::InspectorController::canAccessInspectedScriptState):
1855         * inspector/InspectorDOMAgent.cpp:
1856         (WebCore::InspectorDOMAgent::buildObjectForEventListener):
1857         (WebCore::InspectorDOMAgent::scriptValueAsNode):
1858         * inspector/WebInjectedScriptHost.cpp:
1859         (WebCore::WebInjectedScriptHost::subtype):
1860         (WebCore::WebInjectedScriptHost::isHTMLAllCollection):
1861         * inspector/WebInjectedScriptHost.h:
1862
1863 2017-01-26  Dean Jackson  <dino@apple.com>
1864
1865         WebGL content in Safari sticks to GPU that it was started on, sometimes causing extra battery drain and difficulty interacting with UI
1866         https://bugs.webkit.org/show_bug.cgi?id=167477
1867         <rdar://problem/29956321>
1868
1869         Reviewed by Tim Horton.
1870
1871         We were not implementing the recommended approach to properly handle
1872         GPU switching, causing some contexts to remain on a GPU and slow
1873         down the machine's UI. It also could stop the discrete GPU from
1874         turning off.
1875
1876         Register for CGL's display reconfiguration notification, so that we
1877         can alert any active CGLContexts and cause them to update.
1878
1879         The code change here doesn't lend itself to automated testing because
1880         it is specific to hardware with multiple GPUs, relies on some separate
1881         tools to detect which GPU is active, and an external method of triggering
1882         a GPU switch. It's best tested by the manual workflow in Radar.
1883
1884         * platform/graphics/GraphicsContext3D.h: Add a macOS-specific update
1885         call.
1886         * platform/graphics/mac/GraphicsContext3DMac.mm:
1887         (WebCore::displayWasReconfigured): The callback for display reconfigurations.
1888         (WebCore::addActiveContext): Helper to keep track of active contexts, so we
1889         can register/unregister the callback when necessary.
1890         (WebCore::removeActiveContext):
1891         (WebCore::GraphicsContext3D::create): Use the new helpers.
1892         (WebCore::GraphicsContext3D::~GraphicsContext3D):
1893         (WebCore::GraphicsContext3D::updateCGLContext): Tell the CGLContextRef to update.
1894
1895 2017-01-26  Commit Queue  <commit-queue@webkit.org>
1896
1897         Unreviewed, rolling out r210328.
1898         https://bugs.webkit.org/show_bug.cgi?id=167476
1899
1900         Blocking bug is fixed <rdar://problem/29957753> (Requested by
1901         keith_miller on #webkit).
1902
1903         Reverted changeset:
1904
1905         "Disable smooth playhead animation for main content media in
1906         the Touch Bar"
1907         https://bugs.webkit.org/show_bug.cgi?id=166715
1908         http://trac.webkit.org/changeset/210328
1909
1910 2017-01-26  Joseph Pecoraro  <pecoraro@apple.com>
1911
1912         Web Inspector: iOS: Memory timeline shows impossible values for Page size (underflowed)
1913         https://bugs.webkit.org/show_bug.cgi?id=167468
1914         <rdar://problem/30099051>
1915
1916         Reviewed by Andreas Kling.
1917
1918         * page/cocoa/ResourceUsageThreadCocoa.mm:
1919         (WebCore::vmPageSize):
1920         This value matches the sysctl value we were attempting to access, and is
1921         the most appropriate when dealing with mach APIs, as we are using here.
1922
1923 2017-01-26  Jer Noble  <jer.noble@apple.com>
1924
1925         Autoplay muted videos stop playback of any streaming app in the background
1926         https://bugs.webkit.org/show_bug.cgi?id=163993
1927         <rdar://problem/29020431>
1928
1929         Reviewed by Eric Carlson.
1930
1931         Added test in TestWebKitAPI, WebKit1.AudioSessionCategoryIOS.
1932
1933         Previously, we would set the audio session category to "playback" if there was a media-
1934         element-type media session, and if there was a session capable of playing audio. But because
1935         this was an "or" operation, we would incorrectly set the category to "playback" if there was
1936         a video element incapable of rendering audio (due to being muted, without an audio track,
1937         etc.), and also a session capable of producing audio, such as WebAudio.
1938
1939         With this change, this turns into an "and" operation; there must be a media element capable
1940         of rendering audio in order to switch the audio session category to "playback".
1941
1942         Additionally, we no longer cache the value of "canProduceAudio()"; it's queried directly
1943         whenever updateSessionState() is called.
1944
1945         * Modules/webaudio/AudioContext.cpp:
1946         (WebCore::AudioContext::constructCommon):
1947         * Modules/webaudio/AudioContext.h:
1948         * html/HTMLMediaElement.cpp:
1949         (WebCore::HTMLMediaElement::insertedInto):
1950         (WebCore::HTMLMediaElement::loadResource):
1951         (WebCore::HTMLMediaElement::setMuted):
1952         (WebCore::HTMLMediaElement::mediaPlayerCurrentPlaybackTargetIsWirelessChanged):
1953         (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged):
1954         (WebCore::HTMLMediaElement::clearMediaPlayer):
1955         (WebCore::HTMLMediaElement::mediaPlayerCurrentPlaybackTargetIsWirelessChanged):
1956         (WebCore::HTMLMediaElement::presentationType):
1957         (WebCore::HTMLMediaElement::characteristics):
1958         (WebCore::HTMLMediaElement::canProduceAudio):
1959         * html/HTMLMediaElement.h:
1960         * platform/audio/PlatformMediaSession.cpp:
1961         (WebCore::PlatformMediaSession::activeAudioSessionRequired):
1962         (WebCore::PlatformMediaSession::canProduceAudio):
1963         (WebCore::PlatformMediaSession::canProduceAudioChanged):
1964         (WebCore::PlatformMediaSession::setCanProduceAudio): Deleted.
1965         * platform/audio/PlatformMediaSession.h:
1966         (WebCore::PlatformMediaSessionClient::canProduceAudio):
1967         (WebCore::PlatformMediaSession::canProduceAudio): Deleted.
1968         * platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
1969         (PlatformMediaSessionManager::updateSessionState):
1970
1971 2017-01-26  Filip Pizlo  <fpizlo@apple.com>
1972
1973         EventTarget should visit the JSEventListeners using visitAdditionalChildren
1974         https://bugs.webkit.org/show_bug.cgi?id=167462
1975
1976         Reviewed by Michael Saboff.
1977
1978         No new tests because this is already caught by existing testing. This would show up as ASSERTs
1979         in debug, and we suspect it might be at fault for null deref crashes.
1980         
1981         Previously, EventTarget would have its event listeners visited by its subclasses' visitChildren
1982         methods. Every subclass of EventTarget would call EventTarget's visitJSEventListeners. For
1983         example, this means that if JSFoo has seven classes between it and JSEventTarget in the JSCell
1984         class hierarchy, then JSFoo::visitChildren would end up calling visitJSEventListeners seven extra
1985         times.
1986         
1987         Also, the weird way that visitJSEventListeners was called meant that it was not part of the GC's
1988         output constraint processing. This meant that it would not be called when the GC tried to
1989         terminate. So, if something about the event listener changes during a GC cycle, the GC would
1990         potentially fail to mark one of the references.
1991         
1992         Both problems can be solved by simply moving the call to visitJSEventListeners into
1993         visitAdditionalChildren.
1994
1995         * bindings/js/JSDOMWindowCustom.cpp:
1996         (WebCore::JSDOMWindow::visitAdditionalChildren):
1997         * bindings/js/JSEventTargetCustom.cpp:
1998         (WebCore::JSEventTarget::visitAdditionalChildren):
1999         * bindings/scripts/CodeGeneratorJS.pm:
2000         (GenerateImplementation):
2001         * dom/EventTarget.idl:
2002
2003 2017-01-26  Andy Estes  <aestes@apple.com>
2004
2005         [QuickLook] Create temporary files with NSFileProtectionCompleteUnlessOpen
2006         https://bugs.webkit.org/show_bug.cgi?id=167455
2007         <rdar://problem/12499118>
2008
2009         Reviewed by David Kilzer.
2010
2011         Add the NSFileProtectionKey attribute with value NSFileProtectionCompleteUnlessOpen to
2012         temporary directories created for QuickLook files. Also:
2013
2014         1. Stop calling -[NSFileManager _web_pathWithUniqueFilenameForPath:], since the temporary
2015         directory is already unique and only one file will be placed inside it.
2016         2. Create the temporary file with -[NSFileManager _web_createFileAtPath:contents:attributes:]
2017         instead of with -[NSFileManager _web_createFileAtPathWithIntermediateDirectories:contents:attributes:directoryAttributes:],
2018         since the intermediate directories were already created by createTemporaryDirectory().
2019         3. Explicitly set the temporary directory's attributes with
2020         -[NSFileManager setAttributes:ofItemAtPath:error:].
2021         4. Append the lastPathComponent of fileName to downloadDirectory to ensure fileName isn't
2022         really a relative path.
2023
2024         * loader/ios/QuickLook.h: Stopped declaring QLFileAttributes() and QLDirectoryAttributes().
2025         * loader/ios/QuickLook.mm:
2026         (WebCore::temporaryFileAttributes): Renamed from QLFileAttributes().
2027         (WebCore::temporaryDirectoryAttributes): Renamed from QLDirectoryAttributes().
2028         (WebCore::createTemporaryFileForQuickLook):
2029         (WebCore::QLFileAttributes): Deleted.
2030         (WebCore::QLDirectoryAttributes): Deleted.
2031         * platform/spi/cocoa/NSFileManagerSPI.h: Declared -_web_createFileAtPath:contents:attributes:
2032         and removed declarations for -_web_createFileAtPathWithIntermediateDirectories:contents:attributes:directoryAttributes:
2033         and -_web_pathWithUniqueFilenameForPath:
2034
2035 2017-01-26  Jeremy Jones  <jeremyj@apple.com>
2036
2037         Pointer lock events should be delivered directly to the target element
2038         https://bugs.webkit.org/show_bug.cgi?id=167134
2039
2040         Reviewed by Jon Lee.
2041
2042         pointer-lock/mouse-event-delivery.html: Enabled for mac, added wheel event tests.
2043
2044         When pointer is locked on an element, route mouse events directly to the target element, instead of 
2045         doing the normal event disptach.
2046
2047         * page/EventHandler.cpp:
2048         (WebCore::EventHandler::handleMousePressEvent):
2049         (WebCore::EventHandler::handleMouseDoubleClickEvent):
2050         (WebCore::EventHandler::handleMouseMoveEvent):
2051         (WebCore::EventHandler::handleMouseReleaseEvent):
2052         (WebCore::EventHandler::handleMouseForceEvent):
2053         (WebCore::EventHandler::handleWheelEvent):
2054         * page/PointerLockController.cpp:
2055         (WebCore::PointerLockController::isLocked): Added.
2056         (WebCore::PointerLockController::dispatchLockedWheelEvent): Added.
2057         * page/PointerLockController.h:
2058
2059 2017-01-26  Chris Dumez  <cdumez@apple.com>
2060
2061         Fix CPU / Memory diagnostic logging in PerformanceMonitor
2062         https://bugs.webkit.org/show_bug.cgi?id=167469
2063         <rdar://problem/30220959>
2064
2065         Reviewed by Alex Christensen.
2066
2067         Fix CPU / Memory diagnostic logging in PerformanceMonitor to use logDiagnosticMessage()
2068         instead of logDiagnosticMessageWithValue(). logDiagnosticMessageWithValue() should only
2069         be used with numeric values but we already take care of the bucketing on our side.
2070
2071         * page/DiagnosticLoggingClient.h:
2072         * page/DiagnosticLoggingKeys.cpp:
2073         (WebCore::DiagnosticLoggingKeys::postPageBackgroundingCPUUsageKey):
2074         (WebCore::DiagnosticLoggingKeys::postPageBackgroundingMemoryUsageKey):
2075         (WebCore::DiagnosticLoggingKeys::postPageLoadCPUUsageKey):
2076         (WebCore::DiagnosticLoggingKeys::postPageLoadMemoryUsageKey):
2077         (WebCore::DiagnosticLoggingKeys::foregroundCPUUsageToDiagnosticLoggingKey):
2078         (WebCore::DiagnosticLoggingKeys::backgroundCPUUsageToDiagnosticLoggingKey):
2079         (WebCore::DiagnosticLoggingKeys::postPageBackgroundingKey): Deleted.
2080         (WebCore::DiagnosticLoggingKeys::postPageLoadKey): Deleted.
2081         (WebCore::DiagnosticLoggingKeys::memoryUsageKey): Deleted.
2082         * page/DiagnosticLoggingKeys.h:
2083         * page/PerformanceMonitor.cpp:
2084         (WebCore::PerformanceMonitor::measurePostLoadCPUUsage):
2085         (WebCore::PerformanceMonitor::measurePostLoadMemoryUsage):
2086         (WebCore::PerformanceMonitor::measurePostBackgroundingMemoryUsage):
2087         (WebCore::PerformanceMonitor::measurePostBackgroundingCPUUsage):
2088
2089 2017-01-26  Brady Eidson  <beidson@apple.com>
2090
2091         Gamepads: Some DPads are still not exposed in the HID backend.
2092         rdar://problem/30217518 and https://bugs.webkit.org/show_bug.cgi?id=167465
2093
2094         Reviewed by Alex Christensen.
2095
2096         No new tests (Currently unable to test HID backend directly)
2097
2098         * platform/gamepad/mac/HIDGamepad.cpp:
2099         (WebCore::HIDGamepad::maybeAddButton): Allow GenericDesktop paged elements that are DPads to be buttons.
2100
2101 2017-01-26  Commit Queue  <commit-queue@webkit.org>
2102
2103         Unreviewed, rolling out r210095.
2104         https://bugs.webkit.org/show_bug.cgi?id=167464
2105
2106         broke tiling on mac (Requested by thorton on #webkit).
2107
2108         Reverted changeset:
2109
2110         "TileGrid revalidates tiles twice during flush, first with
2111         wrong visible rect"
2112         https://bugs.webkit.org/show_bug.cgi?id=166406
2113         http://trac.webkit.org/changeset/210095
2114
2115 2017-01-26  Chris Dumez  <cdumez@apple.com>
2116
2117         Fix WebGL diagnostic logging
2118         https://bugs.webkit.org/show_bug.cgi?id=167463
2119         <rdar://problem/30216981>
2120
2121         Reviewed by Alex Christensen.
2122
2123         Fix WebGL diagnostic logging so that it no longer uses logDiagnosticMessageWithValue().
2124         This is because the value apparently needs to be numeric on Mac.
2125
2126         * html/canvas/WebGLRenderingContextBase.cpp:
2127         (WebCore::WebGLRenderingContextBase::checkForContextLossHandling):
2128         * page/DiagnosticLoggingKeys.cpp:
2129         (WebCore::DiagnosticLoggingKeys::pageHandlesWebGLContextLossKey):
2130         (WebCore::WebCore::DiagnosticLoggingKeys::webGLStateKey):
2131         (WebCore::DiagnosticLoggingKeys::stateKey): Deleted.
2132         (WebCore::DiagnosticLoggingKeys::handlesContextLossKey): Deleted.
2133         (WebCore::WebCore::DiagnosticLoggingKeys::webGLKey): Deleted.
2134         * page/DiagnosticLoggingKeys.h:
2135
2136 2017-01-26  Zalan Bujtas  <zalan@apple.com>
2137
2138         Simple line layout: Add support for -webkit-hyphenate-limit-lines
2139         https://bugs.webkit.org/show_bug.cgi?id=167446
2140         <rdar://problem/30194030>
2141
2142         Reviewed by Antti Koivisto.
2143
2144         Now we can set the limit on the number of lines that a word can split across through hyphenation.
2145
2146         Tests: fast/text/simple-line-layout-hyphen-limit-lines.html
2147                fast/text/simple-line-layout-hyphen-limit-lines2.html
2148
2149         * rendering/SimpleLineLayout.cpp:
2150         (WebCore::SimpleLineLayout::canUseForStyle):
2151         (WebCore::SimpleLineLayout::splitFragmentToFitLine):
2152         (WebCore::SimpleLineLayout::printReason):
2153         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
2154         (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style):
2155         * rendering/SimpleLineLayoutTextFragmentIterator.h:
2156         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::TextFragment):
2157         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::wrappingWithHyphenCounter):
2158         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::splitWithHyphen): The right side of the split has +1 on the wrapping counter.
2159
2160 2017-01-26  Wenson Hsieh  <wenson_hsieh@apple.com>
2161
2162         Add support for recognizing data interaction gestures in WebKit2
2163         https://bugs.webkit.org/show_bug.cgi?id=167444
2164
2165         Reviewed by Beth Dakin.
2166
2167         Minor tweaks to pasteboard code to support data interaction.
2168
2169         * WebCore.xcodeproj/project.pbxproj:
2170         * platform/PlatformPasteboard.h:
2171         * platform/ios/PasteboardIOS.mm:
2172         (WebCore::Pasteboard::read):
2173         * platform/ios/PlatformPasteboardIOS.mm:
2174         (WebCore::PlatformPasteboard::PlatformPasteboard):
2175
2176         If the pasteboard is the special data interaction type, use the shared item provider pasteboard; otherwise,
2177         fall back to the general pasteboard.
2178
2179         (WebCore::PlatformPasteboard::getTypes):
2180
2181         Actually populate the list of available types using available pasteboardTypes.
2182
2183         (WebCore::PlatformPasteboard::write):
2184
2185         Add UTF8 plaintext type (kUTTypeUTF8PlainText) when vending data representations of rich text.
2186
2187         * platform/ios/WebItemProviderPasteboard.mm:
2188         (-[WebItemProviderPasteboard setItems:]):
2189         (-[WebItemProviderPasteboard dataForPasteboardType:inItemSet:]):
2190         (-[WebItemProviderPasteboard valuesForPasteboardType:inItemSet:]):
2191
2192         Move off of deprecated methods when retrieving and supplying data to the item provider pasteboard.
2193
2194         * platform/spi/ios/UIKitSPI.h:
2195
2196 2017-01-26  Matt Rajca  <mrajca@apple.com>
2197
2198         Notify clients when the user plays media otherwise prevented from autoplaying
2199         https://bugs.webkit.org/show_bug.cgi?id=167390
2200
2201         Reviewed by Alex Christensen.
2202
2203         The API is tested.
2204
2205         * html/HTMLMediaElement.cpp:
2206         (WebCore::HTMLMediaElement::playInternal):
2207         * page/ChromeClient.h:
2208
2209 2017-01-26  Enrique Ocaña González  <eocanha@igalia.com>
2210
2211         [GStreamer] ASSERTION FAILED: !g_object_is_floating(ptr) in adoptGRef(GstContext* ptr)
2212         https://bugs.webkit.org/show_bug.cgi?id=167458
2213
2214         Reviewed by Xabier Rodriguez-Calvar.
2215
2216         GstContext is a mini_object, not a GObject. Therefore it shouldn't (and can't) be checked for floatingness.
2217
2218         * platform/graphics/gstreamer/GRefPtrGStreamer.cpp:
2219         (WTF::adoptGRef): Removed incorrect assertion.
2220
2221 2017-01-26  Zalan Bujtas  <zalan@apple.com>
2222
2223         Simple line layout: Add support for -webkit-hyphenate-limit-after and -webkit-hyphenate-limit-before
2224         https://bugs.webkit.org/show_bug.cgi?id=167439
2225         <rdar://problem/30180184>
2226
2227         Reviewed by Antti Koivisto.
2228
2229         Implement pre and post hyphen length constrains for simple line layout.
2230
2231         Tests: fast/text/simple-line-layout-hyphen-limit-after.html
2232                fast/text/simple-line-layout-hyphen-limit-before.html
2233
2234         * rendering/SimpleLineLayout.cpp:
2235         (WebCore::SimpleLineLayout::canUseForStyle):
2236         (WebCore::SimpleLineLayout::printReason):
2237         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
2238         (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style): Same as normal line layout default values.
2239         (WebCore::SimpleLineLayout::TextFragmentIterator::lastHyphenPosition):
2240         * rendering/SimpleLineLayoutTextFragmentIterator.h:
2241
2242 2017-01-26  Brady Eidson  <beidson@apple.com>
2243
2244         Gamepad support shows wrong values for PS4 controllers (D-pad is missing).
2245         <rdar://problem/29578619> and https://bugs.webkit.org/show_bug.cgi?id=165588
2246
2247         Reviewed by Alex Christensen.
2248
2249         No new tests (Currently unable to test HID backend directly)
2250
2251         DPads report their HID type as "a button", but their HID usage is "Hatswitch".
2252         This patch adds a new element type that maps a "hatswitch" value to 4 additional buttons.
2253         
2254         * platform/gamepad/mac/HIDGamepad.cpp:
2255         (WebCore::HIDGamepad::initElements):
2256         (WebCore::HIDGamepad::initElementsFromArray):
2257         (WebCore::HIDGamepad::maybeAddButton):
2258         (WebCore::HIDGamepad::maybeAddDPad):
2259         (WebCore::HIDGamepad::maybeAddAxis):
2260         (WebCore::fillInButtonValues):
2261         (WebCore::HIDGamepad::valueChanged):
2262
2263         * platform/gamepad/mac/HIDGamepad.h:
2264         (WebCore::HIDGamepadElement::isDPad):
2265         (WebCore::HIDGamepadDPad::HIDGamepadDPad):
2266         (WebCore::HIDGamepadDPad::normalizedValue):
2267
2268 2017-01-26  Antoine Quint  <graouts@apple.com>
2269
2270         [Modern Media Controls] Hiding controls, changing their width and showing them again shows an incorrect layout
2271         https://bugs.webkit.org/show_bug.cgi?id=167160
2272         <rdar://problem/29612318>
2273
2274         Reviewed by Dean Jackson.
2275
2276         When we toggle visibility of the controls bar, we notify the hosting media controls and in the case of the
2277         macOS inline media controls, we update the controls layout which would have failed to run last time it tried
2278         due to the controls bar being hidden.
2279
2280         Test: media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-resize-with-hidden-controls-bar.html
2281
2282         * Modules/modern-media-controls/controls/controls-bar.js:
2283         (ControlsBar.prototype.set visible):
2284         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
2285         (MacOSInlineMediaControls.prototype.controlsBarVisibilityDidChange):
2286         * Modules/modern-media-controls/controls/media-controls.js:
2287         (MediaControls.prototype.controlsBarVisibilityDidChange):
2288
2289 2017-01-26  Csaba Osztrogonác  <ossy@webkit.org>
2290
2291         [Mac][cmake] Unreviewed speculative buildfix after r211161.
2292         https://bugs.webkit.org/show_bug.cgi?id=167294
2293
2294         * PlatformMac.cmake:
2295
2296 2017-01-26  Zan Dobersek  <zdobersek@igalia.com>
2297
2298         ImageBufferCairo: cairo_image_surface should use bmalloc-allocated memory
2299         https://bugs.webkit.org/show_bug.cgi?id=165751
2300
2301         Reviewed by Carlos Garcia Campos.
2302
2303         Allocate the underlying memory for cairo_image_surface objects through FastMalloc.
2304         This way we can steer such large allocations away from the default libc allocator.
2305
2306         Objects of this class can create Cairo surfaces that need as much as 4MB of memory
2307         for the underlying pixel buffer. Allocating such objects through the default
2308         libc allocator can lead to increased memory usage because of non-optimal allocation
2309         strategy in libc. In contrast, bmalloc performs large allocations by directly using
2310         mmap() to reserve the necessary memory.
2311
2312         The improvements can be significant. On nytimes.com, with the threaded version of
2313         the CoordinatedGraphics system, the memory consumption can drop by roughly 20%.
2314
2315         * platform/graphics/cairo/ImageBufferCairo.cpp:
2316         (WebCore::ImageBuffer::ImageBuffer): Zero-allocate the necessary memory via FastMalloc.
2317         Tie that memory lifetime to the lifetime of the surface by using
2318         cairo_surface_set_user_data() with the specific user data key.
2319
2320 2017-01-26  Miguel Gomez  <magomez@igalia.com>
2321
2322         [GTK] WebProcess from WebKitGtk+ 2.15.3 SIGSEVs in WebCore::GraphicsContext3D::drawArrays(unsigned int, int, int) at Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:740
2323         https://bugs.webkit.org/show_bug.cgi?id=167296
2324
2325         Reviewed by Sergio Villar Senin.
2326
2327         Use a VBO to pass the vertex data when using the stencil for clipping. Passing a custom array without
2328         using an VBO is deprecated when using OpenGL >= 3.0 and a Core profile.
2329
2330         No behaviour change, no new tests.
2331
2332         * platform/graphics/texmap/TextureMapperGL.cpp:
2333         (WebCore::TextureMapperGL::beginClip):
2334
2335 2017-01-25  Ryosuke Niwa  <rniwa@webkit.org>
2336
2337         Crash under DOMSelection::deleteFromDocument()
2338         https://bugs.webkit.org/show_bug.cgi?id=167232
2339
2340         Reviewed by Chris Dumez.
2341
2342         The crash was caused by DOMSelection's deleteFromDocument() mutating contents inside the user-agent
2343         shadow tree of an input element when the text field is readonly. Fixed the bug by exiting early
2344         whenever the selection is inside a shadow tree since getSelection().getRangeAt(0) always returns
2345         a range outside the input element or any shadow tree for that matter.
2346
2347         New behavior matches that of Gecko. The working draft spec of which I'm the editor states that
2348         deleteFromDocument() must invoke Range's deleteContents() on the associated range, which is
2349         the collapsed range returned by getSelection().getRangeAt(0) in the spec:
2350         https://www.w3.org/TR/2016/WD-selection-api-20160921/#widl-Selection-deleteFromDocument-void
2351         And Range's deleteContents() immediately terminates in step 1 when start and end are identical:
2352         https://dom.spec.whatwg.org/commit-snapshots/6b7621282c2e3b222ac585650e484abf4c0a416b/
2353
2354         Note that Range's DOM mutating methods are not available inside an user-agent shadow tree because
2355         WebKit never returns a Range whose end boundary points are inside the tree to author scripts.
2356         Editing commands (ones executable from document.execCommand) that mutate DOM like this check whether
2357         the content is editable or not. Since VisibleSelection's validate() function makes sure the selection
2358         is either entirely within or outside of an root editable element (editing host in the W3C spec lingo),
2359         editing commands should never mutate a random node inside an user-agent shadow tree.
2360
2361         Test: editing/selection/deleteFromDocument-shadow-tree-crash.html
2362
2363         * page/DOMSelection.cpp:
2364         (WebCore::DOMSelection::deleteFromDocument):
2365
2366 2017-01-25  Ryan Haddad  <ryanhaddad@apple.com>
2367
2368         Unreviewed, rolling out r211193.
2369
2370         This change broke internal builds.
2371
2372         Reverted changeset:
2373
2374         "Notify clients when the user plays media otherwise prevented
2375         from autoplaying"
2376         https://bugs.webkit.org/show_bug.cgi?id=167390
2377         http://trac.webkit.org/changeset/211193
2378
2379 2017-01-25  Wenson Hsieh  <wenson_hsieh@apple.com>
2380
2381         Add infrastructure to support data interaction in WebKit2
2382         https://bugs.webkit.org/show_bug.cgi?id=167443
2383
2384         Reviewed by Simon Fraser.
2385
2386         Adds support in WebCore to determine whether there is interactive data at a given position. No new tests, since
2387         there should be no behavior change yet.
2388
2389         * page/EventHandler.h:
2390         * page/Page.cpp:
2391         (WebCore::Page::hasDataInteractionAtPosition):
2392         * page/Page.h:
2393
2394 2017-01-25  Matt Rajca  <mrajca@apple.com>
2395
2396         Notify clients when the user plays media otherwise prevented from autoplaying
2397         https://bugs.webkit.org/show_bug.cgi?id=167390
2398
2399         Reviewed by Alex Christensen.
2400
2401         The API is tested.
2402
2403         * html/HTMLMediaElement.cpp:
2404         (WebCore::HTMLMediaElement::playInternal):
2405         * page/ChromeClient.h:
2406
2407 2017-01-25  Wenson Hsieh  <wenson_hsieh@apple.com>
2408
2409         Refactor drag and drop implementation on Mac
2410         https://bugs.webkit.org/show_bug.cgi?id=167427
2411
2412         Reviewed by Enrica Casucci.
2413
2414         Refactors some code around drag and drop on Mac, and cleans up some other related code as needed. This patch
2415         should result in no behavior change.
2416
2417         * dom/DataTransfer.cpp:
2418         * page/EventHandler.cpp:
2419         * page/ios/EventHandlerIOS.mm:
2420         (WebCore::EventHandler::eventLoopHandleMouseDragged):
2421         * page/mac/EventHandlerMac.mm:
2422         * platform/DragImage.cpp:
2423         * platform/Pasteboard.h:
2424         * platform/ios/DragImageIOS.mm:
2425         * platform/ios/PasteboardIOS.mm:
2426         * platform/mac/DragDataMac.mm:
2427         (rtfPasteboardType):
2428         (rtfdPasteboardType):
2429         (stringPasteboardType):
2430         (urlPasteboardType):
2431         (htmlPasteboardType):
2432         (colorPasteboardType):
2433         (pdfPasteboardType):
2434         (tiffPasteboardType):
2435         (WebCore::DragData::DragData):
2436         (WebCore::DragData::containsColor):
2437         (WebCore::DragData::containsFiles):
2438         (WebCore::DragData::numberOfFiles):
2439         (WebCore::DragData::asFilenames):
2440         (WebCore::DragData::containsPlainText):
2441         (WebCore::DragData::containsCompatibleContent):
2442         (WebCore::DragData::containsPromise):
2443         (WebCore::DragData::asURL):
2444         * platform/mac/DragImageMac.mm:
2445
2446 2017-01-25  Youenn Fablet  <youenn@apple.com>
2447
2448         [WebRTC] Add support for incoming and outgoing libwebrtc audio tracks
2449         https://bugs.webkit.org/show_bug.cgi?id=167438
2450
2451         Reviewed by Eric Carlson.
2452
2453         RealtimeIncomingAudioSource consumes audio buffers given by libwebrtc.
2454         RealtimeOutgoingAudioSource consumes audio buffers from WebCore tracks (capture typically) and feeds libwebrtc with them.
2455         To be covered by Layout/mock tests once LibWebRTC peer connection will be added.
2456         These are only skeletons right now, the conversion between WebCore and LibWebRTC data is not yet implemented.
2457
2458         * WebCore.xcodeproj/project.pbxproj:
2459         * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp: Added.
2460         (WebCore::RealtimeIncomingAudioSource::create):
2461         (WebCore::RealtimeIncomingAudioSource::RealtimeIncomingAudioSource):
2462         (WebCore::RealtimeIncomingAudioSource::OnData):
2463         (WebCore::RealtimeIncomingAudioSource::startProducingData):
2464         (WebCore::RealtimeIncomingAudioSource::stopProducingData):
2465         (WebCore::RealtimeIncomingAudioSource::capabilities):
2466         (WebCore::RealtimeIncomingAudioSource::settings):
2467         (WebCore::RealtimeIncomingAudioSource::supportedConstraints):
2468         (WebCore::RealtimeIncomingAudioSource::addObserver):
2469         (WebCore::RealtimeIncomingAudioSource::removeObserver):
2470         (WebCore::RealtimeIncomingAudioSource::start):
2471         (WebCore::RealtimeIncomingAudioSource::audioSourceProvider):
2472         * platform/mediastream/mac/RealtimeIncomingAudioSource.h: Added.
2473         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp: Added.
2474         (WebCore::RealtimeOutgoingAudioSource::sourceHasMoreMediaData):
2475         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h: Added.
2476
2477 2017-01-25  Youenn Fablet  <youenn@apple.com>
2478
2479         [WebRTC] Add support for libwebrtc video incoming and outgoing video tracks
2480         https://bugs.webkit.org/show_bug.cgi?id=167432
2481
2482         Reviewed by Eric Carlson.
2483
2484         Not covered by tests right now, this will be covered by layout/mock tests.
2485         RealtimeIncomingVideoSource consumes video frames given by libwebrtc.
2486         RealtimeOutgoingVideoSource consumes video frames from WebCore tracks (capture typically) and feeds libwebrtc with them.
2487
2488         * platform/mediastream/mac/RealtimeIncomingVideoSource.cpp: Added.
2489         (WebCore::RealtimeIncomingVideoSource::create):
2490         (WebCore::RealtimeIncomingVideoSource::RealtimeIncomingVideoSource):
2491         (WebCore::RealtimeIncomingVideoSource::startProducingData):
2492         (WebCore::RealtimeIncomingVideoSource::stopProducingData):
2493         (WebCore::RealtimeIncomingVideoSource::OnFrame):
2494         (WebCore::RealtimeIncomingVideoSource::processNewSample):
2495         (WebCore::drawImage):
2496         (WebCore::RealtimeIncomingVideoSource::currentFrameImage):
2497         (WebCore::RealtimeIncomingVideoSource::paintCurrentFrameInContext):
2498         (WebCore::RealtimeIncomingVideoSource::capabilities):
2499         (WebCore::RealtimeIncomingVideoSource::settings):
2500         (WebCore::RealtimeIncomingVideoSource::supportedConstraints):
2501         * platform/mediastream/mac/RealtimeIncomingVideoSource.h: Added.
2502         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp: Added.
2503         (WebCore::RealtimeOutgoingVideoSource::RealtimeOutgoingVideoSource):
2504         (WebCore::RealtimeOutgoingVideoSource::GetStats):
2505         (WebCore::RealtimeOutgoingVideoSource::AddOrUpdateSink):
2506         (WebCore::RealtimeOutgoingVideoSource::RemoveSink):
2507         (WebCore::RealtimeOutgoingVideoSource::sourceHasMoreMediaData):
2508         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h: Added.
2509
2510 2017-01-25  Wenson Hsieh  <wenson_hsieh@apple.com>
2511
2512         Introduce an item-provider-based pasteboard wrapper
2513         https://bugs.webkit.org/show_bug.cgi?id=167410
2514
2515         Reviewed by Enrica Casucci.
2516
2517         Introduces WebItemProviderPasteboard, a pasteboard-like object backed by a number of item providers. No new
2518         tests, since there is no behavior change.
2519
2520         * WebCore.xcodeproj/project.pbxproj:
2521         * platform/ios/AbstractPasteboard.h: Copied from Source/WebCore/platform/spi/ios/UIKitSPI.h.
2522         * platform/ios/WebItemProviderPasteboard.h: Copied from Source/WebCore/platform/spi/ios/UIKitSPI.h.
2523         * platform/ios/WebItemProviderPasteboard.mm: Added.
2524         (isRichTextType):
2525         (isStringType):
2526         (isURLType):
2527         (isColorType):
2528         (isImageType):
2529         (+[WebItemProviderPasteboard sharedInstance]):
2530         (-[WebItemProviderPasteboard init]):
2531         (-[WebItemProviderPasteboard dealloc]):
2532         (-[WebItemProviderPasteboard pasteboardTypes]):
2533         (-[WebItemProviderPasteboard setItemProviders:]):
2534         (-[WebItemProviderPasteboard numberOfItems]):
2535         (-[WebItemProviderPasteboard setItems:]):
2536         (-[WebItemProviderPasteboard dataForPasteboardType:inItemSet:]):
2537         (-[WebItemProviderPasteboard valuesForPasteboardType:inItemSet:]):
2538         (-[WebItemProviderPasteboard changeCount]):
2539         (-[WebItemProviderPasteboard itemProviderAtIndex:]):
2540         * platform/spi/ios/UIKitSPI.h:
2541
2542 2017-01-25  Konstantin Tokarev  <annulen@yandex.ru>
2543
2544         Removed leftovers of pre-2015 VisualStudio support
2545         https://bugs.webkit.org/show_bug.cgi?id=167434
2546
2547         Reviewed by Alex Christensen.
2548
2549         No new tests needed.
2550
2551         * platform/graphics/filters/FEConvolveMatrix.cpp: Replaced MSC_VER
2552         usage with COMPILER(MSVC)
2553
2554 2017-01-25  Youenn Fablet  <youenn@apple.com>
2555
2556         Fixing typos in r211161
2557         https://bugs.webkit.org/show_bug.cgi?id=167433
2558
2559         Reviewed by Alex Christensen.
2560
2561         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
2562
2563 2017-01-25  Simon Fraser  <simon.fraser@apple.com>
2564
2565         Revert r210882, removing support for background-repeat-x/y
2566         https://bugs.webkit.org/show_bug.cgi?id=167223
2567
2568         Reviewed by Myles C. Maxfield.
2569         
2570         Followup from r211149; I missed part of the patch when committing.
2571
2572         * css/parser/CSSParserFastPaths.cpp:
2573         (WebCore::CSSParserFastPaths::isKeywordPropertyID):
2574
2575 2017-01-25  Youenn Fablet  <youennf@gmail.com>
2576
2577         [WebRTC] Introduce libwebrtc abstraction for WK1/WK2 implementations
2578         https://bugs.webkit.org/show_bug.cgi?id=167294
2579
2580         Reviewed by Alex Christensen.
2581
2582         Introducing LibWebRTCMacros.h which should be included before any libwebrtc header.
2583
2584         Introducing LibWebRTCProvider as the abstraction allowing to suport WK1 and WK2 libwebrtc-based WebRTC endpoints.
2585         It  will create a libwebrtc peerconnection object differently in WK1 and WK2 as networking will be done differently.
2586
2587         LibWebRTCUtils contains routines used by WK1 and WK2 RTC providers to create the libwebrtc peerconnection object
2588         and implement the necessary functionalities for it.
2589
2590         Updating PageConfiguration accordingly.
2591
2592         * WebCore.xcodeproj/project.pbxproj:
2593         * page/Page.cpp:
2594         (WebCore::Page::Page):
2595         * page/Page.h:
2596         (WebCore::Page::libWebRTCProvider):
2597         * page/PageConfiguration.cpp:
2598         (WebCore::PageConfiguration::PageConfiguration):
2599         * page/PageConfiguration.h:
2600         * platform/mediastream/libwebrtc/LibWebRTCMacros.h: Added.
2601         * platform/mediastream/libwebrtc/LibWebRTCProvider.h: Added.
2602         * platform/mediastream/libwebrtc/LibWebRTCUtils.cpp: Added.
2603         (WebCore::staticFactoryAndThreads):
2604         (WebCore::ThreadMessageData::ThreadMessageData):
2605         (WebCore::PeerConnectionFactoryAndThreads::OnMessage):
2606         (WebCore::callOnWebRTCNetworkThread):
2607         (WebCore::initializePeerConnectionFactoryAndThreads):
2608         (WebCore::initializeLibWebRTCInternalsWithSocketServer):
2609         (WebCore::peerConnectionFactory):
2610         (WebCore::createPeerConnection):
2611         * platform/mediastream/libwebrtc/LibWebRTCUtils.h: Added.
2612         * svg/graphics/SVGImage.cpp:
2613         (WebCore::SVGImage::dataChanged):
2614
2615 2017-01-25  Wenson Hsieh  <wenson_hsieh@apple.com>
2616
2617         Add support for named pasteboards, pasteboard strategies and platform pasteboards
2618         https://bugs.webkit.org/show_bug.cgi?id=167404
2619
2620         Reviewed by Enrica Casucci.
2621
2622         Refactors some pasteboard-related code to plumb the name of the pasteboard across from WebCore to the client
2623         layer. No new tests, because there should be no change in behavior.
2624
2625         * platform/DragData.h:
2626         * platform/Pasteboard.h:
2627         * platform/PasteboardStrategy.h:
2628         * platform/PlatformPasteboard.h:
2629         * platform/ios/PasteboardIOS.mm:
2630         (WebCore::Pasteboard::Pasteboard):
2631         (WebCore::Pasteboard::write):
2632         (WebCore::Pasteboard::writePlainText):
2633         (WebCore::Pasteboard::read):
2634         (WebCore::Pasteboard::hasData):
2635         (WebCore::Pasteboard::clear):
2636         (WebCore::Pasteboard::readString):
2637         (WebCore::Pasteboard::writeString):
2638         (WebCore::Pasteboard::types):
2639
2640 2017-01-25  Antoine Quint  <graouts@apple.com>
2641
2642         LayoutTest media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-buttons-containers-styles.html is flaky
2643         https://bugs.webkit.org/show_bug.cgi?id=167253
2644
2645         Reviewed by Jon Lee.
2646
2647         An IconButton loads its image asynchronously and waits for its load to obtain metrics. Once that happens,
2648         its layout delegate needs to be notified that it needs a new layout. The test was a flaky failure because
2649         the images would sometime load prior to layout, and sometime after, which would cause a failure. The test
2650         is now robust with a controls layout happening after all buttons had loaded.
2651
2652         * Modules/modern-media-controls/controls/icon-button.js:
2653         (IconButton.prototype._updateImage):
2654         (IconButton):
2655
2656 2017-01-25  Timothy Hatcher  <timothy@hatcher.name>
2657
2658         Fix the !HAVE(ACCESSIBILITY) build by properly instantiating AXObjectCache member timers.
2659
2660         * accessibility/AXObjectCache.h:
2661         (WebCore::AXObjectCache::AXObjectCache):
2662
2663 2017-01-25  Chris Dumez  <cdumez@apple.com>
2664
2665         Measure how common it is for content to deal with WebGL context loss
2666         https://bugs.webkit.org/show_bug.cgi?id=166866
2667         <rdar://problem/30171195>
2668
2669         Reviewed by Alex Christensen.
2670
2671         Add diagnostic logging to measure how common it is for sites to handle
2672         WebGL context loss via the webglcontextlost & webglcontextrestored
2673         events.
2674
2675         * html/canvas/WebGLRenderingContextBase.cpp:
2676         (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase):
2677         (WebCore::WebGLRenderingContextBase::checkForContextLossHandling):
2678         * html/canvas/WebGLRenderingContextBase.h:
2679         * page/DiagnosticLoggingKeys.cpp:
2680         (WebCore::DiagnosticLoggingKeys::noKey):
2681         (WebCore::DiagnosticLoggingKeys::yesKey):
2682         (WebCore::DiagnosticLoggingKeys::handlesContextLossKey):
2683         * page/DiagnosticLoggingKeys.h:
2684
2685 2017-01-25  Simon Fraser  <simon.fraser@apple.com>
2686
2687         Revert r210882, removing support for background-repeat-x/y
2688         https://bugs.webkit.org/show_bug.cgi?id=167223
2689
2690         Reviewed by Myles Maxfield.
2691
2692         CSSPropertyBackgroundRepeatX and CSSPropertyBackgroundRepeatY only exist to make it easier
2693         to parse CSSPropertyBackgroundRepeat as if it were a shorthand; they were never intended to
2694         be web-exposed. r210882 mistakenly expose them to the web, so undo that patch, and annotate
2695         the properties in CSSProperties.json with a flag which indicates their special status.
2696
2697         In addition, remove background-repeat-x/y from the list of properties allowed in video cues,
2698         since these are not valid properties.
2699
2700         * css/CSSProperties.json:
2701         * css/StyleResolver.cpp:
2702         (WebCore::StyleResolver::isValidCueStyleProperty):
2703         * css/makeprop.pl:
2704         (addProperty):
2705         * css/parser/CSSParserFastPaths.cpp:
2706         (WebCore::CSSParserFastPaths::isKeywordPropertyID):
2707
2708 2017-01-25  Carlos Garcia Campos  <cgarcia@igalia.com>
2709
2710         [GTK] UIProcess from WebKitGtk+ 2.15.x SIGSEGVs because of X Error BadDamage in WebKit::AcceleratedBackingStoreX11::update(WebKit::LayerTreeContext const&) () at Source/WebKit2/UIProcess/gtk/AcceleratedBackingStoreX11.cpp:145
2711         https://bugs.webkit.org/show_bug.cgi?id=165656
2712
2713         Reviewed by Michael Catanzaro.
2714
2715         Also return the base error code from PlatformDisplayX11::supportsXDamage().
2716
2717         * platform/graphics/x11/PlatformDisplayX11.cpp:
2718         (WebCore::PlatformDisplayX11::supportsXDamage):
2719         * platform/graphics/x11/PlatformDisplayX11.h:
2720
2721 2017-01-25  Carlos Garcia Campos  <cgarcia@igalia.com>
2722
2723         Unreviewed. Fix 32 bit build after r211140.
2724
2725         Include glib-object.h instead of forward declaring GType.
2726
2727         * platform/network/soup/SoupNetworkSession.h:
2728
2729 2017-01-25  Miguel Gomez  <magomez@igalia.com>
2730
2731         [GTK] The inspector is broken when AC support is disabled
2732         https://bugs.webkit.org/show_bug.cgi?id=165237
2733
2734         Reviewed by Carlos Garcia Campos.
2735
2736         Ensure that PageOverlayController destroys its root GraphicsLayers when leaving AC. They
2737         will be recreated if we enter AC again, avoiding a crash because the layers don't belong to
2738         the appropriate compositor. Also, don't append the document overlay layers if we are not
2739         in compositing mode.
2740
2741         No new tests added.
2742
2743         * page/PageOverlayController.cpp:
2744         (WebCore::PageOverlayController::willDetachRootLayer):
2745         * page/PageOverlayController.h:
2746         * rendering/RenderLayerCompositor.cpp:
2747         (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers):
2748         (WebCore::RenderLayerCompositor::detachRootLayer):
2749
2750 2017-01-25  Carlos Garcia Campos  <cgarcia@igalia.com>
2751
2752         [SOUP] Custom protocols don't work in private browsing mode
2753         https://bugs.webkit.org/show_bug.cgi?id=167236
2754
2755         Reviewed by Sergio Villar Senin.
2756
2757         Add static method to set the global custom protocols request type and setup method to add the feature to the session.
2758
2759         * platform/network/soup/SoupNetworkSession.cpp:
2760         (WebCore::SoupNetworkSession::SoupNetworkSession):
2761         (WebCore::SoupNetworkSession::setCustomProtocolRequestType):
2762         (WebCore::SoupNetworkSession::setupCustomProtocols):
2763         * platform/network/soup/SoupNetworkSession.h:
2764
2765 2017-01-25  Ryosuke Niwa  <rniwa@webkit.org>
2766
2767         collectMatchingElementsInFlatTree should not find elements inside an user agent shadow tree
2768         https://bugs.webkit.org/show_bug.cgi?id=167409
2769
2770         Reviewed by Antti Koivisto.
2771
2772         The bug was caused by collectMatchingElementsInFlatTree including elements inside an user agent shadow tree
2773         even though it shouldn't. Fixed the bug by checking that condition.
2774
2775         Also added matchingElementInFlatTree to find the first element matching a selector as opposed to all,
2776         again, only exposed in a world which forces all shadow trees to be accessible.
2777
2778         * page/DOMWindow.cpp:
2779         (WebCore::selectorQueryInFrame):
2780         (WebCore::DOMWindow::collectMatchingElementsInFlatTree):
2781         (WebCore::DOMWindow::matchingElementInFlatTree):
2782         * page/DOMWindow.h:
2783         * page/DOMWindow.idl:
2784
2785 2017-01-24  Alex Christensen  <achristensen@webkit.org>
2786
2787         REGRESSION (r208902): URLWithUserTypedString returns nil with file URLs
2788         https://bugs.webkit.org/show_bug.cgi?id=167402
2789         <rdar://problem/29896656>
2790
2791         Reviewed by Ryosuke Niwa.
2792
2793         Covered by a new API test.
2794
2795         * platform/mac/WebCoreNSURLExtras.mm:
2796         (WebCore::mapHostNameWithRange):
2797         uidna_IDNToASCII succeeds when length is 0.
2798         uidna_nameToASCII fails when length is 0.
2799         This causes bad things to happen with file URLs, which have no host, so their host length is 0.
2800         This makes us match behavior before r208902.
2801
2802 2017-01-24  Joseph Pecoraro  <pecoraro@apple.com>
2803
2804         Fold USER_TIMING into WEB_TIMING and make it a RuntimeEnabledFeature
2805         https://bugs.webkit.org/show_bug.cgi?id=167394
2806
2807         Reviewed by Ryosuke Niwa.
2808
2809         All of the Performance Timing specifications are highly coupled.
2810         So let make WEB_TIMING encompass them all:
2811
2812             - High Resolution Time (window.performance)
2813             - Performance Timeline (PerformanceEntry, PerformanceObserver)
2814             - Navigation Timing ("navigation" entries)
2815             - Resource Timing ("resource" entries)
2816             - User Timing ("mark" / "measure" entries)
2817
2818         We can then turn on and off individual pieces as runtime features,
2819         such as Resource Timing, User Timing, and Performance Observer.
2820
2821         * DerivedSources.make:
2822         * WebCore.xcodeproj/project.pbxproj:
2823         Add User Timing files that are now included in WEB_TIMING builds.
2824
2825         * page/RuntimeEnabledFeatures.h:
2826         (WebCore::RuntimeEnabledFeatures::setUserTimingEnabled):
2827         (WebCore::RuntimeEnabledFeatures::userTimingEnabled):
2828         Add a runtime feature for user timing. Disabled by default.
2829
2830         * Configurations/FeatureDefines.xcconfig:
2831         * PAL/Configurations/FeatureDefines.xcconfig:
2832         * bindings/js/JSPerformanceEntryCustom.cpp:
2833         (WebCore::toJSNewlyCreated):
2834         * page/Performance.cpp:
2835         (WebCore::Performance::getEntries):
2836         (WebCore::Performance::getEntriesByType):
2837         (WebCore::Performance::getEntriesByName):
2838         (WebCore::Performance::mark):
2839         (WebCore::Performance::clearMarks):
2840         (WebCore::Performance::measure):
2841         (WebCore::Performance::clearMeasures):
2842         (WebCore::Performance::webkitMark): Deleted.
2843         (WebCore::Performance::webkitClearMarks): Deleted.
2844         (WebCore::Performance::webkitMeasure): Deleted.
2845         (WebCore::Performance::webkitClearMeasures): Deleted.
2846         * page/Performance.h:
2847         * page/Performance.idl:
2848         * page/PerformanceMark.h:
2849         * page/PerformanceMark.idl:
2850         * page/PerformanceMeasure.h:
2851         * page/PerformanceMeasure.idl:
2852         * page/PerformanceUserTiming.cpp:
2853         * page/PerformanceUserTiming.h:
2854         Convert USER_TIMING to WEB_TIMING.
2855         Drop webkit prefixed legacy names.
2856
2857 2017-01-24  Antoine Quint  <graouts@apple.com>
2858
2859         LayoutTest media/modern-media-controls/tracks-panel/tracks-panel-hide.html is a flaky timeout
2860         https://bugs.webkit.org/show_bug.cgi?id=167311
2861
2862         Reviewed by Dean Jackson.
2863
2864         Ensure we have a chance to start the transition (on the next frame) before registering for an event
2865         tracking its completion.
2866
2867         * Modules/modern-media-controls/controls/tracks-panel.js:
2868         (TracksPanel.prototype.hide):
2869
2870 2017-01-24  Simon Fraser  <simon.fraser@apple.com>
2871
2872         [iOS WK2] Avoid IOSurface readback for snapshot creation
2873         https://bugs.webkit.org/show_bug.cgi?id=167397
2874         rdar://problem/30174873
2875
2876         Reviewed by Tim Horton.
2877
2878         Export sinkIntoImage().
2879
2880         * platform/graphics/cocoa/IOSurface.h:
2881
2882 2017-01-24  Brent Fulgham  <bfulgham@apple.com>
2883
2884         Bug 167392: REGRESSION(r210531): Relax same-volume display requirement for iOS
2885         https://bugs.webkit.org/show_bug.cgi?id=167392
2886         <rdar://problem/30074665>
2887
2888         Reviewed by Brady Eidson.
2889
2890         * page/SecurityOrigin.cpp:
2891         (WebCore::SecurityOrigin::canDisplay): Exclude the new check when building on iOS.
2892
2893 2017-01-24  Andreas Kling  <akling@apple.com>
2894
2895         Add memory footprint reporting using diagnostic logging.
2896         <https://webkit.org/b/167285>
2897         <rdar://problem/30151767>
2898
2899         Reviewed by Chris Dumez.
2900
2901         Add some basic logging of physical memory footprint post-load and post-backgrounding.
2902         The logging works similarly to the CPU usage logging, though with slightly longer
2903         delays to allow the measurement to stabilize.
2904
2905         * page/DiagnosticLoggingKeys.cpp:
2906         (WebCore::DiagnosticLoggingKeys::memoryUsageKey):
2907         (WebCore::DiagnosticLoggingKeys::memoryUsageToDiagnosticLoggingKey):
2908         * page/DiagnosticLoggingKeys.h:
2909         * page/PerformanceLogging.cpp:
2910         (WebCore::PerformanceLogging::physicalFootprint):
2911         * page/PerformanceLogging.h:
2912         * page/PerformanceMonitor.cpp:
2913         (WebCore::PerformanceMonitor::PerformanceMonitor):
2914         (WebCore::PerformanceMonitor::didFinishLoad):
2915         (WebCore::PerformanceMonitor::activityStateChanged):
2916         (WebCore::PerformanceMonitor::measurePostLoadMemoryUsage):
2917         (WebCore::PerformanceMonitor::measurePostBackgroundingMemoryUsage):
2918         * page/PerformanceMonitor.h:
2919         * page/Settings.h:
2920         (WebCore::Settings::isPostLoadMemoryUsageMeasurementEnabled):
2921         (WebCore::Settings::isPostBackgroundingMemoryUsageMeasurementEnabled):
2922         * page/cocoa/PerformanceLoggingCocoa.mm:
2923         (WebCore::PerformanceLogging::physicalFootprint):
2924
2925 2017-01-24  Joseph Pecoraro  <pecoraro@apple.com>
2926
2927         Remove always true unsafePluginPastingEnabled setting
2928         https://bugs.webkit.org/show_bug.cgi?id=167360
2929
2930         Reviewed by Andreas Kling.
2931
2932         Setting added by Chromium and never used by other ports.
2933
2934         * dom/ScriptableDocumentParser.cpp:
2935         (WebCore::ScriptableDocumentParser::ScriptableDocumentParser):
2936         * page/Settings.in:
2937
2938 2017-01-24  Anders Carlsson  <andersca@apple.com>
2939
2940         When Safari reloads pages with Flash objects after Flash is installed, placeholders don't paint (but do work!)
2941         https://bugs.webkit.org/show_bug.cgi?id=167391
2942         rdar://problem/29857388
2943
2944         Reviewed by Sam Weinig.
2945
2946         * page/Page.cpp:
2947         (WebCore::Page::refreshPlugins):
2948         Remove an unused variable.
2949
2950         * plugins/PluginInfoProvider.cpp:
2951         (WebCore::PluginInfoProvider::refresh):
2952         Make sure to call refreshPlugins(). Instead of reloading subframes, just reload all the main frames with
2953         subframes that contain plug-ins.
2954
2955 2017-01-24  Joseph Pecoraro  <pecoraro@apple.com>
2956
2957         Clean up Performance IDL interfaces so they are easier to read
2958         https://bugs.webkit.org/show_bug.cgi?id=167378
2959
2960         Reviewed by Sam Weinig.
2961
2962         * page/Performance.idl:
2963         * page/PerformanceEntry.idl:
2964         * page/PerformanceMark.idl:
2965         * page/PerformanceMeasure.idl:
2966         Update spec links and use a typedef to match specs.
2967
2968         * page/PerformanceResourceTiming.cpp:
2969         (WebCore::PerformanceResourceTiming::workerStart):
2970         * page/PerformanceResourceTiming.h:
2971         * page/PerformanceResourceTiming.idl:
2972         Add the workerStart property which always returns 0 for non-workers.
2973
2974 2017-01-24  Zalan Bujtas  <zalan@apple.com>
2975
2976         Simple line layout: Add support for hyphen: auto.
2977         https://bugs.webkit.org/show_bug.cgi?id=167297
2978         <rdar://problem/30119463>
2979
2980         Reviewed by Antti Koivisto.
2981
2982         Implement hyphen: auto for simple line layout. 
2983
2984         Tests: fast/text/simple-line-hyphens-with-text-align.html
2985                fast/text/simple-line-hyphens-with-word-letter-spacing.html
2986
2987         * platform/text/Hyphenation.h:
2988         (WebCore::enoughWidthForHyphenation):
2989         * rendering/RenderTreeAsText.cpp:
2990         (WebCore::writeSimpleLine):
2991         (WebCore::write):
2992         * rendering/SimpleLineLayout.cpp:
2993         (WebCore::SimpleLineLayout::canUseForStyle):
2994         (WebCore::SimpleLineLayout::LineState::appendFragmentAndCreateRunIfNeeded): Inherit the hyphen attribute from the
2995         run-to-be-appended. Ensure that we don't append additional runs when the last run has hyphen.
2996         (WebCore::SimpleLineLayout::splitFragmentToFitLine): Before calling into the lastHyphenPosition() we need to
2997         ensure that the hyphen would surely fit (even on the splitting position).
2998         (WebCore::SimpleLineLayout::createLineRuns): Probe hypenation for overhanging non-whitespace runs. 
2999         (WebCore::SimpleLineLayout::printReason):
3000         * rendering/SimpleLineLayout.h:
3001         (WebCore::SimpleLineLayout::Run::Run):
3002         * rendering/SimpleLineLayoutFlowContents.h:
3003         (WebCore::SimpleLineLayout::FlowContents::Segment::toSegmentPosition):
3004         (WebCore::SimpleLineLayout::FlowContents::Segment::toRenderPosition):
3005         * rendering/SimpleLineLayoutResolver.cpp:
3006         (WebCore::SimpleLineLayout::RunResolver::Run::Run):
3007         (WebCore::SimpleLineLayout::RunResolver::Run::constructStringForHyphenIfNeeded):
3008         (WebCore::SimpleLineLayout::RunResolver::Run::text):
3009         * rendering/SimpleLineLayoutResolver.h:
3010         (WebCore::SimpleLineLayout::RunResolver::Run::hasHyphen):
3011         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
3012         (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style):
3013         (WebCore::SimpleLineLayout::TextFragmentIterator::nextBreakablePosition):
3014         (WebCore::SimpleLineLayout::TextFragmentIterator::nextNonWhitespacePosition):
3015         (WebCore::SimpleLineLayout::TextFragmentIterator::textWidth):
3016         (WebCore::SimpleLineLayout::TextFragmentIterator::lastHyphenPosition): We only check the actual run for hyphenation ignoring
3017         the neighboring runs. This might need to be changed in the future.
3018         (WebCore::SimpleLineLayout::TextFragmentIterator::runWidth):
3019         * rendering/SimpleLineLayoutTextFragmentIterator.h:
3020         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::TextFragment):
3021         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::hasHyphen):
3022         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::operator==):
3023         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::split):
3024         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::splitWithHyphen):
3025         * rendering/line/BreakingContext.h:
3026         (WebCore::tryHyphenating):
3027
3028 2017-01-24  Matt Rajca  <mrajca@apple.com>
3029
3030         Pass down website autoplay policies to media elements
3031         https://bugs.webkit.org/show_bug.cgi?id=167355
3032
3033         Reviewed by Alex Christensen.
3034
3035         Autoplay policies can be specified at the global web view preferences level or on a per-page
3036         basis during navigation. This patch ensures that policies specified on a per-page basis hold
3037         precedence over global policies. If no policies are specified during navigation, global
3038         policies are used. A WebsiteAutoplayPolicy::Default option has been added to let clients
3039         explicitly specify web view defaults should be used.
3040
3041         * dom/Document.cpp:
3042         (WebCore::Document::audioPlaybackRequiresUserGesture):
3043         (WebCore::Document::videoPlaybackRequiresUserGesture):
3044         * dom/Document.h:
3045         * html/HTMLMediaElement.cpp:
3046         (WebCore::HTMLMediaElement::HTMLMediaElement):
3047         (WebCore::HTMLMediaElement::playInternal):
3048         * loader/DocumentLoader.h:
3049         (WebCore::DocumentLoader::audioPlaybackRequiresUserGesture):
3050         (WebCore::DocumentLoader::setAudioPlaybackRequiresUserGesture):
3051         (WebCore::DocumentLoader::videoPlaybackRequiresUserGesture):
3052         (WebCore::DocumentLoader::setVideoPlaybackRequiresUserGesture):
3053
3054 2017-01-24  Joseph Pecoraro  <pecoraro@apple.com>
3055
3056         Remove always true selectionIncludesAltImageText setting
3057         https://bugs.webkit.org/show_bug.cgi?id=167358
3058
3059         Reviewed by Alex Christensen.
3060
3061         * editing/Editor.cpp:
3062         (WebCore::Editor::selectedTextForDataTransfer):
3063         * page/Settings.in:
3064
3065 2017-01-24  Daniel Bates  <dabates@apple.com>
3066
3067         StringView.split() should use an iterator design pattern instead of allocating a Vector
3068         https://bugs.webkit.org/show_bug.cgi?id=163225
3069
3070         Reviewed by Darin Adler.
3071
3072         Update code to use the new iterator-style StringView.split().
3073
3074         * platform/URLParser.cpp:
3075
3076 2017-01-24  Joseph Pecoraro  <pecoraro@apple.com>
3077
3078         Remove always true openGLMultisamplingEnabled setting
3079         https://bugs.webkit.org/show_bug.cgi?id=167364
3080
3081         Reviewed by Sam Weinig.
3082
3083         * html/canvas/WebGLRenderingContextBase.cpp:
3084         (WebCore::WebGLRenderingContextBase::create):
3085         * page/Settings.in:
3086
3087 2017-01-24  Miguel Gomez  <magomez@igalia.com>
3088
3089         [GTK] Do not paint non composited content into the window when using the threaded compositor
3090         https://bugs.webkit.org/show_bug.cgi?id=167367
3091
3092         Reviewed by Carlos Garcia Campos.
3093
3094         When using the threaded compositor we need to send the non composited content for compositing as well,
3095         not painting it directly into the window.
3096
3097         No new tests.
3098
3099         * rendering/RenderLayerBacking.cpp:
3100         (WebCore::RenderLayerBacking::paintsIntoWindow):
3101
3102 2017-01-24  Joseph Pecoraro  <pecoraro@apple.com>
3103
3104         Remove always true allowCustomScrollbarInMainFrame setting
3105         https://bugs.webkit.org/show_bug.cgi?id=167362
3106
3107         Reviewed by Andreas Kling.
3108
3109         Setting added by Chromium and never used by other ports.
3110
3111         * page/FrameView.cpp:
3112         (WebCore::FrameView::createScrollbar):
3113         * page/Settings.in:
3114
3115 2017-01-24  Joseph Pecoraro  <pecoraro@apple.com>
3116
3117         Remove always true syncXHRInDocumentsEnabled setting
3118         https://bugs.webkit.org/show_bug.cgi?id=167359
3119
3120         Reviewed by Alex Christensen.
3121
3122         Setting added by Chromium and never used by other ports.
3123
3124         * page/Settings.in:
3125         * xml/XMLHttpRequest.cpp:
3126         (WebCore::XMLHttpRequest::open):
3127
3128 2017-01-24  Joseph Pecoraro  <pecoraro@apple.com>
3129
3130         Remove always true antialiased2dCanvasEnabled setting
3131         https://bugs.webkit.org/show_bug.cgi?id=167361
3132
3133         Reviewed by Andreas Kling.
3134
3135         * html/HTMLCanvasElement.cpp:
3136         (WebCore::HTMLCanvasElement::createImageBuffer):
3137         * page/Settings.in:
3138
3139 2017-01-15  Yusuke Suzuki  <utatane.tea@gmail.com>
3140
3141         Add the support for nomodule attribute on script element
3142         https://bugs.webkit.org/show_bug.cgi?id=166987
3143
3144         Reviewed by Sam Weinig.
3145
3146         As discussed on https://github.com/whatwg/html/pull/2261, we should have
3147         the way to suppress classic script execution when our user agent have
3148         modules support. With such a feature, developers can write the code like,
3149
3150             <script type="module" src="./app.js"></script>
3151             <script nomodule src="./bundled-app.js"></script>
3152
3153         In the above code, if the user agent does not support modules, the bundled-app.js
3154         will be executed. On the other hand, if the user agent supports modules, we should
3155         ignore the script tag which has the `nomodule` attribute.
3156         This way allows us to support the legacy browsers while using modules.
3157
3158         In WebKit, we already support modules. Thus, we should ignore the classic script
3159         attributed `nomodule`.
3160
3161         We also rename asyncAttributeValue and deferAttributeValue to hasAsyncAttribute and
3162         hasDeferAttribute.
3163
3164         Tests: js/dom/modules/nomodule-has-no-effect-on-module-inline.html
3165                js/dom/modules/nomodule-has-no-effect-on-module-src.html
3166                js/dom/modules/nomodule-prevents-execution-classic-script-inline.html
3167                js/dom/modules/nomodule-prevents-execution-classic-script-src.html
3168
3169         * dom/ScriptElement.cpp:
3170         (WebCore::ScriptElement::prepareScript):
3171         * dom/ScriptElement.h:
3172         * html/HTMLAttributeNames.in:
3173         * html/HTMLScriptElement.cpp:
3174         (WebCore::HTMLScriptElement::hasAsyncAttribute):
3175         (WebCore::HTMLScriptElement::hasDeferAttribute):
3176         (WebCore::HTMLScriptElement::hasNoModuleAttribute):
3177         (WebCore::HTMLScriptElement::asyncAttributeValue): Deleted.
3178         (WebCore::HTMLScriptElement::deferAttributeValue): Deleted.
3179         * html/HTMLScriptElement.h:
3180         * html/HTMLScriptElement.idl:
3181         * svg/SVGScriptElement.cpp:
3182         (WebCore::SVGScriptElement::hasAsyncAttribute):
3183         (WebCore::SVGScriptElement::hasDeferAttribute):
3184         (WebCore::SVGScriptElement::hasNoModuleAttribute):
3185         (WebCore::SVGScriptElement::asyncAttributeValue): Deleted.
3186         (WebCore::SVGScriptElement::deferAttributeValue): Deleted.
3187         * svg/SVGScriptElement.h:
3188
3189 2017-01-23  Joseph Pecoraro  <pecoraro@apple.com>
3190
3191         Web Inspector: Provide a way to trigger a Garbage Collection
3192         https://bugs.webkit.org/show_bug.cgi?id=167345
3193         <rdar://problem/30102853>
3194
3195         Reviewed by Timothy Hatcher.
3196
3197         * inspector/WorkerInspectorController.cpp:
3198         (WebCore::WorkerInspectorController::WorkerInspectorController):
3199         Include a HeapAgent so we can do Heap.gc on Workers.
3200
3201 2017-01-23  Joseph Pecoraro  <pecoraro@apple.com>
3202
3203         Cleanup WEB_TIMING code
3204         https://bugs.webkit.org/show_bug.cgi?id=167339
3205
3206         Reviewed by Alex Christensen.
3207
3208         Stylistic cleanup to WEB_TIMING related code.
3209
3210         * bindings/js/JSPerformanceEntryCustom.cpp:
3211         * loader/ResourceTimingInformation.cpp:
3212         * loader/ResourceTimingInformation.h:
3213         * loader/SubresourceLoader.cpp:
3214         (WebCore::SubresourceLoader::didFinishLoading):
3215         * page/Performance.cpp:
3216         (WebCore::Performance::getEntries):
3217         (WebCore::Performance::getEntriesByType):
3218         (WebCore::Performance::setResourceTimingBufferSize):
3219         (WebCore::Performance::isResourceTimingBufferFull):
3220         * page/Performance.h:
3221         * page/PerformanceMark.h:
3222         * page/PerformanceMeasure.h:
3223         * page/PerformanceNavigation.h:
3224         * page/PerformanceResourceTiming.cpp:
3225         (WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
3226         (WebCore::PerformanceResourceTiming::resourceTimeToDocumentMilliseconds):
3227         * page/PerformanceResourceTiming.h:
3228         * page/PerformanceTiming.cpp:
3229         (WebCore::PerformanceTiming::documentLoader):
3230         (WebCore::PerformanceTiming::documentTiming):
3231         (WebCore::PerformanceTiming::loadTiming):
3232         * page/PerformanceTiming.h:
3233         * platform/network/cf/ResourceHandleCFNet.cpp:
3234         (WebCore::ResourceHandle::createCFURLConnection):
3235
3236 2017-01-23  Alex Christensen  <achristensen@webkit.org>
3237
3238         URLParser should fail to parse percent-encoded invalid UTF-8 sequences
3239         https://bugs.webkit.org/show_bug.cgi?id=167330
3240         <rdar://problem/29319962>
3241
3242         Reviewed by Tim Horton.
3243
3244         Covered by new API tests.
3245
3246         * platform/URLParser.cpp:
3247         (WebCore::containsOnlyASCII):
3248         (WebCore::URLParser::parseHostAndPort):
3249         If UTF-8 decoding fails after percent-decoding the host, fail to parse.
3250         This matches Chrome and Firefox, and it was proposed to the spec in https://github.com/whatwg/url/issues/215
3251
3252 2017-01-23  Alex Christensen  <achristensen@webkit.org>
3253
3254         Make URLs with non-special schemes and a query or fragment but no slash after the host more compatible
3255         https://bugs.webkit.org/show_bug.cgi?id=167317
3256         <rdar://problem/29526875>
3257
3258         Reviewed by Sam Weinig.
3259
3260         This is currently being added to the URL spec in https://github.com/whatwg/url/issues/212
3261         Covered by new API tests.
3262
3263         * platform/URLParser.cpp:
3264         (WebCore::URLParser::parse):
3265         Only add a slash if there wasn't one if the URL has a special scheme.
3266         This new behavior matches the old behavior of URL::parse.
3267
3268 2017-01-23  Joseph Pecoraro  <pecoraro@apple.com>
3269
3270         Convert langAttributeAwareFormControlUIEnabled to a Setting
3271         https://bugs.webkit.org/show_bug.cgi?id=167279
3272
3273         Reviewed by Sam Weinig.
3274
3275         * dom/Document.cpp:
3276         (WebCore::Document::getCachedLocale):
3277         * html/HTMLInputElement.cpp:
3278         (WebCore::HTMLInputElement::setupDateTimeChooserParameters):
3279         Convert to use Settings instead of RuntimeEnabledFeatures.
3280
3281         * page/RuntimeEnabledFeatures.h:
3282         (WebCore::RuntimeEnabledFeatures::langAttributeAwareFormControlUIEnabled): Deleted.
3283         (WebCore::RuntimeEnabledFeatures::setLangAttributeAwareFormControlUIEnabled): Deleted.
3284         * page/Settings.in:
3285         Move to Settings.
3286
3287         * testing/InternalSettings.cpp:
3288         (WebCore::InternalSettings::Backup::Backup):
3289         (WebCore::InternalSettings::Backup::restoreTo):
3290         (WebCore::InternalSettings::setLangAttributeAwareFormControlUIEnabled): Deleted.
3291         * testing/InternalSettings.h:
3292         * testing/InternalSettings.idl:
3293         Remove the manual interface for the RuntimeEnabledFeature.
3294         An identical interface is generated from Settings.in!
3295
3296 2017-01-20  Anders Carlsson  <andersca@apple.com>
3297
3298         When Safari reloads pages with Flash objects after Flash is installed, placeholders don't paint (but do work!)
3299         https://bugs.webkit.org/show_bug.cgi?id=167268
3300         rdar://problem/29857388
3301
3302         Reviewed by Sam Weinig.
3303
3304         * page/Page.cpp:
3305         (WebCore::Page::refreshPlugins):
3306         Call PluginInfoProvider::refresh instead.
3307
3308         (WebCore::Page::clearPluginData):
3309         Add new setter.
3310
3311         * page/Page.h:
3312         Declare new members.
3313
3314         * plugins/PluginInfoProvider.cpp:
3315         (WebCore::PluginInfoProvider::refresh):
3316         Put the logic to clear plug-in data and reload frames here.
3317
3318         * plugins/PluginInfoProvider.h:
3319         Add new members.
3320
3321 2017-01-23  Jer Noble  <jer.noble@apple.com>
3322
3323         REGRESSION (r208149): Video details does not apear and missing scrubber in Control Center
3324         https://bugs.webkit.org/show_bug.cgi?id=167233
3325
3326         Reviewed by Alex Christensen.
3327
3328         Test: In TestWebKitAPI, NowPlayingControlsTests.NowPlayingControlsIOS
3329
3330         In r208149, we introduced a new media type, Video, and renamed the old type to
3331         VideoAudio (to be able to distinguish between video-with-audio and silent-video).
3332         But we missed one place where that type needs to be renamed.
3333
3334         For testing purposes, overload methods from PlatformMediaSessionManager which WebKit2 uses
3335         to report the current now playing session and it's information.
3336
3337         * platform/audio/ios/MediaSessionManagerIOS.h:
3338         * platform/audio/ios/MediaSessionManagerIOS.mm:
3339         (WebCore::MediaSessionManageriOS::nowPlayingEligibleSession):
3340         (WebCore::MediaSessionManageriOS::updateNowPlayingInfo):
3341
3342 2017-01-23  Chris Dumez  <cdumez@apple.com>
3343
3344         REGRESSION (r211033): ASSERTION FAILED: m_ptr in com.apple.WebCore: WTF::RefPtr<WebCore::Element>::operator* const + 70
3345         https://bugs.webkit.org/show_bug.cgi?id=167308
3346         <rdar://problem/30144964>
3347
3348         Unreviewed, do a partial revert of r211033 to fix assertion.
3349
3350         No new tests, already covered by:
3351         fullscreen/exit-full-screen-iframe.html
3352
3353         * dom/Document.cpp:
3354         (WebCore::Document::webkitExitFullscreen):
3355         * page/ChromeClient.h:
3356
3357 2017-01-23  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
3358
3359         [GTK] asserting on unknown locale for hyphenation is wrong
3360         https://bugs.webkit.org/show_bug.cgi?id=167312
3361
3362         Reviewed by Carlos Garcia Campos.
3363
3364         The fact that we hit the assert on a test called 'hyphenation-unknown-locale' is already
3365         a strong indication we should not have it. In addition to that, Carlos Lopez pointed out
3366         a similar assert was removed from the Mac codepaths when the test was introduced.
3367
3368         * platform/text/hyphen/HyphenationLibHyphen.cpp:
3369         (WebCore::lastHyphenLocation): early return when a locale that is not available is provided
3370         for hyphenation, instead of asserting.
3371
3372 2017-01-23  Chris Dumez  <cdumez@apple.com>
3373
3374         Unreviewed attempt to fix the iOS build after r211033.
3375
3376         * dom/Node.cpp:
3377         (WebCore::Node::defaultEventHandler):
3378
3379 2017-01-23  Joseph Pecoraro  <pecoraro@apple.com>
3380
3381         Remove allowWindowOpenWithoutUserGesture setting
3382         https://bugs.webkit.org/show_bug.cgi?id=167301
3383
3384         Reviewed by Darin Adler.
3385
3386         * page/DOMWindow.cpp:
3387         (WebCore::DOMWindow::allowPopUp):
3388         * page/Settings.in:
3389
3390 2017-01-22  Carlos Garcia Campos  <cgarcia@igalia.com>
3391
3392         Database file not removed for origins after deleting all databases
3393         https://bugs.webkit.org/show_bug.cgi?id=167281
3394
3395         Reviewed by Darin Adler.
3396
3397         When DatabaseTracker::deleteDatabasesModifiedSince() is called with a min time, all databases for every origin
3398         are deleted. For each origin if all databases are removed DatabaseTracker::deleteOrigin() is called to remove
3399         also the origin database file. However, DatabaseTracker::deleteOrigin() returns early if the origin doesn't have
3400         databases and in this particular case it never has databases, because we have just removed them.
3401
3402         This will be covered by GTK+ unit tests.
3403
3404         * Modules/webdatabase/DatabaseTracker.cpp:
3405         (WebCore::DatabaseTracker::deleteDatabasesModifiedSince): Instead of removing the databases while iterating
3406         them, add the ones to be removed to a vector. If after the iteration all databases should be removed call
3407         DatabaseTracker::deleteOrigin() to ensure both the databases and the database file are removed for the origin,
3408         otherwhise call DatabaseTracker::deleteDatabase() for every database to delete.
3409
3410 2017-01-22  Michael Catanzaro  <mcatanzaro@igalia.com>
3411
3412         [GTK] Update Safari version in user agent
3413         https://bugs.webkit.org/show_bug.cgi?id=167290
3414
3415         Reviewed by Carlos Garcia Campos.
3416
3417         Update Safari version from 10 to 11.
3418
3419         * platform/gtk/UserAgentGtk.cpp:
3420         (WebCore::buildUserAgentString):
3421