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