Make RestrictedHTTPResponseAccess flag true by default
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-04-29  Youenn Fablet  <youenn@apple.com>
2
3         Make RestrictedHTTPResponseAccess flag true by default
4         https://bugs.webkit.org/show_bug.cgi?id=185089
5
6         Reviewed by Geoffrey Garen.
7
8         * page/RuntimeEnabledFeatures.h:
9
10 2018-04-28  Sihui Liu  <sihui_liu@apple.com>
11
12         [Cocoa] Set HTTPOnly flag when converting Cookie to NSHTTPCookie
13         https://bugs.webkit.org/show_bug.cgi?id=185052
14
15         Reviewed by Geoffrey Garen.
16
17         Set HTTPOnly for NSHTTPCookie when it's converted from Cookie, so the WebKit APIs could 
18         create NSHTTPCookie with correct HTTPOnly flag. Also, reverted the change made to operator
19         function because we want the Cookie class to act as a wrapper for NSHTTPCookie and leverage
20         its equal function. 
21
22         Modified API test: WebKit.WKHTTPCookieStoreHttpOnly
23
24         * platform/network/cocoa/CookieCocoa.mm:
25         (WebCore::Cookie::operator NSHTTPCookie * const):
26         (WebCore::Cookie::operator== const):
27         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
28         (WebCore::NetworkStorageSession::deleteCookie):
29
30 2018-04-28  Zalan Bujtas  <zalan@apple.com>
31
32         [LFC] Add LayoutTreeBuilder class to generate the layout tree
33         https://bugs.webkit.org/show_bug.cgi?id=185108
34
35         Reviewed by Antti Koivisto.
36
37         This is for testing purposes.
38
39         * WebCore.xcodeproj/project.pbxproj:
40         * layout/FormattingState.cpp:
41         (WebCore::Layout::FormattingState::~FormattingState):
42         * layout/FormattingState.h:
43         * layout/LayoutContext.h:
44         * layout/blockformatting/BlockFormattingState.cpp:
45         (WebCore::Layout::BlockFormattingState::~BlockFormattingState):
46         * layout/blockformatting/BlockFormattingState.h:
47         * layout/inlineformatting/InlineFormattingState.cpp:
48         (WebCore::Layout::InlineFormattingState::~InlineFormattingState):
49         * layout/inlineformatting/InlineFormattingState.h:
50         * layout/layouttree/LayoutBlockContainer.h:
51         * layout/layouttree/LayoutBox.h:
52         * layout/layouttree/LayoutContainer.h:
53         * layout/layouttree/LayoutInlineContainer.h:
54         * layout/layouttree/LayoutTreeBuilder.cpp: Added.
55         (WebCore::Layout::TreeBuilder::createLayoutTree):
56         (WebCore::Layout::TreeBuilder::createSubTree):
57         (WebCore::Layout::outputLayoutBox):
58         (WebCore::Layout::outputLayoutTree):
59         (WebCore::Layout::TreeBuilder::showLayoutTree):
60         (WebCore::Layout::printLayoutTreeForLiveDocuments):
61         * layout/layouttree/LayoutTreeBuilder.h: Copied from Source/WebCore/layout/layouttree/LayoutBlockContainer.h.
62         * page/mac/PageMac.mm:
63         (WebCore::Page::platformInitialize):
64
65 2018-04-28  Zalan Bujtas  <zalan@apple.com>
66
67         [LFC] Implement BlockMarginCollapse functions.
68         https://bugs.webkit.org/show_bug.cgi?id=185036
69
70         Reviewed by Antti Koivisto.
71
72         * layout/blockformatting/BlockMarginCollapse.cpp:
73         (WebCore::Layout::marginValue):
74         (WebCore::Layout::BlockMarginCollapse::BlockMarginCollapse):
75         (WebCore::Layout::BlockMarginCollapse::marginTop const):
76         (WebCore::Layout::BlockMarginCollapse::marginBottom const):
77         (WebCore::Layout::BlockMarginCollapse::isMarginTopCollapsedWithSibling const):
78         (WebCore::Layout::BlockMarginCollapse::isMarginBottomCollapsedWithSibling const):
79         (WebCore::Layout::BlockMarginCollapse::isMarginTopCollapsedWithParent const):
80         (WebCore::Layout::BlockMarginCollapse::isMarginBottomCollapsedWithParent const):
81         (WebCore::Layout::BlockMarginCollapse::nonCollapsedMarginTop const):
82         (WebCore::Layout::BlockMarginCollapse::nonCollapsedMarginBottom const):
83         (WebCore::Layout::BlockMarginCollapse::collapsedMarginTopFromFirstChild const):
84         (WebCore::Layout::BlockMarginCollapse::collapsedMarginBottomFromLastChild const):
85         (WebCore::Layout::BlockMarginCollapse::hasAdjoiningMarginTopAndBottom const):
86         * layout/blockformatting/BlockMarginCollapse.h:
87         * layout/layouttree/LayoutBox.h:
88         (WebCore::Layout::Box::style const):
89
90 2018-04-27  David Kilzer  <ddkilzer@apple.com>
91
92         Add logging when SpringBoard enables WebThread
93         <https://webkit.org/b/185100>
94         <rdar://problem/39746542>
95
96         Reviewed by Daniel Bates.
97
98         * platform/RuntimeApplicationChecks.h:
99         (WebCore::IOSApplication::isSpringBoard): Add declaration.
100         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
101         (WebCore::IOSApplication::isSpringBoard): Add implementation.
102         * platform/ios/wak/WebCoreThread.mm:
103         (WebThreadEnable): Call RELEASE_LOG_FAULT() if this is called by
104         SpringBoard.
105
106 2018-04-27  Keith Rollin  <krollin@apple.com>
107
108         Fix crash in DocumentLoader::startLoadingMainResource
109         https://bugs.webkit.org/show_bug.cgi?id=185088
110         rdar://problem/39689263
111
112         Reviewed by Chris Dumez.
113
114         Add a "protectedThis" to address a case where a deleted "this" was
115         accessed in a RELEASE_LOG statement.
116
117         No new tests -- covered by existing tests, which now pass.
118
119         * loader/DocumentLoader.cpp:
120         (WebCore::DocumentLoader::startLoadingMainResource):
121
122 2018-04-27  Simon Fraser  <simon.fraser@apple.com>
123
124         Implement color-filter for text stroke
125         https://bugs.webkit.org/show_bug.cgi?id=185098
126
127         Reviewed by Alan Bujtas.
128         
129         Transform the text stroke color through color-filter.
130
131         Test: css3/color-filters/color-filter-text-stroke.html
132
133         * rendering/TextPaintStyle.cpp:
134         (WebCore::computeTextPaintStyle):
135
136 2018-04-27  Simon Fraser  <simon.fraser@apple.com>
137
138         Implement animation for color-filter
139         https://bugs.webkit.org/show_bug.cgi?id=185092
140         rdar://problem/39773810
141
142         Reviewed by Tim Horton.
143         
144         Implement animation of color-filter.
145         
146         This requires tracking whether the color-filter function lists match for both old and new
147         animation code paths.
148         
149         The filter-related ProperyWappers in CSSPropertyAnimation are cleaned up to use a single wrapper,
150         which has to pass the propertyID to the blend function so we know which "lists match" to check.
151         This wrapper reports that its accelerated for filter and backdrop-filter, but not color-filter.
152
153         Test: css3/color-filters/color-filter-animation.html
154
155         * animation/CSSPropertyBlendingClient.h:
156         * animation/KeyframeEffectReadOnly.cpp:
157         (WebCore::KeyframeEffectReadOnly::setBlendingKeyframes):
158         (WebCore::KeyframeEffectReadOnly::checkForMatchingColorFilterFunctionLists):
159         * animation/KeyframeEffectReadOnly.h:
160         * page/animation/AnimationBase.h:
161         * page/animation/CSSPropertyAnimation.cpp:
162         (WebCore::blendFunc):
163         (WebCore::PropertyWrapperFilter::PropertyWrapperFilter):
164         (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
165         (WebCore::PropertyWrapperAcceleratedFilter::PropertyWrapperAcceleratedFilter): Deleted.
166         (WebCore::PropertyWrapperAcceleratedBackdropFilter::PropertyWrapperAcceleratedBackdropFilter): Deleted.
167         (WebCore::PropertyWrapperAcceleratedBackdropFilter::animationIsAccelerated const): Deleted.
168         (WebCore::PropertyWrapperAcceleratedBackdropFilter::blend const): Deleted.
169         * page/animation/ImplicitAnimation.cpp:
170         (WebCore::ImplicitAnimation::reset):
171         (WebCore::ImplicitAnimation::checkForMatchingColorFilterFunctionLists):
172         * page/animation/ImplicitAnimation.h:
173         * page/animation/KeyframeAnimation.cpp:
174         (WebCore::KeyframeAnimation::KeyframeAnimation):
175         (WebCore::KeyframeAnimation::checkForMatchingColorFilterFunctionLists):
176         * page/animation/KeyframeAnimation.h:
177
178 2018-04-27  Zalan Bujtas  <zalan@apple.com>
179
180         [LFC] Add FormattingContext::computeWidth/computeHeight logic.
181         https://bugs.webkit.org/show_bug.cgi?id=185091
182
183         Reviewed by Antti Koivisto.
184
185         Inflow width and height can't really be computed without knowing the exact context. 
186
187         * layout/FormattingContext.cpp:
188         (WebCore::Layout::FormattingContext::computeWidth const):
189         (WebCore::Layout::FormattingContext::computeHeight const):
190         (WebCore::Layout::FormattingContext::computeOutOfFlowWidth const):
191         (WebCore::Layout::FormattingContext::computeFloatingWidth const):
192         (WebCore::Layout::FormattingContext::computeOutOfFlowHeight const):
193         (WebCore::Layout::FormattingContext::computeFloatingHeight const):
194         * layout/FormattingContext.h:
195         * layout/blockformatting/BlockFormattingContext.cpp:
196         (WebCore::Layout::BlockFormattingContext::computeInFlowWidth const):
197         (WebCore::Layout::BlockFormattingContext::computeInFlowHeight const):
198         (WebCore::Layout::BlockFormattingContext::computeWidth const): Deleted.
199         (WebCore::Layout::BlockFormattingContext::computeHeight const): Deleted.
200         * layout/blockformatting/BlockFormattingContext.h:
201         * layout/inlineformatting/InlineFormattingContext.cpp:
202         (WebCore::Layout::InlineFormattingContext::computeInFlowWidth const):
203         (WebCore::Layout::InlineFormattingContext::computeInFlowHeight const):
204         * layout/inlineformatting/InlineFormattingContext.h:
205
206 2018-04-27  Chris Dumez  <cdumez@apple.com>
207
208         Use WindowProxy instead of DOMWindow in our IDL
209         https://bugs.webkit.org/show_bug.cgi?id=185022
210
211         Reviewed by Sam Weinig.
212
213         Stop using DOMWindow in all of our IDL files and use WindowProxy as
214         per their respective specifications. As a result, the implementation
215         as also updated to use WindowProxy type instead of DOMWindow.
216
217         * WebCore.xcodeproj/project.pbxproj:
218         * bindings/js/JSDOMConvertWindowProxy.h: Removed.
219         * bindings/js/JSWindowProxy.cpp:
220         (WebCore::JSWindowProxy::windowProxy const):
221         (WebCore::JSWindowProxy::toWrapped):
222         * bindings/js/JSWindowProxy.h:
223         (WebCore::window):
224         Use static_cast<>() instead of jsCast<>() because jsCast<>()
225         relies on classInfo() which is not allowed to be called during
226         JS sweep due to an assertion inside classInfo(). The JSWindowProxy
227         objects are held strongly by the WindowProxy so we know the JSWindowProxy
228         object is not getting destroyed here.
229
230         (WebCore::toJS):
231         * bindings/js/WindowProxy.cpp:
232         (WebCore::WindowProxy::globalObject):
233         * bindings/js/WindowProxy.h:
234         (WebCore::WindowProxy::frame const):
235         * bindings/scripts/CodeGenerator.pm:
236         (IsBuiltinType):
237         (ComputeIsCallbackInterface):
238         (ComputeIsCallbackFunction):
239         * bindings/scripts/CodeGeneratorJS.pm:
240         (AddToIncludesForIDLType):
241         (GetBaseIDLType):
242         (NativeToJSValueDOMConvertNeedsState):
243         * bindings/scripts/test/JS/JSTestObj.cpp:
244         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod9Body):
245         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodOverloadDispatcher):
246         * bindings/scripts/test/TestObj.idl:
247         * dom/CompositionEvent.cpp:
248         (WebCore::CompositionEvent::CompositionEvent):
249         (WebCore::CompositionEvent::initCompositionEvent):
250         * dom/CompositionEvent.h:
251         * dom/CompositionEvent.idl:
252         * dom/Document.cpp:
253         (WebCore::Document::defaultView const):
254         * dom/Document.h:
255         * dom/Document.idl:
256         * dom/DocumentTouch.cpp:
257         (WebCore::DocumentTouch::createTouch):
258         * dom/DocumentTouch.h:
259         * dom/DocumentTouch.idl:
260         * dom/FocusEvent.cpp:
261         (WebCore::FocusEvent::FocusEvent):
262         * dom/FocusEvent.h:
263         * dom/InputEvent.cpp:
264         (WebCore::InputEvent::create):
265         (WebCore::InputEvent::InputEvent):
266         * dom/InputEvent.h:
267         * dom/KeyboardEvent.cpp:
268         (WebCore::KeyboardEvent::KeyboardEvent):
269         (WebCore::KeyboardEvent::create):
270         (WebCore::KeyboardEvent::initKeyboardEvent):
271         (WebCore::KeyboardEvent::charCode const):
272         * dom/KeyboardEvent.h:
273         * dom/KeyboardEvent.idl:
274         * dom/MessageEvent.h:
275         * dom/MessageEvent.idl:
276         * dom/MouseEvent.cpp:
277         (WebCore::MouseEvent::create):
278         (WebCore::MouseEvent::MouseEvent):
279         (WebCore::MouseEvent::initMouseEvent):
280         (WebCore::MouseEvent::initMouseEventQuirk):
281         * dom/MouseEvent.h:
282         * dom/MouseEvent.idl:
283         * dom/MouseRelatedEvent.cpp:
284         (WebCore::MouseRelatedEvent::MouseRelatedEvent):
285         (WebCore::MouseRelatedEvent::init):
286         (WebCore::MouseRelatedEvent::frameViewFromWindowProxy):
287         (WebCore::MouseRelatedEvent::initCoordinates):
288         (WebCore::MouseRelatedEvent::documentToAbsoluteScaleFactor const):
289         (WebCore::MouseRelatedEvent::computePageLocation):
290         (WebCore::MouseRelatedEvent::locationInRootViewCoordinates const):
291         * dom/MouseRelatedEvent.h:
292         * dom/Node.cpp:
293         * dom/SimulatedClick.cpp:
294         * dom/TextEvent.cpp:
295         (WebCore::TextEvent::create):
296         (WebCore::TextEvent::createForPlainTextPaste):
297         (WebCore::TextEvent::createForFragmentPaste):
298         (WebCore::TextEvent::createForDrop):
299         (WebCore::TextEvent::createForDictation):
300         (WebCore::TextEvent::TextEvent):
301         (WebCore::TextEvent::initTextEvent):
302         * dom/TextEvent.h:
303         * dom/TextEvent.idl:
304         * dom/TouchEvent.idl:
305         * dom/UIEvent.cpp:
306         (WebCore::UIEvent::UIEvent):
307         (WebCore::UIEvent::initUIEvent):
308         * dom/UIEvent.h:
309         (WebCore::UIEvent::create):
310         (WebCore::UIEvent::view const):
311         * dom/UIEvent.idl:
312         * dom/UIEventInit.h:
313         * dom/UIEventInit.idl:
314         * dom/UIEventWithKeyState.h:
315         (WebCore::UIEventWithKeyState::UIEventWithKeyState):
316         * dom/WheelEvent.cpp:
317         (WebCore::WheelEvent::WheelEvent):
318         (WebCore::WheelEvent::create):
319         (WebCore::WheelEvent::initWebKitWheelEvent):
320         * dom/WheelEvent.h:
321         * dom/WheelEvent.idl:
322         * editing/AlternativeTextController.cpp:
323         (WebCore::AlternativeTextController::insertDictatedText):
324         * editing/Editor.cpp:
325         (WebCore::Editor::pasteAsPlainText):
326         (WebCore::Editor::pasteAsFragment):
327         (WebCore::Editor::setComposition):
328         * html/HTMLDocument.cpp:
329         (WebCore::HTMLDocument::namedItem):
330         * html/HTMLDocument.h:
331         * html/HTMLDocument.idl:
332         * html/HTMLFrameElement.idl:
333         * html/HTMLFrameOwnerElement.cpp:
334         (WebCore::HTMLFrameOwnerElement::contentWindow const):
335         * html/HTMLFrameOwnerElement.h:
336         * html/HTMLFrameSetElement.cpp:
337         (WebCore::HTMLFrameSetElement::namedItem):
338         * html/HTMLFrameSetElement.h:
339         * html/HTMLFrameSetElement.idl:
340         * html/HTMLIFrameElement.idl:
341         * html/ImageDocument.cpp:
342         * page/DOMWindow.cpp:
343         (WebCore::PostMessageTimer::PostMessageTimer):
344         (WebCore::PostMessageTimer::event):
345         (WebCore::DOMWindow::postMessage):
346         * page/DragController.cpp:
347         (WebCore::DragController::dispatchTextInputEventFor):
348         * page/EventHandler.cpp:
349         (WebCore::EventHandler::handleTextInputEvent):
350
351 2018-04-27  Nan Wang  <n_wang@apple.com>
352
353         AX: Accessibility needs to know which part of the content view is visible on iOS
354         https://bugs.webkit.org/show_bug.cgi?id=185085
355         <rdar://problem/39801363>
356
357         Reviewed by Chris Fleizach.
358
359         Exposed unobscuredContentRect() to iOS accessibility object wrapper.
360
361         Test: accessibility/ios-simulator/unobscured-content-rect.html
362
363         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
364         (-[WebAccessibilityObjectWrapper accessibilityVisibleContentRect]):
365
366 2018-04-27  Simon Fraser  <simon.fraser@apple.com>
367
368         Refactor filter list checking code
369         https://bugs.webkit.org/show_bug.cgi?id=185087
370
371         Reviewed by Alan Bujtas.
372
373         Deduplicate code between filter and backdrop-filter for checking whether function lists
374         match, by making a shared function that takes a std::function.
375         
376         The call sites have to declare the return type (-> const FilterOperations&) to avoid std::function
377         converting the return type into a value.
378
379         * animation/KeyframeEffectReadOnly.cpp:
380         (WebCore::KeyframeEffectReadOnly::checkForMatchingFilterFunctionLists const):
381         (WebCore::KeyframeEffectReadOnly::checkForMatchingFilterFunctionLists):
382         (WebCore::KeyframeEffectReadOnly::checkForMatchingBackdropFilterFunctionLists):
383         * animation/KeyframeEffectReadOnly.h:
384         * page/animation/KeyframeAnimation.cpp:
385         (WebCore::KeyframeAnimation::checkForMatchingFilterFunctionLists const):
386         (WebCore::KeyframeAnimation::checkForMatchingFilterFunctionLists):
387         (WebCore::KeyframeAnimation::checkForMatchingBackdropFilterFunctionLists):
388         * page/animation/KeyframeAnimation.h:
389
390 2018-04-27  Chris Dumez  <cdumez@apple.com>
391
392         Regression(r222392?): Events can have a negative timestamp which causes app breakage
393         https://bugs.webkit.org/show_bug.cgi?id=185040
394         <rdar://problem/39638051>
395
396         Reviewed by Wenson Hsieh.
397
398         The real fix is in UIKit when generating the touch timestamps. However, this patch
399         does some hardening to make sure that Event.timestamp can never return a negative
400         value even if something goes wrong.
401
402         * dom/Event.cpp:
403         (WebCore::Event::timeStampForBindings const):
404
405 2018-04-27  Christopher Reid  <chris.reid@sony.com>
406
407         URL::appendEncodedHostName is using the deprecated uidna_IDNToASCII function
408         https://bugs.webkit.org/show_bug.cgi?id=184836
409
410         Reviewed by Alex Christensen.
411
412         Update URL::appendEncodedHostName to use uidna_nameToASCII as done in r208902.
413
414         Test: LayoutTests\fast\url\url-hostname-encoding.html
415
416         * platform/URL.cpp:
417
418 2018-04-27  Youenn Fablet  <youenn@apple.com>
419
420         CachedRawResource is not handling incremental data computation correctly
421         https://bugs.webkit.org/show_bug.cgi?id=184936
422         <rdar://problem/38798141>
423
424         Reviewed by Darin Adler.
425
426         * loader/cache/CachedRawResource.cpp:
427         (WebCore::CachedRawResource::updateBuffer): Fixing style.
428
429 2018-04-27  Zalan Bujtas  <zalan@apple.com>
430
431         [LFC] Implement BlockFormattingContext::layout logic and its dependencies
432         https://bugs.webkit.org/show_bug.cgi?id=185024
433
434         Reviewed by Antti Koivisto.
435
436         This patch implements the logic for block formatting context according to
437         https://www.w3.org/TR/CSS22/visuren.html#block-formatting
438
439         1. Traverse the tree iteratively (in post-order fashion) and compute the width/static position for the containers as
440         we visit the descendant nodes until we hit a leaf node.
441         2. Compute the position/geometry of the leaf node and move over to its sibling(s).
442         3. Finalize the container's height/final position as we climb back on the tree.
443         4. Run layout on the out-of-flow descendants.  
444
445         Note that subtrees with a formatting context root need to be laid out completely before moving on to the next box.
446         The formatting root box is laid out in the formatting context it lives in, however its descendants get laid out
447         in a separate formatting context (excluding out-of-flow boxes that don't belong to the root). 
448
449         * layout/FloatingContext.cpp:
450         (WebCore::Layout::FloatingContext::FloatingContext):
451         (WebCore::Layout::FloatingContext::computePosition):
452         * layout/FormattingContext.cpp:
453         (WebCore::Layout::FormattingContext::placeInFlowPositionedChildren const):
454         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
455         * layout/FormattingContext.h:
456         * layout/LayoutContext.cpp:
457         (WebCore::Layout::LayoutContext::updateLayout):
458         (WebCore::Layout::LayoutContext::establishedFormattingState):
459         * layout/LayoutContext.h:
460         * layout/blockformatting/BlockFormattingContext.cpp:
461         (WebCore::Layout::BlockFormattingContext::layout const):
462         (WebCore::Layout::BlockFormattingContext::layout): Deleted.
463         * layout/blockformatting/BlockFormattingContext.h:
464         * layout/inlineformatting/InlineFormattingContext.cpp:
465         (WebCore::Layout::InlineFormattingContext::layout const):
466         (WebCore::Layout::InlineFormattingContext::layout): Deleted.
467         * layout/inlineformatting/InlineFormattingContext.h:
468
469 2018-04-27  Youenn Fablet  <youenn@apple.com>
470
471         Use NetworkLoadChecker for XHR/fetch loads
472         https://bugs.webkit.org/show_bug.cgi?id=184741
473
474         Reviewed by Chris Dumez.
475
476         Covered by existing tests.
477
478         * loader/DocumentThreadableLoader.cpp:
479         (WebCore::DocumentThreadableLoader::shouldSetHTTPHeadersToKeep const):
480         We need to set this option for CORS done in NetworkProcess.
481         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
482         Set httpHeadersTokeep when needed (service worker or CORS loads).
483         Remove the synchronous disabling of preflight since this is now also done for asynchronous loads.
484         (WebCore::DocumentThreadableLoader::checkURLSchemeAsCORSEnabled):
485         Helper routine to make the same check for both simple and preflight case.
486         This allows more consistent error logging between WK1 and WK2.
487         (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest):
488         Skip preflight in case this is done in NetworkProcess.
489         (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest):
490         (WebCore::isResponseComingFromNetworkProcess):
491         (WebCore::DocumentThreadableLoader::redirectReceived):
492         Bypass security checks when they are already done in NetworkProcess.
493         (WebCore::DocumentThreadableLoader::didFail):
494         In case of AccessControl error, it might be due to a CSP check done in NetworkProcess.
495         Check it again to enable specific CSP console logging and error reporting.
496         (WebCore::DocumentThreadableLoader::loadRequest):
497         Recreating the error in case of synchronous loads to be able to log it adequately.
498         (WebCore::DocumentThreadableLoader::isDoingSecurityChecksInNetworkProcess const):
499         * loader/DocumentThreadableLoader.h:
500         * loader/SubresourceLoader.cpp:
501         (WebCore::SubresourceLoader::checkResponseCrossOriginAccessControl):
502         Specific handling of SameOrigin credential mode for which cross-origin load will not use any credential.
503         (WebCore::SubresourceLoader::checkRedirectionCrossOriginAccessControl):
504         We keep the application headers so that DocumentThreadableLoader does not have to restart a brand new load.
505         * loader/cache/CachedResourceLoader.cpp:
506         (WebCore::CachedResourceLoader::requestResource):
507         DocumentThreadableLoader is setting referrer and origin directly. Until we fix that, we remove them from the original requests
508         as applications are not supposed to set these headers.
509
510 2018-04-27  Wenson Hsieh  <wenson_hsieh@apple.com>
511
512         Add an experimental feature flag for viewport "min-device-width"
513         https://bugs.webkit.org/show_bug.cgi?id=185050
514         <rdar://problem/39624038>
515
516         Reviewed by Tim Horton.
517
518         Add MinDeviceWidthEnabled as a new runtime-enabled feature.
519
520         * dom/ViewportArguments.cpp:
521         (WebCore::setViewportFeature):
522
523         Gate the parsing of "min-device-width" on the runtime-enabled feature being flipped on.
524
525         * page/RuntimeEnabledFeatures.h:
526         (WebCore::RuntimeEnabledFeatures::setMinDeviceWidthEnabled):
527         (WebCore::RuntimeEnabledFeatures::minDeviceWidthEnabled const):
528
529 2018-04-27  Simon Fraser  <simon.fraser@apple.com>
530
531         Make color-filter transform gradient colors
532         https://bugs.webkit.org/show_bug.cgi?id=185080
533
534         Reviewed by Zalan Bujtas.
535         
536         In CSSGradientValue::computeStops(), transform the color of each gradient color
537         stop through the color filter. Having a color filter makes the gradient uncacheable.
538         
539         Color filters can add alpha, so we also have to fix up CSSGradientValue::knownToBeOpaque()
540         to take a RenderStyle and convert the colors before testing opaqueness. Clean up some related
541         functions to take const RenderStyle&.
542
543         Test: css3/color-filters/color-filter-gradients.html
544
545         * css/CSSCrossfadeValue.cpp:
546         (WebCore::subimageKnownToBeOpaque):
547         * css/CSSFilterImageValue.cpp:
548         (WebCore::CSSFilterImageValue::knownToBeOpaque const):
549         * css/CSSFilterImageValue.h:
550         * css/CSSGradientValue.cpp:
551         (WebCore::CSSGradientValue::image):
552         (WebCore::CSSGradientValue::computeStops):
553         (WebCore::CSSGradientValue::knownToBeOpaque const):
554         (WebCore::CSSLinearGradientValue::createGradient):
555         (WebCore::CSSRadialGradientValue::createGradient):
556         * css/CSSGradientValue.h:
557         * css/CSSImageGeneratorValue.cpp:
558         (WebCore::CSSImageGeneratorValue::knownToBeOpaque const):
559         * css/CSSImageValue.cpp:
560         (WebCore::CSSImageValue::knownToBeOpaque const):
561         * css/CSSImageValue.h:
562
563 2018-04-26  Simon Fraser  <simon.fraser@apple.com>
564
565         Fix color-filter to apply to text decorations
566         https://bugs.webkit.org/show_bug.cgi?id=185068
567         <rdar://problem/39782136>
568
569         Reviewed by Alan Bujtas.
570         
571         Transform the colors of text shadows, and the shadows of text-decorations through
572         the color-filter.
573         
574         Rather than clone the ShadowData stored on TextPainter and TextDecorationPainter
575         (which would have awkward ownership implications) we pass the color filters through
576         and just map the color through it before painting.
577         
578         Re-order the members of TextPainter a little to optimize padding.
579         
580         Also fix a bug where FilterOperations::transformColor() could transform an invalid
581         color to a valid one; we never want this.
582
583         Tests: css3/color-filters/color-filter-text-decoration-shadow.html
584                css3/color-filters/color-filter-text-shadow.html
585
586         * platform/graphics/filters/FilterOperations.cpp:
587         (WebCore::FilterOperations::transformColor const):
588         * rendering/InlineTextBox.cpp:
589         (WebCore::InlineTextBox::paintMarkedTextForeground):
590         (WebCore::InlineTextBox::paintMarkedTextDecoration):
591         * rendering/TextDecorationPainter.cpp:
592         (WebCore::TextDecorationPainter::paintTextDecoration):
593         * rendering/TextDecorationPainter.h:
594         (WebCore::TextDecorationPainter::setTextShadow):
595         (WebCore::TextDecorationPainter::setShadowColorFilter):
596         (WebCore::TextDecorationPainter::addTextShadow): Deleted.
597         * rendering/TextPainter.cpp:
598         (WebCore::ShadowApplier::ShadowApplier):
599         (WebCore::TextPainter::paintTextWithShadows):
600         (WebCore::TextPainter::paintTextAndEmphasisMarksIfNeeded): Simplify the logic that only paints the shadow
601         on the first iteration.
602         (WebCore::TextPainter::paintRange):
603         * rendering/TextPainter.h:
604         (WebCore::TextPainter::setShadowColorFilter):
605         * rendering/svg/SVGInlineTextBox.cpp:
606         (WebCore::SVGInlineTextBox::paintTextWithShadows):
607
608 2018-04-27  Wenson Hsieh  <wenson_hsieh@apple.com>
609
610         Rename minimumLayoutSize to viewLayoutSize
611         https://bugs.webkit.org/show_bug.cgi?id=185050
612         <rdar://problem/39624038>
613
614         Reviewed by Tim Horton.
615
616         See WebKit/ChangeLog for more information. No change in behavior.
617
618         * page/ViewportConfiguration.cpp:
619         (WebCore::ViewportConfiguration::ViewportConfiguration):
620         (WebCore::ViewportConfiguration::setViewLayoutSize):
621
622         Remove a FIXME comment that is addressed by this refactoring.
623
624         (WebCore::ViewportConfiguration::shouldOverrideDeviceWidthWithMinDeviceWidth const):
625         (WebCore::ViewportConfiguration::initialScaleFromSize const):
626         (WebCore::ViewportConfiguration::minimumScale const):
627         (WebCore::ViewportConfiguration::updateMinimumLayoutSize):
628         (WebCore::ViewportConfiguration::setMinimumLayoutSize): Deleted.
629         * page/ViewportConfiguration.h:
630         (WebCore::ViewportConfiguration::viewLayoutSize const):
631         (WebCore::ViewportConfiguration::viewSize const): Deleted.
632
633 2018-04-27  Zalan Bujtas  <zalan@apple.com>
634
635         [LFC] Formatting contexts should create floating states.
636         https://bugs.webkit.org/show_bug.cgi?id=185032
637
638         Reviewed by Antti Koivisto.
639
640         This patch implements the logic for sharing floating states across multiple formatting contexts.
641         At this point this is mostly about inline formatting contexts. They either create a new floating state
642         or inherit it from the parent formatting context.
643
644         * layout/FloatingState.cpp:
645         (WebCore::Layout::FloatingState::FloatingState):
646         * layout/FloatingState.h:
647         (WebCore::Layout::FloatingState::create):
648         * layout/FormattingContext.cpp:
649         (WebCore::Layout::FormattingContext::FormattingContext):
650         * layout/FormattingContext.h:
651         (WebCore::Layout::FormattingContext::layoutContext const):
652         * layout/FormattingState.cpp:
653         (WebCore::Layout::FormattingState::FormattingState):
654         * layout/FormattingState.h:
655         (WebCore::Layout::FormattingState::floatingState const):
656         * layout/LayoutContext.cpp:
657         (WebCore::Layout::LayoutContext::updateLayout):
658         (WebCore::Layout::LayoutContext::formattingStateForBox const):
659         (WebCore::Layout::LayoutContext::establishedFormattingState):
660         (WebCore::Layout::LayoutContext::formattingContext):
661         (WebCore::Layout::LayoutContext::formattingState): Deleted.
662         * layout/LayoutContext.h:
663         * layout/blockformatting/BlockFormattingContext.cpp:
664         (WebCore::Layout::BlockFormattingContext::BlockFormattingContext):
665         (WebCore::Layout::BlockFormattingContext::createFormattingState const):
666         (WebCore::Layout::BlockFormattingContext::createOrFindFloatingState const):
667         (WebCore::Layout::BlockFormattingContext::formattingState const): Deleted.
668         * layout/blockformatting/BlockFormattingContext.h:
669         * layout/blockformatting/BlockFormattingState.cpp:
670         (WebCore::Layout::BlockFormattingState::BlockFormattingState):
671         * layout/blockformatting/BlockFormattingState.h:
672         * layout/inlineformatting/InlineFormattingContext.cpp:
673         (WebCore::Layout::InlineFormattingContext::InlineFormattingContext):
674         (WebCore::Layout::InlineFormattingContext::createFormattingState const):
675         (WebCore::Layout::InlineFormattingContext::createOrFindFloatingState const):
676         (WebCore::Layout::InlineFormattingContext::formattingState const): Deleted.
677         * layout/inlineformatting/InlineFormattingContext.h:
678         * layout/inlineformatting/InlineFormattingState.cpp:
679         (WebCore::Layout::InlineFormattingState::InlineFormattingState):
680         * layout/inlineformatting/InlineFormattingState.h:
681         * layout/layouttree/LayoutBox.cpp:
682         (WebCore::Layout::Box::formattingContextRoot const):
683         * layout/layouttree/LayoutBox.h:
684
685 2018-04-27  Wenson Hsieh  <wenson_hsieh@apple.com>
686
687         [Extra zoom mode] Add a mechanism to override default viewport behaviors in extra zoom mode
688         https://bugs.webkit.org/show_bug.cgi?id=185050
689         <rdar://problem/39624038>
690
691         Reviewed by Tim Horton.
692
693         Currently, in extra zoom mode, there's no way for web pages to opt out of the default viewport behaviors
694         (namely, laying out at a larger width and shrinking to fit) when the web view is very tall and narrow. This
695         patch adds a new experimental viewport attribute, "min-device-width", that can be used to prevent WebKit from
696         automatically clamping the web view width to a greater value for the device width in this scenario.
697
698         Note that after this patch, logic that plumbs a minimumLayoutSize from WKWebView to the viewport configuration
699         will need to be renamed to reflect that this size is no longer the minimum layout size, but rather, the view
700         size that is used for viewport device dimensions by default. This refactoring will be done in a followup part.
701
702         See per-method comments below for more detail.
703
704         Test: fast/viewport/extrazoom/viewport-change-min-device-width.html
705
706         * dom/ViewportArguments.cpp:
707         (WebCore::setViewportFeature):
708         (WebCore::operator<<):
709         * dom/ViewportArguments.h:
710
711         Removes `m_forceHorizontalShrinkToFit` (more detail below).
712
713         * page/ViewportConfiguration.cpp:
714         (WebCore::computedMinDeviceWidth):
715         (WebCore::ViewportConfiguration::ViewportConfiguration):
716         (WebCore::ViewportConfiguration::setMinimumLayoutSize):
717
718         Instead of directly setting the minimum layout size, setMinimumLayoutSize now first sets the view size (i.e. the
719         size we use for `device-width` in the viewport meta tag), and then updates the minimum layout size.
720
721         (WebCore::ViewportConfiguration::shouldOverrideDeviceWidthWithMinDeviceWidth const):
722
723         Replaces `m_forceHorizontalShrinkToFit`. Whether or not we shrink to fit is now determined by whether the
724         min-device-width attribute is actively clamping the width of the view.
725
726         (WebCore::ViewportConfiguration::shouldIgnoreHorizontalScalingConstraints const):
727         (WebCore::ViewportConfiguration::shouldIgnoreScalingConstraintsRegardlessOfContentSize const):
728         (WebCore::ViewportConfiguration::updateMinimumLayoutSize):
729
730         Computes and sets the minimum layout size using the view size, taking the minimum device width into account if
731         needed.
732
733         (WebCore::ViewportConfiguration::description const):
734         (WebCore::ViewportConfiguration::setForceHorizontalShrinkToFit): Deleted.
735         * page/ViewportConfiguration.h:
736
737 2018-04-27  Zalan Bujtas  <zalan@apple.com>
738
739         [LFC] Formatting contexts should take const Box&
740         https://bugs.webkit.org/show_bug.cgi?id=185031
741
742         Reviewed by Sam Weinig.
743
744         The formatting root boxes are supposed to be all const. The only reason why
745         they are not is because WeakPtr<> does not support const objects yet.
746         Use const_cast instead (remove it when WeakPtr<> gains const support).
747
748         * layout/FormattingContext.cpp:
749         (WebCore::Layout::FormattingContext::FormattingContext):
750         * layout/FormattingContext.h:
751         * layout/LayoutContext.cpp:
752         (WebCore::Layout::LayoutContext::LayoutContext):
753         (WebCore::Layout::LayoutContext::formattingContext):
754         * layout/LayoutContext.h:
755         * layout/blockformatting/BlockFormattingContext.cpp:
756         (WebCore::Layout::BlockFormattingContext::BlockFormattingContext):
757         * layout/blockformatting/BlockFormattingContext.h:
758         * layout/inlineformatting/InlineFormattingContext.cpp:
759         (WebCore::Layout::InlineFormattingContext::InlineFormattingContext):
760         * layout/inlineformatting/InlineFormattingContext.h:
761
762 2018-04-27  Zalan Bujtas  <zalan@apple.com>
763
764         [LFC] Add layout tree iterators.
765         https://bugs.webkit.org/show_bug.cgi?id=185058
766
767         Reviewed by Antti Koivisto.
768
769         They work exactly like the renderer tree iterators.
770
771         * WebCore.xcodeproj/project.pbxproj:
772         * layout/layouttree/LayoutAncestorIterator.h: Added.
773         (WebCore::Layout::LayoutAncestorIterator<T>::LayoutAncestorIterator):
774         (WebCore::Layout::LayoutAncestorIterator<T>::operator):
775         (WebCore::Layout::LayoutAncestorIteratorAdapter<T>::LayoutAncestorIteratorAdapter):
776         (WebCore::Layout::LayoutAncestorIteratorAdapter<T>::begin const):
777         (WebCore::Layout::LayoutAncestorIteratorAdapter<T>::end const):
778         (WebCore::Layout::LayoutAncestorIteratorAdapter<T>::first const):
779         (WebCore::Layout::ancestorsOfType):
780         (WebCore::Layout::lineageOfType):
781         * layout/layouttree/LayoutBox.cpp:
782         * layout/layouttree/LayoutChildIterator.h: Added.
783         (WebCore::Layout::LayoutChildtIterator<T>::LayoutChildtIterator):
784         (WebCore::Layout::LayoutChildtIterator<T>::operator):
785         (WebCore::Layout::LayoutChildtIteratorAdapter<T>::LayoutChildtIteratorAdapter):
786         (WebCore::Layout::LayoutChildtIteratorAdapter<T>::begin const):
787         (WebCore::Layout::LayoutChildtIteratorAdapter<T>::end const):
788         (WebCore::Layout::LayoutChildtIteratorAdapter<T>::first const):
789         (WebCore::Layout::LayoutChildtIteratorAdapter<T>::last const):
790         (WebCore::Layout::childrenOfType):
791         * layout/layouttree/LayoutIterator.h: Added.
792         (WebCore::Layout::isLayoutBoxOfType):
793         (WebCore::Layout::Traversal::firstChild):
794         (WebCore::Layout::Traversal::lastChild):
795         (WebCore::Layout::Traversal::nextSibling):
796         (WebCore::Layout::Traversal::previousSibling):
797         (WebCore::Layout::Traversal::findAncestorOfType):
798         (WebCore::Layout::Traversal::nextAncestorSibling):
799         (WebCore::Layout::Traversal::nextWithin):
800         (WebCore::Layout::Traversal::firstWithin):
801         (WebCore::Layout::Traversal::next):
802         (WebCore::Layout::LayoutIterator<T>::LayoutIterator):
803         (WebCore::Layout::LayoutIterator<T>::traverseNextSibling):
804         (WebCore::Layout::LayoutIterator<T>::traverseNext):
805         (WebCore::Layout::LayoutIterator<T>::traversePreviousSibling):
806         (WebCore::Layout::LayoutIterator<T>::traverseAncestor):
807         (WebCore::Layout::LayoutIterator<T>::operator const):
808         (WebCore::Layout:: const):
809         (WebCore::Layout::= const):
810
811 2018-04-27  Commit Queue  <commit-queue@webkit.org>
812
813         Unreviewed, rolling out r231089.
814         https://bugs.webkit.org/show_bug.cgi?id=185071
815
816         Broke and made crash some WPE EME tests (Requested by calvaris
817         on #webkit).
818
819         Reverted changeset:
820
821         "[EME][GStreamer] Move the decryptor from AppendPipeline to
822         PlaybackPipeline."
823         https://bugs.webkit.org/show_bug.cgi?id=181855
824         https://trac.webkit.org/changeset/231089
825
826 2018-04-27  Yacine Bandou  <yacine.bandou_ext@softathome.com>
827
828         [EME][GStreamer] Move the decryptor from AppendPipeline to PlaybackPipeline.
829         https://bugs.webkit.org/show_bug.cgi?id=181855
830
831         Reviewed by Xabier Rodriguez-Calvar.
832
833         The goal of this move is to handle the limitation of SVP (Secure Video Path) memory size.
834
835         When the decryptor is in the AppendPipeline and we use SVP, we buffer in MediaSource queue
836         the decrypted GstBuffers that are in SVP memory.
837         This behavior cause an out-of-memory error, because we are limited in SVP memory size.
838
839         By moving the decryptor in PlaybackPipeline, we avoid to buffer the decrypted GstBuffers
840         which use the SVP memory and we buffer the encrypted GstBuffers that are in system memory.
841
842         This new architecture also allows to start the buffering before obtaining the DRM license
843         and it makes easier to manage dynamic change of the license or Key.
844
845         The decryptor is auto plugged by GStreamer playbin in PlaybackPipeline.
846
847         SVP: Secure Video Path also named trusted or protected video path, it is a memory which is
848         protected by a hardware access control engine, it is not accessible to other unauthorised
849         software or hardware components.
850
851         Tests:
852             media/encrypted-media/clearKey/clearKey-cenc-audio-playback-mse.html
853             media/encrypted-media/clearKey/clearKey-cenc-video-playback-mse.html
854
855         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
856         (webkitMediaCommonEncryptionDecryptSinkEventHandler):
857         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
858         (WebCore::dumpAppendState):
859         (WebCore::AppendPipeline::AppendPipeline):
860         (WebCore::AppendPipeline::handleNeedContextSyncMessage):
861         (WebCore::AppendPipeline::handleAppsrcNeedDataReceived):
862         (WebCore::AppendPipeline::setAppendState):
863         (WebCore::AppendPipeline::parseDemuxerSrcPadCaps):
864         (WebCore::AppendPipeline::appsinkNewSample):
865         (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsinkFromAnyThread):
866         (WebCore::AppendPipeline::disconnectDemuxerSrcPadFromAppsinkFromAnyThread):
867         (WebCore::appendPipelineElementMessageCallback): Deleted.
868         (WebCore::AppendPipeline::handleElementMessage): Deleted.
869         (WebCore::AppendPipeline::dispatchPendingDecryptionStructure): Deleted.
870         (WebCore::AppendPipeline::dispatchDecryptionStructure): Deleted.
871         * platform/graphics/gstreamer/mse/AppendPipeline.h:
872         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
873         (WebCore::MediaPlayerPrivateGStreamerMSE::attemptToDecryptWithInstance):
874         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
875
876 2018-04-27  Yacine Bandou  <yacine.bandou_ext@softathome.com>
877
878         [EME][GStreamer] Add a new message "decrypt-key-needed" send from the decryptor to the application.
879         https://bugs.webkit.org/show_bug.cgi?id=181858
880
881         Reviewed by Xabier Rodriguez-Calvar.
882
883         Add a new message "decrypt-key-needed" that the decryptor can send when it doesn't have an available key.
884         This message should be handled by the application in order to dispatch or send the key to the decryptor.
885         This patch is a preparation for the patch 181855.
886         With the patch 181855, the decryptor will be in the PlaybackPipeline instead of AppendPipeline, thus we can
887         get the DRM license or key before to instantiate or load the decryptor plugin in PlaybackPipeline.
888         When the decryptor plugin is instantiated or loaded, it should able to ask the application to resend
889         the DRM license or key by using this new message "decrypt-key-needed".
890
891
892         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
893         (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
894         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
895         (WebCore::MediaPlayerPrivateGStreamerBase::dispatchCDMInstance):
896         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
897         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
898         (webkitMediaCommonEncryptionDecryptTransformInPlace):
899
900 2018-04-26  Justin Fan  <justin_fan@apple.com>
901
902         tex[Sub]Image2D slow when passing in a <canvas>, faster with ImageData.
903         https://bugs.webkit.org/show_bug.cgi?id=184843
904         <rdar://problem/34898868>
905
906         Reviewed by Simon Fraser.
907
908         On certain test pages passing 2d canvas objects to gl.texSubImage2D, we spend significant time doing an alpha unpremultiplication in FormatConverter::convert on a single thread. 
909         For now, I am introducing use of the Accelerate framework to do canvas alpha unpremultiplication, specifically for RGBA8 > RGBA8.
910         This improves this rendering path by a factor of ~4. The rest of FormatConverter could use similar improvements; filed https://bugs.webkit.org/show_bug.cgi?id=185064 for these. 
911
912         * platform/graphics/FormatConverter.cpp:
913         (WebCore::FormatConverter::convert):
914
915 2018-04-26  Simon Fraser  <simon.fraser@apple.com>
916
917         Implement rendering support for the color-filter CSS property
918         https://bugs.webkit.org/show_bug.cgi?id=185047
919         rdar://problem/39664967
920
921         Reviewed by Tim Horton.
922         
923         The color-filter property transforms CSS colors just before painting. To support this,
924         add to RenderStyle colorByApplyingColorFilter() and visitedDependentColorWithColorFilter().
925         At most calls sites that transform colors for rendering, replace calls to
926         visitedDependentColor() with visitedDependentColorWithColorFilter(). The few locations
927         that don't use visitedDependentColor() (e.g. for shadows) call colorByApplyingColorFilter().
928         
929         Color transformation is implemented via a new virtual function on FilterOperation;
930         BasicColorMatrixFilterOperation overrides this to use a new ColorMatrix class to
931         do color math, and BasicComponentTransferFilterOperation to do the equivalent of component
932         transfer operations. The math in both cases matches that for SVG filters, with the exception
933         that color components are stored as floats through multiple filters and then mapped to
934         normal 0-255 color components at the end.
935
936         Tests: css3/color-filters/color-filter-backgrounds-borders.html
937                css3/color-filters/color-filter-box-shadow.html
938                css3/color-filters/color-filter-brightness.html
939                css3/color-filters/color-filter-color-property-list-item.html
940                css3/color-filters/color-filter-color-property.html
941                css3/color-filters/color-filter-color-text-decorations.html
942                css3/color-filters/color-filter-column-rule.html
943                css3/color-filters/color-filter-contrast.html
944                css3/color-filters/color-filter-current-color.html
945                css3/color-filters/color-filter-filter-list.html
946                css3/color-filters/color-filter-grayscale.html
947                css3/color-filters/color-filter-hue-rotate.html
948                css3/color-filters/color-filter-inherits.html
949                css3/color-filters/color-filter-invert.html
950                css3/color-filters/color-filter-opacity.html
951                css3/color-filters/color-filter-outline.html
952                css3/color-filters/color-filter-saturate.html
953                css3/color-filters/color-filter-sepia.html
954                css3/color-filters/color-filter-text-emphasis.html
955
956         * html/HTMLTextFormControlElement.cpp:
957         (WebCore::HTMLTextFormControlElement::adjustInnerTextStyle const):
958         * page/FrameView.cpp:
959         (WebCore::FrameView::documentBackgroundColor const):
960         * platform/graphics/ColorUtilities.cpp:
961         (WebCore::ColorMatrix::ColorMatrix):
962         (WebCore::ColorMatrix::makeIdentity):
963         (WebCore::ColorMatrix::grayscaleMatrix):
964         (WebCore::ColorMatrix::saturationMatrix):
965         (WebCore::ColorMatrix::hueRotateMatrix):
966         (WebCore::ColorMatrix::sepiaMatrix):
967         (WebCore::ColorMatrix::transformColorComponents const):
968         * platform/graphics/ColorUtilities.h:
969         * platform/graphics/filters/FilterOperation.cpp:
970         (WebCore::BasicColorMatrixFilterOperation::transformColor const):
971         (WebCore::BasicComponentTransferFilterOperation::transformColor const):
972         * platform/graphics/filters/FilterOperation.h:
973         (WebCore::FilterOperation::transformColor const):
974         * platform/graphics/filters/FilterOperations.cpp:
975         (WebCore::FilterOperations::transformColor const):
976         * platform/graphics/filters/FilterOperations.h:
977         * rendering/BorderEdge.cpp:
978         (WebCore::BorderEdge::getBorderEdgeInfo):
979         * rendering/EllipsisBox.cpp:
980         (WebCore::EllipsisBox::paint):
981         (WebCore::EllipsisBox::paintSelection):
982         * rendering/InlineFlowBox.cpp:
983         (WebCore::InlineFlowBox::paintBoxDecorations):
984         * rendering/InlineTextBox.cpp:
985         (WebCore::InlineTextBox::paintMarkedTextForeground):
986         (WebCore::InlineTextBox::paintMarkedTextDecoration):
987         (WebCore::InlineTextBox::paintCompositionUnderline const):
988         * rendering/RenderBox.cpp:
989         (WebCore::RenderBox::paintRootBoxFillLayers):
990         (WebCore::RenderBox::paintBackground):
991         (WebCore::RenderBox::getBackgroundPaintedExtent const):
992         (WebCore::RenderBox::backgroundIsKnownToBeOpaqueInRect const):
993         (WebCore::RenderBox::backgroundHasOpaqueTopLayer const):
994         * rendering/RenderBoxModelObject.cpp:
995         (WebCore::applyBoxShadowForBackground):
996         (WebCore::RenderBoxModelObject::paintFillLayerExtended):
997         (WebCore::RenderBoxModelObject::boxShadowShouldBeAppliedToBackground const):
998         (WebCore::RenderBoxModelObject::paintBoxShadow):
999         * rendering/RenderDetailsMarker.cpp:
1000         (WebCore::RenderDetailsMarker::paint):
1001         * rendering/RenderElement.cpp:
1002         (WebCore::RenderElement::selectionColor const):
1003         (WebCore::RenderElement::selectionBackgroundColor const):
1004         (WebCore::RenderElement::paintFocusRing):
1005         (WebCore::RenderElement::paintOutline):
1006         * rendering/RenderFileUploadControl.cpp:
1007         (WebCore::RenderFileUploadControl::paintObject):
1008         * rendering/RenderFrameSet.cpp:
1009         (WebCore::RenderFrameSet::paintColumnBorder):
1010         (WebCore::RenderFrameSet::paintRowBorder):
1011         * rendering/RenderImage.cpp:
1012         (WebCore::RenderImage::paintReplaced):
1013         (WebCore::RenderImage::paintAreaElementFocusRing):
1014         * rendering/RenderInline.cpp:
1015         (WebCore::RenderInline::paintOutline):
1016         * rendering/RenderLayerBacking.cpp:
1017         (WebCore::canDirectlyCompositeBackgroundBackgroundImage):
1018         (WebCore::RenderLayerBacking::rendererBackgroundColor const):
1019         * rendering/RenderLayerCompositor.cpp:
1020         (WebCore::RenderLayerCompositor::rootOrBodyStyleChanged):
1021         * rendering/RenderListBox.cpp:
1022         (WebCore::RenderListBox::paintItemForeground):
1023         (WebCore::RenderListBox::paintItemBackground):
1024         * rendering/RenderListMarker.cpp:
1025         (WebCore::RenderListMarker::paint):
1026         * rendering/RenderMenuList.cpp:
1027         (RenderMenuList::itemStyle const):
1028         (RenderMenuList::getItemBackgroundColor const):
1029         (RenderMenuList::menuStyle const):
1030         * rendering/RenderMultiColumnSet.cpp:
1031         (WebCore::RenderMultiColumnSet::paintColumnRules):
1032         * rendering/RenderSearchField.cpp:
1033         (WebCore::RenderSearchField::menuStyle const):
1034         * rendering/RenderTable.h:
1035         (WebCore::RenderTable::bgColor const):
1036         * rendering/RenderTableCell.cpp:
1037         (WebCore::RenderTableCell::computeCollapsedStartBorder const):
1038         (WebCore::RenderTableCell::computeCollapsedEndBorder const):
1039         (WebCore::RenderTableCell::computeCollapsedBeforeBorder const):
1040         (WebCore::RenderTableCell::computeCollapsedAfterBorder const):
1041         (WebCore::RenderTableCell::paintBackgroundsBehindCell):
1042         * rendering/RenderTableSection.cpp:
1043         (WebCore::RenderTableSection::paintRowGroupBorder):
1044         * rendering/RenderTheme.cpp:
1045         (WebCore::RenderTheme::paintSliderTicks):
1046         * rendering/TextDecorationPainter.cpp:
1047         (WebCore::decorationColor):
1048         * rendering/TextPaintStyle.cpp:
1049         (WebCore::computeTextPaintStyle):
1050         * rendering/mathml/MathOperator.cpp:
1051         (WebCore::MathOperator::paint):
1052         * rendering/mathml/RenderMathMLFraction.cpp:
1053         (WebCore::RenderMathMLFraction::paint):
1054         * rendering/mathml/RenderMathMLMenclose.cpp:
1055         (WebCore::RenderMathMLMenclose::paint):
1056         * rendering/mathml/RenderMathMLRoot.cpp:
1057         (WebCore::RenderMathMLRoot::paint):
1058         * rendering/mathml/RenderMathMLToken.cpp:
1059         (WebCore::RenderMathMLToken::paint):
1060         * rendering/style/RenderStyle.cpp:
1061         (WebCore::RenderStyle::visitedDependentColorWithColorFilter const):
1062         (WebCore::RenderStyle::colorByApplyingColorFilter const):
1063         * rendering/style/RenderStyle.h:
1064
1065 2018-04-26  Mark Lam  <mark.lam@apple.com>
1066
1067         Gardening: Speculative build fix for Windows.
1068         https://bugs.webkit.org/show_bug.cgi?id=184976
1069         <rdar://problem/39723901>
1070
1071         Not reviewed.
1072
1073         * cssjit/CSSPtrTag.h:
1074
1075 2018-04-26  Brent Fulgham  <bfulgham@apple.com>
1076
1077         Show punycode if URL contains Latin small letter o with dot below character
1078         https://bugs.webkit.org/show_bug.cgi?id=185051
1079         <rdar://problem/39459297>
1080
1081         Reviewed by David Kilzer.
1082
1083         Revise our "lookalike character" logic to include the small Latin o
1084         with dot below character.
1085
1086         Test: fast/url/host.html
1087
1088         * platform/mac/WebCoreNSURLExtras.mm:
1089         (WebCore::isLookalikeCharacter):
1090
1091 2018-04-26  Daniel Bates  <dabates@apple.com>
1092
1093         Fix the build following r231068
1094         (https://bugs.webkit.org/show_bug.cgi?id=185002)
1095
1096         Substitute mainResourceRequest.resourceRequest().url() for mainResourceRequest.url() as the
1097         latter does not exist.
1098
1099         * loader/DocumentLoader.cpp:
1100         (WebCore::DocumentLoader::loadMainResource):
1101
1102 2018-04-26  Daniel Bates  <dabates@apple.com>
1103
1104         DocumentLoader::loadMainResource() should WTFMove() the passed ResourceRequest
1105         https://bugs.webkit.org/show_bug.cgi?id=185002
1106
1107         Reviewed by Youenn Fablet and Alex Christensen.
1108
1109         In r224852 we extracted logic from DocumentLoader::startLoadingMainResource() into a new
1110         function DocumentLoader::loadMainResource() that could be shared by both DocumentLoader::startLoadingMainResource()
1111         and the service worker code. As part of this extraction, DocumentLoader::loadMainResource()
1112         takes a ResourceRequest by rvalue reference, but it never actually takes ownership of this
1113         ResourceRequest and subsequently makes a copy of it when instantiating a CachedResourceRequest.
1114         Instead we should WTFMove() the passed request into the CachedResourceRequest.
1115
1116         * loader/DocumentLoader.cpp:
1117         (WebCore::DocumentLoader::loadMainResource):
1118
1119 2018-04-26  Sihui Liu  <sihui_liu@apple.com>
1120
1121         -[WKHTTPCookieStore deleteCookie:completionHandler:] doesn't delete cookies
1122         https://bugs.webkit.org/show_bug.cgi?id=184938
1123         <rdar://problem/34737395>
1124
1125         Reviewed by Geoffrey Garen.
1126
1127         When a Cookie object was converted to NSHTTPCookie object, the HTTPOnly property information
1128         was lost so the delete function cannot find the proper cookie to delete.
1129         This patch implements a workaround that compares Cookie object instead of NSHTTPCookie 
1130         object. We might want to add the ability to set HTTPOnly header during conversion if there
1131         is an easy way to do it later.
1132         
1133         New API test: WebKit.WKHTTPCookieStoreHttpOnly
1134
1135         * platform/network/cocoa/CookieCocoa.mm:
1136         (WebCore::Cookie::operator== const):
1137         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
1138         (WebCore::NetworkStorageSession::deleteCookie):
1139
1140 2018-04-26  Commit Queue  <commit-queue@webkit.org>
1141
1142         Unreviewed, rolling out r231052.
1143         https://bugs.webkit.org/show_bug.cgi?id=185044
1144
1145         Broke test http/tests/security/credentials-main-resource.html
1146         (Requested by dydz on #webkit).
1147
1148         Reverted changeset:
1149
1150         "DocumentLoader::loadMainResource() should WTFMove() the
1151         passed ResourceRequest"
1152         https://bugs.webkit.org/show_bug.cgi?id=185002
1153         https://trac.webkit.org/changeset/231052
1154
1155 2018-04-26  Jer Noble  <jer.noble@apple.com>
1156
1157         WK_COCOA_TOUCH all the things.
1158         https://bugs.webkit.org/show_bug.cgi?id=185006
1159
1160         Reviewed by Tim Horton.
1161
1162         * Configurations/WebCore.xcconfig:
1163
1164 2018-04-26  David Kilzer  <ddkilzer@apple.com>
1165
1166         Make WAKScrollView delegate a weak property
1167         <https://webkit.org/b/184799>
1168         <rdar://problem/39469669>
1169
1170         Reviewed by Simon Fraser.
1171
1172         * platform/ios/wak/WAKScrollView.h:
1173         - Remove `delegate` instance variable declaration.
1174         - Declare `delegate` property as weak.
1175         (-[WAKScrollView setDelegate:]): Delete declaration.
1176         (-[WAKScrollView delegate]): Ditto.
1177         * platform/ios/wak/WAKScrollView.mm:
1178         - Synthesize getter/setter methods for `delegate` property.
1179         (-[WAKScrollView setDelegate:]): Delete implementation.
1180         (-[WAKScrollView delegate]): Ditto.
1181
1182 2018-04-26  Youenn Fablet  <youenn@apple.com>
1183
1184         CORS preflight checker should add a console message when preflight load is blocked
1185         https://bugs.webkit.org/show_bug.cgi?id=185021
1186
1187         Reviewed by Chris Dumez.
1188
1189         No change of behavior, adding a JS console message when preflight load is blocked.
1190         This mirrors what is being done in preflighting done from NetworkProcess.
1191         Covered by existing tests.
1192
1193         * loader/CrossOriginPreflightChecker.cpp:
1194         (WebCore::CrossOriginPreflightChecker::notifyFinished):
1195         (WebCore::CrossOriginPreflightChecker::doPreflight):
1196
1197 2018-04-26  Daniel Bates  <dabates@apple.com>
1198
1199         DocumentLoader::loadMainResource() should WTFMove() the passed ResourceRequest
1200         https://bugs.webkit.org/show_bug.cgi?id=185002
1201
1202         Reviewed by Youenn Fablet and Alex Christensen.
1203
1204         In r224852 we extracted logic from DocumentLoader::startLoadingMainResource() into a new
1205         function DocumentLoader::loadMainResource() that could be shared by both DocumentLoader::startLoadingMainResource()
1206         and the service worker code. As part of this extraction, DocumentLoader::loadMainResource()
1207         takes a ResourceRequest by rvalue reference, but it never actually takes ownership of this
1208         ResourceRequest and subsequently makes a copy of it when instantiating a CachedResourceRequest.
1209         Instead we should WTFMove() the passed request into the CachedResourceRequest.
1210
1211         * loader/DocumentLoader.cpp:
1212         (WebCore::DocumentLoader::loadMainResource):
1213
1214 2018-04-26  Per Arne Vollan  <pvollan@apple.com>
1215
1216         Disable content filtering in minimal simulator mode
1217         https://bugs.webkit.org/show_bug.cgi?id=185027
1218         <rdar://problem/39736091>
1219
1220         Reviewed by Jer Noble.
1221
1222         * Configurations/FeatureDefines.xcconfig:
1223
1224 2018-04-25  Brent Fulgham  <bfulgham@apple.com>
1225
1226         Add port 548 (afpovertcp) to port blacklist
1227         https://bugs.webkit.org/show_bug.cgi?id=185000
1228         <rdar://problem/39540481>
1229
1230         Reviewed by David Kilzer.
1231
1232         Tested by security/block-test.html.
1233
1234         * platform/URL.cpp:
1235         (WebCore::portAllowed):Also block port 548.
1236
1237 2018-04-26  Andy VanWagoner  <thetalecrafter@gmail.com>
1238
1239         [INTL] Implement Intl.PluralRules
1240         https://bugs.webkit.org/show_bug.cgi?id=184312
1241
1242         Reviewed by JF Bastien.
1243
1244         Added Intl.PluralRules feature flag.
1245
1246         Test: js/intl-pluralrules.html
1247
1248         * Configurations/FeatureDefines.xcconfig:
1249
1250 2018-04-15  Darin Adler  <darin@apple.com>
1251
1252         [Cocoa] Adopt CCRSAGetCRTComponents and stop using CCBigNum
1253         https://bugs.webkit.org/show_bug.cgi?id=184637
1254
1255         Reviewed by Alexey Proskuryakov.
1256
1257         * crypto/CommonCryptoUtilities.cpp: Compile out WebCore::CCBigNum class if
1258         HAVE(CCRSAGetCRTComponents) is true.
1259
1260         * crypto/CommonCryptoUtilities.h: Define HAVE(CCRSAGetCRTComponents) on new
1261         enough versions of iOS and macOS that have it and add declarations of the
1262         function for the non-Apple-internal-SDK case. Also don't define the
1263         WebCore::CCBigNum class if HAVE(CCRSAGetCRTComponents) is true.
1264
1265         * crypto/mac/CryptoKeyRSAMac.cpp:
1266         (WebCore::getPrivateKeyComponents): Use CCRSAGetCRTComponents if present.
1267
1268 2018-04-26  Per Arne Vollan  <pvollan@apple.com>
1269
1270         Add lazy initialization of caption display mode for videos.
1271         https://bugs.webkit.org/show_bug.cgi?id=184993
1272
1273         The call to MACaptionAppearanceGetDisplayType in CaptionUserPreferencesMediaAF::captionDisplayMode()
1274         is showing up in samples when called from HTMLMediaElement::finishInitialization().
1275
1276         Reviewed by Eric Carlson.
1277
1278         No new tests, covered by existing tests.
1279
1280         * html/HTMLMediaElement.cpp:
1281         (WebCore::HTMLMediaElement::finishInitialization):
1282         (WebCore::HTMLMediaElement::setSelectedTextTrack):
1283         (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged):
1284         (WebCore::HTMLMediaElement::captionPreferencesChanged):
1285         (WebCore::HTMLMediaElement::captionDisplayMode):
1286         * html/HTMLMediaElement.h:
1287
1288 2018-04-26  Zan Dobersek  <zdobersek@igalia.com>
1289
1290         [GTK][WPE] Initial ASYNC_SCROLLING support
1291         https://bugs.webkit.org/show_bug.cgi?id=184961
1292
1293         Reviewed by Carlos Garcia Campos.
1294
1295         Add CoordinatedGraphics-specific code that will be required for async
1296         scrolling support. The ScrollingCoordinatorCoordinatedGraphics and
1297         ScrollingTreeCoordinatedGraphics classes are mostly complete already,
1298         but the new ScrollingTreeNode-inheriting classes will need further
1299         work that will have to be done in parallel with other improvements
1300         planned for the CoordinatedGraphics subsystem.
1301
1302         While the build-time flag is enabled, the feature is still not enabled
1303         at runtime due to being marked as unsupported by the DrawingArea
1304         implementation in the WebKit layer. It would also not work yet if it
1305         were enabled due to the before-mentioned pending changes.
1306
1307         Various build fixes that address non-Cocoa usage of ASYNC_SCROLLING
1308         code are included.
1309
1310         * Sources.txt: Add AsyncScrollingCoordinator.cpp to build.
1311         * SourcesCocoa.txt:
1312         * SourcesGTK.txt: Add new files to build.
1313         * SourcesWPE.txt: Ditto.
1314         * page/scrolling/AsyncScrollingCoordinator.cpp:
1315         Guard setStateScrollingNodeSnapOffsetsAsFloat() with CSS_SCROLL_SNAP.
1316         * page/scrolling/ScrollingTree.h:
1317         * page/scrolling/ThreadedScrollingTree.cpp:
1318         * page/scrolling/ThreadedScrollingTree.h:
1319         currentSnapPointIndicesDidChange() method is only invoked in
1320         Cocoa-specific code, and its implementation calls Cocoa-specific method
1321         on the AsyncScrollingCoordinator class.
1322         * page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.cpp:
1323         (WebCore::ScrollingCoordinator::create):
1324         (WebCore::ScrollingCoordinatorCoordinatedGraphics::ScrollingCoordinatorCoordinatedGraphics):
1325         (WebCore::ScrollingCoordinatorCoordinatedGraphics::~ScrollingCoordinatorCoordinatedGraphics):
1326         (WebCore::ScrollingCoordinatorCoordinatedGraphics::pageDestroyed):
1327         (WebCore::ScrollingCoordinatorCoordinatedGraphics::commitTreeStateIfNeeded):
1328         (WebCore::ScrollingCoordinatorCoordinatedGraphics::handleWheelEvent):
1329         (WebCore::ScrollingCoordinatorCoordinatedGraphics::scheduleTreeStateCommit):
1330         (WebCore::ScrollingCoordinatorCoordinatedGraphics::commitTreeState):
1331         * page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.h: Added.
1332         * page/scrolling/coordinatedgraphics/ScrollingTreeCoordinatedGraphics.cpp: Added.
1333         (WebCore::ScrollingTreeCoordinatedGraphics::create):
1334         (WebCore::ScrollingTreeCoordinatedGraphics::ScrollingTreeCoordinatedGraphics):
1335         (WebCore::ScrollingTreeCoordinatedGraphics::createScrollingTreeNode):
1336         * page/scrolling/coordinatedgraphics/ScrollingTreeCoordinatedGraphics.h: Added.
1337         * page/scrolling/coordinatedgraphics/ScrollingTreeFixedNode.cpp: Added.
1338         (WebCore::ScrollingTreeFixedNode::create):
1339         (WebCore::ScrollingTreeFixedNode::ScrollingTreeFixedNode):
1340         (WebCore::ScrollingTreeFixedNode::~ScrollingTreeFixedNode):
1341         (WebCore::ScrollingTreeFixedNode::commitStateBeforeChildren):
1342         (WebCore::ScrollingTreeFixedNode::updateLayersAfterAncestorChange):
1343         * page/scrolling/coordinatedgraphics/ScrollingTreeFixedNode.h: Added.
1344         * page/scrolling/coordinatedgraphics/ScrollingTreeFrameScrollingNodeCoordinatedGraphics.cpp: Added.
1345         (WebCore::ScrollingTreeFrameScrollingNodeCoordinatedGraphics::create):
1346         (WebCore::ScrollingTreeFrameScrollingNodeCoordinatedGraphics::ScrollingTreeFrameScrollingNodeCoordinatedGraphics):
1347         (WebCore::ScrollingTreeFrameScrollingNodeCoordinatedGraphics::handleWheelEvent):
1348         (WebCore::ScrollingTreeFrameScrollingNodeCoordinatedGraphics::scrollPosition const):
1349         (WebCore::ScrollingTreeFrameScrollingNodeCoordinatedGraphics::setScrollPosition):
1350         (WebCore::ScrollingTreeFrameScrollingNodeCoordinatedGraphics::setScrollPositionWithoutContentEdgeConstraints):
1351         (WebCore::ScrollingTreeFrameScrollingNodeCoordinatedGraphics::setScrollLayerPosition):
1352         (WebCore::ScrollingTreeFrameScrollingNodeCoordinatedGraphics::updateLayersAfterViewportChange):
1353         * page/scrolling/coordinatedgraphics/ScrollingTreeFrameScrollingNodeCoordinatedGraphics.h: Added.
1354         * page/scrolling/coordinatedgraphics/ScrollingTreeStickyNode.cpp: Added.
1355         (WebCore::ScrollingTreeStickyNode::create):
1356         (WebCore::ScrollingTreeStickyNode::ScrollingTreeStickyNode):
1357         (WebCore::ScrollingTreeStickyNode::~ScrollingTreeStickyNode):
1358         (WebCore::ScrollingTreeStickyNode::commitStateBeforeChildren):
1359         (WebCore::ScrollingTreeStickyNode::updateLayersAfterAncestorChange):
1360         * page/scrolling/coordinatedgraphics/ScrollingTreeStickyNode.h: Added.
1361         * platform/PlatformWheelEvent.h: Enable PlatformWheelEventPhase code
1362         for WPE. Guard latching-specific methods under ASYNC_SCROLLING.
1363         * platform/TextureMapper.cmake: Two build targets have been moved to
1364         SourcesGTK.txt and SourcesWPE.txt.
1365
1366 2018-04-25  Michael Catanzaro  <mcatanzaro@igalia.com>
1367
1368         [WPE] Build and link against latest WPEBackend and WPEBackend-fdo
1369         https://bugs.webkit.org/show_bug.cgi?id=184643
1370
1371         Reviewed by Žan Doberšek.
1372
1373         Adapt to single-header WPE includes.
1374
1375         * platform/graphics/egl/GLContextEGLWPE.cpp:
1376         * platform/graphics/wpe/PlatformDisplayWPE.cpp:
1377         * platform/wpe/PlatformPasteboardWPE.cpp:
1378
1379 2018-04-25  Youenn Fablet  <youenn@apple.com>
1380
1381         Use NetworkLoadChecker for all subresource loads except fetch/XHR
1382         https://bugs.webkit.org/show_bug.cgi?id=184870
1383         <rdar://problem/39370034>
1384
1385         Reviewed by Chris Dumez.
1386
1387         No change of behavior.
1388         Update CachedResourceLoader error messages to match NetworkProcess error messages.
1389
1390         * loader/cache/CachedResourceLoader.cpp:
1391         (WebCore::CachedResourceLoader::printAccessDeniedMessage const):
1392
1393 2018-04-25  Zalan Bujtas  <zalan@apple.com>
1394
1395         [LFC] Add support for is<> and downcast<>
1396         https://bugs.webkit.org/show_bug.cgi?id=185016
1397
1398         Reviewed by Antti Koivisto.
1399
1400         * layout/layouttree/LayoutBlockContainer.cpp:
1401         (WebCore::Layout::BlockContainer::BlockContainer):
1402         * layout/layouttree/LayoutBlockContainer.h:
1403         * layout/layouttree/LayoutBox.cpp:
1404         (WebCore::Layout::Box::Box):
1405         * layout/layouttree/LayoutBox.h:
1406         (WebCore::Layout::Box::isContainer const):
1407         (WebCore::Layout::Box::isBlockContainer const):
1408         (WebCore::Layout::Box::isInlineBox const):
1409         (WebCore::Layout::Box::isInlineContainer const):
1410         * layout/layouttree/LayoutContainer.cpp:
1411         (WebCore::Layout::Container::Container):
1412         * layout/layouttree/LayoutContainer.h:
1413         * layout/layouttree/LayoutInlineBox.cpp:
1414         (WebCore::Layout::InlineBox::InlineBox):
1415         * layout/layouttree/LayoutInlineBox.h:
1416         * layout/layouttree/LayoutInlineContainer.cpp:
1417         (WebCore::Layout::InlineContainer::InlineContainer):
1418         * layout/layouttree/LayoutInlineContainer.h:
1419
1420 2018-04-25  Chris Dumez  <cdumez@apple.com>
1421
1422         window.postMessage() / focus() / blur() throw a TypeError when called on a RemoteDOMWindow
1423         https://bugs.webkit.org/show_bug.cgi?id=184981
1424
1425         Reviewed by Sam Weinig.
1426
1427         window.postMessage() / focus() / blur() was throwing a TypeError when called on a RemoteDOMWindow,
1428         complaining that |this| is not a Window. This was caused by a copy & paste mistake in
1429         JSDOMWindowCustom where we were calling the JSDOMWindow methods instead of the JSRemoteDOMWindow
1430         ones.
1431
1432         No new tests, updated existing tests.
1433
1434         * bindings/js/JSDOMWindowCustom.cpp:
1435         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
1436         * page/RemoteDOMWindow.cpp:
1437         (WebCore::RemoteDOMWindow::postMessage):
1438         * page/RemoteDOMWindow.h:
1439         * page/RemoteDOMWindow.idl:
1440
1441 2018-04-25  Simon Fraser  <simon.fraser@apple.com>
1442
1443         brightness() filter should default to 1, and not allow negative values
1444         https://bugs.webkit.org/show_bug.cgi?id=184937
1445
1446         Reviewed by Dean Jackson.
1447
1448         Remove the special-casing for brightness() in consumeFilterFunction(), so it now
1449         follows the same logic as the other color-related filters in not allowing negative
1450         values.
1451
1452         Removed the special-casing for brightness() in createFilterOperations() so its default
1453         value is now 1.
1454
1455         Modified existing tests.
1456
1457         * css/StyleResolver.cpp:
1458         (WebCore::StyleResolver::createFilterOperations):
1459         * css/parser/CSSPropertyParserHelpers.cpp:
1460         (WebCore::CSSPropertyParserHelpers::allowsValuesGreaterThanOne):
1461         (WebCore::CSSPropertyParserHelpers::consumeFilterFunction):
1462
1463 2018-04-25  Wenson Hsieh  <wenson_hsieh@apple.com>
1464
1465         Missing closing parenthesis when determining INSTALL_PATH build setting in WebCore.xcconfig
1466         https://bugs.webkit.org/show_bug.cgi?id=184999
1467
1468         Reviewed by Tim Horton.
1469
1470         Tweaks a line in WebCore.xcconfig that computes INSTALL_PATH, so that it doesn't use WK_NOT or WK_EMPTY.
1471
1472         * Configurations/WebCore.xcconfig:
1473
1474 2018-04-25  Zalan Bujtas  <zalan@apple.com>
1475
1476         [LFC] Implement LayoutContexet::layout() and its dependencies.
1477         https://bugs.webkit.org/show_bug.cgi?id=184951
1478
1479         Reviewed by Antti Koivisto.
1480
1481         * layout/FormattingContext.cpp:
1482         (WebCore::Layout::FormattingContext::FormattingContext):
1483         (WebCore::Layout::FormattingContext::~FormattingContext):
1484         (WebCore::Layout::FormattingContext::computeStaticPosition):
1485         (WebCore::Layout::FormattingContext::computeInFlowPositionedPosition):
1486         (WebCore::Layout::FormattingContext::computeOutOfFlowPosition):
1487         (WebCore::Layout::FormattingContext::computeWidth):
1488         (WebCore::Layout::FormattingContext::computeHeight):
1489         (WebCore::Layout::FormattingContext::marginTop):
1490         (WebCore::Layout::FormattingContext::marginLeft):
1491         (WebCore::Layout::FormattingContext::marginBottom):
1492         (WebCore::Layout::FormattingContext::marginRight):
1493         * layout/FormattingContext.h:
1494         * layout/FormattingState.cpp:
1495         (WebCore::Layout::FormattingState::FormattingState):
1496         * layout/FormattingState.h:
1497         * layout/LayoutContext.cpp:
1498         (WebCore::Layout::LayoutContext::LayoutContext):
1499         (WebCore::Layout::LayoutContext::updateLayout):
1500         (WebCore::Layout::LayoutContext::formattingState):
1501         (WebCore::Layout::LayoutContext::formattingContext):
1502         * layout/LayoutContext.h:
1503         * layout/blockformatting/BlockFormattingContext.cpp:
1504         (WebCore::Layout::BlockFormattingContext::BlockFormattingContext):
1505         (WebCore::Layout::BlockFormattingContext::layout):
1506         (WebCore::Layout::BlockFormattingContext::formattingState const):
1507         (WebCore::Layout::BlockFormattingContext::computeStaticPosition):
1508         (WebCore::Layout::BlockFormattingContext::computeWidth):
1509         (WebCore::Layout::BlockFormattingContext::computeHeight):
1510         (WebCore::Layout::BlockFormattingContext::marginTop):
1511         (WebCore::Layout::BlockFormattingContext::marginBottom):
1512         * layout/blockformatting/BlockFormattingContext.h:
1513         * layout/blockformatting/BlockFormattingState.cpp:
1514         (WebCore::Layout::BlockFormattingState::BlockFormattingState):
1515         * layout/blockformatting/BlockFormattingState.h:
1516         * layout/inlineformatting/InlineFormattingContext.cpp:
1517         (WebCore::Layout::InlineFormattingContext::InlineFormattingContext):
1518         (WebCore::Layout::InlineFormattingContext::layout):
1519         (WebCore::Layout::InlineFormattingContext::formattingState const):
1520         * layout/inlineformatting/InlineFormattingContext.h:
1521         * layout/inlineformatting/InlineFormattingState.cpp:
1522         (WebCore::Layout::InlineFormattingState::InlineFormattingState):
1523         * layout/inlineformatting/InlineFormattingState.h:
1524
1525 2018-04-25  Mark Lam  <mark.lam@apple.com>
1526
1527         Push the definition of PtrTag down to the WTF layer.
1528         https://bugs.webkit.org/show_bug.cgi?id=184976
1529         <rdar://problem/39723901>
1530
1531         Reviewed by Saam Barati.
1532
1533         No new tests needed.  This is covered by existing tests.
1534
1535         * cssjit/CSSPtrTag.h:
1536         * cssjit/SelectorCompiler.h:
1537         (WebCore::SelectorCompiler::ruleCollectorSimpleSelectorCheckerFunction):
1538         (WebCore::SelectorCompiler::querySelectorSimpleSelectorCheckerFunction):
1539         (WebCore::SelectorCompiler::ruleCollectorSelectorCheckerFunctionWithCheckingContext):
1540         (WebCore::SelectorCompiler::querySelectorSelectorCheckerFunctionWithCheckingContext):
1541
1542 2018-04-25  Eric Carlson  <eric.carlson@apple.com>
1543
1544         [iOS] remove media element parameter from MediaElementSession methods
1545         https://bugs.webkit.org/show_bug.cgi?id=184992
1546         <rdar://problem/39731624>
1547
1548         Reviewed by Jon Lee.
1549
1550         No new tests, no behavior change.
1551
1552         * Modules/mediacontrols/MediaControlsHost.cpp:
1553         (WebCore::MediaControlsHost::allowsInlineMediaPlayback const):
1554         (WebCore::MediaControlsHost::userGestureRequired const):
1555         * accessibility/AccessibilityMediaObject.cpp:
1556         (WebCore::AccessibilityMediaObject::isPlayingInline const):
1557         * html/HTMLMediaElement.cpp:
1558         (WebCore::HTMLMediaElement::~HTMLMediaElement):
1559         (WebCore::HTMLMediaElement::parseAttribute):
1560         (WebCore::HTMLMediaElement::prepareForLoad):
1561         (WebCore::HTMLMediaElement::selectMediaResource):
1562         (WebCore::HTMLMediaElement::loadResource):
1563         (WebCore::HTMLMediaElement::canTransitionFromAutoplayToPlay const):
1564         (WebCore::HTMLMediaElement::setReadyState):
1565         (WebCore::HTMLMediaElement::play):
1566         (WebCore::HTMLMediaElement::pause):
1567         (WebCore::HTMLMediaElement::pauseInternal):
1568         (WebCore::HTMLMediaElement::setVolume):
1569         (WebCore::HTMLMediaElement::mediaPlayerDidAddAudioTrack):
1570         (WebCore::HTMLMediaElement::sourceWasAdded):
1571         (WebCore::HTMLMediaElement::mediaEngineWasUpdated):
1572         (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged):
1573         (WebCore::HTMLMediaElement::updatePlayState):
1574         (WebCore::HTMLMediaElement::clearMediaPlayer):
1575         (WebCore::HTMLMediaElement::resume):
1576         (WebCore::HTMLMediaElement::webkitShowPlaybackTargetPicker):
1577         (WebCore::HTMLMediaElement::addEventListener):
1578         (WebCore::HTMLMediaElement::removeEventListener):
1579         (WebCore::HTMLMediaElement::enqueuePlaybackTargetAvailabilityChangedEvent):
1580         (WebCore::HTMLMediaElement::exitFullscreen):
1581         (WebCore::HTMLMediaElement::configureMediaControls):
1582         (WebCore::HTMLMediaElement::createMediaPlayer):
1583         (WebCore::HTMLMediaElement::mediaPlayerIsFullscreenPermitted const):
1584         (WebCore::HTMLMediaElement::updateMediaState):
1585         (WebCore::HTMLMediaElement::mediaState const):
1586         (WebCore::HTMLMediaElement::allowsMediaDocumentInlinePlaybackChanged):
1587         (WebCore::HTMLMediaElement::updateShouldPlay):
1588         * html/HTMLVideoElement.cpp:
1589         (WebCore::HTMLVideoElement::parseAttribute):
1590         (WebCore::HTMLVideoElement::supportsFullscreen const):
1591         (WebCore::HTMLVideoElement::webkitEnterFullscreen):
1592         (WebCore::HTMLVideoElement::webkitWirelessVideoPlaybackDisabled const):
1593         (WebCore::HTMLVideoElement::webkitSupportsPresentationMode const):
1594         (WebCore::HTMLVideoElement::setFullscreenMode):
1595         * html/MediaElementSession.cpp:
1596         (WebCore::MediaElementSession::playbackPermitted const):
1597         (WebCore::MediaElementSession::dataLoadingPermitted const):
1598         (WebCore::MediaElementSession::fullscreenPermitted const):
1599         (WebCore::MediaElementSession::pageAllowsDataLoading const):
1600         (WebCore::MediaElementSession::pageAllowsPlaybackAfterResuming const):
1601         (WebCore::MediaElementSession::canShowControlsManager const):
1602         (WebCore::MediaElementSession::showPlaybackTargetPicker):
1603         (WebCore::MediaElementSession::hasWirelessPlaybackTargets const):
1604         (WebCore::MediaElementSession::wirelessVideoPlaybackDisabled const):
1605         (WebCore::MediaElementSession::setWirelessVideoPlaybackDisabled):
1606         (WebCore::MediaElementSession::setHasPlaybackTargetAvailabilityListeners):
1607         (WebCore::MediaElementSession::mediaStateDidChange):
1608         (WebCore::MediaElementSession::effectivePreloadForElement const):
1609         (WebCore::MediaElementSession::requiresFullscreenForVideoPlayback const):
1610         (WebCore::MediaElementSession::allowsAutomaticMediaDataLoading const):
1611         (WebCore::MediaElementSession::mediaEngineUpdated):
1612         (WebCore::MediaElementSession::allowsPictureInPicture const):
1613         * html/MediaElementSession.h:
1614         * platform/cocoa/PlaybackSessionModelMediaElement.mm:
1615         (WebCore::PlaybackSessionModelMediaElement::wirelessVideoPlaybackDisabled const):
1616
1617 2018-04-25  Jiewen Tan  <jiewen_tan@apple.com>
1618
1619         Remove access to keychain from the WebContent process
1620         https://bugs.webkit.org/show_bug.cgi?id=184428
1621         <rdar://problem/13150903>
1622
1623         Reviewed by Brent Fulgham.
1624
1625         Part 2.
1626
1627         This patch move the operation of HTMLKeygenElement from WebContent Process to UI Process.
1628         Function signedPublicKeyAndChallengeString is therefore marked as WEBCORE_EXPORT. Also, a
1629         localized string is marked WEBCORE_EXPORT as well to support the API test.
1630
1631         Covered by existing tests and api tests.
1632
1633         * WebCore.xcodeproj/project.pbxproj:
1634         * dom/Document.cpp:
1635         (WebCore::Document::signedPublicKeyAndChallengeString):
1636         * dom/Document.h:
1637         * html/HTMLKeygenElement.cpp:
1638         (WebCore::HTMLKeygenElement::appendFormData):
1639         * page/ChromeClient.h:
1640         * platform/LocalizedStrings.h:
1641         * platform/SSLKeyGenerator.h:
1642
1643 2018-04-25  Ryosuke Niwa  <rniwa@webkit.org>
1644
1645         PSON: Don't create a new process when navigating to a blob URL, data URL, and about:blank
1646         https://bugs.webkit.org/show_bug.cgi?id=184962
1647
1648         Reviewed by Youenn Fablet.
1649
1650         Added NavigationAction::treatAsSameOriginNavigation, which signifies WebKit code to avoid creating
1651         a new WebContent process when navigating to a blob URL, data URL, and about:blank.
1652
1653         Tests: ProcessSwap.SameOriginBlobNavigation
1654                ProcessSwap.CrossOriginBlobNavigation
1655                ProcessSwap.NavigateToAboutBlank
1656                ProcessSwap.NavigateToDataURL
1657
1658         * loader/NavigationAction.cpp:
1659         (WebCore::treatAsSameOriginNavigation):
1660         * loader/NavigationAction.h:
1661         (WebCore::NavigationAction::treatAsSameOriginNavigation const):
1662
1663 2018-04-25  Zalan Bujtas  <zalan@apple.com>
1664
1665         [LFC] Implement Layout::BlockContainer functions.
1666         https://bugs.webkit.org/show_bug.cgi?id=184994
1667
1668         Reviewed by Antti Koivisto.
1669
1670         * layout/layouttree/LayoutBlockContainer.cpp:
1671         (WebCore::Layout::BlockContainer::BlockContainer):
1672         (WebCore::Layout::BlockContainer::establishesInlineFormattingContext const):
1673
1674 2018-04-25  Zalan Bujtas  <zalan@apple.com>
1675
1676         [LFC] Implement Layout::Container functions.
1677         https://bugs.webkit.org/show_bug.cgi?id=184988
1678
1679         Reviewed by Antti Koivisto.
1680
1681         * layout/layouttree/LayoutContainer.cpp:
1682         (WebCore::Layout::Container::Container):
1683         (WebCore::Layout::Container::firstInFlowChild const):
1684         (WebCore::Layout::Container::firstInFlowOrFloatingChild const):
1685         (WebCore::Layout::Container::lastInFlowChild const):
1686         (WebCore::Layout::Container::lastInFlowOrFloatingChild const):
1687         (WebCore::Layout::Container::setFirstChild):
1688         (WebCore::Layout::Container::setLastChild):
1689         (WebCore::Layout::Container::setOutOfFlowDescendants):
1690         * layout/layouttree/LayoutContainer.h:
1691         (WebCore::Layout::Container::firstChild const):
1692         (WebCore::Layout::Container::lastChild const):
1693         (WebCore::Layout::Container::hasChild const):
1694         (WebCore::Layout::Container::hasInFlowChild const):
1695         (WebCore::Layout::Container::hasInFlowOrFloatingChild const):
1696         (WebCore::Layout::Container::outOfFlowDescendants):
1697
1698 2018-04-25  Brent Fulgham  <bfulgham@apple.com>
1699
1700         Don't Block First Party Cookies on Redirects
1701         https://bugs.webkit.org/show_bug.cgi?id=184948
1702         <rdar://problem/39534099>
1703
1704         Reviewed by Youenn Fablet.
1705
1706         The Navigation scheduler looses the 'requester' value when performing a ScheduledRedirect.
1707
1708         Test: http/tests/resourceLoadStatistics/do-not-block-top-level-navigation-redirect.html
1709
1710         * loader/NavigationScheduler.cpp:
1711
1712 2018-04-25  Youenn Fablet  <youenn@apple.com>
1713
1714         CachedRawResource is not handling incremental data computation correctly
1715         https://bugs.webkit.org/show_bug.cgi?id=184936
1716
1717         Reviewed by Chris Dumez.
1718
1719         Covered by updated test.
1720
1721         The previous logic was handling the case of only one additional segment being added to the SharedBuffer.
1722         In service worker case, a SharedBuffer may contain more than one segment.
1723         This is fixed by iterating until all new data is sent to clients.
1724
1725         * loader/cache/CachedRawResource.cpp:
1726         (WebCore::CachedRawResource::updateBuffer):
1727
1728 2018-04-25  Andy Estes  <aestes@apple.com>
1729
1730         [Mac] Number of drop items is always 0 when performing a DHTML drag
1731         https://bugs.webkit.org/show_bug.cgi?id=184943
1732
1733         Reviewed by Ryosuke Niwa.
1734
1735         New API test: DragAndDropPasteboardTests.NumberOfValidItemsForDrop
1736
1737         DragController tracks the number of items to be accepted by a file input element, taking
1738         into account whether the control is disabled or accepts multiple files. When this number
1739         changes, WebKit informs the NSDraggingInfo-conforming object passed to -draggingUpdated by
1740         calling -setNumberOfValidItemsForDrop:. This number is presented to the user in a badge
1741         rendered next to the dragging item thumbnails.
1742
1743         When performing a DHTML drag, we don't know how many items the page will accept, so prior
1744         to this patch we would render a "0" in the badge. This is misleading, because the page is
1745         more likely to accept all the items (or at least one of them) rather than none of them.
1746
1747         Let's do the straightforward thing and set numberOfValidItemsForDrop to equal the number of
1748         files in the drag operation when performing a DHTML file drag.
1749
1750         * page/DragController.cpp:
1751         (WebCore::DragController::tryDocumentDrag):
1752
1753 2018-04-25  Eric Carlson  <eric.carlson@apple.com>
1754
1755         [iOS] Set route sharing policy when setting audio session category
1756         https://bugs.webkit.org/show_bug.cgi?id=184979
1757         <rdar://problem/39709577>
1758
1759         Reviewed by Jer Noble.
1760
1761         * platform/audio/ios/AudioSessionIOS.mm:
1762         (WebCore::AudioSession::setCategory):
1763
1764 2018-04-25  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1765
1766         [Curl] Fix wrong schema checking on r230973
1767         https://bugs.webkit.org/show_bug.cgi?id=184977
1768
1769         Did write a wrong condition when making a string.
1770
1771         Reviewed by Alex Christensen.
1772
1773         No new tests because test interface is not ready.
1774
1775         * platform/network/curl/CurlProxySettings.cpp:
1776         (WebCore::createProxyUrl):
1777
1778 2018-04-25  Youenn Fablet  <youenn@apple.com>
1779
1780         Make DocumentThreadableLoader error logging more consistent
1781         https://bugs.webkit.org/show_bug.cgi?id=184853
1782
1783         Reviewed by Chris Dumez.
1784
1785         Covered by rebased tests.
1786         Make EventSource, XHR and Fetch log error messages consistently.
1787         This patch also prepares consistent error logging between WK1 and WK2 as WK2 NetworkProcess
1788         will issue more and more errors in places different from WK1.
1789         This is the reason for SubresourceLoader changes in this patch and DTL/didFail/preflightFailure changes.
1790
1791         Update ImageLoader error message to be more general than CORS.
1792
1793         * loader/CrossOriginPreflightChecker.cpp:
1794         (WebCore::CrossOriginPreflightChecker::doPreflight): Add some more logging for consistency between WK1 and WK2.
1795         (WebCore::CrossOriginPreflightChecker::validatePreflightResponse): Ditto.
1796         * loader/DocumentThreadableLoader.cpp:
1797         (WebCore::DocumentThreadableLoader::didFail):
1798         (WebCore::DocumentThreadableLoader::preflightFailure):
1799         (WebCore::DocumentThreadableLoader::logErrorAndFail):
1800         * loader/ImageLoader.cpp:
1801         (WebCore::ImageLoader::notifyFinished):
1802         * loader/SubresourceLoader.cpp:
1803         (WebCore::SubresourceLoader::didFail):
1804         * loader/ThreadableLoader.cpp:
1805         (WebCore::ThreadableLoader::logError):
1806         * loader/cache/CachedResource.cpp:
1807         (WebCore::CachedResource::load):
1808         * loader/cache/CachedResourceRequestInitiators.cpp:
1809         (WebCore::CachedResourceRequestInitiators::CachedResourceRequestInitiators):
1810         * loader/cache/CachedResourceRequestInitiators.h:
1811         * page/EventSource.cpp:
1812         (WebCore::EventSource::connect):
1813         (WebCore::EventSource::didFail):
1814         * xml/XMLHttpRequest.cpp:
1815         (WebCore::XMLHttpRequest::didFail):
1816
1817 2018-04-25  Zalan Bujtas  <zalan@apple.com>
1818
1819         [LFC] Implement Layout::Box functions.
1820         https://bugs.webkit.org/show_bug.cgi?id=184974
1821
1822         Reviewed by Antti Koivisto.
1823
1824         * layout/layouttree/LayoutBlockContainer.h:
1825         * layout/layouttree/LayoutBox.cpp:
1826         (WebCore::Layout::Box::Box):
1827         (WebCore::Layout::Box::~Box):
1828         (WebCore::Layout::Box::establishesFormattingContext const):
1829         (WebCore::Layout::Box::establishesBlockFormattingContext const):
1830         (WebCore::Layout::Box::isRelativelyPositioned const):
1831         (WebCore::Layout::Box::isStickyPositioned const):
1832         (WebCore::Layout::Box::isAbsolutelyPositioned const):
1833         (WebCore::Layout::Box::isFixedPositioned const):
1834         (WebCore::Layout::Box::isFloatingPositioned const):
1835         (WebCore::Layout::Box::containingBlock const):
1836         (WebCore::Layout::Box::isDescendantOf const):
1837         (WebCore::Layout::Box::isAnonymous const):
1838         (WebCore::Layout::Box::isInlineBlockBox const):
1839         (WebCore::Layout::Box::isBlockLevelBox const):
1840         (WebCore::Layout::Box::isInlineLevelBox const):
1841         (WebCore::Layout::Box::isBlockContainerBox const):
1842         (WebCore::Layout::Box::isInitialContainingBlock const):
1843         (WebCore::Layout::Box::nextInFlowSibling const):
1844         (WebCore::Layout::Box::nextInFlowOrFloatingSibling const):
1845         (WebCore::Layout::Box::previousInFlowSibling const):
1846         (WebCore::Layout::Box::previousInFlowOrFloatingSibling const):
1847         (WebCore::Layout::Box::setParent):
1848         (WebCore::Layout::Box::setNextSibling):
1849         (WebCore::Layout::Box::setPreviousSibling):
1850         (WebCore::Layout::Box::isOverflowVisible const):
1851         * layout/layouttree/LayoutBox.h:
1852         (WebCore::Layout::Box::establishesInlineFormattingContext const):
1853         (WebCore::Layout::Box::isInFlow const):
1854         (WebCore::Layout::Box::isPositioned const):
1855         (WebCore::Layout::Box::isInFlowPositioned const):
1856         (WebCore::Layout::Box::isOutOfFlowPositioned const):
1857         (WebCore::Layout::Box::isFloatingOrOutOfFlowPositioned const):
1858         (WebCore::Layout::Box::parent const):
1859         (WebCore::Layout::Box::nextSibling const):
1860         (WebCore::Layout::Box::previousSibling const):
1861         (WebCore::Layout::Box::weakPtrFactory const):
1862         * layout/layouttree/LayoutContainer.h:
1863         * layout/layouttree/LayoutInlineBox.h:
1864         * layout/layouttree/LayoutInlineContainer.h:
1865
1866 2018-04-25  Per Arne Vollan  <pvollan@apple.com>
1867
1868         [Win] Crash under WebCore::SimpleLineLayout::generateLineBoxTree
1869         https://bugs.webkit.org/show_bug.cgi?id=184953
1870
1871         This is possibly a MSVC compiler bug, since a simple rearrangement of the code fixes the crash.
1872         The crash is only happening in release builds, which also is an indication of this being a
1873         compiler issue.
1874
1875         Reviewed by Zalan Bujtas.
1876
1877         No new tests, covered by existing tests.
1878
1879         * rendering/SimpleLineLayoutFunctions.cpp:
1880         (WebCore::SimpleLineLayout::generateLineBoxTree):
1881
1882 2018-04-25  Dean Jackson  <dino@apple.com>
1883
1884         Make a better flag for system preview, and disable it where necessary
1885         https://bugs.webkit.org/show_bug.cgi?id=184968
1886         <rdar://problem/39686506>
1887
1888         Reviewed by Eric Carlson.
1889
1890         Use USE(SYSTEM_PREVIEW).
1891
1892         * html/HTMLAnchorElement.cpp:
1893         (WebCore::HTMLAnchorElement::isSystemPreviewLink const):
1894         * html/HTMLAnchorElement.h:
1895         * html/HTMLImageElement.cpp:
1896         * html/HTMLImageElement.h:
1897         * html/HTMLPictureElement.cpp:
1898         * html/HTMLPictureElement.h:
1899         * rendering/RenderImage.cpp:
1900         (WebCore::RenderImage::paintIntoRect):
1901         * rendering/RenderTheme.cpp:
1902         * rendering/RenderTheme.h:
1903         * testing/Internals.cpp:
1904         (WebCore::Internals::systemPreviewRelType):
1905         (WebCore::Internals::isSystemPreviewLink const):
1906         (WebCore::Internals::isSystemPreviewImage const):
1907
1908 2018-04-25  Zalan Bujtas  <zalan@apple.com>
1909
1910         Fix project file after r230931.
1911
1912         * WebCore.xcodeproj/project.pbxproj:
1913
1914 2018-04-25  Miguel Gomez  <magomez@igalia.com>
1915
1916         [GTK] fast/repaint/fixed-scale.html failing since r230479 "[TexMap] TextureMapperLayer unnecessarily duplicates state in GraphicsLayerTransform"
1917         https://bugs.webkit.org/show_bug.cgi?id=184780
1918
1919         Reviewed by Žan Doberšek.
1920
1921         Initialize the anchorPoint to (0.5, 0.5, 0) in TextureMapperLayer::State.
1922
1923         Covered by existent tests.
1924
1925         * platform/graphics/texmap/TextureMapperLayer.h:
1926
1927 2018-04-25  Carlos Garcia Campos  <cgarcia@igalia.com>
1928
1929         [GTK] Implement MouseEvent.buttons
1930         https://bugs.webkit.org/show_bug.cgi?id=184913
1931
1932         Reviewed by Žan Doberšek.
1933
1934         Add helper function to get the state modifier of a GDK button.
1935
1936         * platform/gtk/GtkUtilities.cpp:
1937         (WebCore::stateModifierForGdkButton):
1938         * platform/gtk/GtkUtilities.h:
1939
1940 2018-04-24  Ryosuke Niwa  <rniwa@webkit.org>
1941
1942         Release assert in ScriptController::canExecuteScripts via CachedSVGFont::ensureCustomFontData during
1943         Document::updateStyleIfNeeded
1944         https://bugs.webkit.org/show_bug.cgi?id=184950
1945
1946         Reviewed by Zalan Bujtas.
1947
1948         Convert an existing ScriptDisallowedScope::EventAllowedScope which only disables the debug assertions
1949         by ScriptDisallowedScope::DisableAssertionsInScope which also disables the release assertion.
1950
1951         Because SVG font is loaded in a document isolated from the rest of the page (m_externalSVGDocument),
1952         there is no security implication to execute scripts in this isolated document.
1953
1954         Unfortunately, no new tests. I could never make CachedSVGFont::ensureCustomFontData to get called inside
1955         style resolution with m_externalSVGDocument set to nullptr after many attempts. Even EventAllowedScope
1956         I added 13 months ago in r211965, which this patch replaces by DisableAssertionsInScope, is not utilized
1957         by the existing layout tests since removing the assertion doesn't cause any layout test to hit an assertion.
1958
1959         * dom/ScriptDisallowedScope.h: Updated the comment.
1960         * loader/cache/CachedSVGFont.cpp:
1961         (WebCore::CachedSVGFont::ensureCustomFontData): Replaced the asssertion.
1962
1963 2018-04-24  Simon Fraser  <simon.fraser@apple.com>
1964
1965         visitedDependentColor() should take a CSSPropertyID
1966         https://bugs.webkit.org/show_bug.cgi?id=184949
1967
1968         Reviewed by Sam Weinig.
1969         
1970         Change RenderStyle::colorIncludingFallback(), RenderStyle::visitedDependentColor()
1971         and RenderElement::selectionColor() to take CSSPropertyID rather than int.
1972
1973         No behavior change.
1974
1975         * rendering/RenderElement.cpp:
1976         (WebCore::RenderElement::selectionColor const):
1977         * rendering/RenderElement.h:
1978         * rendering/RenderTableCell.cpp:
1979         (WebCore::RenderTableCell::computeCollapsedStartBorder const):
1980         (WebCore::RenderTableCell::computeCollapsedEndBorder const):
1981         (WebCore::RenderTableCell::computeCollapsedBeforeBorder const):
1982         (WebCore::RenderTableCell::computeCollapsedAfterBorder const):
1983         * rendering/style/RenderStyle.cpp:
1984         (WebCore::RenderStyle::colorIncludingFallback const):
1985         (WebCore::RenderStyle::visitedDependentColor const):
1986         * rendering/style/RenderStyle.h:
1987
1988 2018-04-24  Simon Fraser  <simon.fraser@apple.com>
1989
1990         Add a new "color-filter" CSS property as an experimental feature
1991         https://bugs.webkit.org/show_bug.cgi?id=184940
1992         rdar://problem/39664904
1993
1994         Reviewed by Jon Lee.
1995         
1996         Add a new CSS property called "color-filter" as an experimental feature (off by default).
1997         
1998         This property specifies a list of filter functions (as specified in https://drafts.fxtf.org/filter-effects/#supported-filter-functions)
1999         to CSS colors, allowing authors to modify the provided page colors, for example to improve accessibility.
2000         Filters that move pixels (i.e. blur() and drop-shadow()) are invalid in this property.
2001         
2002         Colors will be mapped through the filter functions just before paint time, and gradient stop colors will also be mapped.
2003         
2004         This patch adds support for parsing color-filter.
2005
2006         Test: css3/color-filters/color-filter-parsing.html
2007
2008         * css/CSSComputedStyleDeclaration.cpp:
2009         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
2010         * css/CSSProperties.json:
2011         * css/parser/CSSParser.cpp:
2012         (WebCore::CSSParserContext::CSSParserContext):
2013         (WebCore::operator==):
2014         * css/parser/CSSParserMode.h:
2015         * css/parser/CSSPropertyParser.cpp:
2016         (WebCore::CSSPropertyParser::parseSingleValue):
2017         * css/parser/CSSPropertyParserHelpers.cpp:
2018         (WebCore::CSSPropertyParserHelpers::isColorFilterFunction):
2019         (WebCore::CSSPropertyParserHelpers::consumeFilterFunction):
2020         (WebCore::CSSPropertyParserHelpers::consumeFilter):
2021         * css/parser/CSSPropertyParserHelpers.h:
2022         * page/Settings.yaml:
2023         * rendering/style/RenderStyle.cpp:
2024         (WebCore::RenderStyle::changeRequiresRepaint const):
2025         * rendering/style/RenderStyle.h:
2026         (WebCore::RenderStyle::mutableColorFilter):
2027         (WebCore::RenderStyle::colorFilter const):
2028         (WebCore::RenderStyle::hasColorFilter const):
2029         (WebCore::RenderStyle::setColorFilter):
2030         (WebCore::RenderStyle::initialColorFilter):
2031         * rendering/style/StyleRareInheritedData.cpp:
2032         (WebCore::StyleRareInheritedData::StyleRareInheritedData):
2033         (WebCore::StyleRareInheritedData::operator== const):
2034         (WebCore::StyleRareInheritedData::hasColorFilters const):
2035         * rendering/style/StyleRareInheritedData.h:
2036
2037 2018-04-24  Simon Fraser  <simon.fraser@apple.com>
2038
2039         shape-outside and filter styles occur twice in the result of getComputedStyle
2040         https://bugs.webkit.org/show_bug.cgi?id=184931
2041
2042         Reviewed by Antti Koivisto.
2043
2044         CSSPropertyShapeOutside and CSSPropertyFilter were duplicated in the list of computedProperties[]
2045         used by getComputedStyle. Remove the duplication.
2046         
2047         Tested by existing tests.
2048
2049         * css/CSSComputedStyleDeclaration.cpp:
2050
2051 2018-04-24  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2052
2053         [Curl] Extract proxy settings into a separate class to hold advanced information.
2054         https://bugs.webkit.org/show_bug.cgi?id=184714
2055
2056         It was simplely structure to hold proxy setting. To support advanced feature of proxy
2057         such as authentication, more inteligent object is required to store intermediate state
2058         or errors. That's why we've introduced new class for that purpose.
2059
2060         Reviewed by Youenn Fablet.
2061
2062         No new tests because there's no new behavior.
2063
2064         * platform/Curl.cmake:
2065         * platform/network/curl/CurlContext.cpp:
2066         (WebCore::CurlHandle::enableProxyIfExists):
2067         (WebCore::CurlContext::ProxyInfo::url const): Deleted.
2068         (WebCore::CurlContext::setProxyInfo): Deleted.
2069         * platform/network/curl/CurlContext.h:
2070         (WebCore::CurlContext::proxySettings const):
2071         (WebCore::CurlContext::setProxySettings):
2072         (WebCore::CurlContext::setProxyUserPass):
2073         (WebCore::CurlContext::proxyInfo const): Deleted.
2074         (WebCore::CurlContext::setProxyInfo): Deleted.
2075         * platform/network/curl/CurlProxySettings.cpp: Added.
2076         (WebCore::CurlProxySettings::CurlProxySettings):
2077         (WebCore::CurlProxySettings::rebuildUrl):
2078         (WebCore::CurlProxySettings::setUserPass):
2079         (WebCore::protocolIsInSocksFamily):
2080         (WebCore::getProxyPort):
2081         (WebCore::createProxyUrl):
2082         * platform/network/curl/CurlProxySettings.h: Added.
2083         (WebCore::CurlProxySettings::CurlProxySettings):
2084         (WebCore::CurlProxySettings::isEmpty const):
2085         (WebCore::CurlProxySettings::mode const):
2086         (WebCore::CurlProxySettings::url const):
2087         (WebCore::CurlProxySettings::ignoreHosts const):
2088         (WebCore::CurlProxySettings::user const):
2089         (WebCore::CurlProxySettings::password const):
2090         * platform/network/curl/CurlRequest.cpp:
2091         (WebCore::CurlRequest::didReceiveHeader):
2092         * platform/network/curl/CurlResponse.h:
2093         (WebCore::CurlResponse::isolatedCopy const):
2094         * platform/network/curl/ResourceResponseCurl.cpp:
2095         (WebCore::ResourceResponse::ResourceResponse):
2096
2097 2018-04-24  Youenn Fablet  <youenn@apple.com>
2098
2099         Throw in case of PeerConnection created for detached documents
2100         https://bugs.webkit.org/show_bug.cgi?id=184921
2101         <rdar://problem/39629216>
2102
2103         Reviewed by Eric Carlson.
2104
2105         Add a check to ensure that page is not null when creating a peer connection backend.
2106         In that case, the peer connection constructor will later on throw.
2107         The same for setConfiguration is done.
2108         Behavior is consistent with Chrome.
2109
2110         Test: webrtc/pc-detached-document.html
2111
2112         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
2113         (WebCore::createLibWebRTCPeerConnectionBackend):
2114         (WebCore::LibWebRTCPeerConnectionBackend::LibWebRTCPeerConnectionBackend):
2115         (WebCore::LibWebRTCPeerConnectionBackend::setConfiguration):
2116         (WebCore::libWebRTCProvider): Deleted.
2117         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
2118
2119 2018-04-24  John Wilander  <wilander@apple.com>
2120
2121         From-Origin: Support for 'same' and 'same-site' response header, nested frame origin check
2122         https://bugs.webkit.org/show_bug.cgi?id=184560
2123         <rdar://problem/38901344>
2124
2125         Reviewed by Youenn Fablet and Daniel Bates.
2126
2127         Tests: http/tests/from-origin/document-from-origin-same-accepted.html
2128                http/tests/from-origin/document-from-origin-same-blocked.html
2129                http/tests/from-origin/document-from-origin-same-site-accepted.html
2130                http/tests/from-origin/document-from-origin-same-site-blocked.html
2131                http/tests/from-origin/document-nested-from-origin-same-accepted.html
2132                http/tests/from-origin/document-nested-from-origin-same-blocked.html
2133                http/tests/from-origin/fetch-data-iframe-from-origin-same-blocked.html
2134                http/tests/from-origin/fetch-from-origin-same-accepted.html
2135                http/tests/from-origin/fetch-from-origin-same-blocked.html
2136                http/tests/from-origin/fetch-from-origin-same-site-accepted.html
2137                http/tests/from-origin/fetch-from-origin-same-site-blocked.html
2138                http/tests/from-origin/fetch-iframe-from-origin-same-accepted.html
2139                http/tests/from-origin/fetch-iframe-from-origin-same-blocked.html
2140                http/tests/from-origin/image-about-blank-from-origin-same-blocked.html
2141                http/tests/from-origin/image-from-origin-same-accepted.html
2142                http/tests/from-origin/image-from-origin-same-blocked.html
2143                http/tests/from-origin/image-from-origin-same-site-accepted.html
2144                http/tests/from-origin/image-from-origin-same-site-blocked.html
2145                http/tests/from-origin/redirect-document-from-origin-same-blocked.html
2146                http/tests/from-origin/redirect-fetch-from-origin-same-blocked.html
2147                http/tests/from-origin/redirect-image-from-origin-same-blocked.html
2148                http/tests/from-origin/redirect-script-from-origin-same-blocked.html
2149                http/tests/from-origin/redirect-xhr-from-origin-same-blocked.html
2150                http/tests/from-origin/sandboxed-sub-frame-from-origin-same-blocked.html
2151                http/tests/from-origin/sandboxed-sub-frame-nested-cross-origin-from-origin-same-blocked.html
2152                http/tests/from-origin/sandboxed-sub-frame-nested-same-origin-from-origin-same-blocked.html
2153                http/tests/from-origin/script-from-origin-same-accepted.html
2154                http/tests/from-origin/script-from-origin-same-blocked.html
2155                http/tests/from-origin/script-from-origin-same-site-accepted.html
2156                http/tests/from-origin/script-from-origin-same-site-blocked.html
2157                http/tests/from-origin/top-frame-document-from-origin-same-accepted.php
2158                http/tests/from-origin/xhr-from-origin-same-accepted.html
2159                http/tests/from-origin/xhr-from-origin-same-blocked.html
2160                http/tests/from-origin/xhr-from-origin-same-site-accepted.html
2161                http/tests/from-origin/xhr-from-origin-same-site-blocked.html
2162
2163         * loader/SubresourceLoader.cpp:
2164         (WebCore::SubresourceLoader::didFail):
2165             Outputs the error's localized description in a console message except when the destination
2166             is FetchOptions::Destination::Serviceworker or FetchOptions::Destination::EmptyString.
2167         * page/RuntimeEnabledFeatures.h:
2168         (WebCore::RuntimeEnabledFeatures::setFromOriginResponseHeaderEnabled):
2169         (WebCore::RuntimeEnabledFeatures::fromOriginResponseHeaderEnabled const):
2170             Added From-Origin support as an experimental feature.
2171         * platform/network/HTTPHeaderNames.in:
2172             Added From-Origin.
2173         * platform/network/HTTPParsers.cpp:
2174         (WebCore::parseFromOriginHeader):
2175             Parses the From-Origin header, currently supporting 'Same' and 'Same-Site.'
2176         * platform/network/HTTPParsers.h:
2177
2178 2018-04-24  Antti Koivisto  <antti@apple.com>
2179
2180         Rename LayoutCtx.h/cpp to LayoutContext.h/cpp
2181         https://bugs.webkit.org/show_bug.cgi?id=184922
2182
2183         Reviewed by Zalan Bujtas.
2184
2185         To achieve this the existing LayoutContext class is renamed to FrameViewLayoutContext.
2186
2187         * Sources.txt:
2188         * WebCore.xcodeproj/project.pbxproj:
2189         * layout/LayoutContext.cpp: Copied from Source/WebCore/layout/LayoutCtx.cpp.
2190         * layout/LayoutContext.h: Copied from Source/WebCore/layout/LayoutCtx.h.
2191         * layout/LayoutCtx.cpp: Removed.
2192         * layout/LayoutCtx.h: Removed.
2193         * page/FrameView.cpp:
2194         (WebCore::FrameView::shouldDeferScrollUpdateAfterContentSizeChange):
2195         (WebCore::FrameView::updateLayoutViewport):
2196         (WebCore::FrameView::updateLayerPositionsAfterScrolling):
2197         (WebCore::FrameView::updateCompositingLayersAfterScrolling):
2198         (WebCore::FrameView::availableContentSizeChanged):
2199         * page/FrameView.h:
2200         * page/FrameViewLayoutContext.cpp: Copied from Source/WebCore/page/LayoutContext.cpp.
2201         (WebCore::LayoutScope::LayoutScope):
2202         (WebCore::FrameViewLayoutContext::FrameViewLayoutContext):
2203         (WebCore::FrameViewLayoutContext::~FrameViewLayoutContext):
2204         (WebCore::FrameViewLayoutContext::layout):
2205         (WebCore::FrameViewLayoutContext::runOrScheduleAsynchronousTasks):
2206         (WebCore::FrameViewLayoutContext::runAsynchronousTasks):
2207         (WebCore::FrameViewLayoutContext::flushAsynchronousTasks):
2208         (WebCore::FrameViewLayoutContext::reset):
2209         (WebCore::FrameViewLayoutContext::needsLayout const):
2210         (WebCore::FrameViewLayoutContext::setNeedsLayout):
2211         (WebCore::FrameViewLayoutContext::enableSetNeedsLayout):
2212         (WebCore::FrameViewLayoutContext::disableSetNeedsLayout):
2213         (WebCore::FrameViewLayoutContext::scheduleLayout):
2214         (WebCore::FrameViewLayoutContext::unscheduleLayout):
2215         (WebCore::FrameViewLayoutContext::scheduleSubtreeLayout):
2216         (WebCore::FrameViewLayoutContext::layoutTimerFired):
2217         (WebCore::FrameViewLayoutContext::convertSubtreeLayoutToFullLayout):
2218         (WebCore::FrameViewLayoutContext::setSubtreeLayoutRoot):
2219         (WebCore::FrameViewLayoutContext::canPerformLayout const):
2220         (WebCore::FrameViewLayoutContext::applyTextSizingIfNeeded):
2221         (WebCore::FrameViewLayoutContext::updateStyleForLayout):
2222         (WebCore::FrameViewLayoutContext::handleLayoutWithFrameFlatteningIfNeeded):
2223         (WebCore::FrameViewLayoutContext::startLayoutAtMainFrameViewIfNeeded):
2224         (WebCore::FrameViewLayoutContext::layoutDelta const):
2225         (WebCore::FrameViewLayoutContext::addLayoutDelta):
2226         (WebCore::FrameViewLayoutContext::layoutDeltaMatches):
2227         (WebCore::FrameViewLayoutContext::layoutState const):
2228         (WebCore::FrameViewLayoutContext::pushLayoutState):
2229         (WebCore::FrameViewLayoutContext::pushLayoutStateForPaginationIfNeeded):
2230         (WebCore::FrameViewLayoutContext::popLayoutState):
2231         (WebCore::FrameViewLayoutContext::checkLayoutState):
2232         (WebCore::FrameViewLayoutContext::frame const):
2233         (WebCore::FrameViewLayoutContext::view const):
2234         (WebCore::FrameViewLayoutContext::renderView const):
2235         (WebCore::FrameViewLayoutContext::document const):
2236         (WebCore::LayoutContext::LayoutContext): Deleted.
2237         (WebCore::LayoutContext::~LayoutContext): Deleted.
2238         (WebCore::LayoutContext::layout): Deleted.
2239         (WebCore::LayoutContext::runOrScheduleAsynchronousTasks): Deleted.
2240         (WebCore::LayoutContext::runAsynchronousTasks): Deleted.
2241         (WebCore::LayoutContext::flushAsynchronousTasks): Deleted.
2242         (WebCore::LayoutContext::reset): Deleted.
2243         (WebCore::LayoutContext::needsLayout const): Deleted.
2244         (WebCore::LayoutContext::setNeedsLayout): Deleted.
2245         (WebCore::LayoutContext::enableSetNeedsLayout): Deleted.
2246         (WebCore::LayoutContext::disableSetNeedsLayout): Deleted.
2247         (WebCore::LayoutContext::scheduleLayout): Deleted.
2248         (WebCore::LayoutContext::unscheduleLayout): Deleted.
2249         (WebCore::LayoutContext::scheduleSubtreeLayout): Deleted.
2250         (WebCore::LayoutContext::layoutTimerFired): Deleted.
2251         (WebCore::LayoutContext::convertSubtreeLayoutToFullLayout): Deleted.
2252         (WebCore::LayoutContext::setSubtreeLayoutRoot): Deleted.
2253         (WebCore::LayoutContext::canPerformLayout const): Deleted.
2254         (WebCore::LayoutContext::applyTextSizingIfNeeded): Deleted.
2255         (WebCore::LayoutContext::updateStyleForLayout): Deleted.
2256         (WebCore::LayoutContext::handleLayoutWithFrameFlatteningIfNeeded): Deleted.
2257         (WebCore::LayoutContext::startLayoutAtMainFrameViewIfNeeded): Deleted.
2258         (WebCore::LayoutContext::layoutDelta const): Deleted.
2259         (WebCore::LayoutContext::addLayoutDelta): Deleted.
2260         (WebCore::LayoutContext::layoutDeltaMatches): Deleted.
2261         (WebCore::LayoutContext::layoutState const): Deleted.
2262         (WebCore::LayoutContext::pushLayoutState): Deleted.
2263         (WebCore::LayoutContext::pushLayoutStateForPaginationIfNeeded): Deleted.
2264         (WebCore::LayoutContext::popLayoutState): Deleted.
2265         (WebCore::LayoutContext::checkLayoutState): Deleted.
2266         (WebCore::LayoutContext::frame const): Deleted.
2267         (WebCore::LayoutContext::view const): Deleted.
2268         (WebCore::LayoutContext::renderView const): Deleted.
2269         (WebCore::LayoutContext::document const): Deleted.
2270         * page/FrameViewLayoutContext.h: Copied from Source/WebCore/page/LayoutContext.h.
2271         (WebCore::LayoutContext::startDisallowingLayout): Deleted.
2272         (WebCore::LayoutContext::endDisallowingLayout): Deleted.
2273         (WebCore::LayoutContext::layoutPhase const): Deleted.
2274         (WebCore::LayoutContext::isLayoutNested const): Deleted.
2275         (WebCore::LayoutContext::isLayoutPending const): Deleted.
2276         (WebCore::LayoutContext::isInLayout const): Deleted.
2277         (WebCore::LayoutContext::isInRenderTreeLayout const): Deleted.
2278         (WebCore::LayoutContext::inPaintableState const): Deleted.
2279         (WebCore::LayoutContext::layoutCount const): Deleted.
2280         (WebCore::LayoutContext::subtreeLayoutRoot const): Deleted.
2281         (WebCore::LayoutContext::clearSubtreeLayoutRoot): Deleted.
2282         (WebCore::LayoutContext::resetFirstLayoutFlag): Deleted.
2283         (WebCore::LayoutContext::didFirstLayout const): Deleted.
2284         (WebCore::LayoutContext::setNeedsFullRepaint): Deleted.
2285         (WebCore::LayoutContext::needsFullRepaint const): Deleted.
2286         (WebCore::LayoutContext::isPaintOffsetCacheEnabled const): Deleted.
2287         (WebCore::LayoutContext::layoutDisallowed const): Deleted.
2288         (WebCore::LayoutContext::isLayoutSchedulingEnabled const): Deleted.
2289         (WebCore::LayoutContext::inAsynchronousTasks const): Deleted.
2290         (WebCore::LayoutContext::disablePaintOffsetCache): Deleted.
2291         (WebCore::LayoutContext::enablePaintOffsetCache): Deleted.
2292         * page/LayoutContext.cpp: Removed.
2293         * page/LayoutContext.h: Removed.
2294         * rendering/LayoutState.cpp:
2295         (WebCore::LayoutState::LayoutState):
2296         (WebCore::LayoutState::computePaginationInformation):
2297         (WebCore::LayoutState::establishLineGrid):
2298         (WebCore::LayoutStateDisabler::LayoutStateDisabler):
2299         * rendering/LayoutState.h:
2300
2301 2018-04-24  Mark Lam  <mark.lam@apple.com>
2302
2303         Need to acquire the VM lock before calling toNumber on a JSValue.
2304         https://bugs.webkit.org/show_bug.cgi?id=184924
2305         <rdar://problem/39690679>
2306
2307         Reviewed by Saam Barati.
2308
2309         * bridge/objc/objc_utility.mm:
2310         (JSC::Bindings::convertValueToObjcValue):
2311
2312 2018-04-24  Tadeu Zagallo  <tzagallo@apple.com>
2313
2314         REGRESSION(r221839): Fix requests with FormData containing empty files
2315         https://bugs.webkit.org/show_bug.cgi?id=184490
2316         <rdar://problem/39385169>
2317
2318         Reviewed by Geoffrey Garen.
2319
2320         We should not append the blob to the FormData when it is a file but has no path. It broke
2321         the submission since the request was failing to read the file in FormDataStreamCFNet.h:156
2322
2323         Test: http/tests/local/formdata/send-form-data-with-empty-file.html
2324
2325         * platform/network/FormData.cpp:
2326         (WebCore::FormData::appendMultiPartFileValue):
2327
2328 2018-04-24  Zalan Bujtas  <zalan@apple.com>
2329
2330         Fix project file after r230931.
2331
2332         * WebCore.xcodeproj/project.pbxproj:
2333
2334 2018-04-24  Jer Noble  <jer.noble@apple.com>
2335
2336         Don't add system framework paths to FRAMEWORK_SEARCH_PATHS
2337         https://bugs.webkit.org/show_bug.cgi?id=184786
2338
2339         Reviewed by Tim Horton.
2340
2341         * Configurations/WebCore.xcconfig:
2342         * DerivedSources.make:
2343         * WebCore.xcodeproj/project.pbxproj:
2344
2345 2018-04-24  Zan Dobersek  <zdobersek@igalia.com>
2346
2347         [CoordGraphics] Remove dead fixed layer code
2348         https://bugs.webkit.org/show_bug.cgi?id=184912
2349
2350         Reviewed by Michael Catanzaro.
2351
2352         Remove CoordinatedGraphicsLayer::setFixedToViewport() and the
2353         corresponding attribute on the CoordinatedGraphicsLayerState struct.
2354         The method is not called anywhere since r230952.
2355
2356         CoordinatedGraphicsState struct also loses the scrollPosition attribute
2357         that also isn't used anymore.
2358
2359         Changes to GraphicsLayerTextureMapper class mirror those made to
2360         CoordinatedGraphicsLayer, removing support for the fixed-to-viewport
2361         attribute. This too was not called from anywhere.
2362
2363         All that enables us removing fixed-to-viewport handling in the
2364         TextureMapperLayer class. Along with related changes in the
2365         CoordinatedGraphicsScene class, we're able to remove a bunch of methods
2366         and member variables that are not used or needed anymore.
2367
2368         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
2369         (WebCore::GraphicsLayerTextureMapper::GraphicsLayerTextureMapper):
2370         (WebCore::GraphicsLayerTextureMapper::commitLayerChanges):
2371         (WebCore::GraphicsLayerTextureMapper::setFixedToViewport): Deleted.
2372         * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
2373         * platform/graphics/texmap/TextureMapperLayer.cpp:
2374         (WebCore::TextureMapperLayer::computeTransformsRecursive):
2375         (WebCore::TextureMapperLayer::setFixedToViewport): Deleted.
2376         (WebCore::TextureMapperLayer::isAncestorFixedToViewport const): Deleted.
2377         (WebCore::TextureMapperLayer::setScrollPositionDeltaIfNeeded): Deleted.
2378         * platform/graphics/texmap/TextureMapperLayer.h:
2379         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
2380         (WebCore::CoordinatedGraphicsLayer::CoordinatedGraphicsLayer):
2381         (WebCore::CoordinatedGraphicsLayer::syncLayerState):
2382         (WebCore::CoordinatedGraphicsLayer::setFixedToViewport): Deleted.
2383         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
2384         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
2385         (WebCore::CoordinatedGraphicsLayerState::CoordinatedGraphicsLayerState):
2386
2387 2018-04-24  Zan Dobersek  <zdobersek@igalia.com>
2388
2389         [CoordGraphics] Remove unused fixed layout functionality
2390         https://bugs.webkit.org/show_bug.cgi?id=184908
2391
2392         Reviewed by Carlos Garcia Campos.
2393
2394         Ports using the CoordinatedGraphics subsystem don't expose fixed layout
2395         support. As such, we're able to remove a lot of unused code and
2396         unnecessary USE(COORDINATED_GRAPHICS) special cases in generic sections
2397         in both WebCore and WebKit.
2398
2399         With fixed layout not available for use to users of the GTK+ and WPE
2400         ports, we can remove the ScrollingCoordinatorCoordinatedGraphics
2401         implementation, making room for an implementation that inherits from
2402         AsyncScrollingCoordinator in the future. For that purpose the
2403         ScrollingCoordinator::create() function is moved into the
2404         ScrollingCoordinatorCoordinatedGraphics.cpp file already.
2405
2406         This also enables removing delegatedScrollRequested() method from
2407         HostWindow and the inheriting ChromeClient interface.
2408
2409         * loader/EmptyClients.h:
2410         * page/Chrome.cpp:
2411         (WebCore::Chrome::delegatedScrollRequested): Deleted.
2412         * page/Chrome.h:
2413         * page/ChromeClient.h:
2414         * page/scrolling/ScrollingCoordinator.cpp:
2415         (WebCore::ScrollingCoordinator::create):
2416         * page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.cpp:
2417         (WebCore::ScrollingCoordinator::create):
2418         (WebCore::ScrollingCoordinatorCoordinatedGraphics::ScrollingCoordinatorCoordinatedGraphics): Deleted.
2419         (WebCore::ScrollingCoordinatorCoordinatedGraphics::attachToStateTree): Deleted.
2420         (WebCore::ScrollingCoordinatorCoordinatedGraphics::detachFromStateTree): Deleted.
2421         (WebCore::ScrollingCoordinatorCoordinatedGraphics::clearStateTree): Deleted.
2422         (WebCore::ScrollingCoordinatorCoordinatedGraphics::updateNodeLayer): Deleted.
2423         (WebCore::ScrollingCoordinatorCoordinatedGraphics::updateNodeViewportConstraints): Deleted.
2424         (WebCore::ScrollingCoordinatorCoordinatedGraphics::requestScrollPositionUpdate): Deleted.
2425         * page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.h: Removed.
2426         * platform/HostWindow.h:
2427
2428 2018-04-24  Daniel Bates  <dabates@apple.com>
2429
2430         Attempt to fix the Apple Internal build following r230922
2431         (https://bugs.webkit.org/show_bug.cgi?id=184737)
2432
2433         Cast the return value of std::map::size() to a size_t before logging it with format specifier
2434         "%zu". std::map::size() returns a size_type. According to <http://en.cppreference.com/w/cpp/container/map>
2435         size_type is "usually a size_t", but it may not be. An Apple Internal debug builder reports
2436         that size_type = unsigned int != unsigned long = size_t.
2437
2438         * Modules/mediasource/SourceBuffer.cpp:
2439         (WebCore::SourceBuffer::provideMediaData):
2440
2441 2018-04-24  Zan Dobersek  <zdobersek@igalia.com>
2442
2443         [CoordGraphics] Avoid painting backing stores for zero-opacity layers
2444         https://bugs.webkit.org/show_bug.cgi?id=184143
2445
2446         Reviewed by Carlos Garcia Campos.
2447
2448         Skip generating backing stores for layers that have zero opacity and do
2449         not animate the opacity value. In the current CoordinatedGraphics system
2450         this can end up saving loads of memory on Web content that deploys a
2451         large number of such elements.
2452
2453         * platform/graphics/texmap/TextureMapperLayer.h:
2454         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
2455         (WebCore::CoordinatedGraphicsLayer::shouldHaveBackingStore const):
2456
2457 2018-04-24  Daniel Bates  <dabates@apple.com>
2458
2459         Attempt to fix the Apple Internal build following r230944
2460         (https://bugs.webkit.org/show_bug.cgi?id=159464)
2461
2462         * platform/network/mac/CookieJarMac.mm:
2463
2464 2018-04-24  Daniel Bates  <dabates@apple.com>
2465
2466         Another attempt to fix the Mac and iOS build following r230944
2467         (https://bugs.webkit.org/show_bug.cgi?id=159464)
2468
2469         * platform/network/mac/CookieJarMac.mm:
2470         (WebCore::policyProperties):
2471
2472 2018-04-24  Daniel Bates  <dabates@apple.com>
2473
2474         Attempt to fix the Mac and iOS build following r230944
2475         (https://bugs.webkit.org/show_bug.cgi?id=159464)
2476
2477         * platform/network/mac/CookieJarMac.mm:
2478         (WebCore::policyProperties):
2479
2480 2018-04-23  Daniel Bates  <dabates@apple.com>
2481
2482         Implement Same-Site cookies
2483         https://bugs.webkit.org/show_bug.cgi?id=159464
2484         <rdar://problem/27196358>
2485
2486         Reviewed by Brent Fulgham.
2487
2488         Implements support for Same-Site cookies as per <https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00>.
2489         The implementation is materially consistent with the spec. though implements the computation
2490         for a document's "site for cookies" indirectly as part of loading its frame. This is done to
2491         avoid traversing the frame tree on each subresource request initiated by the document or one
2492         of its workers. We take advantage of the fact that Web Workers and Service Workers use their
2493         host document's loader to load resources on their behalf to use the correct "site for cookies"
2494         for requests (e.g. fetch()) initiating by them without the need to duplicate and store the
2495         host document's "site for cookies" in the worker's script execution context.
2496
2497         The implementation differs from the spec. in the handling of about: URLs and the empty URL
2498         and makes the implementation in WebKit match the behavior of Chrome and Firefox as well as
2499         consistent with origin inheritance as described in <https://html.spec.whatwg.org/multipage/browsers.html#origin>
2500         (16 April 2018). Specifically, requests to about:blank, about:srcdoc and the empty URL ("")
2501         are treated as same-site because these URLs inherit their origin from their owner.
2502
2503         Tests: http/tests/cookies/same-site/fetch-after-navigating-iframe-in-cross-origin-page.html
2504                http/tests/cookies/same-site/fetch-after-top-level-navigation-from-cross-origin-page.html
2505                http/tests/cookies/same-site/fetch-after-top-level-navigation-initiated-from-iframe-in-cross-origin-page.html
2506                http/tests/cookies/same-site/fetch-cookies-set-in-about-blank-iframe.html
2507                http/tests/cookies/same-site/fetch-in-about-blank-page.html
2508                http/tests/cookies/same-site/fetch-in-cross-origin-iframe.html
2509                http/tests/cookies/same-site/fetch-in-cross-origin-page.html
2510                http/tests/cookies/same-site/fetch-in-cross-origin-service-worker.html
2511                http/tests/cookies/same-site/fetch-in-cross-origin-worker.html
2512                http/tests/cookies/same-site/fetch-in-same-origin-page.html
2513                http/tests/cookies/same-site/fetch-in-same-origin-service-worker.html
2514                http/tests/cookies/same-site/fetch-in-same-origin-srcdoc-iframe.html
2515                http/tests/cookies/same-site/fetch-in-same-origin-worker.html
2516                http/tests/cookies/same-site/popup-cross-site-post.html
2517                http/tests/cookies/same-site/popup-cross-site.html
2518                http/tests/cookies/same-site/popup-same-site-post.html
2519                http/tests/cookies/same-site/popup-same-site-via-cross-site-redirect.html
2520                http/tests/cookies/same-site/popup-same-site-via-same-site-redirect.html
2521                http/tests/cookies/same-site/popup-same-site.html
2522
2523         * Sources.txt: Add source file SameSiteInfo.cpp.
2524         * WebCore.xcodeproj/project.pbxproj: Add source files SameSiteInfo.{cpp, h}.
2525         * dom/Document.cpp:
2526         (WebCore::Document::initSecurityContext): Modified to call SecurityPolicy::shouldInheritSecurityOriginFromOwner().
2527         (WebCore::Document::shouldInheritContentSecurityPolicyFromOwner const): Ditto.
2528         (WebCore::shouldInheritSecurityOriginFromOwner): Deleted; moved to SecurityPolicy.
2529         * dom/Document.h:
2530         (WebCore::Document::firstPartyForSameSiteCookies const): Added.
2531         (WebCore::Document::setFirstPartyForSameSiteCookies): Added.
2532         * loader/CookieJar.cpp:
2533         (WebCore::sameSiteInfo): Returns the same-site info for the request used to load the specified document.
2534         (WebCore::cookies): Pass the same-site info down to the platform.
2535         (WebCore::cookieRequestHeaderFieldProxy): Ditto.
2536         (WebCore::setCookies): Ditto.
2537         (WebCore::cookieRequestHeaderFieldValue): Ditto.
2538         (WebCore::getRawCookies): Ditto.
2539         * loader/DocumentLoader.cpp:
2540         (WebCore::DocumentLoader::willSendRequest): Add same-site info to the request.
2541         (WebCore::DocumentLoader::startLoadingMainResource): Update a FIXME comment to explain that
2542         we can simplify ResourceRequestBase if we can remove the call to addExtraFieldsToMainResourceRequest()
2543         here. Specifically, we would not need to differentiate between a request with an unspecified
2544         same-site state (default state of a new request) from a request whose same-site state has
2545         been explicitly set if we can assume that the same-site state of a request is set exactly
2546         once. In absence of this guarantee we need an "unspecified" state to avoid overriding existing
2547         same-site information computed with a null initiating document (the case of a new address bar
2548         initiated load) from a load initiated by the document associated with this loader.
2549         * loader/FrameLoader.cpp:
2550         (WebCore::FrameLoader::setFirstPartyForCookies): Modified to also update the first party for
2551         same-site cookies ("site for cookies").
2552         (WebCore::FrameLoader::load): Add same-site info to the request.
2553         (WebCore::FrameLoader::reload): Ditto.
2554         (WebCore::FrameLoader::setOriginalURLForDownloadRequest): Ditto.
2555         (WebCore::FrameLoader::addExtraFieldsToRequest): If the request does not already have
2556         same-site info then compute it and add it to the request. Mark main frame main resource
2557         requests as a "top-site".
2558         (WebCore::FrameLoader::addSameSiteInfoToRequestIfNeeded): Implements the "'Same-site' and 'cross-site'
2559         Requests" algorithm from <https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00#section-2.1>.
2560         (WebCore::createWindow): Add same-site info to the request.
2561         * loader/FrameLoader.h:
2562         * loader/ResourceLoader.cpp:
2563         (WebCore::ResourceLoader::init): Ditto.
2564         * page/DOMWindow.cpp:
2565         (WebCore::DOMWindow::createWindow): Ditto.
2566         * page/SecurityPolicy.cpp:
2567         (WebCore::SecurityPolicy::shouldInheritSecurityOriginFromOwner): Moved from Document.cpp.
2568         * page/SecurityPolicy.h:
2569         * platform/CookiesStrategy.h:
2570         * platform/network/CacheValidation.cpp:
2571         (WebCore::headerValueForVary): Pass the same-site info down to the platform.
2572         * platform/network/CookieRequestHeaderFieldProxy.h:
2573         (WebCore::CookieRequestHeaderFieldProxy::encode const): Encode same-site bits.
2574         (WebCore::CookieRequestHeaderFieldProxy::decode): Decode same-site bits.
2575         * platform/network/PlatformCookieJar.h:
2576         * platform/network/ResourceRequestBase.cpp:
2577         (WebCore::ResourceRequestBase::setAsIsolatedCopy): Added.
2578         (WebCore::ResourceRequestBase::isSameSite const): Added.
2579         (WebCore::ResourceRequestBase::setIsSameSite): Added.
2580         (WebCore::ResourceRequestBase::isTopSite const): Added.
2581         (WebCore::ResourceRequestBase::setIsTopSite): Added.
2582         (WebCore::equalIgnoringHeaderFields):
2583         * platform/network/ResourceRequestBase.h:
2584         (WebCore::ResourceRequestBase::isSameSiteUnspecified const): Added. See comment for DocumentLoader::startLoadingMainResource()
2585         for more details.
2586         (WebCore::registrableDomainsAreEqual): Added.
2587         (WebCore::ResourceRequestBase::encodeBase const): Encode same-site bits.
2588         (WebCore::ResourceRequestBase::decodeBase): Decode same-site bits.
2589         * platform/network/SameSiteInfo.cpp: Added.
2590         (WebCore::SameSiteInfo::create):
2591         * platform/network/SameSiteInfo.h: Added.
2592         (WebCore::SameSiteInfo::encode const):
2593         (WebCore::SameSiteInfo::decode):
2594         * platform/network/cf/CookieJarCFNet.cpp:
2595         (WebCore::setCookiesFromDOM): Pass Same-Site info down.
2596         (WebCore::cookiesForDOM): Ditto.
2597         (WebCore::cookieRequestHeaderFieldValue): Ditto.
2598         (WebCore::getRawCookies): Ditto.
2599         * platform/network/cf/ResourceRequestCFNet.cpp:
2600         (WebCore::siteForCookies): Added.
2601         (WebCore::ResourceRequest::doUpdatePlatformRequest): Update platform request with same-site info.
2602         (WebCore::ResourceRequest::doUpdateResourceRequest): Ditto.
2603         * platform/network/cocoa/ResourceRequestCocoa.mm:
2604         (WebCore::ResourceRequest::doUpdateResourceRequest): Ditto.
2605         (WebCore::siteForCookies): Added.
2606         (WebCore::ResourceRequest::doUpdatePlatformRequest): Update platform request with same-site info.
2607         * platform/network/curl/CookieJarCurl.cpp:
2608         (WebCore::cookiesForDOM): Pass Same-Site info down.
2609         (WebCore::setCookiesFromDOM): Ditto.
2610         (WebCore::cookieRequestHeaderFieldValue): Ditto.
2611         (WebCore::getRawCookies): Ditto.
2612         * platform/network/curl/CookieJarCurl.h:
2613         * platform/network/curl/CookieJarCurlDatabase.cpp:
2614         (WebCore::CookieJarCurlDatabase::setCookiesFromDOM const): Ditto.
2615         (WebCore::CookieJarCurlDatabase::cookiesForDOM const): Ditto.
2616         (WebCore::CookieJarCurlDatabase::cookieRequestHeaderFieldValue const): Ditto.
2617         (WebCore::CookieJarCurlDatabase::getRawCookies const): Ditto.
2618         * platform/network/curl/CookieJarCurlDatabase.h:
2619         * platform/network/curl/ResourceHandleCurl.cpp:
2620         (WebCore::ResourceHandle::createCurlRequest): Ditto.
2621         * platform/network/mac/CookieJarMac.mm:
2622         (WebCore::cookiesForURL): Added; shared function to return the cookies based on the specified criterion. 
2623         (WebCore::setHTTPCookiesForURL): Moved from the bottom of the file to top to be closer to the other
2624         CFNetwork helper functions. Modified to support fetching same-site cookies.
2625         (WebCore::httpCookiesForURL): Moved to be under setHTTPCookiesForURL(). Modified to call cookiesForURL().
2626         Note the SPI used in cookiesForURL() apply the same criterion for whether to fetch secure cookies as we
2627         were computing here. That is, the CFNetwork SPI only returns secure cookies if the specified URL's scheme
2628         case-insensitively matches "https".
2629         (WebCore::cookiesInPartitionForURL): Wrote in terms of cookiesForURL().
2630         (WebCore::cookiesForSession): Pass the Same-Site info.
2631         (WebCore::cookiesForDOM): Ditto.
2632         (WebCore::cookieRequestHeaderFieldValue): Ditto.
2633         (WebCore::setCookiesFromDOM): Ditto.
2634         (WebCore::getRawCookies): Ditto.
2635         (WebCore::deleteCookie): Pass std::nullopt for the Same-Site info so that we do not consider the SameSite
2636         attribute when fetching cookies to delete.
2637         * platform/network/soup/CookieJarSoup.cpp:
2638         (WebCore::setCookiesFromDOM): Pass the Same-Site info.
2639         (WebCore::cookiesForDOM): Ditto.
2640         (WebCore::cookieRequestHeaderFieldValue): Ditto.
2641         (WebCore::getRawCookies): Ditto.
2642         * workers/service/context/ServiceWorkerThreadProxy.cpp:
2643         (WebCore::createPageForServiceWorker): Set the first party for same site cookies ("site for cookies") to
2644         the script URL.
2645         * xml/XSLTProcessor.cpp:
2646         (WebCore::XSLTProcessor::createDocumentFromSource): Copy the first party for same-site cookies to the
2647         new document.
2648
2649 2018-04-23  Youenn Fablet  <youenn@apple.com>
2650
2651         Make WebLoaderStrategy send to NetworkResourceLoader necessary parameters to handle full loads in NetworkProcess
2652         https://bugs.webkit.org/show_bug.cgi?id=184763
2653
2654         Reviewed by Chris Dumez.
2655
2656         No change of behavior yet since we do not use these parameters in NetworkProcess yet.
2657
2658         Add PreflightPolicy and CSP response headers as ResourceLoaderOptions.
2659         This allows passing them from DocumentThreadableLoader to WebLoaderStrategy.
2660
2661         Allow getting the original headers from a SubresourceLoader.
2662         This allows passing them from DocumentThreadableLoader down to WebLoaderStrategy.
2663
2664         * Modules/fetch/FetchLoader.cpp:
2665         (WebCore::FetchLoader::startLoadingBlobURL):
2666         (WebCore::FetchLoader::start):
2667         * loader/DocumentThreadableLoader.cpp:
2668         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
2669         (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest):
2670         (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest):
2671         * loader/ResourceLoaderOptions.h:
2672         * loader/SubresourceLoader.cpp:
2673         (WebCore::SubresourceLoader::originalHeaders const):
2674         * loader/SubresourceLoader.h:
2675         * loader/ThreadableLoader.cpp:
2676         (WebCore::ThreadableLoaderOptions::ThreadableLoaderOptions):
2677         (WebCore::ThreadableLoaderOptions::isolatedCopy const):
2678         * loader/ThreadableLoader.h:
2679         * page/EventSource.cpp:
2680         (WebCore::EventSource::connect):
2681         * xml/XMLHttpRequest.cpp:
2682         (WebCore::XMLHttpRequest::createRequest):
2683
2684 2018-04-23  Michael Catanzaro  <mcatanzaro@igalia.com>
2685
2686         [WPE][GTK] Remove WlUniquePtr<wl_display> footgun
2687         https://bugs.webkit.org/show_bug.cgi?id=184405
2688
2689         Reviewed by Carlos Garcia Campos.
2690
2691         WlUniquePtr<wl_display> is a pretty big footgun because there are two different destruction
2692         functions -- wl_display_disconnect() and wl_display_destroy() -- and which one you need to
2693         use depends on how the wl_display() was created, and WebKit uses both in different places.
2694         So WlUniquePtr<wl_display> is pretty unsafe. See bug #176490 for an example of fun caused
2695         by using it incorrectly.
2696
2697         Let's use std::unique_ptr with custom deleter functors instead.
2698
2699         * platform/graphics/wayland/WlUniquePtr.h:
2700
2701 2018-04-23  Antti Koivisto  <antti@apple.com>
2702
2703         REGRESSION (r220112): reCAPTCHA images render off screen on Twitch.tv app Log In or Sign Up
2704         https://bugs.webkit.org/show_bug.cgi?id=182859
2705         <rdar://problem/37595065>
2706
2707         Reviewed by Zalan Bujtas.
2708
2709         Roll out this change from the trunk as the issue it fixed no longer occurs.
2710
2711         * css/MediaQueryEvaluator.cpp:
2712         (WebCore::orientationEvaluate):
2713         (WebCore::aspectRatioEvaluate):
2714         (WebCore::heightEvaluate):
2715         (WebCore::widthEvaluate):
2716         * page/FrameView.cpp:
2717         (WebCore::FrameView::layoutSizeForMediaQuery const): Deleted.
2718         * page/FrameView.h:
2719         * page/LayoutContext.cpp:
2720         (WebCore::LayoutContext::handleLayoutWithFrameFlatteningIfNeeded):
2721
2722 2018-04-23  Daniel Bates  <dabates@apple.com>
2723
2724         Another attempt to fix the Windows build following r230921
2725         (https://bugs.webkit.org/show_bug.cgi?id=159464)
2726
2727         Pass dictionary key name using a string instead of a constant and pass CFURL* to
2728         siteForCookies().
2729
2730         * platform/network/cf/ResourceRequestCFNet.cpp:
2731         (WebCore::ResourceRequest::doUpdatePlatformRequest):
2732         (WebCore::ResourceRequest::doUpdateResourceRequest):
2733
2734 2018-04-23  Zalan Bujtas  <zalan@apple.com>
2735
2736         [LayoutFormattingContext] Initial commit.
2737         https://bugs.webkit.org/show_bug.cgi?id=184896
2738
2739         Reviewed by Antti Koivisto.
2740
2741         This is the initial commit of the new layout component -class definitions only (and mostly public functions).
2742         See the header files (and Tools/LayoutReloaded project) for more information.
2743
2744         // Top level layout.
2745         rootContainer = TreeBuilder::createLayoutTree(document);
2746         rootDisplayBox = new Display::Box();
2747         rootDisplayBox->setSize(viewportSize);
2748         layoutContext = new LayoutContext(rootContainer, rootDisplayBox);
2749         layoutContext->layout(rootContainer);
2750
2751         Driven by build time flag (currently off). Not testable yet.
2752
2753         * Configurations/FeatureDefines.xcconfig:
2754         * Sources.txt:
2755         * WebCore.xcodeproj/project.pbxproj:
2756         * layout/BlockFormatting/BlockFormattingContext.cpp: Added.
2757         * layout/BlockFormatting/BlockFormattingContext.h: Added.
2758         * layout/BlockFormatting/BlockFormattingState.cpp: Added.
2759         * layout/BlockFormatting/BlockFormattingState.h: Added.
2760         * layout/BlockFormatting/BlockMarginCollapse.cpp: Added.
2761         * layout/BlockFormatting/BlockMarginCollapse.h: Added.
2762         * layout/DisplayTree/DisplayBox.cpp: Added.
2763         * layout/DisplayTree/DisplayBox.h: Added.
2764         * layout/FloatingContext.cpp: Added.
2765         * layout/FloatingContext.h: Added.
2766         * layout/FloatingState.cpp: Added.
2767         * layout/FloatingState.h: Added.
2768         * layout/FormattingContext.cpp: Added.
2769         * layout/FormattingContext.h: Added.
2770         * layout/FormattingState.cpp: Added.
2771         * layout/FormattingState.h: Added.
2772         * layout/InlineFormatting/InlineFormattingContext.cpp: Added.
2773         * layout/InlineFormatting/InlineFormattingContext.h: Added.
2774         * layout/InlineFormatting/InlineFormattingState.cpp: Added.
2775         * layout/InlineFormatting/InlineFormattingState.h: Added.
2776         * layout/LayoutCtx.cpp: Added.
2777         * layout/LayoutCtx.h: Added.
2778         * layout/LayoutTree/LayoutBlockContainer.cpp: Added.
2779         * layout/LayoutTree/LayoutBlockContainer.h: Added.
2780         * layout/LayoutTree/LayoutBox.cpp: Added.
2781         * layout/LayoutTree/LayoutBox.h: Added.
2782         * layout/LayoutTree/LayoutContainer.cpp: Added.
2783         * layout/LayoutTree/LayoutContainer.h: Added.
2784         * layout/LayoutTree/LayoutCtx.h: Added.
2785         * layout/LayoutTree/LayoutInlineBox.cpp: Added.
2786         * layout/LayoutTree/LayoutInlineBox.h: Added.
2787         * layout/LayoutTree/LayoutInlineContainer.cpp: Added.
2788         * layout/LayoutTree/LayoutInlineContainer.h: Added.
2789
2790 2018-04-23  Daniel Bates  <dabates@apple.com>
2791
2792         Attempt to fix the Mac and iOS build after r230921
2793         (https://bugs.webkit.org/show_bug.cgi?id=159464)
2794
2795         Pass strings for the dictionary key names instead of using an extern constant as the
2796         latter may not be available on all systems.
2797
2798         * platform/network/mac/CookieJarMac.mm:
2799         (WebCore::setHTTPCookiesForURL):
2800
2801 2018-04-23  Daniel Bates  <dabates@apple.com>
2802
2803         Attempt to fix the build after r230921
2804         (https://bugs.webkit.org/show_bug.cgi?id=159464)
2805
2806         Pass Same-Site info through.
2807
2808         * platform/network/cf/CookieJarCFNet.cpp:
2809         (WebCore::cookieRequestHeaderFieldValue):
2810         * platform/network/curl/CookieJarCurl.cpp:
2811         (WebCore::cookieRequestHeaderFieldValue):
2812         * platform/network/curl/CookieJarCurlDatabase.cpp:
2813         (WebCore::CookieJarCurlDatabase::cookieRequestHeaderFieldValue const):
2814         * platform/network/soup/CookieJarSoup.cpp:
2815         (WebCore::cookieRequestHeaderFieldValue):
2816
2817 2018-04-23  Ryan Haddad  <ryanhaddad@apple.com>
2818
2819         Unreviewed, speculative macOS build fix attempt.
2820
2821         * Modules/mediasource/SourceBuffer.cpp:
2822         (WebCore::SourceBuffer::provideMediaData):
2823
2824 2018-04-23  Daniel Bates  <dabates@apple.com>
2825
2826         Implement Same-Site cookies
2827         https://bugs.webkit.org/show_bug.cgi?id=159464
2828         <rdar://problem/27196358>
2829
2830         Reviewed by Brent Fulgham.
2831
2832         Implements support for Same-Site cookies as per <https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00>.
2833         The implementation is materially consistent with the spec. though implements the computation
2834         for a document's "site for cookies" indirectly as part of loading its frame. This is done to
2835         avoid traversing the frame tree on each subresource request initiated by the document or one
2836         of its workers. We take advantage of the fact that Web Workers and Service Workers use their
2837         host document's loader to load resources on their behalf to use the correct "site for cookies"
2838         for requests (e.g. fetch()) initiating by them without the need to duplicate and store the
2839         host document's "site for cookies" in the worker's script execution context.
2840
2841         The implementation differs from the spec. in the handling of about: URLs and the empty URL
2842         and makes the implementation in WebKit match the behavior of Chrome and Firefox as well as
2843         consistent with origin inheritance as described in <https://html.spec.whatwg.org/multipage/browsers.html#origin>
2844         (16 April 2018). Specifically, requests to about:blank, about:srcdoc and the empty URL ("")
2845         are treated as same-site because these URLs inherit their origin from their owner.
2846
2847         Tests: http/tests/cookies/same-site/fetch-after-navigating-iframe-in-cross-origin-page.html
2848                http/tests/cookies/same-site/fetch-after-top-level-navigation-from-cross-origin-page.html
2849                http/tests/cookies/same-site/fetch-after-top-level-navigation-initiated-from-iframe-in-cross-origin-page.html
2850                http/tests/cookies/same-site/fetch-cookies-set-in-about-blank-iframe.html
2851                http/tests/cookies/same-site/fetch-in-about-blank-page.html
2852                http/tests/cookies/same-site/fetch-in-cross-origin-iframe.html
2853                http/tests/cookies/same-site/fetch-in-cross-origin-page.html
2854                http/tests/cookies/same-site/fetch-in-cross-origin-service-worker.html
2855                http/tests/cookies/same-site/fetch-in-cross-origin-worker.html
2856                http/tests/cookies/same-site/fetch-in-same-origin-page.html
2857                http/tests/cookies/same-site/fetch-in-same-origin-service-worker.html
2858                http/tests/cookies/same-site/fetch-in-same-origin-srcdoc-iframe.html
2859                http/tests/cookies/same-site/fetch-in-same-origin-worker.html
2860                http/tests/cookies/same-site/popup-cross-site-post.html
2861                http/tests/cookies/same-site/popup-cross-site.html
2862                http/tests/cookies/same-site/popup-same-site-post.html
2863                http/tests/cookies/same-site/popup-same-site-via-cross-site-redirect.html
2864                http/tests/cookies/same-site/popup-same-site-via-same-site-redirect.html
2865                http/tests/cookies/same-site/popup-same-site.html
2866
2867         * Sources.txt: Add source file SameSiteInfo.cpp.
2868         * WebCore.xcodeproj/project.pbxproj: Add source files SameSiteInfo.{cpp, h}.
2869         * dom/Document.cpp:
2870         (WebCore::Document::initSecurityContext): Modified to call SecurityPolicy::shouldInheritSecurityOriginFromOwner().
2871         (WebCore::Document::shouldInheritContentSecurityPolicyFromOwner const): Ditto.
2872         (WebCore::shouldInheritSecurityOriginFromOwner): Deleted; moved to SecurityPolicy.
2873         * dom/Document.h:
2874         (WebCore::Document::firstPartyForSameSiteCookies const): Added.
2875         (WebCore::Document::setFirstPartyForSameSiteCookies): Added.
2876         * loader/CookieJar.cpp:
2877         (WebCore::sameSiteInfo): Returns the same-site info for the request used to load the specified document.
2878         (WebCore::cookies): Pass the same-site info down to the platform.
2879         (WebCore::cookieRequestHeaderFieldProxy): Ditto.
2880         (WebCore::setCookies): Ditto.
2881         (WebCore::cookieRequestHeaderFieldValue): Ditto.
2882         (WebCore::getRawCookies): Ditto.
2883         * loader/DocumentLoader.cpp:
2884         (WebCore::DocumentLoader::willSendRequest): Add same-site info to the request.
2885         (WebCore::DocumentLoader::startLoadingMainResource): Update a FIXME comment to explain that
2886         we can simplify ResourceRequestBase if we can remove the call to addExtraFieldsToMainResourceRequest()
2887         here. Specifically, we would not need to differentiate between a request with an unspecified
2888         same-site state (default state of a new request) from a request whose same-site state has
2889         been explicitly set if we can assume that the same-site state of a request is set exactly
2890         once. In absence of this guarantee we need an "unspecified" state to avoid overriding existing
2891         same-site information computed with a null initiating document (the case of a new address bar
2892         initiated load) from a load initiated by the document associated with this loader.
2893         * loader/FrameLoader.cpp:
2894         (WebCore::FrameLoader::setFirstPartyForCookies): Modified to also update the first party for
2895         same-site cookies ("site for cookies").
2896         (WebCore::FrameLoader::load): Add same-site info to the request.
2897         (WebCore::FrameLoader::reload): Ditto.
2898         (WebCore::FrameLoader::setOriginalURLForDownloadRequest): Ditto.
2899         (WebCore::FrameLoader::addExtraFieldsToRequest): If the request does not already have
2900         same-site info then compute it and add it to the request. Mark main frame main resource
2901         requests as a "top-site".
2902         (WebCore::FrameLoader::addSameSiteInfoToRequestIfNeeded): Implements the "'Same-site' and 'cross-site'
2903         Requests" algorithm from <https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00#section-2.1>.
2904         (WebCore::createWindow): Add same-site info to the request.
2905         * loader/FrameLoader.h:
2906         * loader/ResourceLoader.cpp:
2907         (WebCore::ResourceLoader::init): Ditto.
2908         * page/DOMWindow.cpp:
2909         (WebCore::DOMWindow::createWindow): Ditto.
2910         * page/SecurityPolicy.cpp:
2911         (WebCore::SecurityPolicy::shouldInheritSecurityOriginFromOwner): Moved from Document.cpp.
2912         * page/SecurityPolicy.h:
2913         * platform/CookiesStrategy.h:
2914         * platform/network/CacheValidation.cpp:
2915         (WebCore::headerValueForVary): Pass the same-site info down to the platform.
2916         * platform/network/CookieRequestHeaderFieldProxy.h:
2917         (WebCore::CookieRequestHeaderFieldProxy::encode const): Encode same-site bits.
2918         (WebCore::CookieRequestHeaderFieldProxy::decode): Decode same-site bits.
2919         * platform/network/PlatformCookieJar.h:
2920         * platform/network/ResourceRequestBase.cpp:
2921         (WebCore::ResourceRequestBase::setAsIsolatedCopy): Added.
2922         (WebCore::ResourceRequestBase::isSameSite const): Added.
2923         (WebCore::ResourceRequestBase::setIsSameSite): Added.
2924         (WebCore::ResourceRequestBase::isTopSite const): Added.
2925         (WebCore::ResourceRequestBase::setIsTopSite): Added.
2926         (WebCore::equalIgnoringHeaderFields):
2927         * platform/network/ResourceRequestBase.h:
2928         (WebCore::ResourceRequestBase::isSameSiteUnspecified const): Added. See comment for DocumentLoader::startLoadingMainResource()
2929         for more details.
2930         (WebCore::registrableDomainsAreEqual): Added.
2931         (WebCore::ResourceRequestBase::encodeBase const): Encode same-site bits.
2932         (WebCore::ResourceRequestBase::decodeBase): Decode same-site bits.
2933         * platform/network/SameSiteInfo.cpp: Added.
2934         (WebCore::SameSiteInfo::create):
2935         * platform/network/SameSiteInfo.h: Added.
2936         (WebCore::SameSiteInfo::encode const):
2937         (WebCore::SameSiteInfo::decode):
2938         * platform/network/cf/CookieJarCFNet.cpp:
2939         (WebCore::setCookiesFromDOM): Pass Same-Site info down.
2940         (WebCore::cookiesForDOM): Ditto.
2941         (WebCore::cookieRequestHeaderFieldValue): Ditto.
2942         (WebCore::getRawCookies): Ditto.
2943         * platform/network/cf/ResourceRequestCFNet.cpp:
2944         (WebCore::siteForCookies): Added.
2945         (WebCore::ResourceRequest::doUpdatePlatformRequest): Update platform request with same-site info.
2946         (WebCore::ResourceRequest::doUpdateResourceRequest): Ditto.
2947         * platform/network/cocoa/ResourceRequestCocoa.mm:
2948         (WebCore::ResourceRequest::doUpdateResourceRequest): Ditto.
2949         (WebCore::siteForCookies): Added.
2950         (WebCore::ResourceRequest::doUpdatePlatformRequest): Update platform request with same-site info.
2951         * platform/network/curl/CookieJarCurl.cpp:
2952         (WebCore::cookiesForDOM): Pass Same-Site info down.
2953         (WebCore::setCookiesFromDOM): Ditto.
2954         (WebCore::cookieRequestHeaderFieldValue): Ditto.
2955         (WebCore::getRawCookies): Ditto.
2956         * platform/network/curl/CookieJarCurl.h:
2957         * platform/network/curl/CookieJarCurlDatabase.cpp:
2958         (WebCore::CookieJarCurlDatabase::setCookiesFromDOM const): Ditto.
2959         (WebCore::CookieJarCurlDatabase::cookiesForDOM const): Ditto.
2960         (WebCore::CookieJarCurlDatabase::cookieRequestHeaderFieldValue const): Ditto.
2961         (WebCore::CookieJarCurlDatabase::getRawCookies const): Ditto.
2962         * platform/network/curl/CookieJarCurlDatabase.h:
2963         * platform/network/curl/ResourceHandleCurl.cpp:
2964         (WebCore::ResourceHandle::createCurlRequest): Ditto.
2965         * platform/network/mac/CookieJarMac.mm:
2966         (WebCore::cookiesForURL): Added; shared function to return the cookies based on the specified criterion.
2967         (WebCore::setHTTPCookiesForURL): Moved from the bottom of the file to top to be closer to the other
2968         CFNetwork helper functions. Modified to support fetching same-site cookies.
2969         (WebCore::httpCookiesForURL): Moved to be under setHTTPCookiesForURL(). Modified to call cookiesForURL().
2970         Note the SPI used in cookiesForURL() apply the same criterion for whether to fetch secure cookies as we
2971         were computing here. That is, the CFNetwork SPI only returns secure cookies if the specified URL's scheme
2972         case-insensitively matches "https".
2973         (WebCore::cookiesInPartitionForURL): Wrote in terms of cookiesForURL().
2974         (WebCore::cookiesForSession): Pass the Same-Site info.
2975         (WebCore::cookiesForDOM): Ditto.
2976         (WebCore::cookieRequestHeaderFieldValue): Ditto.
2977         (WebCore::setCookiesFromDOM): Ditto.
2978         (WebCore::getRawCookies): Ditto.
2979         (WebCore::deleteCookie): Pass std::nullopt for the Same-Site info so that we do not consider the SameSite
2980         attribute when fetching cookies to delete.
2981         * platform/network/soup/CookieJarSoup.cpp:
2982         (WebCore::setCookiesFromDOM): Pass the Same-Site info.
2983         (WebCore::cookiesForDOM): Ditto.
2984         (WebCore::cookieRequestHeaderFieldValue): Ditto.
2985         (WebCore::getRawCookies): Ditto.
2986         * workers/service/context/ServiceWorkerThreadProxy.cpp:
2987         (WebCore::createPageForServiceWorker): Set the first party for same site cookies ("site for cookies") to
2988         the script URL.
2989         * xml/XSLTProcessor.cpp:
2990         (WebCore::XSLTProcessor::createDocumentFromSource): Copy the first party for same-site cookies to the
2991         new document.
2992
2993 2018-04-23  Chris Dumez  <cdumez@apple.com>
2994
2995         HTML String load cannot be prevented by responding 'Cancel' asynchronously in decidePolicyForNavigationAction
2996         https://bugs.webkit.org/show_bug.cgi?id=184848
2997         <rdar://problem/39145306>
2998
2999         Reviewed by Brady Eidson.
3000
3001         When calling loadHTMLString on a WebView, we end up doing a load for 'about:blank'
3002         with substitute data. In such case, we want to do a regular asynchronous policy
3003         delegate check, there is no reason we need it to be synchronous. Update our check
3004         to make sure we only do a synchronous policy check for initial 'about:blank' loads
3005         that do not have substitute data.
3006
3007         * loader/PolicyChecker.cpp:
3008         (WebCore::PolicyChecker::checkNavigationPolicy):
3009
3010 2018-04-23  Wenson Hsieh  <wenson_hsieh@apple.com>
3011
3012         [Extra zoom mode] 100vw is roughly half of the viewport width in extra zoom mode
3013         https://bugs.webkit.org/show_bug.cgi?id=184871
3014         <rdar://problem/39477595>
3015
3016         Reviewed by Andy Estes.
3017
3018         Currently, when computing CSS viewport units, we use ViewportConfiguration::initialScaleIgnoringContentSize().
3019         This method computes an initial scale from the layout width and height without relying on any information
3020         derived from the current content size. This is done to ensure that the content size and viewport dimensions for
3021         CSS viewport units should not be simultaneously dependent on each other.
3022
3023         Since shrink-to-fit heuristics depend on content size, we currently assume that shrink-to-fit is disabled when
3024         computing initialScaleIgnoringContentSize, by always passing in `false` for `shouldIgnoreScalingConstraints`.
3025         However, in extra zoom mode, the opposite is true: since we force both `m_canIgnoreScalingConstraints` and
3026         `m_forceHorizontalShrinkToFit` to be `true` in this mode, we will always try to shrink-to-fit regardless of
3027         content size.
3028
3029         Because of this shrink-to-fit disparity between `initialScale` and `initialScaleIgnoringContentSize`, viewport
3030         units in extra zoom mode are currently computed assuming an initial scale set by the page, whereas the real
3031         viewport is scaled to fit, which causes any lengths computed in terms of vw and vh to be incorrect. To fix this,
3032         we introduce a version of shouldIgnoreScalingConstraints() that returns `true` iff scaling constraints are
3033         always ignored, regardless of content size. We then use this in initialScaleIgnoringContentSize, instead of
3034         always passing in `false` for `shouldIgnoreScalingConstraints`.
3035
3036         Test: fast/css/extrazoom/viewport-units-shrink-to-fit.html
3037
3038         * page/ViewportConfiguration.cpp:
3039         (WebCore::ViewportConfiguration::shouldIgnoreScalingConstraintsRegardlessOfContentSize const):
3040         (WebCore::ViewportConfiguration::initialScaleIgnoringContentSize const):
3041         * page/ViewportConfiguration.h:
3042
3043 2018-04-23  Zalan Bujtas  <zalan@apple.com>
3044
3045         [Simple line layout] Generate inline boxtree using simple line layout runs.
3046         https://bugs.webkit.org/show_bug.cgi?id=184833
3047
3048         Reviewed by Antti Koivisto.
3049
3050         RenderBlockFlow::ensureLineBoxes triggers line layout on the block content to replace
3051         the simple line layout runs with an inline boxtree. The runs generated by the fast path
3052         should always match the inline tree boxes.
3053         In this patch instead of triggering layout, we just convert the simple line runs to
3054         inline boxes.
3055         Currently, it works with only one, non-paginated text renderer, but we should be
3056         able to extend it to all the simple line layout content.   
3057
3058         Covered by existing tests.
3059
3060         * rendering/InlineBox.h:
3061         (WebCore::InlineBox::setHasHyphen):
3062         (WebCore::InlineBox::setCanHaveLeadingExpansion):
3063         (WebCore::InlineBox::setCanHaveTrailingExpansion):
3064         (WebCore::InlineBox::setForceTrailingExpansion):
3065         (WebCore::InlineBox::setForceLeadingExpansion):
3066         (WebCore::InlineBox::hasHyphen const):
3067         (WebCore::InlineBox::canHaveLeadingExpansion const):
3068         (WebCore::InlineBox::canHaveTrailingExpansion const):
3069         (WebCore::InlineBox::forceTrailingExpansion const):
3070         * rendering/RenderBlockFlow.cpp:
3071         (WebCore::RenderBlockFlow::ensureLineBoxes):
3072         * rendering/RenderBlockFlow.h:
3073         * rendering/SimpleLineLayoutFlowContents.h:
3074         (WebCore::SimpleLineLayout::FlowContents::segmentForRun const):
3075         * rendering/SimpleLineLayoutFunctions.cpp:
3076         (WebCore::SimpleLineLayout::canUseForLineBoxTree):
3077         (WebCore::SimpleLineLayout::initializeInlineBox):
3078         (WebCore::SimpleLineLayout::generateLineBoxTree):
3079         * rendering/SimpleLineLayoutFunctions.h:
3080         * rendering/SimpleLineLayoutResolver.cpp:
3081         (WebCore::SimpleLineLayout::RunResolver::rangeForLine const):
3082         * rendering/SimpleLineLayoutResolver.h:
3083
3084 2018-04-23  Zan Dobersek  <zdobersek@igalia.com>
3085
3086         [CoordGraphics] Remove unused trajectory cruft in CoordinatedLayerTreeHost, CoordinatedGraphicsLayer
3087         https://bugs.webkit.org/show_bug.cgi?id=184881
3088
3089         Reviewed by Michael Catanzaro.
3090
3091         Remove the redundant findFirstDescendantWithContentsRecursively() and
3092         setVisibleContentRectTrajectoryVector() methods on the
3093         CoordinatedGraphicsLayer class.
3094
3095         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
3096         (WebCore::CoordinatedGraphicsLayer::findFirstDescendantWithContentsRecursively): Deleted.
3097         (WebCore::CoordinatedGraphicsLayer::setVisibleContentRectTrajectoryVector): Deleted.
3098         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
3099
3100 2018-04-23  Zan Dobersek  <zdobersek@igalia.com>
3101
3102         [CoordGraphics] TiledBackingStore unnecessarily tracks alpha support value
3103         https://bugs.webkit.org/show_bug.cgi?id=184880
3104
3105         Reviewed by Michael Catanzaro.
3106
3107         Drop the m_supportsAlpha member from the TiledBackingStore class. The
3108         member value was unused. TiledBackingStore::setSupportsAlpha() method
3109         is removed.
3110
3111         TiledBackingStore::setSupportsAlpha() invalidated the backing store,
3112         so CoordinatedGraphicsLayer::setContentsOpaque() now enforces the same
3113         behavior by manually updating the m_needsDisplay struct. This means
3114         that during the following layer flush the backing store is repainted
3115         in its entirety.
3116
3117         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
3118         (WebCore::CoordinatedGraphicsLayer::setContentsOpaque):
3119         (WebCore::CoordinatedGraphicsLayer::createBackingStore):
3120         * platform/graphics/texmap/coordinated/TiledBackingStore.cpp:
3121         (WebCore::TiledBackingStore::TiledBackingStore):
3122         (WebCore::TiledBackingStore::setSupportsAlpha): Deleted.
3123         * platform/graphics/texmap/coordinated/TiledBackingStore.h:
3124
3125 2018-04-23  Thibault Saunier  <tsaunier@igalia.com>
3126
3127         [GStreamer] Start implementing Audio/VideoTrackPrivateGSTreamer::kind method
3128         https://bugs.webkit.org/show_bug.cgi?id=184650
3129
3130         Reviewed by Philippe Normand.
3131
3132         In the playbin3 case we can assume that if the GstStream is selected by default,
3133         it is the Main track of that kind.
3134
3135         No new tests are added as:
3136             * It relies on playbin3 case which support might be compiled out
3137             * we already have a few test that are currently disabled in the mediastream
3138               testsuite. This patch is part of the work to enable them.
3139
3140         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp:
3141         (WebCore::AudioTrackPrivateGStreamer::kind const):
3142         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h:
3143         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp:
3144         (WebCore::VideoTrackPrivateGStreamer::kind const):
3145         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h:
3146
3147 2018-04-23  Alicia Boya García  <aboya@igalia.com>
3148
3149         [MSE] Add allSamplesInTrackEnqueued event
3150         https://bugs.webkit.org/show_bug.cgi?id=184737
3151
3152         MediaSource has a .endOfStream() method to signal when there are no more frames
3153         after the ones currently buffered.
3154
3155         This bit of data is important for some multimedia frameworks. For instance, in
3156         GStreamer a stream of frames being decoded should be terminated by a
3157         'end-of-stream' (EOS) event that has a similar meaning. Some GStreamer elements
3158         will expect this event in order to work properly under some circumstances.
3159
3160         Unfortunately currently WebKit provides no mechanism for this: an event of
3161         sorts should be emitted after no more frames are going to be enqueued to signal
3162         the end of the stream. The closest mechanism WebKit has for this is
3163         `markEndOfStream()`, but it's not exactly the same: markEndOfStream() informs
3164         that -- as far as network buffering is concerned -- we are done; but at that
3165         point there may still be (and often are) many frames waiting in the
3166         decodeQueue, so it would be wrong to signal the decoder that there are no more
3167         frames.
3168
3169         This patch introduces a new optional method in SourceBufferPrivate,
3170         `allSamplesInTrackEnqueued(const AtomicString& trackID)` that is called
3171         whenever the MediaSource is in "ended" state (the user has called
3172         `MediaSource.endOfStream()`) and the decodeQueue is empty. Media framework
3173         implementations can use this method to send a EOS event to a decoder that needs
3174         it.
3175
3176         Reviewed by Xabier Rodriguez-Calvar.
3177
3178         * Modules/mediasource/MediaSource.cpp:
3179         (WebCore::MediaSource::streamEndedWithError):
3180         * Modules/mediasource/SourceBuffer.cpp:
3181         (WebCore::SourceBuffer::provideMediaData):
3182         (WebCore::SourceBuffer::trySignalAllSamplesInTrackEnqueued):
3183         (WebCore::SourceBuffer::trySignalAllSamplesEnqueued):
3184         * Modules/mediasource/SourceBuffer.h:
3185         * platform/graphics/SourceBufferPrivate.h:
3186         (WebCore::SourceBufferPrivate::allSamplesInTrackEnqueued):
3187         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
3188         (WebCore::MediaSourceClientGStreamerMSE::allSamplesInTrackEnqueued):
3189         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h:
3190         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
3191         (WebCore::PlaybackPipeline::allSamplesInTrackEnqueued):
3192         * platform/graphics/gstreamer/mse/PlaybackPipeline.h:
3193         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp:
3194         (WebCore::SourceBufferPrivateGStreamer::allSamplesInTrackEnqueued):
3195         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h:
3196
3197 2018-04-23  Ms2ger  <Ms2ger@igalia.com>
3198
3199         Avoid uninitialized memory read.
3200         https://bugs.webkit.org/show_bug.cgi?id=184505
3201         <rdar://problem/39348325>
3202
3203         Reviewed by Dean Jackson.
3204
3205         Test: imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-bounds.html
3206
3207         * html/ImageBitmap.cpp:
3208         (WebCore::croppedSourceRectangleWithFormatting):
3209
3210 2018-04-23  Zan Dobersek  <zdobersek@igalia.com>
3211
3212         [TexMap] Drop RefCounted inheritance off of TextureMapperBackingStore
3213         https://bugs.webkit.org/show_bug.cgi?id=184810
3214
3215         Reviewed by Carlos Garcia Campos.
3216
3217         Turn TextureMapperBackingStore into a simple interface that doesn't
3218         inherit from RefCounted<>. Instead, push that inheritance off to the
3219         classes that implement the TextureMapperBackingStore interface. This
3220         narrows down the purpose of TextureMapperBackingStore towards a simple
3221         interface that TextureMapper algorithms can work with.
3222
3223         TextureMapperLayer has its m_backingStore member variable turn into
3224         a simple pointer instead of a RefPtr<>. Setter method and call sites of
3225         that method are updated to reflect that.
3226
3227         TextureMapperTiledBackingStore now inherits from RefCounted<> directly,
3228         instead of through TextureMapperBackingStore.
3229
3230         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
3231         (WebCore::GraphicsLayerTextureMapper::commitLayerChanges):
3232         (WebCore::GraphicsLayerTextureMapper::updateBackingStoreIfNeeded):
3233         * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
3234         * platform/graphics/texmap/TextureMapperBackingStore.h:
3235         * platform/graphics/texmap/TextureMapperLayer.cpp:
3236         (WebCore::TextureMapperLayer::setBackingStore):
3237         * platform/graphics/texmap/TextureMapperLayer.h:
3238         * platform/graphics/texmap/TextureMapperTiledBackingStore.h:
3239
3240 2018-04-22  Zan Dobersek  <zdobersek@igalia.com>
3241
3242         [AsyncScrolling] Add generic ScrollingThread implementation
3243         https://bugs.webkit.org/show_bug.cgi?id=184809
3244
3245         Reviewed by Yusuke Suzuki.
3246
3247         Add a generic ScrollingThread implementation that internally uses
3248         RunLoop facilities to run the scrolling thread and dispatch
3249         callbacks on that thread.
3250
3251         ScrollingThread::initializeRunLoop() retrieves address of the
3252         thread-specific RunLoop and signals the Condition object.
3253         ScrollingThread::wakeUpRunLoop() uses RunLoop::dispatch() to schedule
3254         callback dispatches on the scrolling thread.
3255
3256         ScrollingThread::createThreadIfNeeded() mimics Cocoa implementation and
3257         waits for the RunLoop address to be retrieved before continuing.
3258
3259         * SourcesGTK.txt: Add to build.
3260         * SourcesWPE.txt: Ditto.
3261         * page/scrolling/ScrollingThread.cpp:
3262         (WebCore::ScrollingThread::createThreadIfNeeded):
3263         * page/scrolling/ScrollingThread.h:
3264         * page/scrolling/generic/ScrollingThreadGeneric.cpp: Added.
3265         (WebCore::ScrollingThread::initializeRunLoop):
3266         (WebCore::ScrollingThread::wakeUpRunLoop):
3267
3268 2018-04-22  Zan Dobersek  <zdobersek@igalia.com>
3269
3270         [CoordinatedGraphics] Unused contentsSize, coveredRect attributes in CoordinatedGraphicsState
3271         https://bugs.webkit.org/show_bug.cgi?id=184811
3272
3273         Reviewed by Carlos Garcia Campos.
3274
3275         Remove the unused contentsSize and coveredRect attributes on the
3276         CoordinatedGraphicsState struct. CoordinatedGraphicsLayer::coverRect()
3277         method is now unused and can also be removed.
3278
3279         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
3280         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
3281
3282 2018-04-21  Daniel Bates  <dabates@apple.com>
3283
3284         Cleanup CookieRequestHeaderFieldProxy
3285         https://bugs.webkit.org/show_bug.cgi?id=184868
3286
3287         Remove extraneous whitespace that I inadvertently added.
3288
3289         * platform/network/CookieRequestHeaderFieldProxy.h:
3290         (WebCore::CookieRequestHeaderFieldProxy::decode):
3291
3292 2018-04-21  Daniel Bates  <dabates@apple.com>
3293
3294         Cleanup CookieRequestHeaderFieldProxy
3295         https://bugs.webkit.org/show_bug.cgi?id=184868
3296
3297         Reviewed by Youenn Fablet.
3298
3299         Simplify the struct CookieRequestHeaderFieldProxy and make it consistent with other structs.
3300         Among other changes, remove constructors for CookieRequestHeaderFieldProxy as they are
3301         unnecessary as all supported compilers support non-static data member initializers (NSDMI)
3302         for aggregates, remove prefix "m_" from the name of fields as this is struct exists for
3303         convenience and offers no encapsulation and simplify decoding logic of this struct.
3304
3305         No functionality changed. So, no new tests.
3306
3307         * loader/CookieJar.cpp:
3308         (WebCore::cookieRequestHeaderFieldProxy):
3309         * platform/network/CookieRequestHeaderFieldProxy.h:
3310         (WebCore::CookieRequestHeaderFieldProxy::encode const):
3311         (WebCore::CookieRequestHeaderFieldProxy::decode):
3312         (WebCore::CookieRequestHeaderFieldProxy::CookieRequestHeaderFieldProxy): Deleted.
3313         * platform/network/SocketStreamHandleImpl.cpp:
3314         (WebCore::cookieDataForHandshake):
3315         * platform/network/cf/CookieJarCFNet.cpp:
3316         (WebCore::cookieRequestHeaderFieldValue):
3317         * platform/network/curl/CookieJarCurl.cpp:
3318         (WebCore::cookieRequestHeaderFieldValue):
3319         * platform/network/curl/CookieJarCurlDatabase.cpp:
3320         (WebCore::CookieJarCurlDatabase::cookieRequestHeaderFieldValue const):
3321         * platform/network/mac/CookieJarMac.mm:
3322         (WebCore::cookieRequestHeaderFieldValue):
3323         * platform/network/soup/CookieJarSoup.cpp:
3324         (WebCore::cookieRequestHeaderFieldValue):
3325
3326 2018-04-21  Antoine Quint  <graouts@apple.com>
3327
3328         [Modern Media Controls] Show a loading indicator after pressing the play button in compact mode
3329         https://bugs.webkit.org/show_bug.cgi?id=184863
3330         <rdar://problem/38939468>
3331
3332         Reviewed by Dean Jackson.
3333
3334         We now display a loading indicator after pressing the play button when in compact mode. We also update the
3335         behavior to use assets provided through WebKitAdditions (see webkit.org/b/184862) for the play button and
3336         the invalid icon. Additionally, we always show a 20% opaque black overlay in the background while any piece
3337         of user interface is up.
3338
3339         * Modules/modern-media-controls/controls/compact-activity-indicator.css: Added.
3340         (button.compact-activity-indicator > picture): The loading indicator asset is a sprite made of 23 frames, so
3341         we specify the mask size (since all buttons are rendered via a mask) to be 23 * 100% the rendered size. The
3342         display of the loading indicator is performed with a first intro animation which runs once through the first
3343         8 frames and then a continuously looping animation going through the remaining frames. We use a frames()
3344         timing function to achieve the frame-by-frame effect while using only from/to keyframe animations. When we
3345         fade out, we use a simply opacity fade, which is combined with the spinning animation. We use CSS variables
3346         to encode both animations so they can be used combined or one at a time without redefining the whole animation
3347         property.
3348         (button.compact-activity-indicator.spins > picture): Use the "spins" animation variable when spinning.
3349         (button.compact-activity-indicator.spins.fades-out > picture): Combine the "spins" and "fades-out" animation
3350         variables when fading out.
3351         (@keyframes compact-activity-indicator-intro): Animation going through the first 8 frames of the loading indicator.
3352         (@keyframes compact-activity-indicator-loop): Animation going through the remaining frames of the loading indicator.
3353         (@keyframes compact-activity-indicator-fades-out): Animation fading opacity from 1 to 0.
3354         * Modules/modern-media-controls/controls/compact-activity-indicator.js: Added.
3355         (CompactActivityIndicator):
3356         (CompactActivityIndicator.prototype.show): Add the "spins" CSS class to show the control spinning with the intro animation.
3357         (CompactActivityIndicator.prototype.hide): Add the "fades-out" CSS class to hide the control, removing both this class and
3358         the "spins" class when the fade-out animation completes.
3359         * Modules/modern-media-controls/controls/compact-media-controls.css: Added.
3360         (.media-controls.compact:before): Add a 20% black overlay over the video frame to provide contrast for controls.
3361         (.media-controls.compact button): Ensure buttons are sized to use the entire video frame so that their hit region
3362         comprises the whole video frame.