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