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