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