[LayoutState cleanup] LayoutContext should own the stack of LayoutState objects
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-11-08  Zalan Bujtas  <zalan@apple.com>
2
3         [LayoutState cleanup] LayoutContext should own the stack of LayoutState objects
4         https://bugs.webkit.org/show_bug.cgi?id=179408
5         <rdar://problem/35423075>
6
7         Reviewed by Antti Koivisto.
8
9         No change in functionality.
10
11         * page/LayoutContext.cpp:
12         (WebCore::LayoutContext::layoutDelta const):
13         (WebCore::LayoutContext::addLayoutDelta):
14         (WebCore::LayoutContext::layoutDeltaMatches):
15         (WebCore::LayoutContext::layoutState const):
16         (WebCore::LayoutContext::pushLayoutState):
17         (WebCore::LayoutContext::pushLayoutStateForPaginationIfNeeded):
18         (WebCore::LayoutContext::popLayoutState):
19         * page/LayoutContext.h:
20         (WebCore::LayoutContext::isPaintOffsetCacheEnabled const):
21         (WebCore::LayoutContext::layoutState const): Deleted.
22         * rendering/LayoutState.cpp:
23         (WebCore::LayoutState::LayoutState):
24         (WebCore::LayoutState::computeOffsets):
25         (WebCore::LayoutState::computeClipRect):
26         (WebCore::LayoutState::computePaginationInformation):
27         (WebCore::LayoutState::propagateLineGridInfo):
28         (WebCore::LayoutState::establishLineGrid):
29         (WebCore::LayoutState::clearPaginationInformation): Deleted.
30         * rendering/LayoutState.h:
31         (WebCore::LayoutState::setIsPaginated):
32
33 2017-11-08  Brady Eidson  <beidson@apple.com>
34
35         ServiceWorkerRegistration::updateStateFromServer fix! (Don't always create a new ServiceWorker every time).
36         https://bugs.webkit.org/show_bug.cgi?id=179456
37
38         Reviewed by Chris Dumez.
39
40         No new tests (No behavior change yet).
41
42         * workers/service/ServiceWorkerRegistration.cpp:
43         (WebCore::ServiceWorkerRegistration::updateStateFromServer): Re-use a previous worker instead of always creating a new one.
44
45 2017-11-08  Brent Fulgham  <bfulgham@apple.com>
46
47         XMLHttpRequest should not treat file URLs as same origin
48         https://bugs.webkit.org/show_bug.cgi?id=178565
49         <rdar://problem/11115901>
50
51         Reviewed by Daniel Bates.
52
53         Based on a Blink patch by <jannhorn@googlemail.com>.
54         https://chromium.googlesource.com/chromium/src/+/c362e001551abc2bea392773f32eaf043d8bc29f
55
56         Test: security/cannot-read-self-from-file.html
57
58         * page/SecurityOrigin.cpp:
59         (WebCore::SecurityOrigin::passesFileCheck const): Do not treat file as same-origin.
60
61 2017-11-08  Jeremy Jones  <jeremyj@apple.com>
62
63         HTMLMediaElement should not use element fullscreen on iOS
64         https://bugs.webkit.org/show_bug.cgi?id=179418
65         rdar://problem/35409277
66
67         Reviewed by Eric Carlson.
68
69         Add ENABLE_VIDEO_USES_ELEMENT_FULLSCREEN to determine if HTMLMediaElement should use element full screen or not.
70
71         * Configurations/FeatureDefines.xcconfig:
72         * html/HTMLMediaElement.cpp:
73         (WebCore::HTMLMediaElement::enterFullscreen):
74
75 2017-11-08  Joseph Pecoraro  <pecoraro@apple.com>
76
77         Web Inspector: Show Internal properties of PaymentRequest in Web Inspector Console
78         https://bugs.webkit.org/show_bug.cgi?id=179276
79
80         Reviewed by Andy Estes.
81
82         Test: http/tests/inspector/runtime/internal-properties-payment-request.https.html
83
84         * Modules/paymentrequest/PaymentRequest.h:
85         Expose access to internal state.
86
87         * inspector/WebInjectedScriptHost.h:
88         * inspector/WebInjectedScriptHost.cpp:
89         (WebCore::constructInternalProperty):
90         (WebCore::WebInjectedScriptHost::getInternalProperties):
91         Provide internal properties for a PaymentRequest.
92
93         * testing/Internals.cpp:
94         (WebCore::Internals::withUserGesture):
95         * testing/Internals.h:
96         * testing/Internals.idl:
97         Provide a simple way to run code inside of a user gesture.
98
99 2017-11-08  Ryosuke Niwa  <rniwa@webkit.org>
100
101         REGRESSION(r224534): Crash inside Document::updateStyleIfNeeded
102         https://bugs.webkit.org/show_bug.cgi?id=179442
103
104         Reviewed by Simon Fraser.
105
106         Disable the assertion when the web thread is used.
107
108         * dom/Document.cpp:
109         (WebCore::Document::updateStyleIfNeeded):
110         (WebCore::Document::updateLayout):
111
112 2017-11-08  Colin Bendell  <colin@bendell.ca>
113
114         Added mime type check to the picture source preloader to avoid downloading incompatible resources.
115         https://bugs.webkit.org/show_bug.cgi?id=179231
116
117         Reviewed by Alex Christensen.
118
119         Test: http/tests/loading/preload-picture-type.html
120
121         * html/parser/HTMLPreloadScanner.cpp:
122         (WebCore::TokenPreloadScanner::StartTagScanner::processAttributes): include type match state when selecting candidate imgs
123         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute): added type attribute evaluation and matching
124
125 2017-11-08  Brady Eidson  <beidson@apple.com>
126
127         Some SW Container and Registration tweaks.
128         https://bugs.webkit.org/show_bug.cgi?id=179450
129
130         Reviewed by Chris Dumez.
131
132         No new tests (Progression in an existing test).
133
134         * workers/service/ServiceWorkerContainer.cpp:
135         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
136         * workers/service/ServiceWorkerRegistration.cpp:
137         (WebCore::ServiceWorkerRegistration::ServiceWorkerRegistration):
138
139 2017-11-08  Antti Koivisto  <antti@apple.com>
140
141         Move inlineElementContinuation function to RenderBoxModelObject and rename to inlineContinuation
142         https://bugs.webkit.org/show_bug.cgi?id=179437
143
144         Reviewed by Zalan Bujtas.
145
146         Unify RenderInline::inlineElementContinuation and RenderBlock::inlineElementContinuation.
147         It is simply a function to find the next RenderInline in the continuation chain.
148
149         * accessibility/AccessibilityRenderObject.cpp:
150         (WebCore::lastChildConsideringContinuation):
151         (WebCore::startOfContinuations):
152         (WebCore::endOfContinuations):
153         (WebCore::childBeforeConsideringContinuations):
154         (WebCore::AccessibilityRenderObject::nextSibling const):
155         (WebCore::nextContinuation):
156         * rendering/RenderBlock.cpp:
157         (WebCore::RenderBlock::paintObject):
158         (WebCore::RenderBlock::absoluteRects const):
159         (WebCore::RenderBlock::addFocusRingRects):
160         (WebCore::RenderBlock::inlineElementContinuation const): Deleted.
161         * rendering/RenderBlock.h:
162         * rendering/RenderBoxModelObject.cpp:
163         (WebCore::accumulateInFlowPositionOffsets):
164         (WebCore::RenderBoxModelObject::inlineContinuation const):
165         * rendering/RenderBoxModelObject.h:
166         * rendering/RenderInline.cpp:
167         (WebCore::updateStyleOfAnonymousBlockContinuations):
168         (WebCore::RenderInline::styleDidChange):
169         (WebCore::nextContinuation):
170         (WebCore::RenderInline::positionForPoint):
171         (WebCore::RenderInline::inlineElementContinuation const): Deleted.
172         * rendering/RenderInline.h:
173         * rendering/line/LineInlineHeaders.h:
174         (WebCore::hasInlineDirectionBordersPaddingOrMargin):
175
176 2017-11-08  Joseph Pecoraro  <pecoraro@apple.com>
177
178         Web Inspector: Eliminate unnecessary hash lookups with NetworkResourceData
179         https://bugs.webkit.org/show_bug.cgi?id=179361
180
181         Reviewed by Brian Burg.
182
183         * inspector/NetworkResourcesData.h:
184         (WebCore::NetworkResourcesData::ResourceData::setURL):
185         (WebCore::NetworkResourcesData::ResourceData::setUrl): Deleted.
186         Drive-by fix the name `setUrl` to `setURL`.
187
188         * inspector/NetworkResourcesData.h:
189         Store unique_ptrs in the HashMap.
190
191         * inspector/NetworkResourcesData.cpp:
192         (WebCore::NetworkResourcesData::resourceCreated):
193         (WebCore::NetworkResourcesData::responseReceived):
194         Create new versions of methods that combine two operations.
195
196         (WebCore::NetworkResourcesData::removeCachedResource):
197         (WebCore::NetworkResourcesData::clear):
198         (WebCore::NetworkResourcesData::ensureNoDataForRequestId):
199         Handle unique_ptrs in the HashMap.
200
201         * inspector/agents/InspectorNetworkAgent.cpp:
202         (WebCore::InspectorNetworkAgent::frameIdentifier):
203         (WebCore::InspectorNetworkAgent::willSendRequest):
204         (WebCore::InspectorNetworkAgent::didReceiveResponse):
205         (WebCore::InspectorNetworkAgent::didFailLoading):
206         Use the new version of operations to avoid multiple lookups.
207
208 2017-11-08  Wenson Hsieh  <wenson_hsieh@apple.com>
209
210         [Attachment Support] Implement delegate hooks for attachment element insertion and removal
211         https://bugs.webkit.org/show_bug.cgi?id=179016
212         <rdar://problem/35250890>
213
214         Reviewed by Tim Horton.
215
216         Relanding this patch with a tweaked API test. WKAttachmentTests.AttachmentUpdatesWhenChangingFontStyles, in its
217         original form, hit a debug assertion and exposed an existing bug related to EditingStyles and text decoration.
218         After some investigation, this debug assertion is unrelated to the attachment logic introduced here; see
219         <https://bugs.webkit.org/show_bug.cgi?id=179431> for additional analysis, and several proposed fixes.
220
221         * editing/Editor.cpp:
222         (WebCore::Editor::respondToChangedSelection):
223         (WebCore::Editor::editorUIUpdateTimerFired):
224         (WebCore::Editor::scheduleEditorUIUpdate):
225         (WebCore::Editor::didInsertAttachmentElement):
226         (WebCore::Editor::didRemoveAttachmentElement):
227         (WebCore::Editor::notifyClientOfAttachmentUpdates):
228         (WebCore::Editor::insertAttachmentFromFile):
229         * editing/Editor.h:
230         * html/HTMLAttachmentElement.cpp:
231         (WebCore::HTMLAttachmentElement::HTMLAttachmentElement):
232         (WebCore::HTMLAttachmentElement::insertedIntoAncestor):
233         (WebCore::HTMLAttachmentElement::removedFromAncestor):
234         (WebCore::HTMLAttachmentElement::uniqueIdentifier const):
235         (WebCore::HTMLAttachmentElement::setUniqueIdentifier):
236         * html/HTMLAttachmentElement.h:
237         * html/HTMLAttributeNames.in:
238         * page/EditorClient.h:
239         (WebCore::EditorClient::didInsertAttachment):
240         (WebCore::EditorClient::didRemoveAttachment):
241
242 2017-11-08  Chris Dumez  <cdumez@apple.com>
243
244         Simplify ServiceWorkerContainer::jobResolvedWithRegistration()
245         https://bugs.webkit.org/show_bug.cgi?id=179429
246
247         Reviewed by Brady Eidson.
248
249         * workers/service/ServiceWorkerContainer.cpp:
250         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
251
252 2017-11-08  Chris Dumez  <cdumez@apple.com>
253
254         [Service Workers] Make sure SWServerRegistration update functions always message back the connection that scheduled the job
255         https://bugs.webkit.org/show_bug.cgi?id=179428
256
257         Reviewed by Brady Eidson.
258
259         * workers/service/server/SWServerJobQueue.cpp:
260         (WebCore::SWServerJobQueue::install):
261         (WebCore::SWServerJobQueue::didFinishInstall):
262         * workers/service/server/SWServerRegistration.cpp:
263         (WebCore::SWServerRegistration::updateRegistrationState):
264         (WebCore::SWServerRegistration::updateWorkerState):
265         (WebCore::SWServerRegistration::fireUpdateFoundEvent):
266         (WebCore::SWServerRegistration::firePostInstallEvents):
267         (WebCore::SWServerRegistration::forEachConnection):
268         * workers/service/server/SWServerRegistration.h:
269
270 2017-11-08  Maciej Stachowiak  <mjs@apple.com>
271
272         iOS supports some text encodings supposedly due to lack of TEC that aren't supported by the TEC decoder on macOS
273         https://bugs.webkit.org/show_bug.cgi?id=179309
274
275         Reviewed by Darin Adler.
276
277         Test: fast/encoding/legacy-ios-encodings.html
278
279         * platform/text/TextCodecICU.cpp:
280         (WebCore::TextCodecICU::registerEncodingNames): Remove most iOS-specific adding of names, leaving only softbank-sjis. 
281         Most were either redundant or unnecessary.
282         (WebCore::TextCodecICU::registerCodecs): ditto
283
284 2017-11-08  Zan Dobersek  <zdobersek@igalia.com>
285
286         Unreviewed. Attempting to unbork the WinCairo bot after r224578.
287
288         * platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h:
289         Add a missing semicolon after the deafult initialization of a member
290         variable in the GraphicsContextPlatformPrivate class.
291
292 2017-11-08  Chris Dumez  <cdumez@apple.com>
293
294         [Service Workers] Support waitUntil() on the 'install' event
295         https://bugs.webkit.org/show_bug.cgi?id=179396
296
297         Reviewed by Brady Eidson.
298
299         Support waitUntil() on the 'install' event:
300         - https://w3c.github.io/ServiceWorker/#installation-algorithm (step 10.4)
301         - https://w3c.github.io/ServiceWorker/#wait-until-method
302
303         Tests: http/tests/workers/service/basic-install-event-waitUntil-multiple-promises.html
304                http/tests/workers/service/basic-install-event-waitUntil-reject.html
305                http/tests/workers/service/basic-install-event-waitUntil-resolve.html
306
307         * testing/Internals.cpp:
308         * testing/Internals.h:
309         * testing/Internals.idl:
310         * workers/service/ExtendableEvent.cpp:
311         (WebCore::ExtendableEvent::waitUntil):
312         (WebCore::ExtendableEvent::addExtendLifetimePromise):
313         (WebCore::ExtendableEvent::whenAllExtendLifetimePromisesAreSettled):
314         * workers/service/ExtendableEvent.h:
315         (WebCore::ExtendableEvent::pendingPromiseCount const):
316         * workers/service/FetchEvent.cpp:
317         (WebCore::FetchEvent::respondWith):
318         * workers/service/ServiceWorkerContainer.cpp:
319         (WebCore::ServiceWorkerContainer::addRegistration):
320         (WebCore::ServiceWorkerContainer::removeRegistration):
321         * workers/service/ServiceWorkerContainer.h:
322         * workers/service/context/ServiceWorkerThread.cpp:
323         (WebCore::ServiceWorkerThread::fireInstallEvent):
324         * workers/service/server/SWClientConnection.h:
325         * workers/service/server/SWServerJobQueue.cpp:
326         (WebCore::SWServerJobQueue::didFinishInstall):
327         * workers/service/server/SWServerRegistration.cpp:
328         (WebCore::SWServerRegistration::firePostInstallEvents):
329
330 2017-11-08  Antti Koivisto  <antti@apple.com>
331
332         Remove Element::isInlineElementContinuation
333         https://bugs.webkit.org/show_bug.cgi?id=179425
334
335         Reviewed by Zalan Bujtas.
336
337         It is really just isInline+isContinuation test and most callers know it is an inline already.
338
339         * accessibility/AccessibilityRenderObject.cpp:
340         (WebCore::firstChildConsideringContinuation):
341         (WebCore::startOfContinuations):
342         (WebCore::firstChildIsInlineContinuation):
343         * rendering/InlineFlowBox.cpp:
344         (WebCore::InlineFlowBox::determineSpacingForFlowBoxes):
345         (WebCore::InlineFlowBox::paint):
346         * rendering/RenderBlock.cpp:
347         (WebCore::RenderBlock::addContinuationWithOutline):
348         * rendering/RenderElement.h:
349         (WebCore::RenderElement::setIsContinuation):
350         (WebCore::RenderElement::isElementContinuation const): Deleted.
351         (WebCore::RenderElement::isInlineElementContinuation const): Deleted.
352         * rendering/RenderInline.cpp:
353         (WebCore::RenderInline::willBeDestroyed):
354         (WebCore::RenderInline::updateHitTestResult):
355         * rendering/line/LineInlineHeaders.h:
356         (WebCore::hasInlineDirectionBordersPaddingOrMargin):
357
358 2017-11-08  David Hyatt  <hyatt@apple.com>
359
360         [Experiment] Implement code to detect high frequency painting
361         https://bugs.webkit.org/show_bug.cgi?id=179118
362         <rdar://problem/35347068>
363
364         Reviewed by Simon Fraser.
365
366         This patch implements a model for detecting that objects whose
367         graphics resources we want to cache (like glyphs or paths) are painting
368         frequently enough that it's worth taking the memory hit to cache them.
369
370         Paint frequency detection is done at the self-painting RenderLayer level, since
371         a lower level of granularity (e.g., per-RenderObject) would be too memory-intensive.
372
373         * rendering/PaintInfo.h:
374         (WebCore::PaintInfo::PaintInfo):
375         (WebCore::PaintInfo::enclosingSelfPaintingLayer):
376         Add the enclosing self-painting layer that is currently painting to the PaintInfo
377         so that objects that have cachaeble graphics resources can notify the layer when
378         they actually paint them.
379
380         * rendering/RenderLayer.cpp:
381         (WebCore::PaintFrequencyInfo::PaintFrequencyInfo):
382         (WebCore::PaintFrequencyInfo::paintingFrequently const):
383         (WebCore::PaintFrequencyInfo::updatePaintFrequency):
384         (WebCore::PaintFrequencyInfo::paintingCacheableResource):
385         RenderLayers have a pointer to PaintFrequencyInfo that is allocated once you've
386         painted cachaeble resources.
387
388         (WebCore::RenderLayer::paintLayerContents):
389         (WebCore::RenderLayer::paintBackgroundForFragments):
390         (WebCore::RenderLayer::paintForegroundForFragmentsWithPhase):
391         (WebCore::RenderLayer::paintOutlineForFragments):
392         (WebCore::RenderLayer::paintMaskForFragments):
393         (WebCore::RenderLayer::paintChildClippingMaskForFragments):
394         (WebCore::RenderLayer::calculateClipRects const):
395         * rendering/RenderLayer.h:
396         Patch to pass the layer with the PaintInfo.
397
398         * testing/Internals.cpp:
399         (WebCore::Internals::isPaintingFrequently):
400         (WebCore::Internals::incrementFrequentPaintCounter):
401         * testing/Internals.h:
402         * testing/Internals.idl:
403         Test methods for making layout tests to ensure we go into the mode properly.
404
405 2017-11-08  Zalan Bujtas  <zalan@apple.com>
406
407         [LayoutState cleanup] Make public data members private.
408         https://bugs.webkit.org/show_bug.cgi?id=179409
409         <rdar://problem/35406184>
410
411         Reviewed by Sam Weinig.
412
413         No change in functionality.
414
415         * page/LayoutContext.cpp:
416         (WebCore::LayoutContext::layoutDelta const):
417         (WebCore::LayoutContext::addLayoutDelta):
418         (WebCore::LayoutContext::layoutDeltaMatches):
419         (WebCore::LayoutContext::pushLayoutStateForPaginationIfNeeded):
420         * rendering/LayoutState.cpp:
421         (WebCore::LayoutState::LayoutState):
422         (WebCore::LayoutState::addLayoutDelta):
423         (WebCore::LayoutState::layoutDeltaMatches):
424         * rendering/LayoutState.h:
425         (WebCore::LayoutState::setIsPaginated):
426         (WebCore::LayoutState::setPageLogicalHeight):
427         (WebCore::LayoutState::paintOffset const):
428         (WebCore::LayoutState::renderer const):
429         (WebCore::LayoutState::clipRect const):
430         (WebCore::LayoutState::isClipped const):
431         (WebCore::LayoutState::layoutDelta const):
432         * rendering/RenderBlock.cpp:
433         (WebCore::RenderBlock::offsetFromLogicalTopOfFirstPage const):
434         (WebCore::RenderBlock::childBoxIsUnsplittableForFragmentation const):
435         * rendering/RenderBlockFlow.cpp:
436         (WebCore::RenderBlockFlow::layoutBlock):
437         (WebCore::RenderBlockFlow::applyBeforeBreak):
438         (WebCore::RenderBlockFlow::applyAfterBreak):
439         (WebCore::RenderBlockFlow::pageLogicalTopForOffset const):
440         (WebCore::RenderBlockFlow::pageLogicalHeightForOffset const):
441         (WebCore::RenderBlockFlow::pageRemainingLogicalHeightForOffset const):
442         * rendering/RenderBox.cpp:
443         (WebCore::RenderBox::mapLocalToContainer const):
444         (WebCore::RenderBox::computeRectForRepaint const):
445         * rendering/RenderInline.cpp:
446         (WebCore::RenderInline::computeRectForRepaint const):
447         (WebCore::RenderInline::mapLocalToContainer const):
448
449 2017-11-08  Zan Dobersek  <zdobersek@igalia.com>
450
451         [Cairo] Improve PlatformContextCairo lifetime management in GraphicsContextPlatformPrivate
452         https://bugs.webkit.org/show_bug.cgi?id=179424
453
454         Reviewed by Carlos Garcia Campos.
455
456         When the PlatformContextCairo object is owned by GraphicsContextPlatformPrivate,
457         the latter should hold it in a std::unique_ptr<>. When PlatformContextCairo is
458         not owned, the std::unique_ptr<> should remain null, and the PlatformContextCairo
459         reference should point to the externally-managed object.
460
461         A new GraphicsContextPlatformPrivate constructor accepts a std::unique_ptr<> that
462         manages a PlatformContextCairo object and moves it into the member variable, tying
463         lifetime of that PlatformContextCairo object to the private object.
464
465         This enables dropping the GraphicsContextPlatformPrivateToplevel class, and the
466         virtual table is no longer required. Small cleanups to the remaining class are
467         also performed.
468
469         No new tests -- no changes in behavior.
470
471         * platform/graphics/cairo/GraphicsContextCairo.cpp:
472         (WebCore::GraphicsContext::GraphicsContext):
473         (WebCore::GraphicsContext::platformInit):
474         (WebCore::GraphicsContext::platformContext const):
475         * platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h:
476         (WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate):
477         (WebCore::GraphicsContextPlatformPrivate::save):
478         (WebCore::GraphicsContextPlatformPrivate::restore):
479         (WebCore::GraphicsContextPlatformPrivate::flush):
480         (WebCore::GraphicsContextPlatformPrivate::clip):
481         (WebCore::GraphicsContextPlatformPrivate::scale):
482         (WebCore::GraphicsContextPlatformPrivate::rotate):
483         (WebCore::GraphicsContextPlatformPrivate::translate):
484         (WebCore::GraphicsContextPlatformPrivate::concatCTM):
485         (WebCore::GraphicsContextPlatformPrivate::setCTM):
486         (WebCore::GraphicsContextPlatformPrivate::~GraphicsContextPlatformPrivate): Deleted.
487         (WebCore::GraphicsContextPlatformPrivateToplevel::GraphicsContextPlatformPrivateToplevel): Deleted.
488         (WebCore::GraphicsContextPlatformPrivateToplevel::~GraphicsContextPlatformPrivateToplevel): Deleted.
489         * platform/graphics/win/GraphicsContextCairoWin.cpp:
490         (WebCore::GraphicsContext::platformInit):
491
492 2017-11-08  Zan Dobersek  <zdobersek@igalia.com>
493
494         [Cairo] Move transparency layers Vector to PlatformContextCairo
495         https://bugs.webkit.org/show_bug.cgi?id=179420
496
497         Reviewed by Carlos Garcia Campos.
498
499         Move the Vector of transparency layer float values from the
500         GraphicsContextPlatformPrivate class to PlatformContextCairo.
501         It fits better there since it's a platform-specific context
502         state, just like e.g. the ShadowBlur member.
503
504         No new tests -- no change in behavior.
505
506         * platform/graphics/cairo/GraphicsContextCairo.cpp:
507         (WebCore::GraphicsContext::beginPlatformTransparencyLayer):
508         (WebCore::GraphicsContext::endPlatformTransparencyLayer):
509         * platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h:
510         * platform/graphics/cairo/PlatformContextCairo.h:
511         (WebCore::PlatformContextCairo::layers):
512         * platform/graphics/win/GraphicsContextCairoWin.cpp:
513         (WebCore::drawBitmapToContext):
514         (WebCore::GraphicsContext::releaseWindowsContext):
515         (WebCore::GraphicsContext::drawWindowsBitmap):
516
517 2017-11-08  Jeremy Jones  <jeremyj@apple.com>
518
519         Disable implicit animations when adding or removing text track representation layers.
520         https://bugs.webkit.org/show_bug.cgi?id=179406
521         rdar://problem/34369835
522
523         Reviewed by Simon Fraser.
524
525         No new tests because this has no effect on the DOM.
526
527         This change prevents implicit animations when the text track layer is added or removed from
528         the video layer.
529
530         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
531         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenLayer):
532         (WebCore::MediaPlayerPrivateAVFoundationObjC::syncTextTrackBounds):
533         (WebCore::MediaPlayerPrivateAVFoundationObjC::setTextTrackRepresentation):
534         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
535         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenLayer):
536         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::syncTextTrackBounds):
537         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setTextTrackRepresentation):
538         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm:
539         (WebCore::VideoFullscreenLayerManager::setVideoFullscreenLayer):
540
541 2017-11-07  Maciej Stachowiak  <mjs@apple.com>
542
543         Get rid of unsightly hex numbers from unified build object files
544         https://bugs.webkit.org/show_bug.cgi?id=179410
545
546         Reviewed by Saam Barati.
547
548         * WebCore.xcodeproj/project.pbxproj: Rename UnifiedSource*.mm to UnifiedSource*-mm.mm for more readable build output.
549
550 2017-11-07  Antti Koivisto  <antti@apple.com>
551
552         Remove RenderBlock::isAnonymousBlockContinuation()
553         https://bugs.webkit.org/show_bug.cgi?id=179403
554
555         Non-anonymous blocks don't have continuations so this is the same as simply calling continuation().
556
557         Some of these are also really isContinuation() tests. This ends up being the same as calling
558         continuation() as block continuations always have next continuation too. This patch uses
559         isContinuation() where appropriate.
560
561         Reviewed by Zalan Bujtas.
562
563         * rendering/RenderBlock.cpp:
564         (WebCore::RenderBlock::nodeForHitTest const):
565         (WebCore::RenderBlock::absoluteRects const):
566         (WebCore::RenderBlock::absoluteQuads const):
567         (WebCore::RenderBlock::rectWithOutlineForRepaint const):
568         (WebCore::RenderBlock::hoverAncestor const):
569         (WebCore::RenderBlock::outlineStyleForRepaint const):
570         * rendering/RenderBlock.h:
571         (WebCore::RenderBlock::isAnonymousBlockContinuation const): Deleted.
572         * rendering/RenderElement.cpp:
573         (WebCore::RenderElement::propagateStyleToAnonymousChildren):
574         * rendering/RenderInline.cpp:
575         (WebCore::updateStyleOfAnonymousBlockContinuations):
576
577 2017-11-07  Antti Koivisto  <antti@apple.com>
578
579         There is no such thing as block element continuation
580         https://bugs.webkit.org/show_bug.cgi?id=179400
581
582         Reviewed by Zalan Bujtas.
583
584         There are no non-anonymous block continuations. This is dead code.
585
586         * rendering/RenderBlock.cpp:
587         (WebCore::borderOrPaddingLogicalWidthChanged):
588         (WebCore::RenderBlock::styleDidChange):
589         (WebCore::RenderBlock::blockElementContinuation const): Deleted.
590
591             This would always return null.
592
593         * rendering/RenderBlock.h:
594
595 2017-11-07  Zalan Bujtas  <zalan@apple.com>
596
597         [LayoutState cleanup] Rename enable/disableLayoutState
598         https://bugs.webkit.org/show_bug.cgi?id=179399
599         <rdar://problem/35400245>
600
601         Reviewed by Antti Koivisto.
602
603         It only enables/disables paint offset caching.
604
605         No change in functionality.
606
607         * page/LayoutContext.cpp:
608         (WebCore::LayoutContext::pushLayoutState):
609         (WebCore::LayoutContext::checkLayoutState):
610         * page/LayoutContext.h:
611         (WebCore::LayoutContext::isPaintOffsetCacheEnabled const):
612         (WebCore::LayoutContext::disablePaintOffsetCache):
613         (WebCore::LayoutContext::enablePaintOffsetCache):
614         (WebCore::LayoutContext::layoutStateEnabled const): Deleted.
615         (WebCore::LayoutContext::disableLayoutState): Deleted.
616         (WebCore::LayoutContext::enableLayoutState): Deleted.
617         * rendering/LayoutState.cpp:
618         (WebCore::LayoutStateMaintainer::LayoutStateMaintainer):
619         (WebCore::LayoutStateMaintainer::push):
620         (WebCore::LayoutStateMaintainer::pop):
621         (WebCore::LayoutStateDisabler::LayoutStateDisabler):
622         (WebCore::LayoutStateDisabler::~LayoutStateDisabler):
623         (WebCore::shouldDisablePaintOffsetCacheForSubtree):
624         (WebCore::SubtreeLayoutStateMaintainer::SubtreeLayoutStateMaintainer):
625         (WebCore::SubtreeLayoutStateMaintainer::~SubtreeLayoutStateMaintainer):
626         (WebCore::shouldDisableLayoutStateForSubtree): Deleted.
627         * rendering/LayoutState.h:
628         * rendering/RenderBox.cpp:
629         (WebCore::RenderBox::mapLocalToContainer const):
630         (WebCore::RenderBox::computeRectForRepaint const):
631         * rendering/RenderInline.cpp:
632         (WebCore::RenderInline::clippedOverflowRectForRepaint const):
633         (WebCore::RenderInline::computeRectForRepaint const):
634         (WebCore::RenderInline::mapLocalToContainer const):
635         * rendering/RenderLayer.cpp:
636         (WebCore::RenderLayer::updateLayerPositions):
637         * rendering/RenderTableCell.cpp:
638         (WebCore::RenderTableCell::computeRectForRepaint const):
639         * rendering/svg/RenderSVGContainer.cpp:
640         (WebCore::RenderSVGContainer::layout):
641         * rendering/svg/RenderSVGForeignObject.cpp:
642         (WebCore::RenderSVGForeignObject::layout):
643
644 2017-11-07  Brady Eidson  <beidson@apple.com>
645
646         Implement "UpdateWorkerState" and use it
647         https://bugs.webkit.org/show_bug.cgi?id=179318
648
649         Reviewed by Chris Dumez.
650
651         No new tests (Existing tests and changes there-to).
652
653         * workers/service/ServiceWorker.cpp:
654         (WebCore::ServiceWorker::allWorkers):
655         (WebCore::ServiceWorker::mutableAllWorkers):
656         (WebCore::ServiceWorker::ServiceWorker):
657         (WebCore::ServiceWorker::~ServiceWorker):
658         (WebCore::ServiceWorker::updateWorkerState):
659         (WebCore::ServiceWorker::setState): Deleted.
660         * workers/service/ServiceWorker.h:
661
662         * workers/service/ServiceWorkerContainer.cpp:
663         (WebCore::ServiceWorkerContainer::updateRegistrationState):
664         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
665         * workers/service/ServiceWorkerContainer.h:
666
667         * workers/service/ServiceWorkerRegistration.cpp:
668         (WebCore::ServiceWorkerRegistration::ServiceWorkerRegistration):
669         (WebCore::ServiceWorkerRegistration::~ServiceWorkerRegistration):
670         (WebCore::ServiceWorkerRegistration::updateStateFromServer):
671
672         * workers/service/ServiceWorkerRegistrationData.cpp:
673         (WebCore::ServiceWorkerRegistrationData::isolatedCopy const):
674         * workers/service/ServiceWorkerRegistrationData.h:
675         (WebCore::ServiceWorkerRegistrationData::encode const):
676         (WebCore::ServiceWorkerRegistrationData::decode):
677
678         * workers/service/ServiceWorkerRegistrationKey.cpp:
679         (WebCore::ServiceWorkerRegistrationKey::loggingString const):
680         * workers/service/ServiceWorkerRegistrationKey.h:
681
682         * workers/service/ServiceWorkerTypes.h:
683
684         * workers/service/context/SWContextManager.cpp:
685         (WebCore::SWContextManager::registerServiceWorkerThreadForInstall):
686         (WebCore::SWContextManager::registerServiceWorkerThreadForUpdate): Deleted.
687         * workers/service/context/SWContextManager.h:
688
689         * workers/service/server/SWClientConnection.cpp:
690         (WebCore::SWClientConnection::updateRegistrationState):
691         (WebCore::SWClientConnection::updateWorkerState):
692         * workers/service/server/SWClientConnection.h:
693
694         * workers/service/server/SWServer.cpp:
695         (WebCore::SWServer::updateWorker):
696         * workers/service/server/SWServer.h:
697         (WebCore::SWServer::workerByID const):
698
699         * workers/service/server/SWServerJobQueue.cpp:
700         (WebCore::SWServerJobQueue::scriptFetchFinished):
701         (WebCore::SWServerJobQueue::scriptContextStarted):
702         (WebCore::SWServerJobQueue::install):
703         (WebCore::SWServerJobQueue::tryClearRegistration):
704
705         * workers/service/server/SWServerRegistration.cpp:
706         (WebCore::SWServerRegistration::updateRegistrationState):
707         (WebCore::SWServerRegistration::updateWorkerState):
708         (WebCore::SWServerRegistration::data const):
709         * workers/service/server/SWServerRegistration.h:
710         (WebCore::SWServerRegistration::setActiveServiceWorkerIdentifier): Deleted.
711
712         * workers/service/server/SWServerWorker.h:
713         (WebCore::SWServerWorker::state const):
714         (WebCore::SWServerWorker::setState):
715
716 2017-11-07  Zalan Bujtas  <zalan@apple.com>
717
718         [LayoutState cleanup] Remove explicit LayoutStateMaintainer::pop calls.
719         https://bugs.webkit.org/show_bug.cgi?id=179380
720         <rdar://problem/35392161>
721
722         Reviewed by Antti Koivisto.
723
724         Besides the pagination related explicit pops (FIXME), all LayoutStateMaintainer pops are
725         now in LayoutStateMaintainer's d'tor.
726
727         Covered by existing tests.
728
729         * rendering/LayoutState.cpp:
730         (WebCore::LayoutStateMaintainer::~LayoutStateMaintainer):
731         * rendering/RenderBlock.cpp:
732         (WebCore::RenderBlock::simplifiedLayout):
733         * rendering/RenderBlockFlow.cpp:
734         (WebCore::RenderBlockFlow::layoutBlock):
735         * rendering/RenderBox.cpp:
736         (WebCore::RenderBox::layout):
737         * rendering/RenderDeprecatedFlexibleBox.cpp:
738         (WebCore::RenderDeprecatedFlexibleBox::layoutBlock):
739         * rendering/RenderEmbeddedObject.cpp:
740         (WebCore::RenderEmbeddedObject::layout):
741         * rendering/RenderFlexibleBox.cpp:
742         (WebCore::RenderFlexibleBox::layoutBlock):
743         * rendering/RenderGrid.cpp:
744         (WebCore::RenderGrid::layoutBlock):
745         * rendering/RenderImage.cpp:
746         (WebCore::RenderImage::layoutShadowControls):
747         * rendering/RenderTable.cpp:
748         (WebCore::RenderTable::layout):
749         * rendering/RenderTableRow.cpp:
750         (WebCore::RenderTableRow::layout):
751         * rendering/RenderTableSection.cpp:
752         (WebCore::RenderTableSection::calcRowLogicalHeight):
753         (WebCore::RenderTableSection::layout):
754         (WebCore::RenderTableSection::layoutRows):
755         * rendering/RenderVTTCue.cpp:
756         (WebCore::RenderVTTCue::layout):
757         * rendering/RenderView.cpp:
758         (WebCore::RenderView::layout):
759
760 2017-11-07  Commit Queue  <commit-queue@webkit.org>
761
762         Unreviewed, rolling out r224512 and r224521.
763         https://bugs.webkit.org/show_bug.cgi?id=179388
764
765         An API test added with this change is failing an assertion on
766         the bots. (Requested by ryanhaddad on #webkit).
767
768         Reverted changesets:
769
770         "[Attachment Support] Implement delegate hooks for attachment
771         element insertion and removal"
772         https://bugs.webkit.org/show_bug.cgi?id=179016
773         https://trac.webkit.org/changeset/224512
774
775         "Remove stray logging from a newly added API test"
776         https://trac.webkit.org/changeset/224521
777
778 2017-11-07  Antoine Quint  <graouts@apple.com>
779
780         <video> does not respect pointer-events
781         https://bugs.webkit.org/show_bug.cgi?id=179378
782         <rdar://problem/34687668>
783
784         Reviewed by Simon Fraser.
785
786         We now honor the "pointer-events" property value set on the <video> element by setting it to "inherit"
787         on the media controls shadow root container.
788
789         Test: media/modern-media-controls/css/pointer-events-none.html
790
791         * Modules/modern-media-controls/controls/media-controls.css:
792         (.media-controls-container):
793
794 2017-11-07  Chris Dumez  <cdumez@apple.com>
795
796         [Service Workers] Add support for "install" event
797         https://bugs.webkit.org/show_bug.cgi?id=179338
798
799         Reviewed by Youenn Fablet.
800
801         Add support for "install" event as per:
802         - https://w3c.github.io/ServiceWorker/#installation-algorithm (Step 10)
803
804         For now, install always succeeds as our support for ExtendableEvent.waitUntil() is
805         still incomplete.
806
807         Test: http/tests/workers/service/basic-install-event.html
808
809         * workers/service/ServiceWorkerContainer.cpp:
810         (WebCore::ServiceWorkerContainer::firePostInstallEvents):
811         * workers/service/ServiceWorkerContainer.h:
812         * workers/service/context/SWContextManager.cpp:
813         (WebCore::SWContextManager::fireInstallEvent):
814         * workers/service/context/SWContextManager.h:
815         * workers/service/context/ServiceWorkerThread.cpp:
816         (WebCore::ServiceWorkerThread::fireInstallEvent):
817         * workers/service/context/ServiceWorkerThread.h:
818         * workers/service/server/SWClientConnection.cpp:
819         (WebCore::SWClientConnection::firePostInstallEvents):
820         * workers/service/server/SWClientConnection.h:
821         * workers/service/server/SWServer.cpp:
822         (WebCore::SWServer::Connection::didFinishInstall):
823         (WebCore::SWServer::didFinishInstall):
824         (WebCore::SWServer::fireInstallEvent):
825         * workers/service/server/SWServer.h:
826         * workers/service/server/SWServerJobQueue.cpp:
827         (WebCore::SWServerJobQueue::scriptContextStarted):
828         (WebCore::SWServerJobQueue::install):
829         (WebCore::SWServerJobQueue::didFinishInstall):
830         * workers/service/server/SWServerJobQueue.h:
831         * workers/service/server/SWServerRegistration.cpp:
832         (WebCore::SWServerRegistration::firePostInstallEvents):
833         * workers/service/server/SWServerRegistration.h:
834
835 2017-11-07  Ryan Haddad  <ryanhaddad@apple.com>
836
837         Unreviewed, rolling out r224498.
838
839         The LayoutTest for this change is flaky and affecting EWS
840         results.
841
842         Reverted changeset:
843
844         "Add tests to ensure that <source> tags are only preloaded
845         when the `type`"
846         https://bugs.webkit.org/show_bug.cgi?id=179231
847         https://trac.webkit.org/changeset/224498
848
849 2017-11-07  Joseph Pecoraro  <pecoraro@apple.com>
850
851         Web Inspector: Add some fast returns in cases where we only call through to a NetworkAgent
852         https://bugs.webkit.org/show_bug.cgi?id=179359
853
854         Reviewed by Devin Rousso.
855
856         * inspector/InspectorInstrumentation.h:
857         (WebCore::InspectorInstrumentation::willSendRequest):
858         (WebCore::InspectorInstrumentation::willSendRequestOfType):
859         (WebCore::InspectorInstrumentation::didLoadResourceFromMemoryCache):
860         (WebCore::InspectorInstrumentation::didReceiveThreadableLoaderResponse):
861         (WebCore::InspectorInstrumentation::didReceiveData):
862         (WebCore::InspectorInstrumentation::didFinishXHRLoading):
863         (WebCore::InspectorInstrumentation::willLoadXHRSynchronously):
864         (WebCore::InspectorInstrumentation::didLoadXHRSynchronously):
865         (WebCore::InspectorInstrumentation::scriptImported):
866         (WebCore::InspectorInstrumentation::didReceiveScriptResponse):
867         Fast return if no frontend in cases that only call into NetworkAgent
868         because the NetworkAgent is only available if there is a frontend.
869
870 2017-10-31  Filip Pizlo  <fpizlo@apple.com>
871
872         bmalloc should support strictly type-segregated isolated heaps
873         https://bugs.webkit.org/show_bug.cgi?id=178108
874
875         Reviewed by Saam Barati, Simon Fraser, and Ryosuke Niwa.
876
877         No new tests because no new change in behavior. Though, the bmalloc change has a unit test.
878         
879         Adopting IsoHeap means dropping in macros in both the .h and .cpp file of each class that we
880         opt in. It's not pretty, but it helps ensure speedy allocation since it means that we never
881         have to do any kind of switch or dynamic lookup to find the right allocator for a type.
882         
883         This change is perf-neutral on MotionMark, PLT3, and membuster.
884
885         * Sources.txt:
886         * html/shadow/SliderThumbElement.cpp:
887         * html/shadow/SliderThumbElement.h:
888         * html/shadow/mac/ImageControlsButtonElementMac.cpp:
889         * html/shadow/mac/ImageControlsRootElementMac.cpp:
890         * rendering/RenderAttachment.cpp:
891         * rendering/RenderAttachment.h:
892         * rendering/RenderBlock.cpp:
893         * rendering/RenderBlock.h:
894         * rendering/RenderBlockFlow.cpp:
895         * rendering/RenderBlockFlow.h:
896         * rendering/RenderBox.cpp:
897         * rendering/RenderBox.h:
898         * rendering/RenderBoxModelObject.cpp:
899         * rendering/RenderBoxModelObject.h:
900         * rendering/RenderButton.cpp:
901         * rendering/RenderButton.h:
902         * rendering/RenderCombineText.cpp:
903         * rendering/RenderCombineText.h:
904         * rendering/RenderCounter.cpp:
905         * rendering/RenderCounter.h:
906         * rendering/RenderDeprecatedFlexibleBox.cpp:
907         * rendering/RenderDeprecatedFlexibleBox.h:
908         * rendering/RenderDetailsMarker.cpp:
909         * rendering/RenderDetailsMarker.h:
910         * rendering/RenderElement.cpp:
911         * rendering/RenderElement.h:
912         * rendering/RenderEmbeddedObject.cpp:
913         * rendering/RenderEmbeddedObject.h:
914         * rendering/RenderFileUploadControl.cpp:
915         * rendering/RenderFileUploadControl.h:
916         * rendering/RenderFlexibleBox.cpp:
917         * rendering/RenderFlexibleBox.h:
918         * rendering/RenderFragmentContainer.cpp:
919         * rendering/RenderFragmentContainer.h:
920         * rendering/RenderFragmentContainerSet.cpp:
921         * rendering/RenderFragmentContainerSet.h:
922         * rendering/RenderFragmentedFlow.cpp:
923         * rendering/RenderFragmentedFlow.h:
924         * rendering/RenderFrameBase.cpp:
925         * rendering/RenderFrameBase.h:
926         * rendering/RenderFrameSet.cpp:
927         * rendering/RenderFrameSet.h:
928         * rendering/RenderFullScreen.cpp:
929         * rendering/RenderFullScreen.h:
930         * rendering/RenderGrid.cpp:
931         * rendering/RenderGrid.h:
932         * rendering/RenderHTMLCanvas.cpp:
933         * rendering/RenderHTMLCanvas.h:
934         * rendering/RenderImage.cpp:
935         * rendering/RenderImage.h:
936         * rendering/RenderImageResourceStyleImage.cpp:
937         * rendering/RenderImageResourceStyleImage.h:
938         * rendering/RenderInline.cpp:
939         * rendering/RenderInline.h:
940         * rendering/RenderLayerModelObject.cpp:
941         * rendering/RenderLayerModelObject.h:
942         * rendering/RenderLineBreak.cpp:
943         * rendering/RenderLineBreak.h:
944         * rendering/RenderListBox.cpp:
945         * rendering/RenderListBox.h:
946         * rendering/RenderListItem.cpp:
947         * rendering/RenderListItem.h:
948         * rendering/RenderListMarker.cpp:
949         * rendering/RenderListMarker.h:
950         * rendering/RenderMedia.cpp:
951         * rendering/RenderMedia.h:
952         * rendering/RenderMediaControlElements.cpp:
953         * rendering/RenderMediaControlElements.h:
954         * rendering/RenderMenuList.cpp:
955         * rendering/RenderMenuList.h:
956         * rendering/RenderMeter.cpp:
957         * rendering/RenderMeter.h:
958         * rendering/RenderMultiColumnFlow.cpp:
959         * rendering/RenderMultiColumnFlow.h:
960         * rendering/RenderMultiColumnSet.cpp:
961         * rendering/RenderMultiColumnSet.h:
962         * rendering/RenderMultiColumnSpannerPlaceholder.cpp:
963         * rendering/RenderMultiColumnSpannerPlaceholder.h:
964         * rendering/RenderObject.cpp:
965         * rendering/RenderObject.h:
966         * rendering/RenderProgress.cpp:
967         * rendering/RenderProgress.h:
968         * rendering/RenderQuote.cpp:
969         * rendering/RenderQuote.h:
970         * rendering/RenderReplaced.cpp:
971         * rendering/RenderReplaced.h:
972         * rendering/RenderReplica.cpp:
973         * rendering/RenderReplica.h:
974         * rendering/RenderRuby.cpp:
975         * rendering/RenderRuby.h:
976         * rendering/RenderRubyBase.cpp:
977         * rendering/RenderRubyBase.h:
978         * rendering/RenderRubyRun.cpp:
979         * rendering/RenderRubyRun.h:
980         * rendering/RenderRubyText.cpp:
981         * rendering/RenderRubyText.h:
982         * rendering/RenderScrollbarPart.cpp:
983         * rendering/RenderScrollbarPart.h:
984         * rendering/RenderSearchField.cpp:
985         * rendering/RenderSearchField.h:
986         * rendering/RenderSlider.cpp:
987         * rendering/RenderSlider.h:
988         * rendering/RenderTable.cpp:
989         * rendering/RenderTable.h:
990         * rendering/RenderTableCaption.cpp:
991         * rendering/RenderTableCaption.h:
992         * rendering/RenderTableCell.cpp:
993         * rendering/RenderTableCell.h:
994         * rendering/RenderTableCol.cpp:
995         * rendering/RenderTableCol.h:
996         * rendering/RenderTableRow.cpp:
997         * rendering/RenderTableRow.h:
998         * rendering/RenderTableSection.cpp:
999         * rendering/RenderTableSection.h:
1000         * rendering/RenderText.cpp:
1001         * rendering/RenderText.h:
1002         * rendering/RenderTextControl.cpp:
1003         * rendering/RenderTextControl.h:
1004         * rendering/RenderTextControlMultiLine.cpp:
1005         * rendering/RenderTextControlMultiLine.h:
1006         * rendering/RenderTextControlSingleLine.cpp:
1007         * rendering/RenderTextControlSingleLine.h:
1008         * rendering/RenderTextFragment.cpp:
1009         * rendering/RenderTextFragment.h:
1010         * rendering/RenderVTTCue.cpp:
1011         * rendering/RenderVTTCue.h:
1012         * rendering/RenderVideo.cpp:
1013         * rendering/RenderVideo.h:
1014         * rendering/RenderView.cpp:
1015         * rendering/RenderView.h:
1016         * rendering/RenderWidget.cpp:
1017         * rendering/RenderWidget.h:
1018         * rendering/mathml/RenderMathMLBlock.cpp:
1019         * rendering/mathml/RenderMathMLBlock.h:
1020         * rendering/mathml/RenderMathMLFenced.cpp:
1021         * rendering/mathml/RenderMathMLFenced.h:
1022         * rendering/mathml/RenderMathMLFencedOperator.cpp:
1023         * rendering/mathml/RenderMathMLFencedOperator.h:
1024         * rendering/mathml/RenderMathMLFraction.cpp:
1025         * rendering/mathml/RenderMathMLFraction.h:
1026         * rendering/mathml/RenderMathMLMath.cpp:
1027         * rendering/mathml/RenderMathMLMath.h:
1028         * rendering/mathml/RenderMathMLMenclose.cpp:
1029         * rendering/mathml/RenderMathMLMenclose.h:
1030         * rendering/mathml/RenderMathMLOperator.cpp:
1031         * rendering/mathml/RenderMathMLOperator.h:
1032         * rendering/mathml/RenderMathMLPadded.cpp:
1033         * rendering/mathml/RenderMathMLPadded.h:
1034         * rendering/mathml/RenderMathMLRoot.cpp:
1035         * rendering/mathml/RenderMathMLRoot.h:
1036         * rendering/mathml/RenderMathMLRow.cpp:
1037         * rendering/mathml/RenderMathMLRow.h:
1038         * rendering/mathml/RenderMathMLScripts.cpp:
1039         * rendering/mathml/RenderMathMLScripts.h:
1040         * rendering/mathml/RenderMathMLSpace.cpp:
1041         * rendering/mathml/RenderMathMLSpace.h:
1042         * rendering/mathml/RenderMathMLToken.cpp:
1043         * rendering/mathml/RenderMathMLToken.h:
1044         * rendering/mathml/RenderMathMLUnderOver.cpp:
1045         * rendering/mathml/RenderMathMLUnderOver.h:
1046         * rendering/svg/RenderSVGBlock.cpp:
1047         * rendering/svg/RenderSVGBlock.h:
1048         * rendering/svg/RenderSVGContainer.cpp:
1049         * rendering/svg/RenderSVGContainer.h:
1050         * rendering/svg/RenderSVGEllipse.cpp:
1051         * rendering/svg/RenderSVGEllipse.h:
1052         * rendering/svg/RenderSVGForeignObject.cpp:
1053         * rendering/svg/RenderSVGForeignObject.h:
1054         * rendering/svg/RenderSVGGradientStop.cpp:
1055         * rendering/svg/RenderSVGGradientStop.h:
1056         * rendering/svg/RenderSVGHiddenContainer.cpp:
1057         * rendering/svg/RenderSVGHiddenContainer.h:
1058         * rendering/svg/RenderSVGImage.cpp:
1059         * rendering/svg/RenderSVGImage.h:
1060         * rendering/svg/RenderSVGInline.cpp:
1061         * rendering/svg/RenderSVGInline.h:
1062         * rendering/svg/RenderSVGInlineText.cpp:
1063         * rendering/svg/RenderSVGInlineText.h:
1064         * rendering/svg/RenderSVGModelObject.cpp:
1065         * rendering/svg/RenderSVGModelObject.h:
1066         * rendering/svg/RenderSVGPath.cpp:
1067         * rendering/svg/RenderSVGPath.h:
1068         * rendering/svg/RenderSVGRect.cpp:
1069         * rendering/svg/RenderSVGRect.h:
1070         * rendering/svg/RenderSVGResourceClipper.cpp:
1071         * rendering/svg/RenderSVGResourceClipper.h:
1072         * rendering/svg/RenderSVGResourceContainer.cpp:
1073         * rendering/svg/RenderSVGResourceContainer.h:
1074         * rendering/svg/RenderSVGResourceFilter.cpp:
1075         * rendering/svg/RenderSVGResourceFilter.h:
1076         * rendering/svg/RenderSVGResourceFilterPrimitive.cpp:
1077         * rendering/svg/RenderSVGResourceFilterPrimitive.h:
1078         * rendering/svg/RenderSVGResourceGradient.cpp:
1079         * rendering/svg/RenderSVGResourceGradient.h:
1080         * rendering/svg/RenderSVGResourceLinearGradient.cpp:
1081         * rendering/svg/RenderSVGResourceLinearGradient.h:
1082         * rendering/svg/RenderSVGResourceMarker.cpp:
1083         * rendering/svg/RenderSVGResourceMarker.h:
1084         * rendering/svg/RenderSVGResourceMasker.cpp:
1085         * rendering/svg/RenderSVGResourceMasker.h:
1086         * rendering/svg/RenderSVGResourcePattern.cpp:
1087         * rendering/svg/RenderSVGResourcePattern.h:
1088         * rendering/svg/RenderSVGResourceRadialGradient.cpp:
1089         * rendering/svg/RenderSVGResourceRadialGradient.h:
1090         * rendering/svg/RenderSVGRoot.cpp:
1091         * rendering/svg/RenderSVGRoot.h:
1092         * rendering/svg/RenderSVGShape.cpp:
1093         * rendering/svg/RenderSVGShape.h:
1094         * rendering/svg/RenderSVGTSpan.cpp: Added.
1095         * rendering/svg/RenderSVGTSpan.h:
1096         * rendering/svg/RenderSVGText.cpp:
1097         * rendering/svg/RenderSVGText.h:
1098         * rendering/svg/RenderSVGTextPath.cpp:
1099         * rendering/svg/RenderSVGTextPath.h:
1100         * rendering/svg/RenderSVGTransformableContainer.cpp:
1101         * rendering/svg/RenderSVGTransformableContainer.h:
1102         * rendering/svg/RenderSVGViewportContainer.cpp:
1103         * rendering/svg/RenderSVGViewportContainer.h:
1104
1105 2017-11-07  Antti Koivisto  <antti@apple.com>
1106
1107         Dynamic media queries don't update in shadow tree stylesheets
1108         https://bugs.webkit.org/show_bug.cgi?id=179324
1109
1110         Reviewed by Ryosuke Niwa.
1111
1112         Viewport and accessibility queries should work dynamically also in shadow trees.
1113
1114         Test: fast/shadow-dom/media-query-in-shadow-style.html
1115
1116         * page/LayoutContext.cpp:
1117         (WebCore::LayoutContext::updateStyleForLayout):
1118         * page/Page.cpp:
1119         (WebCore::Page::accessibilitySettingsDidChange):
1120
1121             Evaluate media query list (JS API) unconditionally as it is independent from style queries.
1122             Remove some logging.
1123
1124         * style/StyleScope.cpp:
1125         (WebCore::Style::Scope::evaluateMediaQueriesForViewportChange):
1126         (WebCore::Style::Scope::evaluateMediaQueriesForAccessibilitySettingsChange):
1127
1128             Factor into functions in style scope.
1129
1130         (WebCore::Style::Scope::evaluateMediaQueries):
1131
1132             Evaluate queries in all shadow trees too.
1133
1134         * style/StyleScope.h:
1135
1136 2017-11-07  Ryosuke Niwa  <rniwa@webkit.org>
1137
1138         Release-assert NoEventDispatchAssertion in canExecute, updateLayout, and updateStyle
1139         https://bugs.webkit.org/show_bug.cgi?id=179281
1140         <rdar://problem/35008993>
1141
1142         Reviewed by Antti Koivisto.
1143
1144         Surgically enable NoEventDispatchAssertion::InMainThread::isEventAllowed() in release builds to prevent
1145         against insecure execution of author scripts.
1146
1147         No new tests since there should be no behavioral changes (other than preventing potential security bugs
1148         from being exploited).
1149
1150         * bindings/js/ScriptController.cpp:
1151         (WebCore::ScriptController::canExecuteScripts): Use the release assert here. This function is consulted
1152         whenever author scripts are executed in event handler, script element, etc... in the main thread so
1153         enabling the release assert here should basically prevent all unwanted script executions protected by
1154         NoEventDispatchAssertion.
1155         * dom/ContainerNode.cpp:
1156         (NoEventDispatchAssertion::s_count): Now always compiled.
1157         * dom/Document.cpp:
1158         (WebCore::Document::updateStyleIfNeeded): Use the release assert here. This assertion would prevent
1159         unwanted style updating. This part of the change can be reverted if it turns out to be too crashy since
1160         just updating the style would not directly introduce a security vulnerability.
1161         (WebCore::Document::updateLayout): Ditto for updating the layout.
1162         * dom/NoEventDispatchAssertion.h:
1163         (WebCore::NoEventDispatchAssertion::NoEventDispatchAssertion): Enabled this in release builds.
1164         (WebCore::NoEventDispatchAssertion::~NoEventDispatchAssertion): Ditto.
1165         (WebCore::NoEventDispatchAssertion::isEventAllowedInMainThread): Ditto.
1166         (WebCore::NoEventDispatchAssertion::InMainThread::InMainThread): Ditto.
1167         (WebCore::NoEventDispatchAssertion::InMainThread::~InMainThread): Ditto.
1168         (WebCore::NoEventDispatchAssertion::InMainThread::isEventDispatchAllowedInSubtree): We still don't enable
1169         this assertion because this check requires O(n) operation. Added a comment to that end.
1170         (WebCore::NoEventDispatchAssertion::InMainThread::isEventAllowed): Enabled this in release builds.
1171         (WebCore::NoEventDispatchAssertion::DisableAssertionsInScope): Ditto.
1172         * dom/ScriptElement.cpp:
1173         (WebCore::ScriptElement::executeClassicScript): Use the release assert here. This is the function used by
1174         the HTML parser to run scripts via HTMLScriptRunner::executePendingScriptAndDispatchEvent. Having a release
1175         assertion here should prevent the rest of the unwanted script executions in the HTML parser not caught by
1176         canExecuteScripts.
1177
1178 2017-11-07  Adrian Perez de Castro  <aperez@igalia.com>
1179
1180         [WPE][GTK] Building with ENABLE_VIDEO=OFF fails to find AudioTrack.idl
1181         https://bugs.webkit.org/show_bug.cgi?id=179372
1182
1183         Reviewed by Michael Catanzaro.
1184
1185         Arrange MSE extensions defined in {Audio,Text,Video}TrackMediaSource.idl to be
1186         only used for building when both ENABLE_VIDEO_TRACK and ENABLE_MEDIA_SOURCE are
1187         enabled.
1188
1189         No new tests needed.
1190
1191         * CMakeLists.txt: Add conditional for ENABLE_MEDIA_SOURCE and move the addition
1192         of the IDL files to the build there.
1193         * Sources.txt: Conversely, source unification should skip sources derived from
1194         the IDL files when ENABLE_MEDIA_SOURCE disabled, so add guards as well.
1195
1196 2017-11-07  Youenn Fablet  <youenn@apple.com>
1197
1198         Support the case of fetch events that are not responded
1199         https://bugs.webkit.org/show_bug.cgi?id=179336
1200
1201         Reviewed by Chris Dumez.
1202
1203         Covered by updated test.
1204
1205         Implementing https://w3c.github.io/ServiceWorker/#on-fetch-request-algorithm step 19.
1206         Making FetchEvent cancellable.
1207
1208         * workers/service/FetchEvent.h:
1209         * workers/service/context/ServiceWorkerFetch.cpp:
1210         (WebCore::ServiceWorkerFetch::dispatchFetchEvent):
1211         * workers/service/context/ServiceWorkerFetch.h:
1212
1213 2017-11-07  Joseph Pecoraro  <pecoraro@apple.com>
1214
1215         Web Inspector: Create inspector agents lazily
1216         https://bugs.webkit.org/show_bug.cgi?id=179360
1217
1218         Reviewed by Sam Weinig.
1219
1220         * inspector/CommandLineAPIHost.h:
1221         Modernize style.
1222
1223         * inspector/InspectorController.h:
1224         * inspector/InspectorController.cpp:
1225         (WebCore::InspectorController::InspectorController):
1226         (WebCore::InspectorController::pageAgentContext):
1227         (WebCore::InspectorController::createLazyAgents):
1228         (WebCore::InspectorController::connectFrontend):
1229         Move many of the agent construction to happen lazily. These
1230         agent's aren't needed until an inspector connects, so defer
1231         creation until an inspector connects.
1232
1233 2017-11-06  Zalan Bujtas  <zalan@apple.com>
1234
1235         [LayoutState cleanup] Move m_layoutState from RenderView to LayoutContext
1236         https://bugs.webkit.org/show_bug.cgi?id=179282
1237         <rdar://problem/35348653>
1238
1239         Reviewed by Antti Koivisto.
1240
1241         LayoutContext now owns the top level LayoutState object.
1242         It makes RenderView behave like any other renderer by constructing a LayoutStateMaintainer on the stack.
1243         This is mostly moving code from RenderView.h/.cpp to LayoutContext.h/.cpp and fixing the callsites.
1244         (While view().frameView().layoutContext().layoutState() is a bit lengthy, it's
1245         temporary only, since LayoutState is planned to be an argument of the layout() method.  
1246
1247         Covered by existing test.
1248
1249         * accessibility/AXObjectCache.cpp:
1250         (WebCore::AXObjectCache::notificationPostTimerFired):
1251         * page/LayoutContext.cpp:
1252         (WebCore::LayoutContext::layoutDelta const):
1253         (WebCore::LayoutContext::addLayoutDelta):
1254         (WebCore::LayoutContext::layoutDeltaMatches):
1255         (WebCore::LayoutContext::pushLayoutState):
1256         (WebCore::LayoutContext::pushLayoutStateForPaginationIfNeeded):
1257         (WebCore::LayoutContext::popLayoutState):
1258         (WebCore::LayoutContext::checkLayoutState):
1259         * page/LayoutContext.h:
1260         (WebCore::LayoutContext::layoutState const):
1261         (WebCore::LayoutContext::layoutStateEnabled const):
1262         (WebCore::LayoutContext::disableLayoutState):
1263         (WebCore::LayoutContext::enableLayoutState):
1264         * rendering/LayoutState.cpp:
1265         (WebCore::LayoutState::LayoutState):
1266         (WebCore::LayoutState::computeClipRect):
1267         (WebCore::LayoutStateMaintainer::LayoutStateMaintainer):
1268         (WebCore::LayoutStateMaintainer::push):
1269         (WebCore::LayoutStateMaintainer::pop):
1270         (WebCore::LayoutStateDisabler::LayoutStateDisabler):
1271         (WebCore::LayoutStateDisabler::~LayoutStateDisabler):
1272         (WebCore::SubtreeLayoutStateMaintainer::SubtreeLayoutStateMaintainer):
1273         (WebCore::SubtreeLayoutStateMaintainer::~SubtreeLayoutStateMaintainer):
1274         (WebCore::PaginatedLayoutStateMaintainer::PaginatedLayoutStateMaintainer):
1275         (WebCore::PaginatedLayoutStateMaintainer::~PaginatedLayoutStateMaintainer):
1276         * rendering/LayoutState.h:
1277         * rendering/RenderBlock.cpp:
1278         (WebCore::RenderBlock::setLogicalLeftForChild):
1279         (WebCore::RenderBlock::setLogicalTopForChild):
1280         (WebCore::RenderBlock::layoutPositionedObject):
1281         (WebCore::RenderBlock::markForPaginationRelayoutIfNeeded):
1282         (WebCore::RenderBlock::adjustLogicalLeftOffsetForLine const):
1283         (WebCore::RenderBlock::adjustLogicalRightOffsetForLine const):
1284         (WebCore::RenderBlock::offsetFromLogicalTopOfFirstPage const):
1285         (WebCore::RenderBlock::childBoxIsUnsplittableForFragmentation const):
1286         * rendering/RenderBlockFlow.cpp:
1287         (WebCore::RenderBlockFlow::layoutBlock):
1288         (WebCore::RenderBlockFlow::layoutBlockChildren):
1289         (WebCore::RenderBlockFlow::layoutBlockChild):
1290         (WebCore::RenderBlockFlow::collapseMarginsWithChildInfo):
1291         (WebCore::RenderBlockFlow::estimateLogicalTopPosition):
1292         (WebCore::RenderBlockFlow::applyBeforeBreak):
1293         (WebCore::RenderBlockFlow::applyAfterBreak):
1294         (WebCore::RenderBlockFlow::hasNextPage const):
1295         (WebCore::RenderBlockFlow::pageLogicalTopForOffset const):
1296         (WebCore::RenderBlockFlow::pageLogicalHeightForOffset const):
1297         (WebCore::RenderBlockFlow::pageRemainingLogicalHeightForOffset const):
1298         (WebCore::RenderBlockFlow::repaintOverhangingFloats):
1299         (WebCore::RenderBlockFlow::insertFloatingObject):
1300         (WebCore::RenderBlockFlow::positionNewFloats):
1301         (WebCore::RenderBlockFlow::layoutSimpleLines):
1302         * rendering/RenderBlockLineLayout.cpp:
1303         (WebCore::RenderBlockFlow::layoutRunsAndFloats):
1304         (WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
1305         (WebCore::RenderBlockFlow::linkToEndLineIfNeeded):
1306         (WebCore::RenderBlockFlow::layoutLineBoxes):
1307         (WebCore::RenderBlockFlow::determineStartPosition):
1308         (WebCore::RenderBlockFlow::checkPaginationAndFloatsAtEndLine):
1309         * rendering/RenderBox.cpp:
1310         (WebCore::RenderBox::outlineBoundsForRepaint const):
1311         (WebCore::RenderBox::mapLocalToContainer const):
1312         (WebCore::RenderBox::clippedOverflowRectForRepaint const):
1313         (WebCore::RenderBox::computeRectForRepaint const):
1314         (WebCore::RenderBox::offsetFromLogicalTopOfFirstPage const):
1315         * rendering/RenderDeprecatedFlexibleBox.cpp:
1316         (WebCore::RenderDeprecatedFlexibleBox::layoutBlock):
1317         (WebCore::layoutChildIfNeededApplyingDelta):
1318         * rendering/RenderElement.cpp:
1319         (WebCore::RenderElement::insertChildInternal):
1320         (WebCore::RenderElement::takeChildInternal):
1321         * rendering/RenderEmbeddedObject.cpp:
1322         * rendering/RenderFragmentedFlow.cpp:
1323         (WebCore::RenderFragmentedFlow::repaintRectangleInFragments const):
1324         * rendering/RenderGrid.cpp:
1325         * rendering/RenderInline.cpp:
1326         (WebCore::RenderInline::clippedOverflowRectForRepaint const):
1327         (WebCore::RenderInline::computeRectForRepaint const):
1328         (WebCore::RenderInline::mapLocalToContainer const):
1329         * rendering/RenderLayer.cpp:
1330         (WebCore::RenderLayer::updateLayerPositions):
1331         * rendering/RenderListBox.cpp:
1332         (WebCore::RenderListBox::layout):
1333         * rendering/RenderMediaControlElements.cpp:
1334         (WebCore::RenderMediaVolumeSliderContainer::layout):
1335         (WebCore::RenderMediaControlTimelineContainer::layout):
1336         (WebCore::RenderTextTrackContainerElement::layout):
1337         * rendering/RenderObject.cpp:
1338         (WebCore::RenderObject::repaintRectangle const):
1339         * rendering/RenderReplaced.cpp:
1340         (WebCore::RenderReplaced::clippedOverflowRectForRepaint const):
1341         * rendering/RenderTable.cpp:
1342         (WebCore::RenderTable::layout):
1343         (WebCore::RenderTable::markForPaginationRelayoutIfNeeded):
1344         * rendering/RenderTableCell.cpp:
1345         (WebCore::RenderTableCell::clippedOverflowRectForRepaint const):
1346         (WebCore::RenderTableCell::computeRectForRepaint const):
1347         * rendering/RenderTableRow.cpp:
1348         (WebCore::RenderTableRow::layout):
1349         * rendering/RenderTableSection.cpp:
1350         (WebCore::RenderTableSection::calcRowLogicalHeight):
1351         (WebCore::RenderTableSection::layout):
1352         (WebCore::RenderTableSection::layoutRows):
1353         (WebCore::RenderTableSection::setLogicalPositionForCell const):
1354         * rendering/RenderVTTCue.cpp:
1355         * rendering/RenderView.cpp:
1356         (WebCore::RenderView::layout):
1357         (WebCore::RenderView::layoutContent): Deleted.
1358         (WebCore::RenderView::checkLayoutState): Deleted.
1359         (WebCore::RenderView::initializeLayoutState): Deleted.
1360         (WebCore::RenderView::pushLayoutState): Deleted.
1361         (WebCore::RenderView::pushLayoutStateForPaginationIfNeeded): Deleted.
1362         * rendering/RenderView.h:
1363         * rendering/RootInlineBox.cpp:
1364         (WebCore::RootInlineBox::lineSnapAdjustment const):
1365         * rendering/svg/RenderSVGContainer.cpp:
1366         (WebCore::RenderSVGContainer::layout):
1367         * rendering/svg/RenderSVGForeignObject.cpp:
1368         (WebCore::RenderSVGForeignObject::layout):
1369         * rendering/svg/RenderSVGRoot.cpp:
1370         (WebCore::RenderSVGRoot::layout):
1371         * style/RenderTreeUpdaterFirstLetter.cpp:
1372         (WebCore::RenderTreeUpdater::FirstLetter::update):
1373         * style/RenderTreeUpdaterListItem.cpp:
1374         (WebCore::RenderTreeUpdater::ListItem::updateMarker):
1375
1376 2017-11-06  Said Abou-Hallawa  <sabouhallawa@apple.com>
1377
1378         [CG] Adopt CGContextDrawPathDirect()
1379         https://bugs.webkit.org/show_bug.cgi?id=179339
1380         <rdar://problem/26283575>
1381
1382         Reviewed by Simon Fraser.
1383
1384         Adopt this function on macOS >= 10.12 and iOS >= 10.0. Instead of clearing
1385         the current path and creating a new one by calling CGContextBeginPath()
1386         and then adding a CGPath by calling CGContextAddPath() and then calling 
1387         one of the drawing path functions, we just call CGContextDrawPathDirect().
1388
1389         * platform/graphics/cg/GraphicsContextCG.cpp:
1390         (WebCore::GraphicsContext::drawPath):
1391         (WebCore::GraphicsContext::fillPath):
1392         (WebCore::GraphicsContext::strokePath): Don't call CGContextBeginPath()
1393         and CGContextAddPath() for the drawing CGContext in the case of gradient
1394         shadow because we add the CGPath to the layerContext and at the end we
1395         draw this CGLayer into the drawing context.
1396
1397 2017-11-06  Alex Christensen  <achristensen@webkit.org>
1398
1399         Make ResourceLoader::willSendRequestInternal asynchronous
1400         https://bugs.webkit.org/show_bug.cgi?id=179251
1401
1402         Reviewed by Andy Estes.
1403
1404         ResourceLoader::willSendRequestInternal is used for redirects, which need to be asynchronous, and for the initial request.
1405         Making it asynchronous requires making load initialization asynchronous, too.
1406
1407         No change in behavior.  This will allow us to make more things asynchronous.
1408
1409         * loader/LoaderStrategy.h:
1410         * loader/NetscapePlugInStreamLoader.cpp:
1411         (WebCore::NetscapePlugInStreamLoader::create):
1412         (WebCore::NetscapePlugInStreamLoader::init):
1413         (WebCore::NetscapePlugInStreamLoader::willSendRequest):
1414         * loader/NetscapePlugInStreamLoader.h:
1415         * loader/ResourceLoader.cpp:
1416         (WebCore::ResourceLoader::init):
1417         (WebCore::ResourceLoader::willSendRequestInternal):
1418         (WebCore::ResourceLoader::willSendRequest):
1419         (WebCore::ResourceLoader::willSendRequestAsync):
1420         * loader/ResourceLoader.h:
1421         (WebCore::ResourceLoader::startLoading):
1422         * loader/SubresourceLoader.cpp:
1423         (WebCore::SubresourceLoader::create):
1424         (WebCore::SubresourceLoader::startLoading):
1425         (WebCore::SubresourceLoader::init):
1426         (WebCore::SubresourceLoader::willSendRequestInternal):
1427         * loader/SubresourceLoader.h:
1428         * loader/cache/CachedResource.cpp:
1429         (WebCore::CachedResource::load):
1430         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
1431         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]):
1432         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]):
1433         Calling autorelease from a non-main thread was causing crashes.  This is because we need to set up an autorelease pool on that thread, which we have not done.  See:
1434         https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmAutoreleasePools.html#//apple_ref/doc/uid/20000047-1041876
1435         I replaced the calls to RetainPtr::autorelease with RetainPtr::get.  This causes us to keep the NSURLRequest and NSURLResponse alive as long as the request is being
1436         responded to in WebKitLegacy and in El Capitan.  Given the number of ResourceRequest and ResourceResponse copies we store, this shouldn't be a problem memory-wise.
1437         This will all go away once NSURLSession is used for loading in WebKitLegacy, and this is a large step towards that.
1438
1439 2017-11-06  Wenson Hsieh  <wenson_hsieh@apple.com>
1440
1441         [Attachment Support] Implement delegate hooks for attachment element insertion and removal
1442         https://bugs.webkit.org/show_bug.cgi?id=179016
1443         <rdar://problem/35250890>
1444
1445         Reviewed by Tim Horton.
1446
1447         Implements a mechanism for notifying WebKit2 clients when attachment elements are inserted into or removed from
1448         the document. See per-change comments below for more details.
1449
1450         API tests: WKAttachmentTests.AttachmentElementInsertion
1451                    WKAttachmentTests.AttachmentUpdatesWhenInsertingAndDeletingNewline
1452                    WKAttachmentTests.AttachmentUpdatesWhenUndoingAndRedoing
1453                    WKAttachmentTests.AttachmentUpdatesWhenChangingFontStyles
1454                    WKAttachmentTests.AttachmentUpdatesWhenInsertingLists
1455                    WKAttachmentTests.AttachmentUpdatesWhenInsertingRichMarkup
1456
1457         * editing/Editor.cpp:
1458         (WebCore::Editor::respondToChangedSelection):
1459         (WebCore::Editor::editorUIUpdateTimerFired):
1460
1461         Additionally notify the client of any attachment updates.
1462
1463         (WebCore::Editor::scheduleEditorUIUpdate):
1464
1465         Add a new helper that starts the editor UI update timer with 0 delay, and use it everywhere we schedule an
1466         editor UI update.
1467
1468         (WebCore::Editor::didInsertAttachmentElement):
1469         (WebCore::Editor::didRemoveAttachmentElement):
1470
1471         Maintain two sets of attachment element identifiers -- the first one tracking insertions, and the second one
1472         tracking removals. When an attachment element is inserted, we first check to see if that attachment element has
1473         just been removed; if so, we don't add it to the inserted identifiers set, but instead remove it from the set of
1474         removed identifiers. We perform a similar check in the opposite case. This prevents us from notifying the client
1475         of extraneous insertions and removals during certain editing commands which may reparent and move attachment
1476         elements around. In both cases, we schedule an editor UI update afterwards, where we will notify the client of
1477         attachment updates.
1478
1479         (WebCore::Editor::notifyClientOfAttachmentUpdates):
1480         (WebCore::Editor::insertAttachmentFromFile):
1481         * editing/Editor.h:
1482         * html/HTMLAttachmentElement.cpp:
1483         (WebCore::HTMLAttachmentElement::HTMLAttachmentElement):
1484
1485         Remove the version of HTMLAttachmentElement's constructor that takes a unique identifier.
1486
1487         (WebCore::HTMLAttachmentElement::insertedIntoAncestor):
1488         (WebCore::HTMLAttachmentElement::removedFromAncestor):
1489
1490         Implement these hooks to observe insertion into and removal from the DOM. If the element was attached to or
1491         removed from an ancestor that was connected to the document, call out to the document's frame's editor. This
1492         "document-connected" rule prevents us from calling out to the client in cases where (for instance) we append an
1493         attachment element to a newly created DocumentFragment in preparation for executing a ReplaceSelectionCommand.
1494
1495         (WebCore::HTMLAttachmentElement::uniqueIdentifier const):
1496         (WebCore::HTMLAttachmentElement::setUniqueIdentifier):
1497
1498         Refactor unique identifier to refer to the new attachment identifier attribute instead of a member variable.
1499
1500         * html/HTMLAttachmentElement.h:
1501         * html/HTMLAttributeNames.in:
1502
1503         Add a new attribute representing an attachment element's identifier. This enables us to keep track of particular
1504         attachments as they are destroyed and recreated as different objects, as a result of some editing commands.
1505
1506         * page/EditorClient.h:
1507         (WebCore::EditorClient::didInsertAttachment):
1508         (WebCore::EditorClient::didRemoveAttachment):
1509
1510         Add boilerplate editor client hooks for attachment insertion and removal.
1511
1512 2017-11-06  Ryan Haddad  <ryanhaddad@apple.com>
1513
1514         Unreviewed, rolling out r224494.
1515
1516         Introduced LayoutTest flakiness on WK1.
1517
1518         Reverted changeset:
1519
1520         "[LayoutState cleanup] Move m_layoutState from RenderView to
1521         LayoutContext"
1522         https://bugs.webkit.org/show_bug.cgi?id=179282
1523         https://trac.webkit.org/changeset/224494
1524
1525 2017-11-03  Simon Fraser  <simon.fraser@apple.com>
1526
1527         UIWebView is not rendering content that comes on screen during overflow scroll
1528         https://bugs.webkit.org/show_bug.cgi?id=179277
1529         rdar://problem/34272949
1530
1531         Reviewed by Tim Horton
1532
1533         When page or overflow scrolling happens, we do a traversal of GraphicsLayers to determine
1534         whether the exposed part of tiled layers changed in a way that requires a change in the tile
1535         coverage. If so, we schedule a compositing layer flush.
1536
1537         There was no equivalent logic for computing whether the "backing store detached" state
1538         of a layer changed (which we use to throw away backing store of layers outside the viewport),
1539         so after scrolling an accelerated overflow:scroll which contained composited layers, we
1540         would sometimes fail to recompute that we should re-create backing store for revealed
1541         layers.
1542
1543         Fix by having GraphicsLayerCA::recursiveVisibleRectChangeRequiresFlush() determine
1544         whether 'intersectsCoverageRect' changed, and if so trigger a flush. This requires
1545         tracking CommitState for isViewportConstrained-ness, just like we do during commits.
1546
1547         Also clean up code related to computing the visible rect passed into visibleRectChangeRequiresFlush() and
1548         flushCompositingState(); these diverged for no good reason. Also clean up the logging a little.
1549         
1550         Not testable because UIWebView layout tests are unreliable.
1551
1552         * page/ios/FrameIOS.mm:
1553         (WebCore::Frame::viewportOffsetChanged):
1554         (WebCore::Frame::overflowScrollPositionChangedForNode):
1555         * platform/graphics/ca/GraphicsLayerCA.cpp:
1556         (WebCore::GraphicsLayerCA::recursiveVisibleRectChangeRequiresFlush const):
1557         (WebCore::GraphicsLayerCA::visibleRectChangeRequiresFlush const):
1558         * platform/graphics/ca/GraphicsLayerCA.h:
1559         * rendering/RenderLayerCompositor.cpp:
1560         (WebCore::RenderLayerCompositor::visibleRectForLayerFlushing const):
1561         (WebCore::RenderLayerCompositor::flushPendingLayerChanges):
1562         (WebCore::RenderLayerCompositor::didChangeVisibleRect):
1563         * rendering/RenderLayerCompositor.h:
1564
1565 2017-11-06  Chris Dumez  <cdumez@apple.com>
1566
1567         [Service Workers] Add proper implementation for 'updatefound' event
1568         https://bugs.webkit.org/show_bug.cgi?id=179302
1569
1570         Reviewed by Brady Eidson.
1571
1572         Add proper implementation for 'updatefound' event instead of faking it.
1573         The 'updatefound' event firing is now triggered from the StorageProcess,
1574         during the install steps, instead of being fired on WebContent process
1575         side in jobResolvedWithRegistration().
1576
1577         Specification:
1578         - https://w3c.github.io/ServiceWorker/#install (step 7)
1579
1580         * workers/service/ServiceWorkerContainer.cpp:
1581         (WebCore::ServiceWorkerContainer::scheduleJob):
1582         (WebCore::ServiceWorkerContainer::fireUpdateFoundEvent):
1583         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
1584         (WebCore::ServiceWorkerContainer::jobDidFinish):
1585         * workers/service/ServiceWorkerContainer.h:
1586         * workers/service/server/SWClientConnection.cpp:
1587         (WebCore::SWClientConnection::fireUpdateFoundEvent):
1588         * workers/service/server/SWClientConnection.h:
1589         * workers/service/server/SWServer.h:
1590         * workers/service/server/SWServerJobQueue.cpp:
1591         (WebCore::SWServerJobQueue::scriptContextStarted):
1592         (WebCore::SWServerJobQueue::install):
1593         * workers/service/server/SWServerJobQueue.h:
1594         * workers/service/server/SWServerRegistration.cpp:
1595         (WebCore::SWServerRegistration::fireUpdateFoundEvent):
1596         * workers/service/server/SWServerRegistration.h:
1597
1598 2017-11-06  Christopher Reid  <chris.reid@sony.com>
1599
1600         Use enum classes within FileSystem
1601         https://bugs.webkit.org/show_bug.cgi?id=175172
1602
1603         Reviewed by Myles C. Maxfield.
1604
1605         No new tests, no change in behavior.
1606
1607         Using enum classes in filesystem to enforce stronger type safety.
1608
1609         * Modules/webdatabase/OriginLock.cpp:
1610         * loader/appcache/ApplicationCacheStorage.cpp:
1611         * platform/FileHandle.h:
1612         * platform/FileStream.cpp:
1613         * platform/FileSystem.cpp:
1614         * platform/FileSystem.h:
1615         * platform/cocoa/FileMonitorCocoa.mm:
1616         * platform/glib/FileSystemGlib.cpp:
1617         * platform/network/curl/CurlCacheEntry.cpp:
1618         * platform/network/curl/CurlCacheManager.cpp:
1619         * platform/posix/FileSystemPOSIX.cpp:
1620         * platform/win/FileSystemWin.cpp:
1621         * rendering/RenderThemeWin.cpp:
1622
1623 2017-11-06  Commit Queue  <commit-queue@webkit.org>
1624
1625         Unreviewed, rolling out r224497.
1626         https://bugs.webkit.org/show_bug.cgi?id=179335
1627
1628         It is breaking internal builds (Requested by youenn on
1629         #webkit).
1630
1631         Reverted changeset:
1632
1633         "Use VCP H264 encoder for platforms supporting it"
1634         https://bugs.webkit.org/show_bug.cgi?id=179076
1635         https://trac.webkit.org/changeset/224497
1636
1637 2017-11-06  Chris Dumez  <cdumez@apple.com>
1638
1639         ScriptExecutionContext::serviceWorkerContainer() should avoid constructing a Navigator object
1640         https://bugs.webkit.org/show_bug.cgi?id=179322
1641
1642         Reviewed by Sam Weinig.
1643
1644         ScriptExecutionContext::serviceWorkerContainer() should avoid constructing a Navigator object
1645         unnecessarily.
1646
1647         * dom/ScriptExecutionContext.cpp:
1648         (WebCore::ScriptExecutionContext::serviceWorkerContainer):
1649         * page/DOMWindow.h:
1650
1651 2017-11-06  Colin Bendell  <colin@bendell.ca>
1652
1653         Added mime type check to the picture source preloader to avoid downloading incompatible resources.
1654         https://bugs.webkit.org/show_bug.cgi?id=179231
1655
1656         Reviewed by Alex Christensen.
1657
1658         Test: http/tests/loading/preload-picture-type.html
1659
1660         * html/parser/HTMLPreloadScanner.cpp:
1661         (WebCore::TokenPreloadScanner::StartTagScanner::processAttributes): include type match state when selecting candidate imgs
1662         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute): added type attribute evaluation and matching
1663
1664 2017-11-06  Youenn Fablet  <youenn@apple.com>
1665
1666         Use VCP H264 encoder for platforms supporting it
1667         https://bugs.webkit.org/show_bug.cgi?id=179076
1668         rdar://problem/35180773
1669
1670         Reviewed by Eric Carlson.
1671
1672         Covered by existing test coverage.
1673
1674         * platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.cpp:
1675         (WebCore::VideoToolboxVideoEncoderFactory::setActive):
1676         (WebCore::VideoToolboxVideoEncoderFactory::CreateSupportedVideoEncoder):
1677         (WebCore::VideoToolboxVideoEncoderFactory::DestroyVideoEncoder):
1678         * platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.h:
1679
1680 2017-11-06  Chris Dumez  <cdumez@apple.com>
1681
1682         ServiceWorkerContainer should take a PendingActivity while a service worker job is pending
1683         https://bugs.webkit.org/show_bug.cgi?id=179321
1684
1685         Reviewed by Youenn Fablet.
1686
1687         ServiceWorkerContainer should take a PendingActivity while a service worker job is pending.
1688         ServiceWorkerContainer is an ActiveDOMObject and taking such pending activity makes sure
1689         the object stays alive while a job is pending (and a promise is not resolved yet). It also
1690         makes sure the document does not get suspended in the middle of a job.
1691
1692         * workers/service/ServiceWorkerContainer.cpp:
1693         (WebCore::ServiceWorkerContainer::scheduleJob):
1694         (WebCore::ServiceWorkerContainer::jobDidFinish):
1695
1696 2017-11-06  Antti Koivisto  <antti@apple.com>
1697
1698         @media rules ignored in user agent style sheet html.css
1699         https://bugs.webkit.org/show_bug.cgi?id=169245
1700         <rdar://problem/30885951>
1701
1702         Reviewed by Darin Adler.
1703
1704         To support accessibility features, allow non-trivial @media rules in user agent stylesheet.
1705
1706         This patch creates a special stylesheet consisting of rules with media queries seen on user agent stylesheets.
1707         The queries on this sheet are evaluated with the document's media query evaluator.
1708
1709         No tests as I don't want to add things to UA style just for testing purposes. This will
1710         gain coverage when the feature is used.
1711
1712          * css/CSSDefaultStyleSheets.cpp:
1713         (WebCore::CSSDefaultStyleSheets::addToDefaultStyle):
1714
1715             Add a helper.
1716             Build a new stylesheet that consists of complex media rules seen in user agent sheets.
1717
1718         (WebCore::CSSDefaultStyleSheets::loadFullDefaultStyle):
1719         (WebCore::CSSDefaultStyleSheets::ensureDefaultStyleSheetsForElement):
1720         * css/CSSDefaultStyleSheets.h:
1721         * css/DocumentRuleSets.cpp:
1722         (WebCore::DocumentRuleSets::userAgentMediaQueryStyle const):
1723
1724             Rule set constructed from media queries seen on UA sheet.
1725
1726         (WebCore::DocumentRuleSets::updateUserAgentMediaQueryStyleIfNeeded const):
1727
1728             Evalute the media queries if needed.
1729             Re-evaluate if the rule count of the media query stylesheet increases
1730             (this could happen when additional UA style is added).
1731
1732         (WebCore::DocumentRuleSets::resetUserAgentMediaQueryStyle):
1733         (WebCore::DocumentRuleSets::collectFeatures const):
1734
1735             Collect the features from userAgentMediaQueryStyle.
1736
1737         * css/DocumentRuleSets.h:
1738         (WebCore::DocumentRuleSets::setIsForShadowScope):
1739         * css/ElementRuleCollector.cpp:
1740         (WebCore::ElementRuleCollector::ElementRuleCollector):
1741         (WebCore::ElementRuleCollector::matchUARules):
1742
1743             Also match rules in userAgentMediaQueryStyle.
1744
1745         * css/ElementRuleCollector.h:
1746         * css/InspectorCSSOMWrappers.cpp:
1747         (WebCore::InspectorCSSOMWrappers::collectDocumentWrappers):
1748         * css/StyleResolver.cpp:
1749         (WebCore::StyleResolver::StyleResolver):
1750         * style/StyleScope.cpp:
1751         (WebCore::Style::Scope::resolver):
1752
1753 2017-11-06  Zalan Bujtas  <zalan@apple.com>
1754
1755         [LayoutState cleanup] Move m_layoutState from RenderView to LayoutContext
1756         https://bugs.webkit.org/show_bug.cgi?id=179282
1757         <rdar://problem/35348653>
1758
1759         Reviewed by Antti Koivisto.
1760
1761         LayoutContext now owns the top level LayoutState object.
1762         It makes RenderView behave like any other renderer by constructing a LayoutStateMaintainer on the stack.
1763         This is mostly moving code from RenderView.h/.cpp to LayoutContext.h/.cpp and fixing the callsites.
1764         (While view().frameView().layoutContext().layoutState() is a bit lengthy, it's
1765         temporary only, since LayoutState is planned to be an argument of the layout() method.  
1766
1767         Covered by existing test.
1768
1769         * accessibility/AXObjectCache.cpp:
1770         (WebCore::AXObjectCache::notificationPostTimerFired):
1771         * page/LayoutContext.cpp:
1772         (WebCore::LayoutContext::layoutDelta const):
1773         (WebCore::LayoutContext::addLayoutDelta):
1774         (WebCore::LayoutContext::layoutDeltaMatches):
1775         (WebCore::LayoutContext::pushLayoutState):
1776         (WebCore::LayoutContext::pushLayoutStateForPaginationIfNeeded):
1777         (WebCore::LayoutContext::popLayoutState):
1778         (WebCore::LayoutContext::checkLayoutState):
1779         * page/LayoutContext.h:
1780         (WebCore::LayoutContext::layoutState const):
1781         (WebCore::LayoutContext::layoutStateEnabled const):
1782         (WebCore::LayoutContext::disableLayoutState):
1783         (WebCore::LayoutContext::enableLayoutState):
1784         * rendering/LayoutState.cpp:
1785         (WebCore::LayoutState::LayoutState):
1786         (WebCore::LayoutState::computeClipRect):
1787         (WebCore::LayoutStateMaintainer::LayoutStateMaintainer):
1788         (WebCore::LayoutStateMaintainer::push):
1789         (WebCore::LayoutStateMaintainer::pop):
1790         (WebCore::LayoutStateDisabler::LayoutStateDisabler):
1791         (WebCore::LayoutStateDisabler::~LayoutStateDisabler):
1792         (WebCore::SubtreeLayoutStateMaintainer::SubtreeLayoutStateMaintainer):
1793         (WebCore::SubtreeLayoutStateMaintainer::~SubtreeLayoutStateMaintainer):
1794         (WebCore::PaginatedLayoutStateMaintainer::PaginatedLayoutStateMaintainer):
1795         (WebCore::PaginatedLayoutStateMaintainer::~PaginatedLayoutStateMaintainer):
1796         * rendering/LayoutState.h:
1797         * rendering/RenderBlock.cpp:
1798         (WebCore::RenderBlock::setLogicalLeftForChild):
1799         (WebCore::RenderBlock::setLogicalTopForChild):
1800         (WebCore::RenderBlock::layoutPositionedObject):
1801         (WebCore::RenderBlock::markForPaginationRelayoutIfNeeded):
1802         (WebCore::RenderBlock::adjustLogicalLeftOffsetForLine const):
1803         (WebCore::RenderBlock::adjustLogicalRightOffsetForLine const):
1804         (WebCore::RenderBlock::offsetFromLogicalTopOfFirstPage const):
1805         (WebCore::RenderBlock::childBoxIsUnsplittableForFragmentation const):
1806         * rendering/RenderBlockFlow.cpp:
1807         (WebCore::RenderBlockFlow::layoutBlock):
1808         (WebCore::RenderBlockFlow::layoutBlockChildren):
1809         (WebCore::RenderBlockFlow::layoutBlockChild):
1810         (WebCore::RenderBlockFlow::collapseMarginsWithChildInfo):
1811         (WebCore::RenderBlockFlow::estimateLogicalTopPosition):
1812         (WebCore::RenderBlockFlow::applyBeforeBreak):
1813         (WebCore::RenderBlockFlow::applyAfterBreak):
1814         (WebCore::RenderBlockFlow::hasNextPage const):
1815         (WebCore::RenderBlockFlow::pageLogicalTopForOffset const):
1816         (WebCore::RenderBlockFlow::pageLogicalHeightForOffset const):
1817         (WebCore::RenderBlockFlow::pageRemainingLogicalHeightForOffset const):
1818         (WebCore::RenderBlockFlow::repaintOverhangingFloats):
1819         (WebCore::RenderBlockFlow::insertFloatingObject):
1820         (WebCore::RenderBlockFlow::positionNewFloats):
1821         (WebCore::RenderBlockFlow::layoutSimpleLines):
1822         * rendering/RenderBlockLineLayout.cpp:
1823         (WebCore::RenderBlockFlow::layoutRunsAndFloats):
1824         (WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
1825         (WebCore::RenderBlockFlow::linkToEndLineIfNeeded):
1826         (WebCore::RenderBlockFlow::layoutLineBoxes):
1827         (WebCore::RenderBlockFlow::determineStartPosition):
1828         (WebCore::RenderBlockFlow::checkPaginationAndFloatsAtEndLine):
1829         * rendering/RenderBox.cpp:
1830         (WebCore::RenderBox::outlineBoundsForRepaint const):
1831         (WebCore::RenderBox::mapLocalToContainer const):
1832         (WebCore::RenderBox::clippedOverflowRectForRepaint const):
1833         (WebCore::RenderBox::computeRectForRepaint const):
1834         (WebCore::RenderBox::offsetFromLogicalTopOfFirstPage const):
1835         * rendering/RenderDeprecatedFlexibleBox.cpp:
1836         (WebCore::RenderDeprecatedFlexibleBox::layoutBlock):
1837         (WebCore::layoutChildIfNeededApplyingDelta):
1838         * rendering/RenderElement.cpp:
1839         (WebCore::RenderElement::insertChildInternal):
1840         (WebCore::RenderElement::takeChildInternal):
1841         * rendering/RenderEmbeddedObject.cpp:
1842         * rendering/RenderFragmentedFlow.cpp:
1843         (WebCore::RenderFragmentedFlow::repaintRectangleInFragments const):
1844         * rendering/RenderGrid.cpp:
1845         * rendering/RenderInline.cpp:
1846         (WebCore::RenderInline::clippedOverflowRectForRepaint const):
1847         (WebCore::RenderInline::computeRectForRepaint const):
1848         (WebCore::RenderInline::mapLocalToContainer const):
1849         * rendering/RenderLayer.cpp:
1850         (WebCore::RenderLayer::updateLayerPositions):
1851         * rendering/RenderListBox.cpp:
1852         (WebCore::RenderListBox::layout):
1853         * rendering/RenderMediaControlElements.cpp:
1854         (WebCore::RenderMediaVolumeSliderContainer::layout):
1855         (WebCore::RenderMediaControlTimelineContainer::layout):
1856         (WebCore::RenderTextTrackContainerElement::layout):
1857         * rendering/RenderObject.cpp:
1858         (WebCore::RenderObject::repaintRectangle const):
1859         * rendering/RenderReplaced.cpp:
1860         (WebCore::RenderReplaced::clippedOverflowRectForRepaint const):
1861         * rendering/RenderTable.cpp:
1862         (WebCore::RenderTable::layout):
1863         (WebCore::RenderTable::markForPaginationRelayoutIfNeeded):
1864         * rendering/RenderTableCell.cpp:
1865         (WebCore::RenderTableCell::clippedOverflowRectForRepaint const):
1866         (WebCore::RenderTableCell::computeRectForRepaint const):
1867         * rendering/RenderTableRow.cpp:
1868         (WebCore::RenderTableRow::layout):
1869         * rendering/RenderTableSection.cpp:
1870         (WebCore::RenderTableSection::calcRowLogicalHeight):
1871         (WebCore::RenderTableSection::layout):
1872         (WebCore::RenderTableSection::layoutRows):
1873         (WebCore::RenderTableSection::setLogicalPositionForCell const):
1874         * rendering/RenderVTTCue.cpp:
1875         * rendering/RenderView.cpp:
1876         (WebCore::RenderView::layout):
1877         (WebCore::RenderView::layoutContent): Deleted.
1878         (WebCore::RenderView::checkLayoutState): Deleted.
1879         (WebCore::RenderView::initializeLayoutState): Deleted.
1880         (WebCore::RenderView::pushLayoutState): Deleted.
1881         (WebCore::RenderView::pushLayoutStateForPaginationIfNeeded): Deleted.
1882         * rendering/RenderView.h:
1883         * rendering/RootInlineBox.cpp:
1884         (WebCore::RootInlineBox::lineSnapAdjustment const):
1885         * rendering/svg/RenderSVGContainer.cpp:
1886         (WebCore::RenderSVGContainer::layout):
1887         * rendering/svg/RenderSVGForeignObject.cpp:
1888         (WebCore::RenderSVGForeignObject::layout):
1889         * rendering/svg/RenderSVGRoot.cpp:
1890         (WebCore::RenderSVGRoot::layout):
1891         * style/RenderTreeUpdaterFirstLetter.cpp:
1892         (WebCore::RenderTreeUpdater::FirstLetter::update):
1893         * style/RenderTreeUpdaterListItem.cpp:
1894         (WebCore::RenderTreeUpdater::ListItem::updateMarker):
1895
1896 2017-11-05  Yusuke Suzuki  <utatane.tea@gmail.com>
1897
1898         JIT call inline caches should cache calls to objects with getCallData/getConstructData traps
1899         https://bugs.webkit.org/show_bug.cgi?id=144458
1900
1901         Reviewed by Saam Barati.
1902
1903         * bridge/runtime_method.cpp:
1904         (JSC::RuntimeMethod::RuntimeMethod):
1905         (JSC::RuntimeMethod::getCallData): Deleted.
1906         * bridge/runtime_method.h:
1907
1908 2017-11-06  Maciej Stachowiak  <mjs@apple.com>
1909
1910         Canonical name of EUC-KR encoding should be EUC-KR, not windows-949
1911         https://bugs.webkit.org/show_bug.cgi?id=179305
1912
1913         Reviewed by Alexey Proskuryakov.
1914
1915         Already covered by:
1916         LayoutTests/imported/w3c/web-platform-tests/encoding/textdecoder-labels.html
1917         LayoutTests/imported/w3c/web-platform-tests/encoding/textencoder-constructor-non-utf-expected.html
1918         LayoutTests/fast/encoding/charset-decode.html
1919         
1920         * platform/text/TextCodecICU.cpp: Change registration so the EUC-KR name
1921         is canonical.
1922         (WebCore::TextCodecICU::registerCodecs): However, we still want to use the windows-949
1923         decoder. It's not exactly the same, but the spec calls for that.
1924
1925 2017-11-06  Zan Dobersek  <zdobersek@igalia.com>
1926
1927         [Cairo] CairoGlyphToPathTranslator::path() shouldn't fill out the glyph path
1928         https://bugs.webkit.org/show_bug.cgi?id=179159
1929
1930         Reviewed by Michael Catanzaro.
1931
1932         In case of non-zero synthetic bold offset in CairoGlyphToPathTranslator::path(),
1933         cairo_glyph_path() should be called just like in the generic case.
1934         cairo_show_glyphs() performs the actual rasterization of the glyph, but we're
1935         only interested in the generated path operations.
1936
1937         No new tests -- covered by existing tests.
1938
1939         * platform/graphics/cairo/FontCairo.cpp:
1940         (WebCore::CairoGlyphToPathTranslator::path):
1941
1942 2017-11-05  Fujii Hironori  <Hironori.Fujii@sony.com>
1943
1944         [WinCairo] Fix build after r224463
1945         https://bugs.webkit.org/show_bug.cgi?id=179310
1946
1947         Unreviewed build fix.
1948
1949         No new tests (No behavior change).
1950
1951         * platform/graphics/win/GraphicsContextCairoWin.cpp: Include "GraphicsContextImpl.h".
1952
1953 2017-11-05  Antoine Quint  <graouts@apple.com>
1954
1955         [Web Animations] Schedule animations registered on the document timeline
1956         https://bugs.webkit.org/show_bug.cgi?id=179236
1957         <rdar://problem/35332669>
1958
1959         Reviewed by Dean Jackson.
1960
1961         We now schedule animations contained in the document timeline using a three-step approach.
1962
1963         1. Each time an object that is part of the timing model changes one of its timing properties, we call
1964            animationTimingModelDidChange() on the document timeline. This schedules performInvalidationTask()
1965            to be called when the current run loop completes, such that we invalidate the timing model just once
1966            per run loop.
1967
1968         2. Once performInvalidationTask() is called, the timing model is invalidated in updateAnimationSchedule().
1969            We iterate over the registered animations on the timineline and identify the shortest interval between
1970            the current time and the next moment one of the animations requires a tick to update its value. If we
1971            find a value below 15ms, we schedule animations to be resolved with scheduleAnimationResolution() right
1972            away. If the value is above 15ms, and not inifinity, we schedule a one-shot timer for that interval to
1973            call scheduleAnimationResolution().
1974
1975         3. Once scheduleAnimationResolution() is called, we call scheduleAnimation() on the shared DisplayRefreshMonitorManager
1976            to be notified when the next display refresh occurs to actually resolve animations with resolveAnimations().
1977
1978         Note that, in this patch, resolveAnimations() does nothing, we will add support for interpolating values in
1979         a future patch.
1980
1981         Another important thing to note is that every time the document timeline's current time is requested, we cache
1982         it for the duration of the run loop such that the timing model always uses the same value during a given run loop.
1983
1984         Finally, to support tests where we check the state of the timing model by manually advancing time, we expose a
1985         new pause() method on AnimationTimeline for tests to call to avoid the timeline to self-advance.
1986
1987         * animation/AnimationTimeline.cpp:
1988         (WebCore::AnimationTimeline::addAnimation): Mark that the timing model changed as a result of adding an animation.
1989         (WebCore::AnimationTimeline::removeAnimation): Mark that the timing model changed as a result of removing an animation.
1990         (WebCore::AnimationTimeline::bindingsCurrentTime): Update the method signature to no longer be const and call into
1991         currentTime() instead of reading directly from the m_currentTime member variable since a subclass, like DocumentTimeline,
1992         may have a custom currentTime() implementation.
1993         (WebCore::AnimationTimeline::setCurrentTime): Mark that the timing model changed as a result of the timeline current time
1994         changing.
1995         (WebCore::AnimationTimeline::bindingsCurrentTime const): Deleted.
1996         * animation/AnimationTimeline.h:
1997         (WebCore::AnimationTimeline::currentTime): Change both methods signatures to no longer be const so that DocumentTimeline's
1998         implementation of currentTime() may cache the current time in a member variable, enqueuing a callback when the run loop
1999         completes for this member variable to be reset, and updating some states.
2000         (WebCore::AnimationTimeline::pause): To be implemented by subclasses.
2001         (WebCore::AnimationTimeline::animationTimingModelDidChange): Add a new virtual method to indicate that the timing model
2002         needs invalidating.
2003         (WebCore::AnimationTimeline::animations const): Add an accessor to allow animations to be accessed by a subclass.
2004         * animation/DocumentTimeline.cpp:
2005         (WebCore::DocumentTimeline::create):
2006         (WebCore::DocumentTimeline::DocumentTimeline): Update the constructor signature to receive a Document and a PlatformDisplayID
2007         since we need a reference to the Document to get at the nowTime() and a PlatformDisplayID to create the DisplayRefreshMonitor.
2008         (WebCore::DocumentTimeline::~DocumentTimeline): Close the task queue when the timeline gets destroyed.
2009         (WebCore::DocumentTimeline::currentTime): If we don't have a current cahed current time, compute one and schedule
2010         the invalidation task if needed so that we may reset the cached value as the run loop completes.
2011         (WebCore::DocumentTimeline::pause): Allows the timeline not to self-advance, for testing purposes only.
2012         (WebCore::DocumentTimeline::animationTimingModelDidChange): If we haven't already done so, mark that we need to update our
2013         animation schedule in the invalidation task and schedule that task if not scheduled yet.
2014         (WebCore::DocumentTimeline::scheduleInvalidationTaskIfNeeded): Schedule the invalidation task to run as the run loop completes
2015         if we haven't already done so.
2016         (WebCore::DocumentTimeline::performInvalidationTask): Update the animation schedule if needed and reset the cached current
2017         time value.
2018         (WebCore::DocumentTimeline::updateAnimationSchedule): Iterate over registed animations and find the shortest interval until
2019         one of them needs to update their animation. If the shortest interval is below 15ms, schedule the animation resolution right
2020         away. If the shortest inverval is finite and above 15ms, then schedule a one-shot timer for that interval to perform the
2021         animation resolution then. 
2022         (WebCore::DocumentTimeline::animationScheduleTimerFired): The one-shot timer to perform the animation resolution has fired,
2023         we call scheduleAnimationResolution().
2024         (WebCore::DocumentTimeline::scheduleAnimationResolution): We call scheduleAnimation() on the shared DisplayRefreshMonitorManager
2025         so that we may resolve animations on the next display refresh, or start a timer if the DisplayRefreshMonitorManager is not available.
2026         (WebCore::DocumentTimeline::displayRefreshFired): The display is about to refresh, we call resolveAnimations().
2027         (WebCore::DocumentTimeline::animationResolutionTimerFired): The fallback animation resolution timer has fired, we call resolveAnimations().
2028         (WebCore::DocumentTimeline::resolveAnimations): Currently do nothing, this is where we'll iterate over registered animations to
2029         update them with the current time.
2030         (WebCore::DocumentTimeline::windowScreenDidChange): Notify the shared DisplayRefreshMonitorManager that the PlatformDisplayID
2031         changed.
2032         (WebCore::DocumentTimeline::createDisplayRefreshMonitor const): Provide a DisplayRefreshMonitor as part of the
2033         DisplayRefreshMonitorClient protocol. 
2034         * animation/DocumentTimeline.h:
2035         * animation/WebAnimation.cpp:
2036         (WebCore::WebAnimation::create): Remove extra white space.
2037         (WebCore::WebAnimation::setStartTime): Mark that the timing model changed as a result of changing this animation's start time.
2038         (WebCore::WebAnimation::timeToNextRequiredTick const): Compute the interval until the next time we need to resolve this animation.
2039         If the provided current time is before this animation's start time, compute the delay until the start time. If the current time
2040         is after the animation's start time but before the animation's end time, indicate that we want to resolve the animation again
2041         right away and return 0ms. In any other case, return an infinite interval to indicate that we don't need to be refreshed after
2042         the provided time.
2043         * animation/WebAnimation.h:
2044         * dom/Document.cpp:
2045         (WebCore::Document::windowScreenDidChange): Notify the document timeline that the PlatformDisplayID changed.
2046         (WebCore::Document::timeline): Provide the Document and the PlatformDisplayID to the DocumentTimeline.
2047         * testing/Internals.cpp:
2048         (WebCore::Internals::pauseTimeline):
2049         * testing/Internals.h:
2050         * testing/Internals.idl:
2051
2052 2017-11-05  Chris Dumez  <cdumez@apple.com>
2053
2054         Implement ServiceWorkerRegistration.update()
2055         https://bugs.webkit.org/show_bug.cgi?id=179270
2056
2057         Reviewed by Youenn Fablet.
2058
2059         Implement ServiceWorkerRegistration.update():
2060         - https://w3c.github.io/ServiceWorker/#service-worker-registration-update
2061
2062         We already had support for the Update algorithm in SWServerJobQueue but
2063         this patch enhances our support a bit to get us closer to the specification:
2064         - https://w3c.github.io/ServiceWorker/#update-algorithm
2065
2066         No new tests, rebaselined existing tests.
2067
2068         * workers/service/ServiceWorker.h:
2069         * workers/service/ServiceWorkerContainer.cpp:
2070         (WebCore::ServiceWorkerContainer::updateRegistration):
2071         (WebCore::ServiceWorkerContainer::getRegistration):
2072         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
2073         * workers/service/ServiceWorkerContainer.h:
2074         * workers/service/ServiceWorkerJobData.h:
2075         (WebCore::ServiceWorkerJobData::encode const):
2076         (WebCore::ServiceWorkerJobData::decode):
2077         * workers/service/ServiceWorkerJobType.h:
2078         * workers/service/ServiceWorkerRegistration.cpp:
2079         (WebCore::ServiceWorkerRegistration::ServiceWorkerRegistration):
2080         (WebCore::ServiceWorkerRegistration::installing):
2081         (WebCore::ServiceWorkerRegistration::waiting):
2082         (WebCore::ServiceWorkerRegistration::active):
2083         (WebCore::ServiceWorkerRegistration::setInstallingWorker):
2084         (WebCore::ServiceWorkerRegistration::setWaitingWorker):
2085         (WebCore::ServiceWorkerRegistration::setActiveWorker):
2086         (WebCore::ServiceWorkerRegistration::getNewestWorker):
2087         (WebCore::ServiceWorkerRegistration::update):
2088         * workers/service/ServiceWorkerRegistration.h:
2089         * workers/service/server/SWServerJobQueue.cpp:
2090         (WebCore::SWServerJobQueue::scriptFetchFinished):
2091         (WebCore::SWServerJobQueue::scriptContextFailedToStart):
2092         (WebCore::SWServerJobQueue::runNextJobSynchronously):
2093         (WebCore::SWServerJobQueue::runUpdateJob):
2094
2095 2017-11-04  Simon Fraser  <simon.fraser@apple.com>
2096
2097         Move code that maps a CompositeOperator and BlendMode to a CGBlendMode into a helper function
2098         https://bugs.webkit.org/show_bug.cgi?id=179290
2099
2100         Reviewed by Darin Adler.
2101
2102         Move the code, and use nested switch rather than conditionals.
2103
2104         * platform/graphics/GraphicsTypes.h:
2105         * platform/graphics/cg/GraphicsContextCG.cpp:
2106         (WebCore::selectCGBlendMode):
2107         (WebCore::GraphicsContext::setPlatformCompositeOperation):
2108
2109 2017-11-04  Chris Dumez  <cdumez@apple.com>
2110
2111         Index properties on cross origin Window objects should be enumerable
2112         https://bugs.webkit.org/show_bug.cgi?id=179289
2113
2114         Reviewed by Darin Adler.
2115
2116         Index properties on cross origin Window objects should be enumerable:
2117         - https://github.com/whatwg/html/pull/3186
2118         - https://github.com/w3c/web-platform-tests/pull/8045
2119
2120         All exposed properties used to be enumerable but we had to revert this in
2121         r224287 because it was not Web-compatible. The HTML specification has now
2122         been updated so that only index properties are enumerable cross origin.
2123
2124         No new tests, rebaselined existing tests.
2125
2126         * bindings/js/JSDOMWindowCustom.cpp:
2127         (WebCore::JSDOMWindow::getOwnPropertySlotByIndex):
2128         (WebCore::JSDOMWindow::getOwnPropertyNames):
2129
2130 2017-11-04  Simon Fraser  <simon.fraser@apple.com>
2131
2132         Add a GraphicsContextImpl and use it for DispayList::Recorder
2133         https://bugs.webkit.org/show_bug.cgi?id=179286
2134
2135         Reviewed by Sam Weinig.
2136
2137         Start moving towards a model when GraphicsContext has a pointer to an implementation
2138         ("pimpl") by adding GraphicsContextImpl, and converting display list recording to
2139         be an implementation of a GraphicsContextImpl.
2140
2141         No behavior change.
2142
2143         * Sources.txt:
2144         * WebCore.xcodeproj/project.pbxproj:
2145         * html/canvas/CanvasRenderingContext2D.cpp:
2146         (WebCore::DisplayListDrawingContext::DisplayListDrawingContext):
2147         * platform/graphics/GraphicsContext.cpp:
2148         (WebCore::GraphicsContext::GraphicsContext):
2149         (WebCore::GraphicsContext::save):
2150         (WebCore::GraphicsContext::restore):
2151         (WebCore::GraphicsContext::setStrokeThickness):
2152         (WebCore::GraphicsContext::setStrokeStyle):
2153         (WebCore::GraphicsContext::setStrokeColor):
2154         (WebCore::GraphicsContext::setShadow):
2155         (WebCore::GraphicsContext::setLegacyShadow):
2156         (WebCore::GraphicsContext::clearShadow):
2157         (WebCore::GraphicsContext::setFillColor):
2158         (WebCore::GraphicsContext::setShadowsIgnoreTransforms):
2159         (WebCore::GraphicsContext::setShouldAntialias):
2160         (WebCore::GraphicsContext::setShouldSmoothFonts):
2161         (WebCore::GraphicsContext::setShouldSubpixelQuantizeFonts):
2162         (WebCore::GraphicsContext::setImageInterpolationQuality):
2163         (WebCore::GraphicsContext::setStrokePattern):
2164         (WebCore::GraphicsContext::setFillPattern):
2165         (WebCore::GraphicsContext::setStrokeGradient):
2166         (WebCore::GraphicsContext::setFillRule):
2167         (WebCore::GraphicsContext::setFillGradient):
2168         (WebCore::GraphicsContext::beginTransparencyLayer):
2169         (WebCore::GraphicsContext::endTransparencyLayer):
2170         (WebCore::GraphicsContext::drawGlyphs):
2171         (WebCore::GraphicsContext::drawImage):
2172         (WebCore::GraphicsContext::drawTiledImage):
2173         (WebCore::GraphicsContext::setTextDrawingMode):
2174         (WebCore::GraphicsContext::fillRect):
2175         (WebCore::GraphicsContext::fillRoundedRect):
2176         (WebCore::GraphicsContext::setAlpha):
2177         (WebCore::GraphicsContext::setCompositeOperation):
2178         (WebCore::GraphicsContext::setDrawLuminanceMask):
2179         (WebCore::GraphicsContext::applyDeviceScaleFactor):
2180         (WebCore::GraphicsContext::fillEllipse):
2181         (WebCore::GraphicsContext::strokeEllipse):
2182         * platform/graphics/GraphicsContext.h:
2183         (WebCore::GraphicsContext::hasPlatformContext const):
2184         (WebCore::GraphicsContext::paintingDisabled const):
2185         (WebCore::GraphicsContext::setDisplayListRecorder): Deleted.
2186         (WebCore::GraphicsContext::isRecording const): Deleted.
2187         * platform/graphics/GraphicsContextImpl.cpp: Added.
2188         (WebCore::GraphicsContextImpl::GraphicsContextImpl):
2189         (WebCore::GraphicsContextImpl::~GraphicsContextImpl):
2190         * platform/graphics/GraphicsContextImpl.h: Added.
2191         (WebCore::GraphicsContextImpl::graphicsContext const):
2192         * platform/graphics/ca/GraphicsLayerCA.cpp:
2193         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
2194         * platform/graphics/cairo/GraphicsContextCairo.cpp:
2195         (WebCore::GraphicsContext::getCTM const):
2196         (WebCore::GraphicsContext::savePlatformState):
2197         (WebCore::GraphicsContext::restorePlatformState):
2198         (WebCore::GraphicsContext::drawRect):
2199         (WebCore::GraphicsContext::drawNativeImage):
2200         (WebCore::GraphicsContext::drawLine):
2201         (WebCore::GraphicsContext::drawEllipse):
2202         (WebCore::GraphicsContext::fillPath):
2203         (WebCore::GraphicsContext::strokePath):
2204         (WebCore::GraphicsContext::fillRect):
2205         (WebCore::GraphicsContext::clip):
2206         (WebCore::GraphicsContext::clipPath):
2207         (WebCore::GraphicsContext::clipBounds const):
2208         (WebCore::GraphicsContext::drawLinesForText):
2209         (WebCore::GraphicsContext::roundToDevicePixels):
2210         (WebCore::GraphicsContext::translate):
2211         (WebCore::GraphicsContext::setPlatformStrokeThickness):
2212         (WebCore::GraphicsContext::setPlatformStrokeStyle):
2213         (WebCore::GraphicsContext::concatCTM):
2214         (WebCore::GraphicsContext::setCTM):
2215         (WebCore::GraphicsContext::beginPlatformTransparencyLayer):
2216         (WebCore::GraphicsContext::endPlatformTransparencyLayer):
2217         (WebCore::GraphicsContext::clearRect):
2218         (WebCore::GraphicsContext::strokeRect):
2219         (WebCore::GraphicsContext::setLineCap):
2220         (WebCore::GraphicsContext::setLineDash):
2221         (WebCore::GraphicsContext::setLineJoin):
2222         (WebCore::GraphicsContext::setMiterLimit):
2223         (WebCore::GraphicsContext::clipOut):
2224         (WebCore::GraphicsContext::rotate):
2225         (WebCore::GraphicsContext::scale):
2226         (WebCore::GraphicsContext::platformFillRoundedRect):
2227         (WebCore::GraphicsContext::fillRectWithRoundedHole):
2228         (WebCore::GraphicsContext::drawPattern):
2229         (WebCore::GraphicsContext::setPlatformShouldAntialias):
2230         (WebCore::GraphicsContext::setPlatformImageInterpolationQuality):
2231         (WebCore::GraphicsContext::isAcceleratedContext const):
2232         * platform/graphics/cg/GraphicsContextCG.cpp:
2233         (WebCore::GraphicsContext::savePlatformState):
2234         (WebCore::GraphicsContext::restorePlatformState):
2235         (WebCore::GraphicsContext::drawNativeImage):
2236         (WebCore::GraphicsContext::drawPattern):
2237         (WebCore::GraphicsContext::drawRect):
2238         (WebCore::GraphicsContext::drawLine):
2239         (WebCore::GraphicsContext::drawEllipse):
2240         (WebCore::GraphicsContext::applyStrokePattern):
2241         (WebCore::GraphicsContext::applyFillPattern):
2242         (WebCore::GraphicsContext::drawPath):
2243         (WebCore::GraphicsContext::fillPath):
2244         (WebCore::GraphicsContext::strokePath):
2245         (WebCore::GraphicsContext::fillRect):
2246         (WebCore::GraphicsContext::platformFillRoundedRect):
2247         (WebCore::GraphicsContext::fillRectWithRoundedHole):
2248         (WebCore::GraphicsContext::clip):
2249         (WebCore::GraphicsContext::clipOut):
2250         (WebCore::GraphicsContext::clipPath):
2251         (WebCore::GraphicsContext::clipBounds const):
2252         (WebCore::GraphicsContext::beginPlatformTransparencyLayer):
2253         (WebCore::GraphicsContext::endPlatformTransparencyLayer):
2254         (WebCore::GraphicsContext::setPlatformShadow):
2255         (WebCore::GraphicsContext::setMiterLimit):
2256         (WebCore::GraphicsContext::clearRect):
2257         (WebCore::GraphicsContext::strokeRect):
2258         (WebCore::GraphicsContext::setLineCap):
2259         (WebCore::GraphicsContext::setLineDash):
2260         (WebCore::GraphicsContext::setLineJoin):
2261         (WebCore::GraphicsContext::scale):
2262         (WebCore::GraphicsContext::rotate):
2263         (WebCore::GraphicsContext::translate):
2264         (WebCore::GraphicsContext::concatCTM):
2265         (WebCore::GraphicsContext::setCTM):
2266         (WebCore::GraphicsContext::getCTM const):
2267         (WebCore::GraphicsContext::roundToDevicePixels):
2268         (WebCore::GraphicsContext::drawLinesForText):
2269         (WebCore::GraphicsContext::setURLForRect):
2270         (WebCore::GraphicsContext::setIsCALayerContext):
2271         (WebCore::GraphicsContext::isCALayerContext const):
2272         (WebCore::GraphicsContext::setIsAcceleratedContext):
2273         (WebCore::GraphicsContext::isAcceleratedContext const):
2274         (WebCore::GraphicsContext::setPlatformTextDrawingMode):
2275         (WebCore::GraphicsContext::setPlatformStrokeColor):
2276         (WebCore::GraphicsContext::setPlatformStrokeThickness):
2277         (WebCore::GraphicsContext::setPlatformFillColor):
2278         (WebCore::GraphicsContext::setPlatformShouldAntialias):
2279         (WebCore::GraphicsContext::setPlatformShouldSmoothFonts):
2280         (WebCore::GraphicsContext::setPlatformAlpha):
2281         (WebCore::GraphicsContext::setPlatformCompositeOperation):
2282         (WebCore::GraphicsContext::platformApplyDeviceScaleFactor):
2283         (WebCore::GraphicsContext::platformFillEllipse):
2284         (WebCore::GraphicsContext::platformStrokeEllipse):
2285         (WebCore::GraphicsContext::setDestinationForRect):
2286         (WebCore::GraphicsContext::addDestinationAtPoint):
2287         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
2288         (WebCore::GraphicsContext::drawFocusRing):
2289         * platform/graphics/displaylists/DisplayListRecorder.cpp:
2290         (WebCore::DisplayList::Recorder::Recorder):
2291         (WebCore::DisplayList::Recorder::updateItemExtent const):
2292         (WebCore::DisplayList::Recorder::extentFromLocalBounds const):
2293         * platform/graphics/displaylists/DisplayListRecorder.h:
2294         (WebCore::DisplayList::Recorder::itemCount const):
2295         * rendering/RenderTheme.cpp:
2296         (WebCore::RenderTheme::paint):
2297
2298 2017-11-04  Zalan Bujtas  <zalan@apple.com>
2299
2300         [LayoutState cleanup] Move all LayoutState* classes to LayoutState.h/cpp
2301         https://bugs.webkit.org/show_bug.cgi?id=179280
2302         <rdar://problem/35348452>
2303
2304         Reviewed by Antti Koivisto.
2305
2306         No change in functionality.
2307
2308         * page/LayoutContext.cpp:
2309         (WebCore::SubtreeLayoutStateMaintainer::SubtreeLayoutStateMaintainer): Deleted.
2310         (WebCore::SubtreeLayoutStateMaintainer::~SubtreeLayoutStateMaintainer): Deleted.
2311         (WebCore::SubtreeLayoutStateMaintainer::shouldDisableLayoutStateForSubtree): Deleted.
2312         * rendering/LayoutState.cpp:
2313         (WebCore::LayoutStateMaintainer::LayoutStateMaintainer):
2314         (WebCore::LayoutStateMaintainer::~LayoutStateMaintainer):
2315         (WebCore::LayoutStateMaintainer::push):
2316         (WebCore::LayoutStateMaintainer::pop):
2317         (WebCore::LayoutStateDisabler::LayoutStateDisabler):
2318         (WebCore::LayoutStateDisabler::~LayoutStateDisabler):
2319         (WebCore::shouldDisableLayoutStateForSubtree):
2320         (WebCore::SubtreeLayoutStateMaintainer::SubtreeLayoutStateMaintainer):
2321         (WebCore::SubtreeLayoutStateMaintainer::~SubtreeLayoutStateMaintainer):
2322         (WebCore::PaginatedLayoutStateMaintainer::PaginatedLayoutStateMaintainer):
2323         (WebCore::PaginatedLayoutStateMaintainer::~PaginatedLayoutStateMaintainer):
2324         * rendering/LayoutState.h:
2325         (WebCore::LayoutStateMaintainer::didPush const):
2326         * rendering/RenderBlockFlow.cpp:
2327         (WebCore::PaginatedLayoutStateMaintainer::PaginatedLayoutStateMaintainer): Deleted.
2328         (WebCore::PaginatedLayoutStateMaintainer::~PaginatedLayoutStateMaintainer): Deleted.
2329         (): Deleted.
2330         * rendering/RenderView.h:
2331         (WebCore::LayoutStateMaintainer::LayoutStateMaintainer): Deleted.
2332         (WebCore::LayoutStateMaintainer::~LayoutStateMaintainer): Deleted.
2333         (WebCore::LayoutStateMaintainer::push): Deleted.
2334         (WebCore::LayoutStateMaintainer::pop): Deleted.
2335         (WebCore::LayoutStateMaintainer::didPush const): Deleted.
2336         (WebCore::LayoutStateDisabler::LayoutStateDisabler): Deleted.
2337         (WebCore::LayoutStateDisabler::~LayoutStateDisabler): Deleted.
2338
2339 2017-11-04  Zalan Bujtas  <zalan@apple.com>
2340
2341         [LayoutState cleanup] Move offset/cliprect/pagination code to dedicate methods
2342         https://bugs.webkit.org/show_bug.cgi?id=179279
2343         <rdar://problem/35348171>
2344
2345         Reviewed by Antti Koivisto.
2346
2347         This is in preparation for creating the initial LayoutSate through LayoutStateMaintainer.
2348
2349         Moving code around. No change in functionality.
2350
2351         * rendering/LayoutState.cpp:
2352         (WebCore::LayoutState::LayoutState):
2353         (WebCore::LayoutState::computeOffsets):
2354         (WebCore::LayoutState::computeClipRect):
2355         (WebCore::LayoutState::computePaginationInformation):
2356         * rendering/LayoutState.h:
2357
2358 2017-11-01  Darin Adler  <darin@apple.com>
2359
2360         Simplify event dispatch code and make it a bit more consistent
2361         https://bugs.webkit.org/show_bug.cgi?id=178991
2362
2363         Reviewed by Chris Dumez.
2364
2365         Straighten out event dispatch code in three ways:
2366
2367         1) Add an Event::resetAfterDispatch function, and use it instead of the multiple
2368            separate functions that were used before to reset after dispatching. This fixed
2369            an extremely minor bug where we would leave some kinds of state on some event
2370            objects in unusual cases after dispatching the events.
2371
2372         2) Remove IDBEventDispatcher and make its callers use EventDispatcher instead.
2373            This leaves us with one less event dispatch code path to maintain, more shared code.
2374
2375         3) Remove boolean return values from functions that take event objects and
2376            dispatch the events. The return values are redundant with various things that
2377            can be checked by looking at the event itself. The legacy return value indicates
2378            whether the event has its "canceled flag" set, which means that the default
2379            behavior should be prevented. If that is what we need to check, it's easier
2380            to read the code and see that it's correct if it calls the named function
2381            "defaultPrevented" directly. More importantly, callers can also call whatever
2382            other function is appropriate to ask the specific relevant question to their needs.
2383            The general rule is that default behavior that we want to allow even with an
2384            untrusted event can be inside a default event handler function. Default behavior
2385            that should only happen for the browser-generated event can and should be done
2386            after dispatching the event, in the code that dispatches it; but that requires
2387            explicitly checking "defaultPrevented".
2388
2389         * Modules/indexeddb/IDBDatabase.cpp:
2390         (WebCore::IDBDatabase::dispatchEvent): Removed boolean return value.
2391         * Modules/indexeddb/IDBDatabase.h: Ditto.
2392
2393         * Modules/indexeddb/IDBEventDispatcher.cpp: Removed.
2394         * Modules/indexeddb/IDBEventDispatcher.h: Removed.
2395
2396         * Modules/indexeddb/IDBOpenDBRequest.cpp:
2397         (WebCore::IDBOpenDBRequest::dispatchEvent): Removed boolean return value.
2398         Added protection for "this" since the function accesses it after dispatching the event.
2399         * Modules/indexeddb/IDBOpenDBRequest.h: Ditto.
2400
2401         * Modules/indexeddb/IDBRequest.cpp:
2402         (WebCore::IDBRequest::dispatchEvent): Removed boolean return value. Instead of using
2403         IDBEventDispatcher, use EventDispatcher's new function that takes an initializer_list
2404         with a list of event targets. Added protection for "this" since the function accesses
2405         it after dispatching the event.
2406         * Modules/indexeddb/IDBRequest.h: Ditto.
2407         * Modules/indexeddb/IDBTransaction.cpp:
2408         (WebCore::IDBTransaction::dispatchEvent): Ditto.
2409         * Modules/indexeddb/IDBTransaction.h: Ditto.
2410
2411         * Modules/mediastream/RTCPeerConnection.cpp:
2412         (WebCore::RTCPeerConnection::dispatchEvent): Removed boolean return value.
2413         * Modules/mediastream/RTCPeerConnection.h: Ditto.
2414         * Modules/paymentrequest/PaymentRequest.cpp:
2415         (WebCore::PaymentRequest::shippingAddressChanged): Don't dispatch an event if
2416         m_isUpdating is true; preserves behavior that was implemented in
2417         PaymentRequest::dispatchEvent before. Since this is the source of the trusted
2418         event, cleaner to implement the rule here instead of overriding dispatchEvent.
2419         (WebCore::PaymentRequest::shippingOptionChanged): Ditto.
2420         (WebCore::PaymentRequest::dispatchEvent): Deleted.
2421         * Modules/paymentrequest/PaymentRequest.h: Ditto.
2422
2423         * Sources.txt: Removed IDBEventDispatcher.cpp.
2424         * WebCore.xcodeproj/project.pbxproj: Removed IDBEventDispatcher.h/cpp.
2425
2426         * dom/Element.cpp:
2427         (WebCore::Element::dispatchMouseEvent): Updated to call defaultPrevented
2428         directly instead of using the return value of dispatchEvent.
2429         (WebCore::Element::dispatchWheelEvent): Ditto.
2430         (WebCore::Element::dispatchKeyEvent): Ditto.
2431         (WebCore::Element::dispatchFocusInEvent): Removed assertion, since the
2432         underlying event dispatching takes care of it.
2433         (WebCore::Element::dispatchFocusOutEvent): Ditto.
2434         (WebCore::Element::dispatchFocusEvent): Call dispatchEvent instead of
2435         calling EventDispatcher::dispatchEvent. There is no good reason to use
2436         EventDispatcher directly.
2437         (WebCore::Element::dispatchBlurEvent): Ditto.
2438
2439         * dom/Event.cpp:
2440         (WebCore::Event::eventInterface const): Deleted. Moved into header since this is
2441         short and if called in a non-polymorphic context it's good to have it be inlined.
2442         (WebCore::Event::isUIEvent const): Ditto.
2443         (WebCore::Event::isMouseEvent const): Ditto.
2444         (WebCore::Event::isFocusEvent const): Ditto.
2445         (WebCore::Event::isKeyboardEvent const): Ditto.
2446         (WebCore::Event::isInputEvent const): Ditto.
2447         (WebCore::Event::isCompositionEvent const): Ditto.
2448         (WebCore::Event::isTouchEvent const): Ditto.
2449         (WebCore::Event::isClipboardEvent const): Ditto.
2450         (WebCore::Event::isBeforeTextInsertedEvent const): Ditto.
2451         (WebCore::Event::isBeforeUnloadEvent const): Ditto.
2452         (WebCore::Event::isErrorEvent const): Ditto.
2453         (WebCore::Event::isTextEvent const): Ditto.
2454         (WebCore::Event::isWheelEvent const): Ditto.
2455         (WebCore::Event::receivedTarget): Ditto.
2456         (WebCore::Event::resetAfterDispatch): Added. Replaces functions like
2457         clearEventPath and resetPropagationFlags, covering all the things we need to clear
2458         after dispatching an event.
2459
2460         * dom/Event.h: Removed some unneeded includes and forward declarations. Moved bodies
2461         of multi-line inline member functions out of the class definition. Changed argument
2462         type of setEventPhase and m_eventPhase to an enum rather than just an integer, since
2463         only the getter is for use from the bindings. Removed clearEventPath, srcElement, and
2464         resetPropagationFlags. Sorted the isXXX functions alphabetically and removed previous
2465         attempts to make categories out of them. Marked the constructor explicit since it has
2466         a single argument. Moved trivially short bodies into the class definition.
2467
2468         * dom/Event.idl: Use ImplementedAs to implement srcElement so we don't need it in
2469         the C++ code.
2470
2471         * dom/EventContext.cpp:
2472         (WebCore::EventContext::EventContext): Removed assertion since we now handle event
2473         contexts without nodes so we can use this to dispatch events for IDB, for example.
2474         (WebCore::EventContext::handleLocalEvents const): Add code to handle non-node event
2475         targets by calling fireEventListeners directly.
2476         (WebCore::MouseOrFocusEventContext::MouseOrFocusEventContext): Take a reference
2477         insetad of a pointer for the node.
2478         (WebCore::TouchEventContext::TouchEventContext): Ditto.
2479         (WebCore::TouchEventContext::handleLocalEvents const): Streamline a bit by improving
2480         the checkReachability function to be easier to call. Also removed an unneeded assertion
2481         just before calling downcast<>, the same assertion that downcast<> itself does.
2482         (WebCore::TouchEventContext::checkReachability const): Chagned argument type to take
2483         a Ref& so the caller doesn't have to call get() or ptr().
2484
2485         * dom/EventContext.h: Removed unneeded FIXME and currentTargetSameAsTarget function.
2486         Changed arguemnt types to use Node& instead of Node* as appropriate. Removed unused
2487         functions from TouchEventContext, made more private, and changed data members to Ref
2488         instead of RefPtr. Removed unused NotTouchList value from TouchListType enumeration.
2489         Changed touchList function to return a reference instead of a pointer.
2490
2491         * dom/EventDispatcher.cpp: Removed unneeded includes.
2492         (WebCore::dispatchEventInDOM): Removed use of currentTargetSameAsTarget since it's
2493         clearer if written out.
2494         (WebCore::EventDispatcher::dispatchEvent): Changed no-event dispatch assertion to
2495         use RELEASE_ASSERT_WITH_SECURITY_IMPLICATION since the style checker says so, but
2496         it still doesn't assert anything in release builds because the check in
2497         NoEventDispatchAssertion itself is debug-only. Moved the calls to EventPath's
2498         setRelatedTarget and retargetTouchLists functions inside the EventPath constructor.
2499         Removed the second no-event dispatch assertion because we only need one. Replaced
2500         calls to clearEventPath, setCurrentTarget(nullptr), resetPropagationFlags,
2501         and setEventPhase(NONE) and with a call to resetAfterDispatch. Moved the code that
2502         temporarily sets the target to a different value when calling default event handlers
2503         into the block that calls the default event handlers. Added a new overload that
2504         takes an initializer list of event targets so we can dispatch events that are not
2505         being sent to nodes.
2506
2507         * dom/EventDispatcher.h: Fixed misleading copyright dates and names since this file
2508         just contains a couple of function declarations. Added new overload of dispatchEvent.
2509
2510         * dom/EventPath.cpp:
2511         (WebCore::WindowEventContext::WindowEventContext): Take references instead of pointers.
2512         (WebCore::EventPath::EventPath): Moved the bulk of construction into a new function
2513         named buildPath, so it can still use "return" without skipping the additions here.
2514         Added calls to setRelatedTarget and retargetTouchLists and now both can be private.
2515         Also added a new overload that takes event targets that are not nodes.
2516         (WebCore::EventPath::buildPath): Added. Contains what used to be in the constructor.
2517         But use some references instead of pointers and refactor a bit using lambdas.
2518         (WebCore::EventPath::retargetTouchList): Added. Makes the retargetTouchLists function
2519         shorter and less repetetive.
2520         (WebCore::EventPath::retargetTouchLists): Updated to call retargetTouchList.
2521         (WebCore::EventPath::hasEventListeners const): Deleted. This was unused.
2522         * dom/EventPath.h: Added a constructor that takes an initializer list of event targets.
2523         Made retargetTouchEvents and setRelatedTarget private and used them in the constructor
2524         insead of expecting clients to call them. Removed unused hasEventListeners and
2525         lastContextIfExists functions. Moved body of the eventTargetRespectingTargetRules
2526         function out of the class definition.
2527
2528         * dom/EventTarget.cpp:
2529         (WebCore::EventTarget::dispatchEventForBindings): Updated so it does not expect
2530         dispatchEvent to return a boolean. Instead call a function on the event after dispatching.
2531         Decided to use legacyReturnValue instead of !defaultPrevented, because this is exactly
2532         the return value that the returnValue property is referring to.
2533         (WebCore::EventTarget::dispatchEvent): Removed return value. Replaced calls to
2534         resetPropagationFlags and setEventPhase(NONE) with a call to resetAfterDispatch.
2535         I noticed that there was a local boolean here named "defaultPrevented", which was
2536         backwards; the value in that local was "default not prevented". Doesn't matter since
2537         the boolean return value was removed.
2538         (WebCore::EventTarget::fireEventListeners): Removed the boolean return value.
2539
2540         * dom/EventTarget.h: Added initial values to members of ListenerOptions and
2541         AddEventListenerOptions; maybe we can get rid of the constructors some day.
2542         Removed booelan return values from dispatchEvent and fireEventListeners.
2543
2544         * dom/KeyboardEvent.cpp: Removed unneeded include of EventDispatcher.h.
2545
2546         * dom/Node.cpp:
2547         (WebCore::Node::dispatchEvent): Got rid of boolean return value.
2548         Removed special case code that sometimes called dispatchTouchEvent, since that
2549         just turns around and calls EventDispatcher::dispatchEvent just like this function.
2550         (WebCore::Node::dispatchDOMActivateEvent): Removed boolean return value, removed
2551         integer detail argument and moved the logic to compute the value of the detail
2552         peroprty and to call setDefaultHandled on the underlying click event in here.
2553         This is a private helper function used only in one place.
2554         (WebCore::Node::dispatchTouchEvent): Deleted.
2555         (WebCore::Node::defaultEventHandler): Updated for change to dispatchDOMActivateEvent.
2556         * dom/Node.h: Updated for the above changes.
2557
2558         * dom/RejectedPromiseTracker.cpp:
2559         (WebCore::RejectedPromiseTracker::reportUnhandledRejections): Use defaultPrevented
2560         directly instead of the return value from dispatchEvent.
2561
2562         * dom/ScopedEventQueue.cpp:
2563         (WebCore::ScopedEventQueue::enqueueEvent): Moved assertions here ...
2564         (WebCore::ScopedEventQueue::dispatchEvent const): ... from here. Also changed this
2565         to call Node::dispatchEvent instead of calling EventDispatcher::dispatchEvent directly.
2566
2567         * dom/SimulatedClick.cpp:
2568         (WebCore::simulateMouseEvent): Call Element::dispatchEvent instead of calling
2569         EventDispatcher::dispatchEvent directly.
2570
2571         * editing/Editor.cpp:
2572         (WebCore::dispatchBeforeInputEvent): Use defaultPrevented directly instead of the
2573         return value from dispatchEvent.
2574         * editing/FrameSelection.cpp:
2575         (WebCore::FrameSelection::selectAll): Ditto.
2576         (WebCore::FrameSelection::dispatchSelectStart): Ditto.
2577
2578         * html/CheckboxInputType.cpp:
2579         (WebCore::CheckboxInputType::didDispatchClick): Take a reference instead of a pointer.
2580         * html/CheckboxInputType.h: Updated for above and to use final instead of override.
2581
2582         * html/HTMLFormControlElement.cpp:
2583         (WebCore::HTMLFormControlElement::checkValidity): Use defaultPrevented directly instead
2584         of the return value from dispatchEvent.
2585
2586         * html/HTMLFormElement.cpp:
2587         (WebCore::HTMLFormElement::prepareForSubmission): Use defaultPrevented directly instead
2588         of the return value from dispatchEvent.
2589         (WebCore::HTMLFormElement::reset): Ditto.
2590
2591         * html/HTMLInputElement.cpp:
2592         (WebCore::HTMLInputElement::didDispatchClickEvent): Updated to pass references instead
2593         of pointer.
2594
2595         * html/HTMLMediaElement.cpp:
2596         (WebCore::HTMLMediaElement::dispatchEvent): Got rid of boolean return value.
2597         * html/HTMLMediaElement.h: Ditto.
2598
2599         * html/HTMLPlugInElement.h: Use "delete" instead of just a private function for something
2600         that should never be called.
2601
2602         * html/InputType.cpp:
2603         (WebCore::InputType::didDispatchClick): Take a reference instead of a pointer.
2604         * html/InputType.h: Ditto.
2605         * html/RadioInputType.cpp:
2606         (WebCore::RadioInputType::didDispatchClick): Ditto.
2607         * html/RadioInputType.h: Updated for above and to use final instead of override.
2608
2609         * html/track/TextTrackCue.cpp:
2610         (WebCore::TextTrackCue::dispatchEvent): Got rid of boolean return value.
2611         * html/track/TextTrackCue.h: Ditto.
2612
2613         * inspector/InspectorInstrumentation.cpp: Removed unneeded include of EventDispatcher.h.
2614
2615         * page/DOMWindow.cpp:
2616         (WebCore::DOMWindow::dispatchLoadEvent): Streamlined code a bit so we only have a single
2617         call to dispatchEvent. Improved comments.
2618         (WebCore::DOMWindow::dispatchEvent): Removed return value. Added comments. Replaced
2619         calls to setCurrentTarget(null), setEventPhase(NONE), and resetPropagationFlags with
2620         a call to resetAfterDispatch.
2621         * page/DOMWindow.h: Updated to get rid of the boolean return value.
2622
2623         * page/DragController.cpp:
2624         (WebCore::DragController::dispatchTextInputEventFor): Use defaultPrevented directly instead
2625         of the return value from dispatchEvent.
2626
2627         * page/EventHandler.cpp:
2628         (WebCore::dispatchSelectStart): Use defaultPrevented directly instead
2629         of the return value from dispatchEvent.
2630         (WebCore::EventHandler::accessibilityPreventsEventPropagation): Fixed spelling error in the
2631         name of this function.
2632         (WebCore::EventHandler::dispatchDragSrcEvent): Got rid of boolean return value.
2633         (WebCore::EventHandler::handleTouchEvent): Call dispatchEvent instead of dispatchTouchEvent;
2634         there was no difference between the two except that dispatchTouchEvent required downcasting
2635         and might some day lead to us missing some behavior implemented in an override to dispatchEvent.
2636         * page/EventHandler.h: Updated for above changes.
2637
2638         * platform/graphics/filters/FilterOperation.h:
2639         (WebCore::FilterOperation::clone): Removed dead code that was causing a compiler warning.
2640
2641         * workers/WorkerMessagingProxy.cpp:
2642         (WebCore::WorkerMessagingProxy::postExceptionToWorkerObject): Use defaultPrevented
2643         directly instead of the return value from dispatchEvent.
2644
2645 2017-11-04  Aishwarya Nirmal  <anirmal@apple.com>
2646
2647         [Touch Bar Web API] Add support for menuitem tag
2648         https://bugs.webkit.org/show_bug.cgi?id=179020
2649
2650         Reviewed by Ryosuke Niwa.
2651
2652         The Touch Bar Web API will make use of the menu and menuitem tags
2653         to represent the NSTouchBar and NSTouchBarItem respectively.
2654         Since WebKit currently does not offer support for the menuitem tag,
2655         this change adds it in. There is a runtime flag for this tag, which
2656         is set to false by default.
2657
2658         A specification for the menuitem element can be found at
2659         https://www.w3.org/TR/2013/WD-html51-20130528/interactive-elements.html#the-menuitem-element.
2660         More attributes of this element will be implemented in future patches.
2661
2662         Test: fast/html/menuitem-element.html
2663
2664         * CMakeLists.txt:
2665         * DerivedSources.cpp:
2666         * DerivedSources.make:
2667         * Sources.txt:
2668         * WebCore.xcodeproj/project.pbxproj:
2669         * bindings/js/WebCoreBuiltinNames.h:
2670         * html/HTMLElementsAllInOne.cpp:
2671         * html/HTMLMenuItemElement.cpp: Added.
2672         (WebCore::HTMLMenuItemElement::HTMLMenuItemElement):
2673         (WebCore::HTMLMenuItemElement::create):
2674         * html/HTMLMenuItemElement.h: Added.
2675         * html/HTMLMenuItemElement.idl: Added.
2676         * html/HTMLTagNames.in:
2677         * page/RuntimeEnabledFeatures.h:
2678         (WebCore::RuntimeEnabledFeatures::setMenuItemElementEnabled):
2679         (WebCore::RuntimeEnabledFeatures::menuItemElementEnabled const):
2680
2681 2017-11-03  Zalan Bujtas  <zalan@apple.com>
2682
2683         LayoutState should take RenderBox reference.
2684         https://bugs.webkit.org/show_bug.cgi?id=179272
2685         <rdar://problem/35345247>
2686
2687         Reviewed by Simon Fraser.
2688
2689         No change in functionality.
2690
2691         * rendering/LayoutState.cpp:
2692         (WebCore::LayoutState::LayoutState):
2693         (WebCore::LayoutState::propagateLineGridInfo):
2694         (WebCore::LayoutState::establishLineGrid):
2695         * rendering/LayoutState.h: type tightening.
2696         * rendering/RenderBlock.cpp:
2697         (WebCore::RenderBlock::offsetFromLogicalTopOfFirstPage const):
2698         * rendering/RenderView.cpp:
2699         (WebCore::RenderView::pushLayoutState):
2700         * rendering/RenderView.h:
2701
2702 2017-11-03  Youenn Fablet  <youenn@apple.com>
2703
2704         Implement ServiceWorkerContainer.getRegistration
2705         https://bugs.webkit.org/show_bug.cgi?id=179253
2706
2707         Reviewed by Chris Dumez.
2708
2709         Test: http/tests/workers/service/service-worker-getRegistration.html
2710
2711         Added a map of ServiceWorkerRegistration in ServiceWorkerContainer.
2712         Removing a similar map from SWClientConnection as it is more convenient to have this map per ScriptExecutionContext.
2713
2714         This map allows returning the same JS object for different getRegistration.
2715         Delegating the actual matching to SWServer::Connection which is implemented on the StorageProcess through IPC.
2716
2717         * workers/service/ServiceWorkerContainer.cpp:
2718         (WebCore::ServiceWorkerContainer::getRegistration):
2719         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
2720         (WebCore::ServiceWorkerContainer::jobDidFinish):
2721         * workers/service/ServiceWorkerContainer.h:
2722         * workers/service/ServiceWorkerContainer.idl:
2723         * workers/service/ServiceWorkerRegistration.cpp:
2724         (WebCore::ServiceWorkerRegistration::ServiceWorkerRegistration):
2725         (WebCore::ServiceWorkerRegistration::~ServiceWorkerRegistration):
2726         * workers/service/ServiceWorkerRegistration.h:
2727         * workers/service/server/SWClientConnection.cpp:
2728         (WebCore::SWClientConnection::updateRegistrationState):
2729         (WebCore::SWClientConnection::addServiceWorkerRegistration): Deleted.
2730         (WebCore::SWClientConnection::removeServiceWorkerRegistration): Deleted.
2731         * workers/service/server/SWClientConnection.h:
2732
2733 2017-11-03  Chris Dumez  <cdumez@apple.com>
2734
2735         [iOS-WK1] Fix thread safety issue in WebSQLiteDatabaseTrackerClient
2736         https://bugs.webkit.org/show_bug.cgi?id=179190
2737
2738         Reviewed by David Kilzer.
2739
2740         WebSQLiteDatabaseTrackerClient and its HystererisActivity member are constructed on the UIThread. The
2741         HystererisActivity activity also fires on the UIThread, which means that WebSQLiteDatabaseTrackerClient::hysteresisUpdated()
2742         gets called on the UIThread.
2743
2744         However, the code in WebSQLiteDatabaseTrackerClient::willBeginFirstTransaction() / WebSQLiteDatabaseTrackerClient::didFinishLastTransaction()
2745         uses callOnMainThread() before calling methods on the HysteresisActivity. callOnMainThread() dispatches to the WebThread on WK1 iOS, which
2746         would lead to crashes when calling methods of the HystererisActivity object:
2747         *** -[CFRunLoopTimer respondsToSelector:]: message sent to deallocated instance 0x1c0b6a500
2748
2749         To address the issue, we now dispatch_async() to the main queue in willBeginFirstTransaction() / didFinishLastTransaction()
2750         instead of using callOnMainThread(). I also added assertions to catch issues like these.
2751
2752         * platform/ios/WebSQLiteDatabaseTrackerClient.mm:
2753         (WebCore::WebSQLiteDatabaseTrackerClient::willBeginFirstTransaction):
2754         (WebCore::WebSQLiteDatabaseTrackerClient::didFinishLastTransaction):
2755         (WebCore::WebSQLiteDatabaseTrackerClient::hysteresisUpdated):
2756
2757 2017-11-03  Ryosuke Niwa  <rniwa@webkit.org>
2758
2759         ASSERTION FAILED: NoEventDispatchAssertion::InMainThread::isEventAllowed() || (frameView && frameView->isInChildFrameWithFrameFlattening())
2760         https://bugs.webkit.org/show_bug.cgi?id=179259
2761
2762         Reviewed by Youenn Fablet.
2763
2764         Avoid updating the layout inside HTMLMediaElement::stop() and MediaElementSession::~MediaElementSession
2765
2766         No new tests since existing tests cover this.
2767
2768         * html/HTMLMediaElement.cpp:
2769         (WebCore::HTMLMediaElement::userCancelledLoad): Don't update VTT cues when the active DOM objects are being stopped.
2770         * platform/audio/mac/MediaSessionManagerMac.mm:
2771         (WebCore::MediaSessionManagerMac::removeSession): Update the updateNowPlayingInfo asynchronously
2772         since this function can be called inside HTMLMediaElement::~HTMLMediaElement.
2773
2774 2017-11-03  Alex Christensen  <achristensen@webkit.org>
2775
2776         Add WEBCORE_EXPORT to CachedResourceHandleBase
2777         https://bugs.webkit.org/show_bug.cgi?id=179251
2778
2779         * loader/cache/CachedResourceHandle.h:
2780         (WebCore::CachedResourceHandleBase::get const): Deleted.
2781         (WebCore::CachedResourceHandleBase::operator! const): Deleted.
2782         (WebCore::CachedResourceHandleBase::operator UnspecifiedBoolType const): Deleted.
2783         (WebCore::CachedResourceHandleBase::operator=): Deleted.
2784         I'll need this soon for bug 179251, and having to touch CachedResourceHandle.h causes me to rebuild everything.
2785         Committing it separately greatly increases my debugging and comparison speed.
2786
2787 2017-11-03  Commit Queue  <commit-queue@webkit.org>
2788
2789         Unreviewed, rolling out r224428, r224435, and r224440.
2790         https://bugs.webkit.org/show_bug.cgi?id=179274
2791
2792         Broke iOS and internal builds (Requested by ryanhaddad on
2793         #webkit).
2794
2795         Reverted changesets:
2796
2797         "Use VCP H264 encoder for platforms supporting it"
2798         https://bugs.webkit.org/show_bug.cgi?id=179076
2799         https://trac.webkit.org/changeset/224428
2800
2801         "Use VCP H264 encoder for platforms supporting it"
2802         https://bugs.webkit.org/show_bug.cgi?id=179076
2803         https://trac.webkit.org/changeset/224435
2804
2805         "Use VCP H264 encoder for platforms supporting it"
2806         https://bugs.webkit.org/show_bug.cgi?id=179076
2807         https://trac.webkit.org/changeset/224440
2808
2809 2017-11-03  Youenn Fablet  <youenn@apple.com>
2810
2811         Requests handled by Service Worker should not go through preflighting
2812         https://bugs.webkit.org/show_bug.cgi?id=179250
2813
2814         Reviewed by Alex Christensen.
2815
2816         Test: http/tests/workers/service/service-worker-crossorigin-fetch.html
2817         In case of cross origin requests needed preflighting that may be served through SW, the following is done:
2818         - Bypass preflight
2819         - Put service workers mode as Only so that if SW is not handling the request, the load will fail
2820         - If load fails, restart DocumentThreadableLoader load with preflight.
2821
2822         Additional testing should be added when we properly handle the case where no fetch event handler is registered in the service worker.
2823
2824         * loader/DocumentThreadableLoader.cpp:
2825         (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest):
2826         (WebCore::DocumentThreadableLoader::didFail):
2827         * loader/DocumentThreadableLoader.h:
2828         * loader/ResourceLoaderOptions.h:
2829         * loader/cache/CachedResourceRequest.cpp:
2830         (WebCore::CachedResourceRequest::setSelectedServiceWorkerIdentifierIfNeeded):
2831         * platform/network/ResourceErrorBase.h:
2832
2833 2017-11-03  Zalan Bujtas  <zalan@apple.com>
2834
2835         Remove redundant LayoutStateMaintainer argument (RenderView&)
2836         https://bugs.webkit.org/show_bug.cgi?id=179269
2837         <rdar://problem/35344397>
2838
2839         Reviewed by Simon Fraser.
2840
2841         No change in functionality.
2842
2843         * rendering/RenderBlock.cpp:
2844         (WebCore::RenderBlock::simplifiedLayout):
2845         * rendering/RenderBlockFlow.cpp:
2846         (WebCore::RenderBlockFlow::layoutBlock):
2847         * rendering/RenderBox.cpp:
2848         (WebCore::RenderBox::layout):
2849         * rendering/RenderDeprecatedFlexibleBox.cpp:
2850         (WebCore::RenderDeprecatedFlexibleBox::layoutBlock):
2851         * rendering/RenderEmbeddedObject.cpp:
2852         (WebCore::RenderEmbeddedObject::layout):
2853         * rendering/RenderFlexibleBox.cpp:
2854         (WebCore::RenderFlexibleBox::layoutBlock):
2855         * rendering/RenderGrid.cpp:
2856         (WebCore::RenderGrid::layoutBlock):
2857         * rendering/RenderImage.cpp:
2858         (WebCore::RenderImage::layoutShadowControls):
2859         * rendering/RenderTable.cpp:
2860         (WebCore::RenderTable::layout):
2861         * rendering/RenderTableRow.cpp:
2862         (WebCore::RenderTableRow::layout):
2863         * rendering/RenderTableSection.cpp:
2864         (WebCore::RenderTableSection::layout):
2865         (WebCore::RenderTableSection::layoutRows):
2866         * rendering/RenderVTTCue.cpp:
2867         (WebCore::RenderVTTCue::layout):
2868         * rendering/RenderView.h:
2869         (WebCore::LayoutStateMaintainer::LayoutStateMaintainer):
2870
2871 2017-11-03  Youenn Fablet  <youenn@apple.com>
2872
2873         Use VCP H264 encoder for platforms supporting it
2874         https://bugs.webkit.org/show_bug.cgi?id=179076
2875         rdar://problem/35180773
2876
2877         Reviewed by Eric Carlson.
2878
2879         Covered by existing test coverage.
2880
2881         * platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.cpp:
2882         (WebCore::VideoToolboxVideoEncoderFactory::setActive):
2883         (WebCore::VideoToolboxVideoEncoderFactory::CreateSupportedVideoEncoder):
2884         (WebCore::VideoToolboxVideoEncoderFactory::DestroyVideoEncoder):
2885         * platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.h:
2886
2887 2017-11-03  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2888
2889         [Curl] Fix build after r224373
2890         https://bugs.webkit.org/show_bug.cgi?id=179265
2891
2892         Unreviewed build fix.
2893
2894         * platform/network/curl/ResourceHandleCurl.cpp:
2895         (WebCore::ResourceHandle::continueWillSendRequest): Deleted.
2896
2897 2017-11-03  Brady Eidson  <beidson@apple.com>
2898
2899         Remove an invalid ASSERT that is seen intermittently.
2900         https://bugs.webkit.org/show_bug.cgi?id=179186
2901
2902         Unreviewed.
2903
2904         * workers/service/server/SWServerRegistration.cpp:
2905         (WebCore::SWServerRegistration::removeClientServiceWorkerRegistration): This is an invalid ASSERT,
2906           it's definitely racey over IPC.
2907
2908 2017-11-03  Michael Catanzaro  <mcatanzaro@igalia.com>
2909
2910         [WPE] Remove unneeded USE(LIBEPOXY) guards
2911         https://bugs.webkit.org/show_bug.cgi?id=179228
2912
2913         Reviewed by Carlos Garcia Campos.
2914
2915         USE(LIBEPOXY) is already mandatory for WPE.
2916
2917         * platform/graphics/egl/GLContextEGLWPE.cpp:
2918         * platform/graphics/wpe/PlatformDisplayWPE.cpp:
2919
2920 2017-11-03  Ali Juma  <ajuma@chromium.org>
2921
2922         Layout viewport rect is too wide after window resize
2923         https://bugs.webkit.org/show_bug.cgi?id=175235
2924
2925         Fix a formatting mistake that was introduced by r224241.
2926
2927         Reviewed by Simon Fraser.
2928
2929         No change in behavior.
2930
2931         * platform/ScrollView.cpp:
2932         (WebCore::ScrollView::updateScrollbars):
2933
2934 2017-11-03  Youenn Fablet  <youenn@apple.com>
2935
2936         Implement Service Worker Matching Registration algorithm
2937         https://bugs.webkit.org/show_bug.cgi?id=178882
2938
2939         Reviewed by Chris Dumez.
2940
2941         Test: http/tests/workers/service/service-worker-clear.html
2942
2943         Adding support for scope as part of the ServiceWorkerRegistrationKey to disambiguate several service workers registered with different scopes.
2944         Adding the Service Worker Registration algorithm in SWServer and adding internals API to test it.
2945         Making ServiceWorkerRegistrationKey a class to protect its internal field to be reused in wrong places.
2946
2947         Added preliminary support for clearing service workers for a given session ID as this is needed by WTR for stable testing.
2948
2949         * testing/Internals.cpp:
2950         (WebCore::Internals::hasServiceWorkerRegistration):
2951         * testing/Internals.h:
2952         * testing/Internals.idl:
2953         * workers/service/ServiceWorkerJobData.cpp:
2954         (WebCore::ServiceWorkerJobData::registrationKey const):
2955         * workers/service/ServiceWorkerRegistration.h:
2956         * workers/service/ServiceWorkerRegistrationKey.cpp:
2957         (WebCore::ServiceWorkerRegistrationKey::hash const):
2958         (WebCore::ServiceWorkerRegistrationKey::operator== const):
2959         (WebCore::ServiceWorkerRegistrationKey::isolatedCopy const):
2960         * workers/service/ServiceWorkerRegistrationKey.h:
2961         (WebCore::ServiceWorkerRegistrationKey::encode const):
2962         (WebCore::ServiceWorkerRegistrationKey::decode):
2963         * workers/service/server/SWClientConnection.h:
2964         * workers/service/server/SWServer.cpp:
2965         (WebCore::SWServer::clear):
2966         (WebCore::SWServer::doRegistrationMatching const):
2967         * workers/service/server/SWServer.h:
2968         (WebCore::SWServer::Connection::doRegistrationMatching const):
2969         * workers/service/server/SWServerJobQueue.cpp:
2970         (WebCore::SWServerJobQueue::~SWServerJobQueue):
2971         * workers/service/server/SWServerRegistration.h:
2972
2973 2017-11-02  Dean Jackson  <dino@apple.com>
2974
2975         Add basic OffscreenCanvas interface
2976         https://bugs.webkit.org/show_bug.cgi?id=179213
2977         <rdar://problem/35326778>
2978
2979         Reviewed by Sam Weinig.
2980
2981         Add the basic infrastructure for the OffscreenCanvas
2982         object, so it can be created from script.
2983
2984         Test: http/wpt/offscreen-canvas/offscreencanvas.constructor.html
2985
2986         * DerivedSources.make:
2987         * Sources.txt:
2988         * WebCore.xcodeproj/project.pbxproj:
2989         * bindings/js/JSEventTargetCustom.cpp:
2990         * dom/EventTargetFactory.in:
2991         * html/OffscreenCanvas.cpp: Added.
2992         (WebCore::OffscreenCanvas::create):
2993         (WebCore::OffscreenCanvas::OffscreenCanvas):
2994         (WebCore::OffscreenCanvas::width const):
2995         (WebCore::OffscreenCanvas::setWidth):
2996         (WebCore::OffscreenCanvas::height const):
2997         (WebCore::OffscreenCanvas::setHeight):
2998         * html/OffscreenCanvas.h: Added.
2999         * html/OffscreenCanvas.idl: Added.
3000
3001 2017-11-03  Ryosuke Niwa  <rniwa@webkit.org>
3002
3003         Crash inside ChildListMutationAccumulator::enqueueMutationRecord()
3004         https://bugs.webkit.org/show_bug.cgi?id=179234
3005         <rdar://problem/35287748>
3006
3007         Reviewed by Darin Adler.
3008
3009         Fixed the crash by keeping MutationObserver referenced by MutationObserverInterestGroup alive.
3010
3011         Also added hasCallback() virtual function on MutationObserver to check whether the callback is alive
3012         to work around the bug that JS function referenced by MutationObserver isn't kept alive.
3013         We'll address this bug separately in https://webkit.org/b/179224.
3014
3015         Test: fast/dom/MutationObserver/disconnect-observer-while-mutation-records-are-enqueued-crash.html
3016
3017         * bindings/scripts/CodeGeneratorJS.pm:
3018         (GenerateCallbackHeaderContent): Added an override for the newly added virtual hasCallback().
3019         * dom/MutationCallback.h:
3020         * dom/MutationObserver.cpp:
3021         (WebCore::MutationObserver::deliver): Added the aforementioned workaround.
3022         * dom/MutationObserverInterestGroup.cpp:
3023         (WebCore::MutationObserverInterestGroup::MutationObserverInterestGroup): Fixed the crash by using Ref.
3024         (WebCore::MutationObserverInterestGroup::enqueueMutationRecord): Ditto.
3025         * dom/MutationObserverInterestGroup.h:
3026         * dom/NativeNodeFilter.cpp:
3027         (WebCore::NativeNodeFilter::hasCallback const): Always return true here. This function is never called
3028         but we still need to implement it since NodeFilter has a pure virtual hasCallback() now.
3029         * dom/NativeNodeFilter.h:
3030         * dom/Node.cpp:
3031         (WebCore::collectMatchingObserversForMutation): Use Ref to fix the crash.
3032         (WebCore::Node::registeredMutationObservers): Ditto.
3033         * dom/Node.h:
3034         * dom/NodeFilter.h:
3035
3036 2017-11-03  Zalan Bujtas  <zalan@apple.com>
3037
3038         RenderObject::*positioned() naming cleanup
3039         https://bugs.webkit.org/show_bug.cgi?id=179206
3040         <rdar://problem/35325254>
3041
3042         Reviewed by Darin Adler.
3043
3044         +isFixedPositioned()
3045         +isAbsolutelyPositioned()
3046         isRelPositioned() -> isRelativelyPositioned()
3047
3048         Covered by existing tests.
3049
3050         * css/CSSComputedStyleDeclaration.cpp:
3051         (WebCore::positionOffsetValue):
3052         * dom/Element.cpp:
3053         (WebCore::layoutOverflowRectContainsAllDescendants):
3054         * rendering/LayoutState.cpp:
3055         (WebCore::LayoutState::LayoutState):
3056         * rendering/LayoutState.h:
3057         * rendering/RenderBlock.cpp:
3058         (WebCore::RenderBlock::renderName const):
3059         * rendering/RenderBox.cpp:
3060         (WebCore::RenderBox::fixedElementLaysOutRelativeToFrame const):
3061         (WebCore::RenderBox::foregroundIsKnownToBeOpaqueInRect const):
3062         (WebCore::RenderBox::mapLocalToContainer const):
3063         (WebCore::RenderBox::pushMappingToContainer const):
3064         (WebCore::RenderBox::mapAbsoluteToLocalPoint const):
3065         (WebCore::RenderBox::offsetFromContainer const):
3066         (WebCore::RenderBox::containingBlockLogicalWidthForPositioned const):
3067         (WebCore::RenderBox::containingBlockLogicalHeightForPositioned const):
3068         * rendering/RenderBoxModelObject.cpp:
3069         (WebCore::RenderBoxModelObject::adjustedPositionRelativeToOffsetParent const):
3070         (WebCore::RenderBoxModelObject::offsetForInFlowPosition const):
3071         * rendering/RenderDeprecatedFlexibleBox.cpp:
3072         (WebCore::RenderDeprecatedFlexibleBox::renderName const):
3073         * rendering/RenderFragmentedFlow.cpp:
3074         (WebCore::RenderFragmentedFlow::adjustedPositionRelativeToOffsetParent const):
3075         * rendering/RenderGeometryMap.cpp:
3076         (WebCore::canMapBetweenRenderersViaLayers):
3077         * rendering/RenderGrid.cpp:
3078         (WebCore::RenderGrid::renderName const):
3079         * rendering/RenderInline.cpp:
3080         (WebCore::RenderInline::renderName const):
3081         * rendering/RenderLayer.cpp:
3082         (WebCore::RenderLayer::paintLayer):
3083         (WebCore::RenderLayer::calculateClipRects const):
3084         * rendering/RenderLayerBacking.cpp:
3085         (WebCore::RenderLayerBacking::updateCompositedBounds):
3086         * rendering/RenderLayerCompositor.cpp:
3087         (WebCore::RenderLayerCompositor::updateBacking):
3088         (WebCore::RenderLayerCompositor::computeExtent const):
3089         (WebCore::RenderLayerCompositor::reasonsForCompositing const):
3090         (WebCore::RenderLayerCompositor::isViewportConstrainedFixedOrStickyLayer const):
3091         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
3092         (WebCore::RenderLayerCompositor::registerAllViewportConstrainedLayers):
3093         * rendering/RenderObject.cpp:
3094         (WebCore::RenderObject::containingBlock const):
3095         (WebCore::RenderObject::outputRenderObject const):
3096         (WebCore::RenderObject::offsetParent const):
3097         * rendering/RenderObject.h:
3098         (WebCore::RenderObject::isPositioned const):
3099         (WebCore::RenderObject::isInFlowPositioned const):
3100         (WebCore::RenderObject::isFixedPositioned const):
3101         (WebCore::RenderObject::isAbsolutePositioned const):
3102         (WebCore::RenderObject::isRelativePositioned const):
3103         (WebCore::RenderObject::isStickyPositioned const):
3104         (WebCore::RenderObject::RenderObjectBitfields::RenderObjectBitfields):
3105         (WebCore::RenderObject::RenderObjectBitfields::isRelativePositioned const):
3106         (WebCore::RenderObject::RenderObjectBitfields::isPositioned const):
3107         (WebCore::RenderObject::isRelPositioned const): Deleted.
3108         (WebCore::RenderObject::RenderObjectBitfields::isRelPositioned const): Deleted.
3109
3110 2017-11-03  Chris Dumez  <cdumez@apple.com>
3111
3112         Use a single identifier type to identify Service Workers
3113         https://bugs.webkit.org/show_bug.cgi?id=179192
3114
3115         Reviewed by Brady Eidson.
3116
3117         Use a single identifier type to identify Service Workers. We had both a String
3118         identifier and a uint64_t identifier for each service worker. We now consistently
3119         use a ServiceWorkerIdentifier which is a strongly typed identifier backed by a
3120         uint64_t.
3121
3122         * WebCore.xcodeproj/project.pbxproj:
3123         * loader/ResourceLoaderOptions.h:
3124         * loader/cache/CachedResourceRequest.cpp:
3125         (WebCore::CachedResourceRequest::setSelectedServiceWorkerIdentifierIfNeeded):
3126         * loader/cache/CachedResourceRequest.h:
3127         * workers/service/ServiceWorker.cpp:
3128         (WebCore::ServiceWorker::ServiceWorker):
3129         * workers/service/ServiceWorker.h:
3130         * workers/service/ServiceWorkerClient.cpp:
3131         (WebCore::ServiceWorkerClient::postMessage):
3132         * workers/service/ServiceWorkerContainer.cpp:
3133         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
3134         * workers/service/ServiceWorkerContextData.cpp:
3135         (WebCore::ServiceWorkerContextData::isolatedCopy const):
3136         * workers/service/ServiceWorkerContextData.h:
3137         (WebCore::ServiceWorkerContextData::encode const):
3138         (WebCore::ServiceWorkerContextData::decode):
3139         * workers/service/ServiceWorkerIdentifier.h: Copied from Source/WebCore/workers/service/ServiceWorkerContextData.cpp.
3140         * workers/service/ServiceWorkerRegistrationData.h:
3141         (WebCore::ServiceWorkerRegistrationData::decode):
3142         * workers/service/context/SWContextManager.cpp:
3143         (WebCore::SWContextManager::serviceWorkerThreadProxy const):
3144         (WebCore::SWContextManager::postMessageToServiceWorkerGlobalScope):
3145         * workers/service/context/SWContextManager.h:
3146         * workers/service/context/ServiceWorkerThread.cpp:
3147         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
3148         * workers/service/context/ServiceWorkerThread.h:
3149         (WebCore::ServiceWorkerThread::identifier const):
3150         * workers/service/context/ServiceWorkerThreadProxy.h:
3151         * workers/service/server/SWClientConnection.cpp:
3152         (WebCore::SWClientConnection::postMessageToServiceWorkerClient):
3153         * workers/service/server/SWClientConnection.h:
3154         * workers/service/server/SWServer.cpp:
3155         (WebCore::generateServiceWorkerIdentifier):
3156         (WebCore::SWServer::Connection::scriptContextFailedToStart):
3157         (WebCore::SWServer::Connection::scriptContextStarted):
3158         (WebCore::SWServer::scriptContextFailedToStart):
3159         (WebCore::SWServer::scriptContextStarted):
3160         (WebCore::SWServer::updateWorker):
3161         * workers/service/server/SWServer.h:
3162         * workers/service/server/SWServerJobQueue.cpp:
3163         (WebCore::SWServerJobQueue::scriptContextFailedToStart):
3164         (WebCore::SWServerJobQueue::scriptContextStarted):
3165         * workers/service/server/SWServerJobQueue.h:
3166         * workers/service/server/SWServerRegistration.h:
3167         (WebCore::SWServerRegistration::setActiveServiceWorkerIdentifier):
3168         * workers/service/server/SWServerWorker.cpp:
3169         (WebCore::SWServerWorker::SWServerWorker):
3170         * workers/service/server/SWServerWorker.h:
3171         (WebCore::SWServerWorker::create):
3172         (WebCore::SWServerWorker::identifier const):
3173
3174 2017-11-02  Andy Estes  <aestes@apple.com>
3175
3176         [Payment Request] show() should only be called with user activation
3177         https://bugs.webkit.org/show_bug.cgi?id=179056
3178
3179         Reviewed by Sam Weinig.
3180
3181         Updated existing tests to call PaymentRequest.show() with user activation.
3182
3183         * Modules/paymentrequest/PaymentRequest.cpp:
3184         (WebCore::PaymentRequest::show):
3185
3186 2017-11-03  Daniel Bates  <dabates@apple.com>
3187
3188         Invalidate node list when associated form control element is removed
3189         https://bugs.webkit.org/show_bug.cgi?id=179232
3190         <rdar://problem/35308269>
3191
3192         Reviewed by Ryosuke Niwa.
3193
3194         A node list represents a live view of the DOM. Invalidate the node list
3195         associated with a form element whenever one of its associated form control
3196         elements is removed.
3197
3198         Test: fast/forms/node-list-remove-button-from-form.html
3199
3200         * html/HTMLFormElement.cpp:
3201         (WebCore::HTMLFormElement::removeFormElement):
3202
3203 2017-11-03  Frederic Wang  <fwang@igalia.com>
3204
3205         Add USE(APPLE_INTERNAL_SDK)-guards around SPI in ResourceHandle code
3206         https://bugs.webkit.org/show_bug.cgi?id=136107
3207
3208         Based on patch by Daniel Bates <dabates@apple.com>
3209         Reviewed by Darin Adler.
3210
3211         No new tests, behavior unchanged.
3212
3213         * platform/network/ResourceHandleClient.h: Replace includes of private headers with CFNetworkSPI.h.
3214         * platform/network/ResourceHandleInternal.h: Ditto.
3215         * platform/network/ios/ResourceHandleIOS.mm: Add USE(APPLE_INTERNAL_SDK)-guard around SPI
3216         headers and forward declare NSURLRequest SPI and constant _kCFStreamSSLTrustedLeafCertificates
3217         for clients that build without the internal SDK. Add BSD license block to file.
3218         (WebCore::ResourceHandle::createSSLPropertiesFromNSURLRequest): Fix code style issues; use
3219         nullptr instead of 0, use reinterpret_cast instead of C-style cast, remove unnecessary
3220         "using namespace WebCore"
3221         and rename variables to improve readability.
3222         * platform/network/mac/ResourceErrorMac.mm: Add USE(APPLE_INTERNAL_SDK)-guard around private
3223         headers and add typedef for CFCachedURLResponseRef for clients that build without the
3224         internal SDK.
3225
3226 2017-11-03  Antti Koivisto  <antti@apple.com>
3227
3228         Crash in WebCore::RenderStyle::overflowX with display:contents
3229         https://bugs.webkit.org/show_bug.cgi?id=178857
3230         <rdar://problem/35201120>
3231
3232         Reviewed by Zalan Bujtas.
3233
3234         Crash test by Renata Hodovan.
3235
3236         Tests: fast/css/display-contents-all.html
3237                fast/css/display-contents-document-element.html
3238
3239         * css/StyleResolver.cpp:
3240         (WebCore::adjustDisplayContentsStyle):
3241
3242         For document element 'display:contents' should adjust to 'display:block' like it does for other display types.
3243
3244 2017-11-03  Jiewen Tan  <jiewen_tan@apple.com>
3245
3246         Replace some auto* with RefPtr within WebCore/html
3247         https://bugs.webkit.org/show_bug.cgi?id=179218
3248         <rdar://problem/35102567>
3249
3250         Reviewed by Ryosuke Niwa.
3251
3252         No changes in behaviors.
3253
3254         In this patch, it replace some auto* pointers with RefPtrs. The way it achieves this goal is to wrap
3255         the RHS with makeRefPtr(). Also, some methods have been modified to return RefPtrs directly. Those
3256         include:
3257             HTMLInputElement::list,
3258             HTMLInputElement::dataList,
3259             HTMLLabelElement::control,
3260             HTMLLegendElement::associatedControl,
3261             HTMLSummaryElement::detailsElement,
3262             HTMLTableElement::tHead,
3263             HTMLTableElement::tFoot,
3264             HTMLTablePartElement::findParentTable,
3265             HTMLTableRowElement.cpp::findTable, local function
3266             RadioNodeList.cpp::toRadioButtonInputElement, local function
3267             CanvasStyle::canvasGradient,
3268             CanvasStyle::canvasPattern,
3269             WebGLRenderingContextBase::validateTextureBinding,
3270             GraphicsContext::strokeGradient,
3271             GraphicsContext::fillGradient.
3272
3273         * accessibility/AXObjectCache.cpp:
3274         (WebCore::AXObjectCache::labelChanged):
3275         * accessibility/AccessibilityRenderObject.cpp:
3276         (WebCore::AccessibilityRenderObject::correspondingControlForLabelElement const):
3277         * accessibility/AccessibilityTable.cpp:
3278         (WebCore::AccessibilityTable::addChildren):
3279         (WebCore::AccessibilityTable::title const):
3280         * accessibility/atk/WebKitAccessibleInterfaceTable.cpp:
3281         (webkitAccessibleTableGetCaption):
3282         * html/ColorInputType.cpp:
3283         (WebCore::ColorInputType::suggestions const):
3284         * html/FTPDirectoryDocument.cpp:
3285         (WebCore::FTPDirectoryDocumentParser::loadDocumentTemplate):
3286         * html/FileInputType.cpp:
3287         (WebCore::FileInputType::appendFormData const):
3288         (WebCore::FileInputType::disabledAttributeChanged):
3289         (WebCore::FileInputType::multipleAttributeChanged):
3290         * html/FormAssociatedElement.cpp:
3291         (WebCore::FormAssociatedElement::formOwnerRemovedFromTree):
3292         * html/HTMLBodyElement.cpp:
3293         (WebCore::HTMLBodyElement::insertedIntoAncestor):
3294         (WebCore::HTMLBodyElement::didFinishInsertingNode):
3295         (WebCore::HTMLBodyElement::scrollTo):
3296         * html/HTMLDetailsElement.cpp:
3297         (WebCore::HTMLDetailsElement::isActiveSummary const):
3298         (WebCore::HTMLDetailsElement::parseAttribute):
3299         * html/HTMLDocument.cpp:
3300         (WebCore::HTMLDocument::namedItem):
3301         * html/HTMLElement.cpp:
3302         (WebCore::HTMLElement::editabilityFromContentEditableAttr):
3303         * html/HTMLFormControlElement.cpp:
3304         (WebCore::HTMLFormControlElement::didAttachRenderers):
3305         * html/HTMLFrameOwnerElement.cpp:
3306         (WebCore:: const):
3307         * html/HTMLFrameSetElement.cpp:
3308         (WebCore::HTMLFrameSetElement::namedItem):
3309         * html/HTMLHtmlElement.cpp:
3310         (WebCore::HTMLHtmlElement::insertedByParser):
3311         * html/HTMLImageElement.cpp:
3312         (WebCore::HTMLImageElement::bestFitSourceFromPictureElement):
3313         * html/HTMLInputElement.cpp:
3314         (WebCore::HTMLInputElement::defaultEventHandler):
3315         (WebCore::HTMLInputElement::list const):
3316         (WebCore::HTMLInputElement::dataList const):
3317         (WebCore::HTMLInputElement::setupDateTimeChooserParameters):
3318         * html/HTMLInputElement.h:
3319         * html/HTMLLabelElement.cpp:
3320         (WebCore::firstElementWithIdIfLabelable):
3321         (WebCore::HTMLLabelElement::control const):
3322         (WebCore::HTMLLabelElement::form const):
3323         (WebCore::HTMLLabelElement::setActive):
3324         (WebCore::HTMLLabelElement::setHovered):
3325         (WebCore::HTMLLabelElement::willRespondToMouseClickEvents):
3326         (WebCore::HTMLLabelElement::focus):
3327         (WebCore::HTMLLabelElement::accessKeyAction):
3328         * html/HTMLLabelElement.h:
3329         * html/HTMLLegendElement.cpp:
3330         (WebCore::HTMLLegendElement::associatedControl):
3331         (WebCore::HTMLLegendElement::focus):
3332         (WebCore::HTMLLegendElement::accessKeyAction):
3333         (WebCore::HTMLLegendElement::form const):
3334         * html/HTMLLegendElement.h:
3335         * html/HTMLLinkElement.cpp:
3336         (WebCore::HTMLLinkElement::setCSSStyleSheet):
3337         (WebCore::HTMLLinkElement::addSubresourceAttributeURLs const):
3338         * html/HTMLMediaElement.cpp:
3339         (WebCore::needsAutoplayPlayPauseEventsQuirk):
3340         (WebCore::HTMLMediaElement::loadResource):
3341         (WebCore::HTMLMediaElement::updateActiveTextTrackCues):
3342         (WebCore::HTMLMediaElement::removeTextTrack):
3343         (WebCore::HTMLMediaElement::layoutSizeChanged):
3344         * html/HTMLObjectElement.cpp:
3345         (WebCore::shouldBeExposed):
3346         (WebCore::HTMLObjectElement::appendFormData):
3347         * html/HTMLOptGroupElement.cpp:
3348         (WebCore::HTMLOptGroupElement::recalcSelectOptions):
3349         * html/HTMLPictureElement.cpp:
3350         (WebCore::HTMLPictureElement::viewportChangeAffectedPicture const):
3351         * html/HTMLPlugInElement.cpp:
3352         (WebCore::HTMLPlugInElement::bindingsInstance):
3353         * html/HTMLPlugInImageElement.cpp:
3354         (WebCore::HTMLPlugInImageElement::isImageType):
3355         (WebCore::HTMLPlugInImageElement::willDetachRenderers):
3356         (WebCore::HTMLPlugInImageElement::partOfSnapshotOverlay const):
3357         (WebCore::HTMLPlugInImageElement::checkSizeChangeForSnapshotting):
3358         * html/HTMLSlotElement.cpp:
3359         (WebCore::HTMLSlotElement::attributeChanged):
3360         (WebCore:: const):
3361         * html/HTMLSourceElement.cpp:
3362         (WebCore::HTMLSourceElement::parseAttribute):
3363         * html/HTMLStyleElement.cpp:
3364         (WebCore::HTMLStyleElement::addSubresourceAttributeURLs const):
3365         * html/HTMLSummaryElement.cpp:
3366         (WebCore::HTMLSummaryElement::detailsElement const):
3367         * html/HTMLSummaryElement.h:
3368         * html/HTMLTableElement.cpp:
3369         (WebCore::HTMLTableElement::caption const):
3370         (WebCore::HTMLTableElement::tHead const):
3371         (WebCore::HTMLTableElement::tFoot const):
3372         (WebCore::HTMLTableElement::createTHead):
3373         (WebCore::HTMLTableElement::deleteTHead):
3374         (WebCore::HTMLTableElement::createTFoot):
3375         (WebCore::HTMLTableElement::deleteTFoot):
3376         (WebCore::HTMLTableElement::createCaption):
3377         (WebCore::HTMLTableElement::deleteCaption):
3378         * html/HTMLTableElement.h:
3379         * html/HTMLTablePartElement.cpp:
3380         (WebCore::HTMLTablePartElement::findParentTable const):
3381         * html/HTMLTablePartElement.h:
3382         * html/HTMLTableRowElement.cpp:
3383         (WebCore::findTable):
3384         (WebCore::HTMLTableRowElement::rowIndex const):
3385         (WebCore::findRows):
3386         * html/HTMLTableSectionElement.cpp:
3387         (WebCore::HTMLTableSectionElement::additionalPresentationAttributeStyle const):
3388         * html/HTMLTrackElement.cpp:
3389         (WebCore::HTMLTrackElement::mediaElement const):
3390         * html/LinkIconCollector.cpp:
<