[Streams API] Support the start function parameter in ReadableStream constructor
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2015-04-08  Xabier Rodriguez Calvar  <calvaris@igalia.com> and Youenn Fablet  <youenn.fablet@crf.canon.fr>
2
3         [Streams API] Support the start function parameter in ReadableStream constructor
4         https://bugs.webkit.org/show_bug.cgi?id=141160
5
6         Reviewed by Benjamin Poulain.
7
8         Stores the JS source object in ReadableStreamJSSource and calls its "start" function.
9         This function takes a controller object that has three JS functions as members: close, enqueue and error.
10         This controller is stored in ReadableStreamJSSource as it will be reused as "pull" parameter.
11         All three JS functions do not currently do anything.
12
13         Test: streams/readablestream-start.html
14
15         * Modules/streams/ReadableStream.cpp:
16         (WebCore::ReadableStream::start): Place holder for step 11 of https://streams.spec.whatwg.org/#rs-constructor.
17         * Modules/streams/ReadableStream.h:
18         * bindings/js/JSReadableStreamCustom.cpp:
19         (WebCore::constructJSReadableStream):
20         * bindings/js/ReadableStreamJSSource.cpp:
21         (WebCore::getPropertyFromObject): Helper function to get a public property from an object.
22         (WebCore::setPropertyToObject): Helper function to set a public property to an object.
23         (WebCore::callFunction): Helper function to call a JS function from C++.
24         (WebCore::ReadableStreamJSSource::ReadableStreamJSSource):
25         (WebCore::notImplementedFunction):
26         (WebCore::createReadableStreamEnqueueFunction): Creates the JS function for enqueue.
27         (WebCore::createReadableStreamCloseFunction): Creates the JS function for close.
28         (WebCore::createReadableStreamErrorFunction): Creates the JS function for error.
29         (WebCore::startReadableStreamAsync): Equivalent of promise resolution for start.
30         (WebCore::ReadableStreamJSSource::start): Calls the "start" function of the JS source with all three JS functions (enqueue, close, error) as parameters.
31         * bindings/js/ReadableStreamJSSource.h:
32
33 2015-04-08  Brent Fulgham  <bfulgham@apple.com>
34
35         [Mac] Unreviewed test fix after r182584
36         https://bugs.webkit.org/show_bug.cgi?id=143452
37
38         Correct bit comparison to use the correct value for the Control-key
39
40         * platform/mac/PlatformEventFactoryMac.mm:
41         (WebCore::typeForEvent):
42
43 2015-04-08  Simon Fraser  <simon.fraser@apple.com>
44
45         Add a debug assertion that will fire if we try to paint layer contents on a background thread
46         https://bugs.webkit.org/show_bug.cgi?id=143547
47
48         Reviewed by Alexey Proskuryakov.
49
50         New assertion to catch cases where other frameworks erroneously trigger painting
51         on a non-main (or non-Web) thread.
52
53         * platform/graphics/mac/WebLayer.mm:
54         (-[WebSimpleLayer display]):
55         (-[WebSimpleLayer drawInContext:]):
56
57 2015-04-08  Brent Fulgham  <bfulgham@apple.com>
58
59         [Mac] WebKit is not honoring OS preferences for secondary click behaviors
60         https://bugs.webkit.org/show_bug.cgi?id=143452
61         <rdar://problem/20437483>
62
63         Reviewed by Tim Horton.
64
65         We cannot rely on the event's button number to decide behavior. The OS settings might have
66         mapped middle button to context menu, etc. Instead, we should ask the OS (via NSMenu) what
67         the proper button press behavior is.
68
69         * platform/mac/PlatformEventFactoryMac.mm:
70         (WebCore::mouseButtonForEvent): Ask NSMenu what kind of button press we have received.
71
72 2015-04-08  Michael Catanzaro  <mcatanzaro@igalia.com>
73
74         Fix -Wformat in AnimationBase.cpp
75         https://bugs.webkit.org/show_bug.cgi?id=143541
76
77         Reviewed by Simon Fraser.
78
79         * page/animation/AnimationBase.cpp:
80         (WebCore::nameForStateInput): Added. Converts an AnimationBase::AnimationStateInput to a
81         string.
82         (WebCore::AnimationBase::updateStateMachine): Print AnimationBase::AnimationStateInput as a
83         string, instead of passing it to %d and assuming that works, to silence GCC's -Wformat.
84
85 2015-04-08  Brady Eidson  <beidson@apple.com>
86
87         Expose the "Share" menu for links, images, and media.
88         <rdar://problem/20435340> and https://bugs.webkit.org/show_bug.cgi?id=143502
89
90         Reviewed by Tim Horton.
91
92         * loader/EmptyClients.h:
93         * page/ContextMenuClient.h:
94         (WebCore::ContextMenuClient::shareSelectedTextMenuItem): Deleted.
95
96         * page/ContextMenuController.cpp:
97         (WebCore::ContextMenuController::populate):
98         (WebCore::selectionContainsPossibleWord): Deleted.
99         * page/ContextMenuController.h:
100         (WebCore::ContextMenuController::page):
101
102         * platform/ContextMenuItem.cpp:
103         (WebCore::ContextMenuItem::ContextMenuItem):
104         (WebCore::ContextMenuItem::isNull):
105         (WebCore::ContextMenuItem::shareMenuItem):
106         (WebCore::ContextMenuItem::supportsShareMenu): Deleted.
107         (WebCore::ContextMenuItem::shareSelectedTextMenuItem): Deleted.
108         * platform/ContextMenuItem.h:
109
110         * platform/gtk/ContextMenuItemGtk.cpp:
111         (WebCore::ContextMenuItem::shareMenuItem): Return a null item.
112         (WebCore::ContextMenuItem::supportsShareMenu): Deleted.
113         (WebCore::ContextMenuItem::shareSelectedTextMenuItem): Deleted.
114
115         * platform/mac/ContextMenuItemMac.mm:
116         (WebCore::ContextMenuItem::shareMenuItem): Create a full-featured Share menu item instead of just for selected text.
117         (WebCore::ContextMenuItem::supportsShareMenu): Deleted.
118         (WebCore::ContextMenuItem::shareSelectedTextMenuItem): Deleted.
119
120         * rendering/HitTestResult.cpp:
121         (WebCore::HitTestResult::selectedText): Instead of calculating selected text outside the HitTestResult, let the
122           HitTestResult do what it does best: Calculate things!
123         * rendering/HitTestResult.h:
124
125 2015-04-08  Per Arne Vollan  <peavo@outlook.com>
126
127         [Curl] Compile error in CurlCacheEntry::parseResponseHeaders method.
128         https://bugs.webkit.org/show_bug.cgi?id=143531
129
130         Reviewed by Alex Christensen.
131
132         Cache related methods in ResourceResponse have changed return type.
133
134         * platform/network/curl/CurlCacheEntry.cpp:
135         (WebCore::CurlCacheEntry::parseResponseHeaders):
136
137 2015-04-08  Anders Carlsson  <andersca@apple.com>
138
139         Remove ApplicationCacheGroup::m_isCopy
140         https://bugs.webkit.org/show_bug.cgi?id=143536
141
142         Reviewed by Tim Horton.
143
144         Code that used to set m_isCopy to true is long gone.
145
146         * loader/appcache/ApplicationCache.cpp:
147         (WebCore::ApplicationCache::~ApplicationCache):
148         * loader/appcache/ApplicationCacheGroup.cpp:
149         (WebCore::ApplicationCacheGroup::ApplicationCacheGroup):
150         (WebCore::ApplicationCacheGroup::~ApplicationCacheGroup):
151         * loader/appcache/ApplicationCacheGroup.h:
152         (WebCore::ApplicationCacheGroup::isCopy): Deleted.
153
154 2015-04-08  Anders Carlsson  <andersca@apple.com>
155
156         Delete ApplicationCache static member functions
157         https://bugs.webkit.org/show_bug.cgi?id=143534
158
159         Reviewed by Tim Horton.
160
161         * loader/appcache/ApplicationCache.cpp:
162         (WebCore::ApplicationCache::deleteCacheForOrigin): Deleted.
163         (WebCore::ApplicationCache::deleteAllCaches): Deleted.
164         (WebCore::ApplicationCache::diskUsageForOrigin): Deleted.
165         * loader/appcache/ApplicationCache.h:
166
167 2015-04-08  Alex Christensen  <achristensen@webkit.org>
168
169         Block popups from content extensions.
170         https://bugs.webkit.org/show_bug.cgi?id=143497
171
172         Reviewed by Brady Eidson.
173
174         Test: http/tests/contentextensions/popups.html
175
176         * loader/ResourceLoadInfo.cpp:
177         (WebCore::readResourceType):
178         * loader/ResourceLoadInfo.h:
179         * page/DOMWindow.cpp:
180         (WebCore::DOMWindow::open):
181         * page/UserContentController.cpp:
182         (WebCore::UserContentController::actionsForResourceLoad):
183         * page/UserContentController.h:
184         Check content extensions before opening a window.
185
186 2015-04-08  Bem Jones-Bey  <bjonesbe@adobe.com>
187
188         [CSS Shapes] Properly handle negative reference box widths and center coordinates
189         https://bugs.webkit.org/show_bug.cgi?id=142610
190
191         Reviewed by Rob Buis.
192
193         Fix a few cases where values that should not be negative end up that
194         way.
195
196         This patch is based on a couple of Blink patches by Rob Buis.
197
198         Tests: fast/shapes/shape-outside-floats/shape-outside-floats-circle-negative-radius-crash.html
199                fast/shapes/shape-outside-floats/shape-outside-floats-ellipse-negative-width-crash.html
200
201         * rendering/shapes/ShapeOutsideInfo.cpp:
202         (WebCore::ShapeOutsideInfo::computeDeltasForContainingBlockLine): A
203             negative margin box width means that the shape has no extent, so
204             clamp to zero.
205         * rendering/style/BasicShapes.cpp:
206         (WebCore::BasicShapeCircle::floatValueForRadiusInBox): When computing
207             the radii, take the absolute value, since the radii is based on
208             the distance, which is always positive.
209         (WebCore::BasicShapeEllipse::floatValueForRadiusInBox): Ditto.
210
211 2015-04-08  Commit Queue  <commit-queue@webkit.org>
212
213         Unreviewed, rolling out r182522.
214         https://bugs.webkit.org/show_bug.cgi?id=143529
215
216         Not needed any more (Requested by ap on #webkit).
217
218         Reverted changeset:
219
220         "Fix the build."
221         http://trac.webkit.org/changeset/182522
222
223 2015-04-08  Beth Dakin  <bdakin@apple.com>
224
225         Force events should not require preventDefault in order to fire
226         https://bugs.webkit.org/show_bug.cgi?id=143503
227         -and corresponding-
228         rdar://problem/20458916
229
230         Reviewed by Tim Horton.
231
232         Since these events will fire whether or not preventDefault was set on the 
233         willBegin event, we should make sure we only send them when there are registered 
234         event listeners. These are new events, so we don’t want to spam the vast majority 
235         of web content that doesn’t use them yet.
236         * dom/Document.cpp:
237         (WebCore::Document::addListenerTypeIfNeeded):
238         * dom/Document.h:
239         * dom/Element.cpp:
240         (WebCore::Element::dispatchMouseForceWillBegin):
241         (WebCore::Element::dispatchMouseForceChanged):
242         (WebCore::Element::dispatchMouseForceDown):
243         (WebCore::Element::dispatchMouseForceUp):
244         (WebCore::Element::dispatchMouseForceClick):
245         (WebCore::Element::dispatchMouseForceCancelled):
246
247 2015-04-08  Jer Noble  <jer.noble@apple.com>
248
249         [Mac][WebAudio] Update the AVAudioMix in the AudioSourceProviderAVFObjC when the list of enabled audio tracks change.
250         https://bugs.webkit.org/show_bug.cgi?id=143332
251
252         Reviewed by Eric Carlson.
253
254         Some media assets (notably, mp3s) will not have an enabled audio track when the AVAsset is
255         first loaded, so the AVAudioMix will have no trackID in it's parameters. Whenever the list
256         of enabled tracks change, recreate the AVAudioMix with the new first enabled audio trackID.
257
258         To facilitate this, add a new setter to AudioSourceProviderAVFObjC taking an AVAssetTrack to
259         use with the AVAudioMix. Whenever this parameter changes, the AVAudioMix is destroyed and
260         recreated.
261
262         * html/HTMLMediaElement.cpp:
263         (WebCore::HTMLMediaElement::mediaPlayerEngineUpdated): Drive-by fix: when the media
264             player switches engines, re-associate the audio source node with its provider.
265         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.h:
266         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
267         (WebCore::AudioSourceProviderAVFObjC::setPlayerItem): Only create the mix if there is a valid AVPlayerItem and AVAssetTrack
268         (WebCore::AudioSourceProviderAVFObjC::setAudioTrack): Ditto.
269         (WebCore::AudioSourceProviderAVFObjC::createMix): Don't iterate over the AVPlayerItem's tracks,
270             just use the one passed in through setAudioTrack().
271         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
272         (WebCore::MediaPlayerPrivateAVFoundationObjC::cancelLoad): Clear the provider's track.
273         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem): Set the provider's track.
274         (WebCore::MediaPlayerPrivateAVFoundationObjC::tracksChanged): Ditto.
275         (WebCore::MediaPlayerPrivateAVFoundationObjC::audioSourceProvider): Ditto.
276
277 2015-04-08  Anders Carlsson  <andersca@apple.com>
278
279         Move some ApplicationCache static member functions to ApplicationCacheStorage
280         https://bugs.webkit.org/show_bug.cgi?id=143524
281
282         Reviewed by Antti Koivisto.
283
284         This is yet another step towards eliminating ApplicationCacheStorage::singleton() and making the storage be per page instead.
285
286         * loader/appcache/ApplicationCache.cpp:
287         (WebCore::ApplicationCache::deleteCacheForOrigin):
288         (WebCore::ApplicationCache::deleteAllCaches):
289         (WebCore::ApplicationCache::diskUsageForOrigin):
290         * loader/appcache/ApplicationCacheStorage.cpp:
291         (WebCore::ApplicationCacheStorage::deleteAllCaches):
292         (WebCore::ApplicationCacheStorage::deleteCacheForOrigin):
293         (WebCore::ApplicationCacheStorage::diskUsageForOrigin):
294         * loader/appcache/ApplicationCacheStorage.h:
295
296 2015-04-08  ChangSeok Oh  <changseok.oh@collabora.com>
297
298         Fill list style background with same color with that of list background.
299         https://bugs.webkit.org/show_bug.cgi?id=143483
300
301         Reviewed by Simon Fraser.
302
303         LayoutListMarker does not have a node so its selectionBackgroundColor alway returns
304         the default theme color for selection. We can make it more natural by filling
305         the same color with that of LayoutListItem into it.
306
307         Tests: fast/backgrounds/selection-background-color-of-image-list-style.html
308                fast/backgrounds/selection-background-color-of-list-style.html
309
310         * rendering/RenderListMarker.cpp:
311         (WebCore::RenderListMarker::paint):
312
313 2015-04-08  Alex Christensen  <achristensen@webkit.org> and Patrick Gansterer  <paroga@webkit.org>
314
315         Add CMake build system for WinCairo port.
316         https://bugs.webkit.org/show_bug.cgi?id=115944
317
318         Reviewed by Chris Dumez.
319
320         * CMakeLists.txt:
321         * PlatformWin.cmake:
322         * PlatformWinCairo.cmake:
323         * platform/graphics/texmap/TextureMapperGL.cpp:
324         (WebCore::TextureMapperGL::TextureMapperGL):
325
326 2015-04-08  Chris Dumez  <cdumez@apple.com>
327
328         Rename ActiveDOMObject::canSuspend() to canSuspendForPageCache() for clarity
329         https://bugs.webkit.org/show_bug.cgi?id=143513
330
331         Reviewed by Andreas Kling.
332
333         Rename ActiveDOMObject::canSuspend() to canSuspendForPageCache() for
334         clarity as it is only used for the page cache. Also rename the
335         'DocumentWillBecomeInactive' value of the ReasonForSuspension enum to
336         'PageCache' as it is only used by CachedFrame for the page cache and it
337         is a lot more understandable.
338
339 2015-04-08  Commit Queue  <commit-queue@webkit.org>
340
341         Unreviewed, rolling out r182536.
342         https://bugs.webkit.org/show_bug.cgi?id=143523
343
344         Made accessibility/table-sections.html time out on debug bots
345         (Requested by ap on #webkit).
346
347         Reverted changeset:
348
349         "Simple line layout: Add <br> support."
350         https://bugs.webkit.org/show_bug.cgi?id=139012
351         http://trac.webkit.org/changeset/182536
352
353 2015-04-08  Carlos Garcia Campos  <cgarcia@igalia.com>
354
355         [GTK] Crash in DOMObjectCache when a wrapped object owned by the cache is unreffed by the user
356         https://bugs.webkit.org/show_bug.cgi?id=143521
357
358         Reviewed by Martin Robinson.
359
360         This is a case we claim to support, but it only works if the
361         object has only one reference. In that case, when the user unrefs
362         it, the weak ref notify callback removes the object from the
363         cache. However, if the object has more than one ref, the cache
364         doesn't know the user unreffed it, and when clearing the cache we
365         try to remove more references than what the object actually has,
366         causing a crash in g_object_unref.
367
368         * bindings/gobject/DOMObjectCache.cpp:
369         (WebKit::DOMObjectCacheData::clearObject):
370
371 2015-04-08  Zalan Bujtas  <zalan@apple.com>
372
373         Simple line layout: Add <br> support.
374         https://bugs.webkit.org/show_bug.cgi?id=139012
375
376         This patch enables RenderBlockFlows to use simple line layout on text content when <br> is present.
377         Simple text with <br> is a fairly common pattern on discussion(forum)-like web pages. This patch reduces memory usage
378         and speeds up layout for such content.
379
380         PerformanceTest/layout/line-layout-simple.html shows more than 2x speedup, when each paragraph is modified by appending <br> to the end.
381         With <br> support enabled:
382           mean: 70.02391461289068 runs/s
383           median: 70.47986488932318 runs/s
384     
385         While with <br> support disabled: 
386           mean: 30.417295049468184 runs/s
387           median: 30.36517778760357 runs/s
388
389         Reviewed by Antti Koivisto.
390
391         Test: fast/text/simple-line-with-br.html
392
393         * editing/TextIterator.cpp:
394         (WebCore::TextIterator::handleTextNode):
395         * rendering/RenderBlock.h:
396         * rendering/RenderBlockFlow.cpp:
397         (WebCore::RenderBlockFlow::setSelectionState):
398         (WebCore::RenderBlockFlow::deleteLineBoxesBeforeSimpleLineLayout):
399         * rendering/RenderBlockFlow.h:
400         * rendering/RenderLineBreak.cpp:
401         (WebCore::simpleLineLayout):
402         (WebCore::ensureLineBoxes):
403         (WebCore::RenderLineBreak::deleteLineBoxesBeforeSimpleLineLayout):
404         (WebCore::RenderLineBreak::positionForPoint):
405         (WebCore::RenderLineBreak::setSelectionState):
406         (WebCore::RenderLineBreak::linesBoundingBox):
407         (WebCore::RenderLineBreak::absoluteRects):
408         (WebCore::RenderLineBreak::absoluteQuads):
409         (WebCore::RenderLineBreak::collectSelectionRects):
410         * rendering/RenderLineBreak.h:
411         * rendering/SimpleLineLayout.cpp:
412         (WebCore::SimpleLineLayout::canUseFor):
413         (WebCore::SimpleLineLayout::LineState::removeTrailingWhitespace):
414         (WebCore::SimpleLineLayout::removeTrailingWhitespace):
415         (WebCore::SimpleLineLayout::consumeLineBreakIfNeeded):
416         (WebCore::SimpleLineLayout::skipWhitespaceIfNeeded):
417         (WebCore::SimpleLineLayout::firstFragment):
418         (WebCore::SimpleLineLayout::forceFragmentToLine):
419         (WebCore::SimpleLineLayout::createLineRuns):
420         (WebCore::SimpleLineLayout::create):
421         * rendering/SimpleLineLayoutFlowContents.cpp:
422         (WebCore::SimpleLineLayout::initializeSegments):
423         (WebCore::SimpleLineLayout::FlowContents::segmentForRenderer): Deleted.
424         * rendering/SimpleLineLayoutFlowContents.h:
425         * rendering/SimpleLineLayoutFunctions.cpp:
426         (WebCore::SimpleLineLayout::paintFlow):
427         (WebCore::SimpleLineLayout::hitTestFlow):
428         (WebCore::SimpleLineLayout::showLineLayoutForFlow):
429         * rendering/SimpleLineLayoutResolver.cpp:
430         (WebCore::SimpleLineLayout::RunResolver::Run::rect):
431         (WebCore::SimpleLineLayout::RunResolver::RunResolver):
432         (WebCore::SimpleLineLayout::RunResolver::rangeForRenderer):
433         * rendering/SimpleLineLayoutResolver.h:
434         (WebCore::SimpleLineLayout::RunResolver::Iterator::inQuirksMode):
435         (WebCore::SimpleLineLayout::RunResolver::Iterator::operator--):
436         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
437         (WebCore::SimpleLineLayout::EndOfSegmentSetter::EndOfSegmentSetter):
438         (WebCore::SimpleLineLayout::EndOfSegmentSetter::~EndOfSegmentSetter):
439         (WebCore::SimpleLineLayout::TextFragmentIterator::nextTextFragment):
440         (WebCore::SimpleLineLayout::TextFragmentIterator::revertToFragment):
441         (WebCore::SimpleLineLayout::TextFragmentIterator::skipToNextPosition):
442         * rendering/SimpleLineLayoutTextFragmentIterator.h:
443         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::isLastInRenderer):
444         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::isLineBreak):
445         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::isEmpty):
446         (WebCore::SimpleLineLayout::TextFragmentIterator::isSoftLineBreak):
447         (WebCore::SimpleLineLayout::TextFragmentIterator::isHardLineBreak):
448         (WebCore::SimpleLineLayout::TextFragmentIterator::isLineBreak): Deleted.
449
450 2015-04-08  Philippe Normand  <pnormand@igalia.com>
451
452         [GStreamer] compress property for the HTTP source element
453         https://bugs.webkit.org/show_bug.cgi?id=143518
454
455         Reviewed by Carlos Garcia Campos.
456
457         Added a compress property so the default behavior or not
458         requesting content encoded to the server can be overridden if
459         needed. This is useful for adaptive streaming playback.
460
461         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
462         (webKitWebSrcSetProperty):
463         (webKitWebSrcGetProperty):
464         (webKitWebSrcStart):
465
466 2015-04-08  Joonghun Park  <jh718.park@samsung.com>
467
468         Remove CSS functions min() and max() which had been dropped from specification
469         https://bugs.webkit.org/show_bug.cgi?id=143440
470
471         Reviewed by Darin Adler.
472
473         No new tests, No Behavior changes.
474
475         * css/CSSCalculationValue.cpp:
476         (WebCore::CSSCalcValue::create):
477         * css/CSSParser.cpp:
478         (WebCore::CSSParser::isCalculation):
479
480 2015-04-07  Philippe Normand  <pnormand@igalia.com>
481
482         [GStreamer] extra-headers and keep-alive properties for HTTP source element
483         https://bugs.webkit.org/show_bug.cgi?id=143480
484
485         Reviewed by Carlos Garcia Campos.
486
487         Keep the resource loader around when persistent HTTP connection
488         support is enabled. The keep-alive property is set to false by
489         default. Also before sending the HTTP request we now check the
490         contents of the extra-headers GstStructure and set additional
491         headers based on the structure contents.
492
493         Patch inspired by GStreamer's souphttpsrc element.
494
495         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
496         (webkit_web_src_init):
497         (webKitWebSrcFinalize):
498         (webKitWebSrcSetProperty):
499         (webKitWebSrcGetProperty):
500         (webKitWebSrcStop): Clear resource loader only for non-persistent connections.
501         (webKitWebSrcSetExtraHeader): Utility function to append headers
502         to an existing request based on a GValue contents.
503         (webKitWebSrcProcessExtraHeaders): Parse a GValue and set headers
504         based on its contents.
505         (webKitWebSrcStart): Extra headers and persistent connection
506         support. The resource loader is now lazily initialized here.
507
508 2015-04-07  Simon Fraser  <simon.fraser@apple.com>
509
510         Fix the build.
511
512         * platform/graphics/cocoa/FontCascadeCocoa.mm:
513         (WebCore::FontCascade::drawGlyphs):
514         * platform/spi/cg/CoreGraphicsSPI.h:
515
516 2015-04-07  Chris Dumez  <cdumez@apple.com>
517
518         Unreviewed, another iOS build fix after r182516.
519
520         I missed another use of __MAC_OS_X_VERSION_MIN_REQUIRED without a
521         PLATFORM(MAC) check.
522
523         * platform/graphics/cocoa/FontCascadeCocoa.mm:
524
525 2015-04-07  Michael Peechatt  <mpeechatt@gmail.com>
526
527         Bug 142887 - role progress bar does not support indeterminate state
528         https://bugs.webkit.org/show_bug.cgi?id=142887
529
530         Reviewed by Chris Fleizach.
531
532         Test: platform/mac/accessibility/progressbar-indeterminate.html
533
534         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
535         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
536         When getting min or max value of an indeterminate progress indicator, return 0.
537         This is so VoiceOver will recognize it as indeterminate.
538
539 2015-04-07  Chris Dumez  <cdumez@apple.com>
540
541         Unreviewed, speculative iOS build fix after r182516.
542
543         Add #if PLATFORM(MAC) checks.
544
545         * platform/spi/cg/CoreGraphicsSPI.h:
546
547 2015-04-07  Simon Fraser  <simon.fraser@apple.com>
548
549         Try to fix incremental builds by forcing *InternalSettings* to get
550         regenerated.
551
552         * testing/InternalSettings.idl:
553
554 2015-04-07  Chris Dumez  <cdumez@apple.com>
555
556         Open WebSockets should not prevent a page from entering PageCache
557         https://bugs.webkit.org/show_bug.cgi?id=143505
558         <rdar://problem/19923085>
559
560         Reviewed by Alexey Proskuryakov.
561
562         Open WebSockets should not prevent a page from entering PageCache. This
563         is currently causing mobile.nytimes.com to not be page-cacheable.
564
565         In this patch, We close open WebSockets when entering the page cache
566         and fire the "close" events after resuming, similarly to what we did
567         for XMLHttpRequest in r181480. This gives a chance for the content to
568         handle the 'close' event (with wasClean being false and code being
569         1006) in order to reopen the connection if necessary.
570
571         Test: http/tests/websocket/tests/hybi/closed-when-entering-page-cache.html
572
573         * Modules/websockets/WebSocket.cpp:
574         (WebCore::WebSocket::WebSocket):
575         (WebCore::WebSocket::canSuspend):
576         (WebCore::WebSocket::suspend):
577         (WebCore::WebSocket::resume):
578         (WebCore::WebSocket::resumeTimerFired):
579         (WebCore::WebSocket::didClose):
580         * Modules/websockets/WebSocket.h:
581
582 2015-04-07  Simon Fraser  <simon.fraser@apple.com>
583
584         Add experimental code to use custom font dilation when rendering into non-opaque contexts
585         https://bugs.webkit.org/show_bug.cgi?id=143508
586
587         Reviewed by Sam Weinig.
588
589         Add GraphicsContext::setAntialiasedFontDilationEnabled(), and set it to true
590         when rendering into a compositing layer which is not opaque (at the same location
591         where we disable font smoothing).
592
593         If Settings::antialiasedFontDilationEnabled() is true, when rendering non-smoothed
594         text (and if CSS hasn't opted into antialiased mode), use custom font dilation
595         parameters, chosen using a light/medium/dark heuristic, to make this text
596         match more closely with LCD-smoothed text.
597
598         * page/Settings.cpp:
599         (WebCore::Settings::Settings):
600         (WebCore::Settings::setAntialiasedFontDilationEnabled): Set global state
601         in FontCascade (which can't easily get at Settings). This it not ideal,
602         but is temporary.
603         * page/Settings.h:
604         (WebCore::Settings::antialiasedFontDilationEnabled):
605         * page/Settings.in: Can't autogenerate this setting any more.
606         * platform/graphics/FontCascade.cpp:
607         (WebCore::FontCascade::setAntialiasedFontDilationEnabled): Set the global.
608         (WebCore::FontCascade::antialiasedFontDilationEnabled):
609         * platform/graphics/FontCascade.h:
610         * platform/graphics/GraphicsContext.cpp:
611         (WebCore::GraphicsContext::setAntialiasedFontDilationEnabled): Set graphics state
612         to say that we should do dilation of antialiased text.
613         * platform/graphics/GraphicsContext.h:
614         (WebCore::GraphicsContextState::GraphicsContextState):
615         (WebCore::GraphicsContext::antialiasedFontDilationEnabled):
616         * platform/graphics/ca/mac/PlatformCALayerMac.mm:
617         (PlatformCALayer::drawLayerContents): If the layer is not opaque, enable the
618         dilated text code path.
619         * platform/graphics/cocoa/FontCascadeCocoa.mm:
620         (WebCore::dilationSizeForTextColor): Heuristic (values chosen empirically) to
621         computed custom dilation based on foreground color.
622         (WebCore::FontCascade::drawGlyphs): Set the custom dilation parameters, and the
623         antialiasing state if we're not doing smoothing, and CSS hasn't opted into the
624         antialiased path.
625         * platform/spi/cg/CoreGraphicsSPI.h: New SPI.
626
627 2015-04-07  Commit Queue  <commit-queue@webkit.org>
628
629         Unreviewed, rolling out r182511.
630         https://bugs.webkit.org/show_bug.cgi?id=143507
631
632         caused debug test failures (Requested by alexchristensen on
633         #webkit).
634
635         Reverted changeset:
636
637         "Block popups from content extensions."
638         https://bugs.webkit.org/show_bug.cgi?id=143497
639         http://trac.webkit.org/changeset/182511
640
641 2015-04-07  Myles C. Maxfield  <mmaxfield@apple.com>
642
643         [Cocoa] System fonts do not get correct tracking
644         https://bugs.webkit.org/show_bug.cgi?id=143395
645
646         Reviewed by Ryosuke Niwa.
647
648         Inside FontPlatformData, we have two CTFonts. If the user has specified
649         -webkit-system-font, we will pass in a CTFont, and the FontPlatformData
650         will wrap it. However, we will then roundtrip through CGFont in order
651         to create a second CTFont. We were basing our tracking and system
652         font knowledge off of this round-tripped font instead of the original font.
653
654         Note that this design is terrible and needs to be overhauled.
655         FontPlatformData should only have a single platform font inside it.
656
657         This patch also caches whether or not a font is a system font.
658
659         No new tests because it is impossible to test the tracking of the
660         system font in a robust way.
661
662         * platform/graphics/Font.cpp:
663         (WebCore::Font::Font): Rearrange member variables.
664         * platform/graphics/Font.h: Move member variables around for better
665         packing, and cache whether or not the font is a system font.
666         * platform/graphics/FontData.h: Add comment
667         * platform/graphics/cocoa/FontCocoa.mm:
668         (WebCore::Font::platformInit): Cache whether or not the font is a system
669         font.
670         (WebCore::hasCustomTracking): Use cached value.
671         (WebCore::canUseFastGlyphAdvanceGetter):
672         (WebCore::Font::platformWidthForGlyph):
673
674 2015-04-07  Alex Christensen  <achristensen@webkit.org>
675
676         Block popups from content extensions.
677         https://bugs.webkit.org/show_bug.cgi?id=143497
678
679         Reviewed by Brady Eidson.
680
681         Test: http/tests/contentextensions/popups.html
682
683         * loader/ResourceLoadInfo.cpp:
684         (WebCore::readResourceType):
685         * loader/ResourceLoadInfo.h:
686         * page/DOMWindow.cpp:
687         (WebCore::DOMWindow::open):
688         * page/UserContentController.cpp:
689         (WebCore::UserContentController::actionsForResourceLoad):
690         * page/UserContentController.h:
691         Check content extensions before opening a window.
692
693 2015-04-07  Benjamin Poulain  <benjamin@webkit.org>
694
695         Get the features.json files ready for open contributions
696         https://bugs.webkit.org/show_bug.cgi?id=143436
697
698         Reviewed by Darin Adler.
699
700         * features.json:
701
702 2015-04-07  Alex Christensen  <achristensen@webkit.org>
703
704         More unreviewed fixing API tests.
705
706         * contentextensions/ContentExtensionsBackend.cpp:
707         (WebCore::ContentExtensions::ContentExtensionsBackend::actionsForResourceLoad):
708         Don't check for javascript protocol.
709
710 2015-04-07  Eric Carlson  <eric.carlson@apple.com>
711
712         [Mac] never update caption user style sheet during parsing
713         https://bugs.webkit.org/show_bug.cgi?id=143499
714
715         Reviewed by Jer Noble.
716
717         * page/CaptionUserPreferencesMediaAF.cpp:
718         (WebCore::CaptionUserPreferencesMediaAF::setInterestedInCaptionPreferenceChanges):
719         (WebCore::CaptionUserPreferencesMediaAF::captionPreferencesChanged):  Ignore a
720             "preferences changed" notification fired while registering for said notification, we 
721             already create and insert the style sheet after a brief delay anyway.
722         * page/CaptionUserPreferencesMediaAF.h:
723
724 2015-04-07  Alex Christensen  <achristensen@webkit.org>
725
726         [Win] Unreviewed build fix after r182494.
727
728         * platform/win/ContextMenuItemWin.cpp:
729         (WebCore::ContextMenuItem::ContextMenuItem): Deleted.
730
731 2015-04-07  Alex Christensen  <achristensen@webkit.org>
732
733         Unreviewed fixing API tests.
734
735         * contentextensions/ContentExtensionsBackend.cpp:
736         (WebCore::ContentExtensions::ContentExtensionsBackend::actionsForResourceLoad):
737         * platform/URL.cpp:
738         (WebCore::URL::init):
739         * platform/URL.h:
740         (WebCore::URL::protocolIsData):
741         (WebCore::URL::protocolIsJavaScript): Deleted.
742         Revert part of r182492 that changed URL.h.
743
744 2015-04-07  Anders Carlsson  <andersca@apple.com>
745
746         More work on making the application cache storage be per page
747         https://bugs.webkit.org/show_bug.cgi?id=143498
748
749         Reviewed by Andreas Kling.
750
751         * loader/appcache/ApplicationCacheStorage.cpp:
752         (WebCore::ApplicationCacheStorage::create):
753         (WebCore::ApplicationCacheStorage::singleton):
754         * loader/appcache/ApplicationCacheStorage.h:
755         * page/Page.cpp:
756         (WebCore::Page::Page):
757         * page/Page.h:
758         (WebCore::Page::applicationCacheStorage):
759         * page/PageConfiguration.cpp:
760         (WebCore::PageConfiguration::PageConfiguration): Deleted.
761         * page/PageConfiguration.h:
762
763 2015-04-07  Matthew Mirman  <mmirman@apple.com>
764
765         Source and stack information should get appended only to native errors
766         and should be added directly after construction rather than when thrown.
767         This fixes frozen objects being unfrozen when thrown while conforming to 
768         ecma script standard and other browser behavior.
769         rdar://problem/19927293
770         https://bugs.webkit.org/show_bug.cgi?id=141871
771         
772         Reviewed by Geoffrey Garen.
773
774         Covered by existing tests.
775         
776         Sets line, column, source and stack information for DOMExceptions as 
777         expected by the webinspector for native errors.
778         
779         * bindings/js/JSDOMBinding.cpp:
780         (WebCore::setDOMException):
781
782 2015-04-07  Brady Eidson  <beidson@apple.com>
783
784         ContextMenuItem refactoring
785         https://bugs.webkit.org/show_bug.cgi?id=143485
786
787         Reviewed by Beth Dakin.
788
789         * platform/ContextMenuItem.h:
790         (WebCore::ContextMenuItem::isNull):
791
792         * platform/gtk/ContextMenuItemGtk.cpp:
793         (WebCore::ContextMenuItem::ContextMenuItem):
794
795         * platform/mac/ContextMenuItemMac.mm:
796         (WebCore::ContextMenuItem::ContextMenuItem):
797         (WebCore::ContextMenuItem::platformDescription):
798         (WebCore::ContextMenuItem::setSubMenu):
799         (WebCore::ContextMenuItem::releasePlatformDescription): Deleted.
800         (WebCore::ContextMenuItem::getPlatformDescription): Deleted.
801
802         * platform/mac/ContextMenuMac.mm:
803         (WebCore::ContextMenu::appendItem):
804         (WebCore::ContextMenu::insertItem):
805         (WebCore::platformMenuDescription):
806
807         * platform/win/ContextMenuItemWin.cpp:
808         (WebCore::ContextMenuItem::ContextMenuItem):
809
810 2015-04-07  Alex Christensen  <achristensen@webkit.org>
811
812         Optimize content extensions interpreting speed.
813         https://bugs.webkit.org/show_bug.cgi?id=143490
814
815         Reviewed by Brady Eidson.
816
817         * contentextensions/ContentExtensionCompiler.cpp:
818         (WebCore::ContentExtensions::compileRuleList):
819         * contentextensions/ContentExtensionsBackend.cpp:
820         (WebCore::ContentExtensions::ContentExtensionsBackend::actionsForResourceLoad):
821         Measure total time added by content extensions.
822         * contentextensions/DFABytecodeCompiler.cpp:
823         (WebCore::ContentExtensions::DFABytecodeCompiler::compileNode):
824         (WebCore::ContentExtensions::DFABytecodeCompiler::compile):
825         When jumping to the root, don't re-add all the actions.
826         * contentextensions/DFABytecodeCompiler.h:
827         * platform/URL.cpp:
828         (WebCore::URL::init):
829         * platform/URL.h:
830         (WebCore::URL::protocolIsJavaScript): Added.
831
832 2015-04-07  Simon Fraser  <simon.fraser@apple.com>
833
834         Add a new setting, AntialiasedFontDilationEnabled, exposed via WK2.
835         https://bugs.webkit.org/show_bug.cgi?id=143495
836
837         Reviewed by Tim Horton.
838
839         Add a new Setting, antialiasedFontDilationEnabled, which defaults to true. This 
840         will be used in an upcoming patch.
841
842         * page/Settings.in:
843
844 2015-04-07  Andy Estes  <aestes@apple.com>
845
846         [Content Filtering] Add logging
847         https://bugs.webkit.org/show_bug.cgi?id=143470
848
849         Reviewed by Daniel Bates.
850
851         Added a new ContentFiltering logging channel, and started logging some useful diagnostic messages.
852
853         * loader/ContentFilter.cpp:
854         (WebCore::ContentFilter::~ContentFilter):
855         (WebCore::ContentFilter::willSendRequest):
856         (WebCore::ContentFilter::startFilteringMainResource):
857         (WebCore::ContentFilter::responseReceived):
858         (WebCore::ContentFilter::dataReceived):
859         (WebCore::ContentFilter::notifyFinished):
860         (WebCore::ContentFilter::didDecide):
861         * platform/Logging.h:
862         * platform/cocoa/ContentFilterUnblockHandlerCocoa.mm:
863         (WebCore::ContentFilterUnblockHandler::canHandleRequest):
864         (WebCore::ContentFilterUnblockHandler::requestUnblockAsync):
865         * platform/cocoa/NetworkExtensionContentFilter.mm:
866         (WebCore::NetworkExtensionContentFilter::enabled):
867         (WebCore::NetworkExtensionContentFilter::unblockHandler):
868         (WebCore::NetworkExtensionContentFilter::handleDecision):
869         * platform/cocoa/ParentalControlsContentFilter.mm:
870         (WebCore::ParentalControlsContentFilter::enabled):
871         (WebCore::ParentalControlsContentFilter::updateFilterState):
872         * testing/MockContentFilter.cpp:
873         (WebCore::MockContentFilter::enabled):
874         (WebCore::MockContentFilter::unblockHandler):
875         (WebCore::MockContentFilter::maybeDetermineStatus):
876
877 2015-04-07  Eric Carlson  <eric.carlson@apple.com>
878
879         [Mac] video playing to external device should not be interrupted
880         https://bugs.webkit.org/show_bug.cgi?id=143492
881
882         Reviewed by Jer Noble.
883
884         * Modules/mediacontrols/mediaControlsApple.js:
885         (Controller.prototype.handlePanelTransitionEnd):  Drive-by fix to make sure the controls are 
886             not hidden if the opacity timer is primed before they go into a state where they should
887             never be hidden.
888
889         * html/HTMLMediaElement.cpp:
890         (WebCore::HTMLMediaElement::canPlayToWirelessPlaybackTarget): Make it const.
891         (WebCore::HTMLMediaElement::isPlayingToWirelessPlaybackTarget): New.
892         * html/HTMLMediaElement.h:
893
894         * html/HTMLMediaSession.cpp:
895         (WebCore::HTMLMediaSession::canPlayToWirelessPlaybackTarget): New. Short-circuit call to
896             client when we already know the answer.
897         (WebCore::HTMLMediaSession::isPlayingToWirelessPlaybackTarget): Ditto.
898         (WebCore::HTMLMediaSession::startPlayingToPlaybackTarget): Ditto.
899         (WebCore::HTMLMediaSession::stopPlayingToPlaybackTarget): Ditto.
900         * html/HTMLMediaSession.h:
901
902         * platform/audio/MediaSession.cpp:
903         (WebCore::MediaSession::canPlayToWirelessPlaybackTarget): Deleted, moved inline and neutered
904             because only HTMLMediaSession needs to use them.
905         (WebCore::MediaSession::startPlayingToPlaybackTarget): Ditto.
906         (WebCore::MediaSession::stopPlayingToPlaybackTarget): Ditto.
907         * platform/audio/MediaSession.h:
908         (WebCore::MediaSession::canPlayToWirelessPlaybackTarget):
909         (WebCore::MediaSession::isPlayingToWirelessPlaybackTarget):
910         (WebCore::MediaSession::startPlayingToPlaybackTarget):
911         (WebCore::MediaSession::stopPlayingToPlaybackTarget):
912         (WebCore::MediaSessionClient::canPlayToWirelessPlaybackTarget):
913         (WebCore::MediaSessionClient::isPlayingToWirelessPlaybackTarget):
914
915         * platform/audio/MediaSessionManager.cpp:
916         (WebCore::MediaSessionManager::MediaSessionManager):
917         (WebCore::MediaSessionManager::sessionShouldBeginPlayingToWirelessPlaybackTarget): New.
918         (WebCore::MediaSessionManager::sessionWillBeginPlayback): Don't interrupt an active session
919             playing to a target device.
920         * platform/audio/MediaSessionManager.h:
921
922         * platform/graphics/MediaPlayer.cpp:
923         (WebCore::MediaPlayer::isPlayingToWirelessPlaybackTarget): New, passthrough.
924         * platform/graphics/MediaPlayer.h:
925         * platform/graphics/MediaPlayerPrivate.h:
926         (WebCore::MediaPlayerPrivateInterface::isPlayingToWirelessPlaybackTarget):
927
928         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
929         (WebCore::MediaPlayerPrivateAVFoundationObjC::canPlayToWirelessPlaybackTarget):
930         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
931         (WebCore::MediaPlayerPrivateAVFoundationObjC::setWirelessPlaybackTarget): Explicitly call 
932             when passed a nil or inactive target context.
933         (WebCore::MediaPlayerPrivateAVFoundationObjC::startPlayingToPlaybackTarget): Add logging.
934         (WebCore::MediaPlayerPrivateAVFoundationObjC::stopPlayingToPlaybackTarget): Ditto.
935         (WebCore::MediaPlayerPrivateAVFoundationObjC::isPlayingToWirelessPlaybackTarget): New. Return
936             true when playing with an active context.
937         (WebCore::playerKVOProperties): "outputContext" is not observable.
938
939 2015-04-07  Sam Weinig  <sam@webkit.org>
940
941         Re-add JSReadableStream and JSReadableStreamReader the Xcode project to
942         make Xcode happy.
943
944         * WebCore.xcodeproj/project.pbxproj:
945
946 2015-02-25  Sergio Villar Senin  <svillar@igalia.com>
947
948         [CSS Grid Layout] Update track sizes after distributing extra space
949         https://bugs.webkit.org/show_bug.cgi?id=141422
950
951         Reviewed by Antti Koivisto.
952
953         Both old and new tracks sizing algorithms instruct us to update
954         the sizes of the content sized tracks only after distributing the
955         extra space for all the items in the same span group. So far we
956         were doing it inside distributeSpaceToTracks(), i.e., once for
957         every single item. That is wrong because it makes the algorithm
958         order dependent.
959
960         Our old implementation looked something like this (pseudocode):
961
962         resolveContentBasedTrackSizingFunctions()
963           foreach item
964             resolveContentBasedTrackSizingFunctionsForItems() (x4)
965               distributeSpaceToTracks()
966                 updateTrackSizes()
967
968         Now it's done this way (pseudocode):
969
970         resolveContentBasedTrackSizingFunctions()
971           foreach spanGroup
972             resolveContentBasedTrackSizingFunctionsForItems() (x4)
973               foreach item in spanGroup
974                 distributeSpaceToTracks()
975               updateTrackSizes()
976
977         As it can be seen the update of track sizes only happens after
978         processing all the items of a given span group. In order to
979         accomplish this a new field was added to GridTrack called
980         tempIncrease which stores per-track increases while distributing
981         the extra space among the items in the same span group. That
982         temporal increase could eventually be used to update the
983         plannedIncrease which is the one we use to finally set the new
984         size of the track.
985
986         This change makes our implementation closer to the spec, removes
987         the order dependency and ensures that every track satisfies their
988         min track sizing functions before starting to consider the max
989         track sizing functions.
990
991         Test: fast/css-grid-layout/grid-update-sizes-after-distributing-all.html
992
993         * rendering/RenderGrid.cpp:
994         (WebCore::GridTrack::plannedSize):
995         (WebCore::GridTrack::setPlannedSize): New setter.
996         (WebCore::GridTrack::tempSize): New attribute.
997         (WebCore::RenderGrid::computeUsedBreadthOfGridTracks):
998         RenderGrid::distributeSpaceToTracks() no longer updates the track
999         sizes so we have to do it after the call returns.
1000         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctions):
1001         Call RenderGrid::resolveContentBasedTrackSizingFunctionsForItems()
1002         passing a span group instead of a single item.
1003         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctionsForItems):
1004         It now receives a span group instead of a single item. Apart from
1005         that we need an extra function to get the unaltered track size (as
1006         the current one returns the base size whenever the growth limit is
1007         infinity).
1008         (WebCore::RenderGrid::distributeSpaceToTracks): This no longer
1009         updates track sizes but only the track's planned size;
1010         * rendering/RenderGrid.h:
1011
1012 2015-04-06  Chris Dumez  <cdumez@apple.com>
1013
1014         Bing video search result pages are not PageCacheable
1015         https://bugs.webkit.org/show_bug.cgi?id=143463
1016         <rdar://problem/20440916>
1017
1018         Reviewed by Alexey Proskuryakov.
1019
1020         Bing video search result pages are not PageCacheable (tested on iOS).
1021         It both:
1022         - is bad for power usage as it causes a reload when clicking one of the
1023           results then navigating back in history.
1024         - degrades user experience because the results page uses infinite
1025           scrolling and the scroll position is not properly restored when
1026           navigating back, not to mention the user has to wait for the reload
1027           to complete.
1028
1029         The issue was that the bing search page was doing a ping load when
1030         clicking on one of the search results. The ping load was done by
1031         create an image and its 'src' attribute to the ping URL. This load
1032         usually did not have time to complete when navigating away so we would
1033         cancel it and the main document would end up with an error that would
1034         prevent the page from entering the page cache. We already have code
1035         making sure load cancellations do not prevent page caching as long as
1036         the loads are for XHR or images. However, the latter check was broken
1037         in the case where the ResourceRequest's cachePartition was non-empty.
1038         This is because the check was using the MemoryCache::ResourceForUrl()
1039         API which rarely does what we want because it will request a dummy
1040         ResourceRequest (without cachePartition) and then call
1041         MemoryCache::resourceForRequest(). This patch updates the check
1042         to use resourceForRequest() directly as we have the ResourceRequest
1043         at this point.
1044
1045         This patch also gets rid of the  MemoryCache::ResourceForUrl() API as
1046         it rarely does what we want and it is bug prone. It was only used in
1047         2 places, one of them causing this bug and the other in Internals.
1048
1049         Tests: http/tests/navigation/page-cache-pending-image-load-cache-partition.html
1050                http/tests/navigation/page-cache-pending-image-load.html
1051
1052         * loader/DocumentLoader.cpp:
1053         (WebCore::areAllLoadersPageCacheAcceptable):
1054         Use MemoryCache::resourceForRequest() instead of resourceForUrl() as
1055         we have the ResourceRequest and calling resourceForUrl() would loose
1056         the cachePartition.
1057
1058         * loader/cache/MemoryCache.cpp:
1059         (WebCore::MemoryCache::resourceForURL): Deleted.
1060         Drop this API as it is bug prone and rarely does what we want.
1061
1062         * testing/Internals.cpp:
1063         (WebCore::Internals::isLoadingFromMemoryCache):
1064         Update call to create a dummy ResourceRequest and call
1065         resourceForRequest() instead of resourceForUrl(), as this API no
1066         longer exists. The new code also set the cachePartition on the
1067         dummy request so that this function actually behaves as expected
1068         if the cachePartition in the memory cache is non-empty.
1069
1070
1071 2015-04-06  Jer Noble  <jer.noble@apple.com>
1072
1073         Synchronize fullscreen animation between processes.
1074         https://bugs.webkit.org/show_bug.cgi?id=143131
1075
1076         Reviewed by Simon Fraser.
1077
1078         Rather than attempt to synchcronize animations across the WebProcess / UIProcess boundary,
1079         do the bounds-change animation in-process by applying a sublayer transformation to the
1080         video layer. This gives the same visual effect as a synchronized bounds animation, but
1081         without needing a synchronization fence. Resolve the difference between the transformation
1082         and bounds by doing a fence-synchronized bounds change after the current animation is
1083         scheduled to complete.
1084
1085         To do this calculation correctly, WebAVPlayer needs to query both the effective
1086         videoLayerFrame and the videoLayerGravity. To that end, add getter methods for
1087         videoLayerFrame() and videoLayerGravity().
1088
1089         * html/HTMLMediaElement.h:
1090         (WebCore::HTMLMediaElement::videoFullscreenGravity):
1091         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
1092         (-[WebAVVideoLayer dealloc]): Cancel outstanding performSelector requests.
1093         (-[WebAVVideoLayer setBounds:]): Add a scale transform to simulate a bonuds change.
1094         (-[WebAVVideoLayer resolveBounds]): Reset the scale transform and set the bounds.
1095         (WebVideoFullscreenInterfaceAVKit::setupFullscreenInternal): Set the initial video frame bounds.
1096         (-[WebAVPlayerController layoutSublayersOfLayer:]): Deleted.
1097         * platform/ios/WebVideoFullscreenModel.h:
1098         * platform/ios/WebVideoFullscreenModelVideoElement.h:
1099         * platform/ios/WebVideoFullscreenModelVideoElement.mm:
1100         (WebVideoFullscreenModelVideoElement::videoLayerFrame): Added; simple getter.
1101         (WebVideoFullscreenModelVideoElement::videoLayerGravity): Ditto.
1102
1103 2015-04-06  Zalan Bujtas  <zalan@apple.com>
1104
1105         Simple line layout: RunResolver::Iterator class cleanup.
1106         https://bugs.webkit.org/show_bug.cgi?id=143445
1107
1108         Reviewed by Antti Koivisto.
1109
1110         1. SimpleLineLayout::Run is an intermediate structure and should not be publicly accessible through RunResolver::Iterator.
1111         RunResolver::Run is the class to use to access run properties.
1112         2. Also move advance()/advanceLine() to private. Callers should use LineResolver to advance on lines.
1113
1114         No change in functionality.
1115
1116         * rendering/SimpleLineLayoutResolver.h:
1117
1118 2015-04-06  Simon Fraser  <simon.fraser@apple.com>
1119
1120         Use a RenderObject bit for isRenderFlowThread()
1121         https://bugs.webkit.org/show_bug.cgi?id=143439
1122
1123         Reviewed by Darin Adler.
1124
1125         Turning isRenderFlowThread() into a bit in rare data rather than a virtual function reduces
1126         the time under RenderLayer::scrollTo() on a large overflow:scroll table from 56% to 44%.
1127
1128         * rendering/RenderFlowThread.cpp:
1129         (WebCore::RenderFlowThread::RenderFlowThread):
1130         * rendering/RenderFlowThread.h:
1131         * rendering/RenderObject.cpp:
1132         (WebCore::RenderObject::setIsRenderFlowThread):
1133         * rendering/RenderObject.h:
1134         (WebCore::RenderObject::isDragging):
1135         (WebCore::RenderObject::hasReflection):
1136         (WebCore::RenderObject::isRenderFlowThread):
1137         (WebCore::RenderObject::RenderObjectRareData::RenderObjectRareData):
1138
1139 2015-04-06  Myles C. Maxfield  <mmaxfield@apple.com>
1140
1141         [Win] [SVG -> OTF Converter] Support the SVG -> OTF Font Converter
1142         https://bugs.webkit.org/show_bug.cgi?id=143402
1143
1144         Reviewed by Darin Adler.
1145
1146         There are a few pieces to the converter that Windows requires that we haven't already
1147         implemented:
1148         1. Checksums were being calculated with the wrong endianness
1149         2. Windows requires a format 4 'cmap' subtable in addition to the format 12 one we already
1150         were using
1151         3. Windows requires a reference to a Private DICT inside the CFF table, even if the DICT
1152         is of 0 length.
1153
1154         Covered by all our existing SVG font tests.
1155
1156         * svg/SVGFontFaceElement.h: Add capHeight accessor.
1157         * svg/SVGFontFaceElement.cpp:
1158         (WebCore::SVGFontFaceElement::capHeight): Ditto.
1159         * svg/SVGToOTFConversion.cpp: Update the conversion process according to the above
1160         requirements.
1161         (WebCore::SVGToOTFFontConverter::appendFormat12CMAPTable):
1162         (WebCore::SVGToOTFFontConverter::appendFormat4CMAPTable):
1163         (WebCore::SVGToOTFFontConverter::appendCMAPTable): Use helpers.
1164         (WebCore::SVGToOTFFontConverter::appendHHEATable): Use member variables.
1165         (WebCore::SVGToOTFFontConverter::appendOS2Table): Update to version 2.
1166         (WebCore::SVGToOTFFontConverter::appendCFFTable): Create a reference to a
1167         zero-sized Private DICT
1168         (WebCore::SVGToOTFFontConverter::SVGToOTFFontConverter): Populate member
1169         variables.
1170         (WebCore::SVGToOTFFontConverter::calculateChecksum): Flip endianness
1171
1172 2015-04-06  Yusuke Suzuki  <utatane.tea@gmail.com>
1173
1174         Return Optional<uint32_t> from PropertyName::asIndex
1175         https://bugs.webkit.org/show_bug.cgi?id=143422
1176
1177         Reviewed by Darin Adler.
1178
1179         * bindings/js/JSDOMWindowCustom.cpp:
1180         (WebCore::JSDOMWindow::getOwnPropertySlot):
1181         (WebCore::JSDOMWindow::getOwnPropertySlotByIndex):
1182         * bindings/js/JSHTMLAllCollectionCustom.cpp:
1183         (WebCore::callHTMLAllCollection):
1184         (WebCore::JSHTMLAllCollection::item):
1185         * bindings/scripts/CodeGeneratorJS.pm:
1186         (GenerateGetOwnPropertySlotBody):
1187         (GenerateImplementation):
1188         * bindings/scripts/test/JS/JSFloat64Array.cpp:
1189         (WebCore::JSFloat64Array::getOwnPropertySlot):
1190         (WebCore::JSFloat64Array::getOwnPropertyDescriptor):
1191         (WebCore::JSFloat64Array::put):
1192         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
1193         (WebCore::JSTestEventTarget::getOwnPropertySlot):
1194         * bridge/runtime_array.cpp:
1195         (JSC::RuntimeArray::getOwnPropertySlot):
1196         (JSC::RuntimeArray::put):
1197
1198 2015-04-06  Žan Doberšek  <zdobersek@igalia.com>
1199
1200         FileList constructor should move the passed-in Vector<> rvalue reference into the member variable
1201         https://bugs.webkit.org/show_bug.cgi?id=143412
1202
1203         Reviewed by Darin Adler.
1204
1205         * fileapi/FileList.h:
1206         (WebCore::FileList::FileList): An explicit move of the passed-in rvalue
1207         reference into the member variable is required, otherwise a copy is
1208         performed since an rvalue reference is just an lvalue.
1209
1210 2015-04-06  Žan Doberšek  <zdobersek@igalia.com>
1211
1212         UserScript, UserStyleSheet constructors should take in Vector<String> rvalue references
1213         https://bugs.webkit.org/show_bug.cgi?id=143411
1214
1215         Reviewed by Darin Adler.
1216
1217         Have the UserScript and UserStyleSheet constructors take in Vector<String>
1218         rvalue references for the whitelist and blacklist parameters. Both classes
1219         store these Vector<String> objects, so the referenced objects can simply be
1220         moved into the member variable.
1221
1222         Because the constructor is now demanding an rvalue, it's up to the caller
1223         to move in the desired object if possible, or create an explicit copy
1224         otherwise.
1225
1226         * page/UserScript.h:
1227         (WebCore::UserScript::UserScript):
1228         * page/UserStyleSheet.h:
1229         (WebCore::UserStyleSheet::UserStyleSheet):
1230
1231 2015-04-05  Andy Estes  <aestes@apple.com>
1232
1233         [Content Filtering] Only pass http(s) requests to -[NEFilterSource willSendRequest:...]
1234         https://bugs.webkit.org/show_bug.cgi?id=143437
1235
1236         Reviewed by Dan Bernstein.
1237
1238         No new tests. We can't test NEFilterSource directly.
1239
1240         * platform/cocoa/NetworkExtensionContentFilter.mm:
1241         (WebCore::NetworkExtensionContentFilter::willSendRequest): Immediately allow requests with url schemes other than http and https.
1242
1243 2015-04-05  Darin Adler  <darin@apple.com>
1244
1245         FrameView code uses page() without null checking
1246         https://bugs.webkit.org/show_bug.cgi?id=143425
1247         rdar://problem/18920601
1248
1249         Reviewed by Anders Carlsson.
1250
1251         While we don't have tests that cover this, we are seeing crashes coming in
1252         that indicate the shouldEnableSpeculativeTilingDuringLoading function is
1253         being called when the page is null. This patch adds null checks to all the
1254         places in FrameView that use page() without doing null checking.
1255
1256         * page/FrameView.cpp:
1257         (WebCore::FrameView::layout): If page is null, don't try to do the
1258         auto-sizing logic that involves the textAutosizingWidth value from the page.
1259         (WebCore::FrameView::setFixedVisibleContentRect): Get settings from the
1260         frame rather than the page to avoid possible null-dereference.
1261         (WebCore::FrameView::scrollPositionChanged): Check the page for null when
1262         getting the event throttling delay.
1263         (WebCore::FrameView::updateLayerFlushThrottling): Check the page for null,
1264         and return early if it is null.
1265         (WebCore::shouldEnableSpeculativeTilingDuringLoading): Check the page for
1266         null, and return false if it is null.
1267         (WebCore::FrameView::performPostLayoutTasks): Guard the code that calls
1268         didLayout on the page client by a check if the page is null.
1269         (WebCore::FrameView::pagination): Don't call Page::pagination on a null
1270         page here.
1271         (WebCore::FrameView::visibleContentScaleFactor): Use a scale factor of 1
1272         if the page is null.
1273         (WebCore::FrameView::setVisibleScrollerThumbRect): Don't call through to
1274         the page client if the page is null.
1275         (WebCore::FrameView::scrollbarStyleChanged): Ditto.
1276         (WebCore::FrameView::setScrollPinningBehavior): Check the page for null
1277         before asking it for the scrolling coordinator.
1278
1279 2015-04-05  Simon Fraser  <simon.fraser@apple.com>
1280
1281         Free up some bits in RenderObject by moving rarely used bits into a side table
1282         https://bugs.webkit.org/show_bug.cgi?id=143432
1283
1284         Reviewed by Darin Adler.
1285         
1286         Add a side table (global hash) on RenderObject to store data that is rarely
1287         used. Move the "isDragging" and "hasReflection" bits there. Re-use one of
1288         those bits for "hasRareData", and leave the other unused (I have plans for it).
1289         
1290         * rendering/RenderBlock.cpp:
1291         (WebCore::getBlockRareData): Renamed for consistency.
1292         (WebCore::ensureBlockRareData): Renamed to avoid conflict with RenderObject::ensureRareData().
1293         (WebCore::RenderBlock::cachedFlowThreadContainingBlock):
1294         (WebCore::RenderBlock::cachedFlowThreadContainingBlockNeedsUpdate):
1295         (WebCore::RenderBlock::setCachedFlowThreadContainingBlockNeedsUpdate):
1296         (WebCore::RenderBlock::updateCachedFlowThreadContainingBlock):
1297         (WebCore::RenderBlock::locateFlowThreadContainingBlock):
1298         (WebCore::RenderBlock::paginationStrut):
1299         (WebCore::RenderBlock::pageLogicalOffset):
1300         (WebCore::RenderBlock::setPaginationStrut):
1301         (WebCore::RenderBlock::setPageLogicalOffset):
1302         (WebCore::getRareData): Deleted.
1303         (WebCore::ensureRareData): Deleted.
1304         * rendering/RenderObject.cpp:
1305         (WebCore::RenderObject::~RenderObject): Assert that rare data hasn't been resurrected
1306         since willBeDestroyed().
1307         (WebCore::RenderObject::willBeDestroyed): Clear the rare data.
1308         (WebCore::RenderObject::setIsDragging): If setting, ensure that we have rare data and
1309         set the bit. Otherwise, only clear the bit of we have rare data.
1310         (WebCore::RenderObject::setHasReflection): Ditto.
1311         (WebCore::RenderObject::rareDataMap):
1312         (WebCore::RenderObject::rareData):
1313         (WebCore::RenderObject::ensureRareData):
1314         (WebCore::RenderObject::clearRareData):
1315         * rendering/RenderObject.h:
1316         (WebCore::RenderObject::isDragging): Fast-fail on the hasRareData() bit, then do the
1317         slower lookup in rare data.
1318         (WebCore::RenderObject::hasReflection): Ditto.
1319         (WebCore::RenderObject::setEverHadLayout): Moved up to group with other bit setters.
1320         (WebCore::RenderObject::hasRareData):
1321         (WebCore::RenderObject::setHasRareData):
1322         (WebCore::RenderObject::RenderObjectBitfields::RenderObjectBitfields):
1323         (WebCore::RenderObject::RenderObjectRareData::RenderObjectRareData):
1324         (WebCore::RenderObject::setHasReflection): Deleted. Out of line now.
1325         (WebCore::RenderObject::setIsDragging): Deleted. Ditto.
1326
1327 2015-04-05  Darin Adler  <darin@apple.com>
1328
1329         REGRESSION (r181778): Crash after scrolling Google search result page
1330         https://bugs.webkit.org/show_bug.cgi?id=143431
1331
1332         Reviewed by Simon Fraser.
1333
1334         I can't reproduce this crash, nor was I able to make a regression test,
1335         but the crash data makes it clear this is a null dereference.
1336
1337         * page/animation/AnimationController.cpp:
1338         (WebCore::AnimationControllerPrivate::scrollWasUpdated): Check the result
1339         of Frame::view for null. We know this is only called when there is a
1340         valid FrameView, but it can be called after Frame::m_view is already null.
1341
1342 2015-04-05  Andy Estes  <aestes@apple.com>
1343
1344         [Content Filtering] Tell the filter about requests and redirects
1345         https://bugs.webkit.org/show_bug.cgi?id=143414
1346         rdar://problem/19239549
1347
1348         Reviewed by Darin Adler.
1349
1350         Tests: contentfiltering/allow-after-will-send-request.html
1351                contentfiltering/block-after-will-send-request.html
1352                http/tests/contentfiltering/allow-after-redirect.html
1353                http/tests/contentfiltering/block-after-redirect.html
1354
1355         NEFilterSource supports making filter decisions based on NSURLRequests, so this patch adds support for telling
1356         ContentFilter about the original main resource request as well as redirect requests.
1357
1358         * bindings/js/JSMockContentFilterSettingsCustom.cpp: Updated decisionPoint values to include AfterWillSendRequest and AfterRedirect.
1359         (WebCore::JSMockContentFilterSettings::decisionPoint):
1360         (WebCore::JSMockContentFilterSettings::setDecisionPoint):
1361         * loader/ContentFilter.cpp:
1362         (WebCore::ContentFilter::willSendRequest): Called willSendRequest() on each filter using forEachContentFilterUntilBlocked().
1363         (WebCore::ContentFilter::redirectReceived): Called willSendRequest().
1364         * loader/ContentFilter.h:
1365         * loader/DocumentLoader.cpp:
1366         (WebCore::DocumentLoader::willSendRequest): Called ContentFilter::willSendRequest() if there is a content filter.
1367         Asserted that this is not a redirect, and that ContentFilter does not set the request to null.
1368         * loader/SubresourceLoader.cpp:
1369         (WebCore::SubresourceLoader::willSendRequest): Called redirectReceived() instead of willSendRequest().
1370         * loader/cache/CachedRawResource.cpp:
1371         (WebCore::CachedRawResource::redirectReceived): Renamed from willSendRequest(), since this function is only called during redirects.
1372         (WebCore::CachedRawResource::willSendRequest): Deleted.
1373         * loader/cache/CachedRawResource.h:
1374         * loader/cache/CachedResource.cpp:
1375         (WebCore::CachedResource::redirectReceived): Renamed from willSendRequest(), since this function is only called during redirects.
1376         (WebCore::CachedResource::willSendRequest): Deleted.
1377         * loader/cache/CachedResource.h:
1378         * platform/PlatformContentFilter.h:
1379         * platform/cocoa/NetworkExtensionContentFilter.h:
1380         * platform/cocoa/NetworkExtensionContentFilter.mm:
1381         (WebCore::NetworkExtensionContentFilter::willSendRequest): Called responseReceived() if there was a redirectResponse.
1382         Then called -[NEFilterSource willSendRequest:decisionHandler:].
1383         * platform/cocoa/ParentalControlsContentFilter.h:
1384         * platform/spi/cocoa/NEFilterSourceSPI.h: Added a #define for NEFilterSourceOptionsPageData.
1385         * testing/MockContentFilter.cpp:
1386         (WebCore::MockContentFilter::willSendRequest): Added support for willSendRequest.
1387         * testing/MockContentFilter.h: Added decision points for AfterWillSendRequest and AfterRedirect.
1388         * testing/MockContentFilterSettings.h:
1389         * testing/MockContentFilterSettings.idl:
1390
1391 2015-04-05  Sungmann Cho  <sungmann.cho@navercorp.com>
1392
1393         Remove DocumentLoader::requestURL().
1394         https://bugs.webkit.org/show_bug.cgi?id=140001
1395
1396         Reviewed by Darin Adler.
1397
1398         No new tests, no behavior change.
1399
1400         * loader/DocumentLoader.cpp:
1401         (WebCore::DocumentLoader::documentURL):
1402         (WebCore::DocumentLoader::requestURL): Deleted.
1403         * loader/DocumentLoader.h:
1404         * loader/ResourceLoadNotifier.cpp:
1405         (WebCore::ResourceLoadNotifier::dispatchWillSendRequest):
1406
1407 2015-04-05  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
1408
1409         Use constants of sqlite3 directly for status of SQL result in webdatabase
1410         https://bugs.webkit.org/show_bug.cgi?id=143329
1411
1412         Reviewed by Darin Adler.
1413
1414         In webdatabase, it has used own constant vairables as well as using sqlite3 constants directly.
1415         It causes to use if~else statement which consumes more cpu cycles compared to switch~case. This
1416         patch makes to use constants of sqlite3. Additionally if~else statment is changed to switch~case
1417         to save cpu cycles.
1418
1419         No new tests, no behavior changes.
1420
1421         * Modules/webdatabase/Database.cpp:
1422         (WebCore::Database::performGetTableNames):
1423         * Modules/webdatabase/DatabaseBackendBase.cpp:
1424         (WebCore::retrieveTextResultFromDatabase):
1425         (WebCore::setTextValueInDatabase):
1426         (WebCore::DatabaseBackendBase::incrementalVacuumIfNeeded):
1427         * Modules/webdatabase/DatabaseTracker.cpp:
1428         (WebCore::DatabaseTracker::hasEntryForOriginNoLock):
1429         (WebCore::DatabaseTracker::hasEntryForDatabase):
1430         (WebCore::DatabaseTracker::fullPathForDatabaseNoLock):
1431         (WebCore::DatabaseTracker::origins):
1432         (WebCore::DatabaseTracker::databaseNamesForOriginNoLock):
1433         (WebCore::DatabaseTracker::detailsForNameAndOrigin):
1434         (WebCore::DatabaseTracker::setDatabaseDetails):
1435         (WebCore::DatabaseTracker::quotaForOriginNoLock):
1436         (WebCore::DatabaseTracker::setQuota):
1437         (WebCore::DatabaseTracker::addDatabase):
1438         (WebCore::DatabaseTracker::deleteOrigin):
1439         (WebCore::DatabaseTracker::deleteDatabase):
1440         (WebCore::DatabaseTracker::removeDeletedOpenedDatabases):
1441         (WebCore::DatabaseTracker::deleteDatabaseFileIfEmpty):
1442         * Modules/webdatabase/SQLStatementBackend.cpp:
1443         (WebCore::SQLStatementBackend::execute):
1444         * Modules/webdatabase/SQLStatementBackend.h:
1445         * Modules/webdatabase/SQLTransactionBackend.cpp:
1446         (WebCore::SQLTransactionBackend::runCurrentStatementAndGetNextState):
1447         Change to use a reference instead of a pointer in arguemnt of execute().
1448         * loader/appcache/ApplicationCacheStorage.cpp:
1449         (WebCore::ApplicationCacheStorage::loadCacheGroup):
1450         (WebCore::ApplicationCacheStorage::loadManifestHostHashes):
1451         (WebCore::ApplicationCacheStorage::cacheGroupForURL):
1452         (WebCore::ApplicationCacheStorage::fallbackCacheGroupForURL):
1453         (WebCore::ApplicationCacheStorage::calculateQuotaForOrigin):
1454         (WebCore::ApplicationCacheStorage::calculateUsageForOrigin):
1455         (WebCore::ApplicationCacheStorage::calculateRemainingSizeForOriginExcludingCache):
1456         (WebCore::ApplicationCacheStorage::storeUpdatedQuotaForOrigin):
1457         (WebCore::ApplicationCacheStorage::verifySchemaVersion):
1458         (WebCore::ApplicationCacheStorage::store):
1459         (WebCore::ApplicationCacheStorage::storeUpdatedType):
1460         (WebCore::ApplicationCacheStorage::ensureOriginRecord):
1461         (WebCore::ApplicationCacheStorage::storeNewestCache):
1462         (WebCore::ApplicationCacheStorage::loadCache):
1463         (WebCore::ApplicationCacheStorage::remove):
1464         (WebCore::ApplicationCacheStorage::getManifestURLs):
1465         (WebCore::ApplicationCacheStorage::cacheGroupSize):
1466         (WebCore::ApplicationCacheStorage::deleteCacheGroupRecord):
1467         (WebCore::ApplicationCacheStorage::checkForMaxSizeReached):
1468         (WebCore::ApplicationCacheStorage::checkForDeletedResources):
1469         (WebCore::ApplicationCacheStorage::flatFileAreaSize):
1470         * loader/icon/IconDatabase.cpp:
1471         (WebCore::IconDatabase::checkIntegrity):
1472         (WebCore::IconDatabase::performURLImport):
1473         (WebCore::IconDatabase::pruneUnretainedIcons):
1474         (WebCore::readySQLiteStatement):
1475         (WebCore::IconDatabase::setIconIDForPageURLInSQLDatabase):
1476         (WebCore::IconDatabase::removePageURLFromSQLDatabase):
1477         (WebCore::IconDatabase::getIconIDForIconURLFromSQLDatabase):
1478         (WebCore::IconDatabase::addIconURLToSQLDatabase):
1479         (WebCore::IconDatabase::getImageDataForIconURLFromSQLDatabase):
1480         (WebCore::IconDatabase::removeIconFromSQLDatabase):
1481         (WebCore::IconDatabase::writeIconSnapshotToSQLDatabase):
1482         * platform/sql/SQLiteDatabase.cpp:
1483         (WebCore::SQLiteDatabase::setMaximumSize):
1484         * platform/sql/SQLiteDatabase.h:
1485         * platform/sql/SQLiteFileSystem.cpp:
1486         (WebCore::SQLiteFileSystem::getFileNameForNewDatabase):
1487         * platform/sql/SQLiteStatement.cpp:
1488         (WebCore::SQLiteStatement::step):
1489         (WebCore::SQLiteStatement::returnIntResults):
1490         (WebCore::SQLiteStatement::returnInt64Results):
1491
1492 2015-04-05  Simon Fraser  <simon.fraser@apple.com>
1493
1494         Remove "go ahead and" from comments
1495         https://bugs.webkit.org/show_bug.cgi?id=143421
1496
1497         Reviewed by Darin Adler, Benjamin Poulain.
1498
1499         Remove the phrase "go ahead and" from comments where it doesn't add
1500         anything (which is almost all of them).
1501
1502         * Modules/webdatabase/DatabaseTracker.cpp:
1503         (WebCore::DatabaseTracker::deleteOriginLockFor):
1504         * css/CSSFontFaceSrcValue.cpp:
1505         (WebCore::CSSFontFaceSrcValue::isSupportedFormat):
1506         * css/CSSPrimitiveValue.h:
1507         * css/StyleResolver.cpp:
1508         (WebCore::StyleResolver::styleForKeyframe):
1509         (WebCore::StyleResolver::styleForPage):
1510         (WebCore::StyleResolver::applyMatchedProperties):
1511         * editing/ApplyStyleCommand.cpp:
1512         (WebCore::ApplyStyleCommand::pushDownInlineStyleAroundNode):
1513         * loader/DocumentLoader.cpp:
1514         (WebCore::DocumentLoader::detachFromFrame):
1515         * loader/cache/CachedImage.cpp:
1516         (WebCore::CachedImage::addIncrementalDataBuffer):
1517         * loader/icon/IconDatabase.cpp:
1518         (WebCore::IconDatabase::performURLImport):
1519         * page/PageOverlay.cpp:
1520         (WebCore::PageOverlay::fadeAnimationTimerFired):
1521         * platform/ScrollView.cpp:
1522         (WebCore::ScrollView::updateScrollbars):
1523         (WebCore::ScrollView::scrollContents):
1524         * platform/graphics/DisplayRefreshMonitor.cpp:
1525         (WebCore::DisplayRefreshMonitor::create):
1526         * platform/graphics/GraphicsContext.cpp:
1527         * platform/graphics/mac/ComplexTextController.cpp:
1528         (WebCore::ComplexTextController::adjustGlyphsAndAdvances):
1529         * platform/network/HTTPParsers.cpp:
1530         (WebCore::parseHTTPRefresh):
1531         * rendering/RenderBlock.cpp:
1532         (WebCore::RenderBlock::removeChild):
1533         (WebCore::RenderBlock::layoutPositionedObjects):
1534         (WebCore::RenderBlock::selectionGaps):
1535         (WebCore::RenderBlock::blockSelectionGaps):
1536         (WebCore::RenderBlock::absoluteRects):
1537         (WebCore::RenderBlock::absoluteQuads):
1538         (WebCore::RenderBlock::addFocusRingRects):
1539         * rendering/RenderBlockFlow.cpp:
1540         (WebCore::RenderBlockFlow::layoutBlockChild):
1541         (WebCore::RenderBlockFlow::handleAfterSideOfBlock):
1542         (WebCore::RenderBlockFlow::adjustBlockChildForPagination):
1543         (WebCore::RenderBlockFlow::insertFloatingObject):
1544         (WebCore::RenderBlockFlow::addOverhangingFloats):
1545         (WebCore::RenderBlockFlow::inlineSelectionGaps):
1546         (WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths):
1547         * rendering/RenderBlockLineLayout.cpp:
1548         (WebCore::RenderBlockFlow::appendRunsForObject):
1549         * rendering/RenderBox.cpp:
1550         (WebCore::RenderBox::positionLineBox):
1551         (WebCore::RenderBox::sizesLogicalWidthToFitContent):
1552         * rendering/RenderBoxModelObject.cpp:
1553         (WebCore::RenderBoxModelObject::paintFillLayerExtended):
1554         * rendering/RenderLayer.cpp:
1555         (WebCore::RenderLayer::updateLayerPositions):
1556         (WebCore::RenderLayer::hitTestLayer):
1557         (WebCore::RenderLayer::calculateClipRects):
1558         * rendering/RenderLayerModelObject.cpp:
1559         (WebCore::RenderLayerModelObject::styleWillChange):
1560         * rendering/RenderLineBoxList.cpp:
1561         (WebCore::RenderLineBoxList::dirtyLinesFromChangedChild):
1562         * rendering/RenderTextLineBoxes.cpp:
1563         (WebCore::RenderTextLineBoxes::dirtyRange):
1564         * rendering/line/BreakingContext.h:
1565         (WebCore::BreakingContext::handleOutOfFlowPositioned):
1566         (WebCore::BreakingContext::handleText):
1567         * rendering/line/LineBreaker.cpp:
1568         (WebCore::LineBreaker::nextLineBreak):
1569         * style/StyleResolveTree.cpp:
1570         (WebCore::Style::resolveLocal):
1571         * xml/XMLHttpRequestProgressEventThrottle.cpp:
1572         (WebCore::XMLHttpRequestProgressEventThrottle::dispatchThrottledProgressEvent):
1573         * xml/parser/XMLDocumentParser.cpp:
1574         (WebCore::XMLDocumentParser::append):
1575
1576 2015-04-04  Andy Estes  <aestes@apple.com>
1577
1578         [Content Filtering] Blocked page is not always displayed when it should be
1579         https://bugs.webkit.org/show_bug.cgi?id=143410
1580         rdar://problem/20211099
1581
1582         Reviewed by Andreas Kling.
1583
1584         These tests now pass: contentfiltering/block-after-add-data.html
1585                               contentfiltering/block-after-response.html
1586
1587         There were several problems with how ContentFilter loaded replacement data:
1588         (1) Replacement data was delivered to DocumentLoader as if it were the original document's data. This assumes
1589             that the original data was a UTF-8 encoded HTML document, which is not always true. We had a way to reset
1590             the encoding, but not the content type.
1591         (2) Replacement data was never delivered when the filter blocks in DocumentLoader::responseReceived().
1592         (3) The main resource load was cancelled before the replacement data could be rendered when the filter blocks
1593             in DocumentLoader::dataReceived().
1594         The result was that only when the load was blocked after DocumentLoader::notifyFinished() would the replacement
1595         data be shown properly, and only when problem (1) wasn't occurring.
1596
1597         This patch addresses these issues by using the substitute data mechanism to deliver replacement data. By using
1598         substitute data, we can ensure that the original load is cancelled at the earliest opportunity and that the
1599         replacement data is loaded with the proper content type and encoding.
1600
1601         Accomplishing this required changing the way ContentFilter interacts with DocumentLoader. Instead of placing
1602         ContentFilter hooks throughout DocumentLoader, this patch makes ContentFilter itself the client of the
1603         CachedRawResource for the duration of the filtering. If the filter decides to allow the load, DocumentLoader
1604         adds itself as a client causing CachedRawResource to deliver to it the response and buffered data. If the
1605         filter decides to block the load, DocumentLoader schedules a substitute data load. An added benefit of this
1606         approach is that ContentFilter can reuse CachedRawResource's original data buffer instead of keeping its own.
1607
1608         * loader/ContentFilter.cpp:
1609         (WebCore::ContentFilter::createIfNeeded): Changed to take a DecisionFunction rather than a ResourceResponse and DocumentLoader.
1610         (WebCore::ContentFilter::ContentFilter): Ditto.
1611         (WebCore::ContentFilter::~ContentFilter): Removed ourself as a CachedRawResource client if needed.
1612         (WebCore::ContentFilter::startFilteringMainResource): Became the client of the CachedRawResource in order to start the filtering process.
1613         (WebCore::ContentFilter::unblockHandler): Returned the unblock handler.
1614         (WebCore::ContentFilter::replacementData): Returned the replacement data.
1615         (WebCore::ContentFilter::unblockRequestDeniedScript): Returned the unblock request denied script.
1616         (WebCore::ContentFilter::responseReceived): Called responseReceived() on each filter using forEachContentFilterUntilBlocked().
1617         (WebCore::ContentFilter::dataReceived): Ditto for dataReceived().
1618         (WebCore::ContentFilter::notifyFinished): Ditto for finishedLoading().
1619         (WebCore::ContentFilter::forEachContentFilterUntilBlocked): For each filter that needs more data, called the function.
1620         If the filter blocked the load, called didDecide() with State::Blocked.
1621         If all filters allowed the load, called didDecide() with State::Allowed.
1622         (WebCore::ContentFilter::didDecide): Set m_state and called m_decisionFunction().
1623         (WebCore::ContentFilter::addData): Deleted.
1624         (WebCore::ContentFilter::finishedAddingData): Deleted.
1625         (WebCore::ContentFilter::needsMoreData): Deleted.
1626         (WebCore::ContentFilter::didBlockData): Deleted.
1627         (WebCore::ContentFilter::getReplacementData): Deleted.
1628         * loader/ContentFilter.h:
1629         (WebCore::ContentFilter::type):
1630         * loader/DocumentLoader.cpp:
1631         (WebCore::DocumentLoader::DocumentLoader): Called ContentFilter::createIfNeeded() if not loading substitute data.
1632         (WebCore::DocumentLoader::finishedLoading): Removed old ContentFilter code.
1633         (WebCore::DocumentLoader::responseReceived): Ditto.
1634         (WebCore::DocumentLoader::commitData): Ditto.
1635         (WebCore::DocumentLoader::dataReceived): Ditto.
1636         (WebCore::DocumentLoader::detachFromFrame): Set m_contentFilter to nullptr.
1637         (WebCore::DocumentLoader::startLoadingMainResource): Called becomeMainResourceClientIfFilterAllows() instead of
1638         becoming m_mainResource's client.
1639         (WebCore::DocumentLoader::clearMainResource): Set m_contentFilter to nullptr.
1640         (WebCore::DocumentLoader::becomeMainResourceClientIfFilterAllows): If ContentFilter is initialized, called
1641         ContentFilter::startFilteringMainResource(). Otherwise added ourself as a client of m_mainResource.
1642         (WebCore::DocumentLoader::installContentFilterUnblockHandler): Added a helper for creating and notifying
1643         FrameLoaderClient of the unblock handler.
1644         (WebCore::DocumentLoader::contentFilterDidDecide): Set m_contentFilter to nullptr. If the content filter
1645         allowed the load, then added ourself as the CachedRawResource's client. Otherwise, installed the unblock handler
1646         and scheduled a substitute data load with the replacement data.
1647         * loader/DocumentLoader.h:
1648         * loader/FrameLoader.cpp:
1649         (WebCore::FrameLoader::prepareForLoadStart): Removed call to PolicyChecker::prepareForLoadStart().
1650         * loader/NavigationScheduler.cpp:
1651         (WebCore::ScheduledSubstituteDataLoad::ScheduledSubstituteDataLoad): Added a ScheduledNavigation subclass that
1652         calls FrameLoader::load() with a FrameLoadRequest containing substitute data.
1653         (WebCore::NavigationScheduler::scheduleSubstituteDataLoad): Scheduled a substitute data load.
1654         * loader/NavigationScheduler.h:
1655         * loader/PolicyChecker.cpp:
1656         (WebCore::PolicyChecker::checkNavigationPolicy): Reset m_contentFilterUnblockHandler if it couldn't handle the request.
1657         (WebCore::PolicyChecker::prepareForLoadStart): Deleted.
1658         * loader/PolicyChecker.h:
1659         * platform/ContentFilterUnblockHandler.h:
1660         (WebCore::ContentFilterUnblockHandler::unreachableURL):
1661         (WebCore::ContentFilterUnblockHandler::setUnreachableURL):
1662         (WebCore::ContentFilterUnblockHandler::unblockURLScheme): Renamed to ContentFilter::urlScheme().
1663         * platform/PlatformContentFilter.h:
1664         * platform/cocoa/ContentFilterUnblockHandlerCocoa.mm:
1665         (WebCore::ContentFilterUnblockHandler::wrapWithDecisionHandler): Added a helper to wrap the unblock handler with an outer DecisionHandlerFunction.
1666         (WebCore::ContentFilterUnblockHandler::encode): Added m_unreachableURL to the encoding.
1667         (WebCore::ContentFilterUnblockHandler::decode): Ditto for the decoding.
1668         (WebCore::ContentFilterUnblockHandler::canHandleRequest): Changed to call ContentFilter::urlScheme().
1669         * platform/cocoa/NetworkExtensionContentFilter.h:
1670         * platform/cocoa/NetworkExtensionContentFilter.mm:
1671         (replacementDataFromDecisionInfo): Added a helper to extract replacement data from the decisionInfo dictionary.
1672         (WebCore::NetworkExtensionContentFilter::enabled): Renamed from canHandleReponse(); only checks if the filter is enabled.
1673         (WebCore::NetworkExtensionContentFilter::create): Created a new object.
1674         (WebCore::NetworkExtensionContentFilter::NetworkExtensionContentFilter): Created a NEFilterSource immediately when using the modern API.
1675         (WebCore::NetworkExtensionContentFilter::responseReceived): Created a NEFilterSource when using the legacy API.
1676         Called -[NEFilterSource receivedResponse:decisionHandler:] when using the modern API.
1677         (WebCore::NetworkExtensionContentFilter::addData): Stopped buffering the original data.
1678         (WebCore::NetworkExtensionContentFilter::replacementData): Returned a SharedBuffer instead of a char* and int&.
1679         (WebCore::NetworkExtensionContentFilter::canHandleResponse): Deleted.
1680         (WebCore::createNEFilterSource): Deleted.
1681         (WebCore::NetworkExtensionContentFilter::getReplacementData): Deleted.
1682         * platform/cocoa/ParentalControlsContentFilter.h:
1683         * platform/cocoa/ParentalControlsContentFilter.mm:
1684         (WebCore::ParentalControlsContentFilter::enabled): Renamed from canHandleReponse(); only checks if the filter is enabled.
1685         (WebCore::ParentalControlsContentFilter::create): Created a new object.
1686         (WebCore::ParentalControlsContentFilter::ParentalControlsContentFilter): Initialized m_filterState to kWFEStateBuffering.
1687         (WebCore::canHandleResponse): Added a helper to check if the response can be filtered.
1688         (WebCore::ParentalControlsContentFilter::responseReceived): If !canHandleResponse(), set m_filterState to kWFEStateAllowed and return.
1689         Otherwise created a new WebFilterEvaluator with the response.
1690         (WebCore::ParentalControlsContentFilter::addData): Called updateFilterState().
1691         (WebCore::ParentalControlsContentFilter::finishedAddingData): Ditto.
1692         (WebCore::ParentalControlsContentFilter::needsMoreData): Changed to check m_filterState.
1693         (WebCore::ParentalControlsContentFilter::didBlockData): Ditto.
1694         (WebCore::ParentalControlsContentFilter::replacementData): Returned a SharedBuffer instead of a char* and int&.
1695         (WebCore::ParentalControlsContentFilter::updateFilterState): Updated m_filterState by calling -[WebFilterEvaluator filterState].
1696         (WebCore::ParentalControlsContentFilter::canHandleResponse): Deleted.
1697         (WebCore::ParentalControlsContentFilter::getReplacementData): Deleted.
1698         * platform/spi/cocoa/NEFilterSourceSPI.h:
1699         * platform/spi/cocoa/WebFilterEvaluatorSPI.h:
1700         * testing/MockContentFilter.cpp:
1701         (WebCore::MockContentFilter::enabled): Renamed from canHandleReponse(); only checks if the filter is enabled.
1702         (WebCore::MockContentFilter::create): Created a new object.
1703         (WebCore::MockContentFilter::responseReceived): Called maybeDetermineStatus().
1704         (WebCore::MockContentFilter::addData): Stopped buffering the original data.
1705         (WebCore::MockContentFilter::replacementData): Returned a SharedBuffer instead of a char* and int&.
1706         (WebCore::MockContentFilter::unblockHandler): Asserted that we blocked data.
1707         (WebCore::MockContentFilter::canHandleResponse): Deleted.
1708         (WebCore::MockContentFilter::MockContentFilter): Deleted.
1709         (WebCore::MockContentFilter::getReplacementData): Deleted.
1710         * testing/MockContentFilter.h:
1711         * testing/MockContentFilterSettings.cpp:
1712         (WebCore::MockContentFilterSettings::unblockRequestURL): Changed to use a StringBuilder.
1713
1714 2015-04-04  Chris Fleizach  <cfleizach@apple.com>
1715
1716         AX: Heuristic: Avoid exposing an element as clickable if mouse event delegation is handled on an AXElement with more than one descendant AXElement
1717         https://bugs.webkit.org/show_bug.cgi?id=136247
1718
1719         Reviewed by Mario Sanchez Prada.
1720
1721         Modify the logic for determining whether an element supports the press action by trying to filter out objects being handled by event delegation.
1722         The heuristic is if an element handles click actions and has more than one of a {static text, image, control, link, heading}, then we think
1723         it's using event delegation, and do not expose the press action.
1724
1725         Test: platform/mac/accessibility/press-action-not-exposed-for-event-delegation.html
1726
1727         * accessibility/AccessibilityObject.cpp:
1728         (WebCore::AccessibilityObject::supportsPressAction):
1729
1730 2015-04-04  Simon Fraser  <simon.fraser@apple.com>
1731
1732         More const in CSSToStyleMap
1733         https://bugs.webkit.org/show_bug.cgi?id=143409
1734
1735         Reviewed by Andreas Kling.
1736
1737         The CSSValues passed to CSSToStyleMap functions can mostly be treated
1738         as |const|, except for CSSImageValues which have special behavior.
1739         
1740         This makes it clearer what the inputs and outputs of these
1741         functions are.
1742
1743         * css/CSSPrimitiveValue.cpp:
1744         (WebCore::CSSPrimitiveValue::computeDegrees):
1745         * css/CSSPrimitiveValue.h:
1746         (WebCore::CSSPrimitiveValue::computeTime):
1747         * css/CSSToStyleMap.cpp:
1748         (WebCore::CSSToStyleMap::mapFillAttachment):
1749         (WebCore::CSSToStyleMap::mapFillClip):
1750         (WebCore::CSSToStyleMap::mapFillComposite):
1751         (WebCore::CSSToStyleMap::mapFillBlendMode):
1752         (WebCore::CSSToStyleMap::mapFillOrigin):
1753         (WebCore::CSSToStyleMap::mapFillRepeatX):
1754         (WebCore::CSSToStyleMap::mapFillRepeatY):
1755         (WebCore::CSSToStyleMap::mapFillSize):
1756         (WebCore::CSSToStyleMap::mapFillXPosition):
1757         (WebCore::CSSToStyleMap::mapFillYPosition):
1758         (WebCore::CSSToStyleMap::mapFillMaskSourceType):
1759         (WebCore::CSSToStyleMap::mapAnimationDelay):
1760         (WebCore::CSSToStyleMap::mapAnimationDirection):
1761         (WebCore::CSSToStyleMap::mapAnimationDuration):
1762         (WebCore::CSSToStyleMap::mapAnimationFillMode):
1763         (WebCore::CSSToStyleMap::mapAnimationIterationCount):
1764         (WebCore::CSSToStyleMap::mapAnimationName):
1765         (WebCore::CSSToStyleMap::mapAnimationPlayState):
1766         (WebCore::CSSToStyleMap::mapAnimationProperty):
1767         (WebCore::CSSToStyleMap::mapAnimationTimingFunction):
1768         (WebCore::CSSToStyleMap::mapAnimationTrigger):
1769         * css/CSSToStyleMap.h:
1770
1771 2015-04-04  Dan Bernstein  <mitz@apple.com>
1772
1773         Tried to fix the build.
1774
1775         * loader/icon/IconController.cpp:
1776         (WebCore::iconsFromLinkElements):
1777
1778 2015-04-02  Darin Adler  <darin@apple.com>
1779
1780         Streamline icon-related code, mostly unused
1781         https://bugs.webkit.org/show_bug.cgi?id=143306
1782
1783         Reviewed by Antti Koivisto.
1784
1785         I started on this path because Document::iconURLs had a poor implementation,
1786         storing results in a data member with no benefit, using HTMLCollection for
1787         iteration of the children of the head element instead of using the simpler
1788         faster technique we use inside the engine. Then, I discovered this function was
1789         mostly-unused code left over from before the Blink fork. I removed most of it.
1790         We can add this back later if someone finds a use for it, but if we do we
1791         should do a higher quality implementation without the quirks of the old one.
1792
1793         Refactoring also made it clear that logic isn't exactly sensible. There's a
1794         set of rules about what order to return the list in that is not followed by
1795         the code that tries to find the "default touch icon". Later we could add some
1796         more test coverage and tighten up the logic. But the reality is that at this
1797         time, with some small exceptions, icon logic is in the web browsers, not in WebKit.
1798
1799         * CMakeLists.txt: Removed IconURL.cpp.
1800         * WebCore.vcxproj/WebCore.vcxproj: Ditto.
1801         * WebCore.vcxproj/WebCore.vcxproj.filters: Ditto.
1802         * WebCore.xcodeproj/project.pbxproj: Ditto.
1803         * dom/DOMAllInOne.cpp: Ditto.
1804
1805         * dom/Document.cpp:
1806         (WebCore::Document::evaluate): Tweaked formatting.
1807         (WebCore::Document::shortcutIconURLs): Removed. Unused function.
1808         (WebCore::Document::iconURLs): Removed. Moved code to IconController.
1809         (WebCore::Document::addIconURL): Removed. Moved code to LinkLoader.
1810
1811         * dom/Document.h: Removed shortcutIconURLs, iconURLs, addIconURL,
1812         and m_iconURLs.
1813
1814         * dom/IconURL.cpp: Removed.
1815         * dom/IconURL.h: Removed everything from this header except for the
1816         IconType enum. Added a FIXME about possibly renaming the header.
1817
1818         * html/HTMLLinkElement.cpp:
1819         (WebCore::HTMLLinkElement::HTMLLinkElement): Pass a reference when creating
1820         the link loading.
1821         (WebCore::HTMLLinkElement::setDisabledState): Access members of the struct
1822         LinkRelElement without "m_" prefix.
1823         (WebCore::HTMLLinkElement::parseAttribute): Changed to use early return style,
1824         and made the part of this for parsing title use a more normal idiom.
1825         (WebCore::HTMLLinkElement::process): Removed many unneeded arguments, made the
1826         logic of the code a little easier to follow.
1827         (WebCore::HTMLLinkElement::removedFrom): Removed a call to a function that had
1828         an empty body.
1829         (WebCore::HTMLLinkElement::iconType): Updated for change to LinkRelElement.
1830         (WebCore::HTMLLinkElement::addSubresourceAttributeURLs): Ditto.
1831         * html/HTMLLinkElement.h: More of the same.
1832
1833         * html/LinkRelAttribute.cpp:
1834         (WebCore::LinkRelAttribute::LinkRelAttribute): Initialize data members in the
1835         struct itself. Got rid of "m_" prefix since this is a struct, not a class.
1836         Changed code to use modern for loop; even better would be to eliminate the
1837         splitting into a vector entirely and use StringView (do that next time).
1838         * html/LinkRelAttribute.h: See above.
1839
1840         * html/parser/HTMLPreloadScanner.cpp:
1841         (WebCore::TokenPreloadScanner::StartTagScanner::relAttributeIsStyleSheet):
1842         Updated for chnages to LinkRelAttribute and give the local variable a clearer name.
1843
1844         * loader/FrameLoader.cpp:
1845         (WebCore::FrameLoader::didChangeIcons): Removed.
1846         * loader/FrameLoader.h: Removed didChangeIcons.
1847
1848         * loader/FrameLoaderClient.h: Added include for String since it's no longer
1849         taken care of by IconURLs.h.
1850
1851         * loader/LinkLoader.cpp:
1852         (WebCore::LinkLoader::LinkLoader): Take a reference instead of a pointer.
1853         (WebCore::LinkLoader::linkLoadTimerFired): Use m_client reference instead of pointer.
1854         (WebCore::LinkLoader::linkLoadingErrorTimerFired): Ditto.
1855         (WebCore::LinkLoader::notifyFinished): Use nullptr.
1856         (WebCore::LinkLoader::loadLink): Tweak formatting. Move the dispatchDidChangeIcons
1857         call in here instead of going through Document to FrameLoader and then FrameLoader to
1858         FrameLoaderClient, and passing extra unused arguments, the way the old code did.
1859         Use a reference instead of a pointer for the document.
1860         (WebCore::LinkLoader::released): Removed. Empty function.
1861
1862         * loader/LinkLoader.h: Changed constructor argument to be a reference. Made more
1863         things private. Removed empty released function.
1864
1865         * loader/icon/IconController.cpp:
1866         (WebCore::IconController::IconController): Moved initialization of data members to
1867         the class definition in the header.
1868         (WebCore::iconsFromLinkElements): Added. This function replaces the existing
1869         Document::iconURLs function, but has a simpler implementation and interface.
1870         It focuses on exactly what the code in this file needs. If we want to add some
1871         more features to the icon controller we might make this more complex again.
1872         Even now, building a vector is not necessarily helpful; the only client of this
1873         function ends up extracting only one of the URLs this function returns.
1874         (WebCore::IconController::url): Rewrote this. It's the only function actually
1875         using the icon URLs. This contains a combination of the logic from the various
1876         functions in this class before, including iconURL, urlsForTypes, appendToIconURLs,
1877         and defaultURL. Among other improvements, replaced the unusual code to construct
1878         the icon URL with a call to Document::completeURL.
1879         (WebCore::IconController::startLoader): Refactored a bit to remove a local variable.
1880         (WebCore::IconController::continueLoadWithDecision): Ditto.
1881
1882         * loader/icon/IconController.h: Removed unneeded includes, unneeded use of
1883         WTF_MAKE_NONCOPYABLE (since classes with data members of reference type are
1884         automatically noncopyable), unused fucntions. Also initialize m_waitingForLoadDecision.
1885
1886         * testing/Internals.cpp:
1887         (WebCore::Internals::iconURLs): Removed.
1888         (WebCore::Internals::shortcutIconURLs): Left this in place since it is used by
1889         tests. Changed it to return the actual value from the IconController::url function,
1890         since that's the interface to our icon machinery that is actually exposed on some
1891         platforms. That means this returns only a single URL.
1892         (WebCore::Internals::allIconURLs): Removed.
1893         * testing/Internals.h: Removed allIconURLs and iconURLs.
1894         * testing/Internals.idl: Removed allIconURLs.
1895
1896 2015-04-04  Simon Fraser  <simon.fraser@apple.com>
1897
1898         Fix EFL and Gtk build.
1899
1900         * dom/Document.cpp:
1901         (WebCore::Document::didRemoveTouchEventHandler):
1902
1903 2015-04-04  Simon Fraser  <simon.fraser@apple.com>
1904
1905         Crash under Document::absoluteRegionForEventTargets on build.webkit.org/dashboard
1906         https://bugs.webkit.org/show_bug.cgi?id=143406
1907         rdar://problem/20407080
1908
1909         Reviewed by Ryosuke Niwa.
1910         
1911         We failed to remove elements from Document's m_wheelEventTargets HashSet when the
1912         elements were destroyed with wheel handlers still on them. Fix by removing the
1913         node from the set via Node::willBeDeletedFrom().
1914
1915         Tests: platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-element-with-multiple-handlers-crash.html
1916                platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-wheel-element-crash.html
1917                platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/destroy-wheel-element-parent-crash.html
1918
1919         * dom/Document.cpp:
1920         (WebCore::removeHandlerFromSet): Helper to remove one or all handlers on the given node.
1921         (WebCore::Document::didRemoveWheelEventHandler): Add a parameter to specify whether we're
1922         removing all handlers on the given node.
1923         (WebCore::Document::didRemoveTouchEventHandler): Use removeHandlerFromSet().
1924         * dom/Document.h:
1925         * dom/Node.cpp:
1926         (WebCore::Node::willBeDeletedFrom): Tell the document we're removing all handlers
1927         for this node.
1928
1929 2015-04-04  Simon Fraser  <simon.fraser@apple.com>
1930
1931         REGRESSION (r182215): Feedly crashes when closing article
1932         https://bugs.webkit.org/show_bug.cgi?id=143405
1933         rdar://problem/20382734, rdar://problem/20395497
1934
1935         Reviewed by Tim Horton.
1936         
1937         Calling computeNonFastScrollableRegion() eagerly when scrollable areas come and go
1938         is bad, because it can cause FrameView::layout() to get called in the middle of
1939         RenderObject destruction, which leaves the render tree in a bad state.
1940         
1941         Fix by calling computeNonFastScrollableRegion() lazily, just before scrolling tree commit.
1942         
1943         AsyncScrollingCoordinator::frameViewNonFastScrollableRegionChanged() now just sets
1944         a flag to say that the non-fast region needs to be recomputed, and that schedules
1945         a scrolling tree commit. When the commit happens, we recompute the region. If the
1946         region didn't change, and no other changes are pending, there's no need to commit.
1947
1948         Test: platform/mac-wk2/tiled-drawing/scrolling/non-fast-region/compute-region-inside-delete-renderer-crash.html
1949
1950         * page/scrolling/AsyncScrollingCoordinator.cpp:
1951         (WebCore::AsyncScrollingCoordinator::setNonFastScrollableRegionDirty):
1952         (WebCore::AsyncScrollingCoordinator::willCommitTree):
1953         (WebCore::AsyncScrollingCoordinator::updateNonFastScrollableRegion):
1954         (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
1955         (WebCore::AsyncScrollingCoordinator::frameViewNonFastScrollableRegionChanged):
1956         (WebCore::AsyncScrollingCoordinator::scrollingStateTreeAsText): Need to eagerly update
1957         the non-fast scrollable region.
1958         * page/scrolling/AsyncScrollingCoordinator.h:
1959         (WebCore::AsyncScrollingCoordinator::nonFastScrollableRegionDirty):
1960         * page/scrolling/ScrollingCoordinator.cpp:
1961         (WebCore::ScrollingCoordinator::ScrollingCoordinator):
1962         (WebCore::ScrollingCoordinator::computeNonFastScrollableRegion):
1963         * page/scrolling/ScrollingCoordinator.h:
1964         (WebCore::ScrollingCoordinator::willCommitTree):
1965         * page/scrolling/mac/ScrollingCoordinatorMac.mm:
1966         (WebCore::ScrollingCoordinatorMac::commitTreeStateIfNeeded):
1967         (WebCore::ScrollingCoordinatorMac::scheduleTreeStateCommit):
1968         (WebCore::ScrollingCoordinatorMac::commitTreeState):
1969
1970 2015-04-04  Simon Fraser  <simon.fraser@apple.com>
1971
1972         Differentiate between composited scrolling, and async scrolling
1973         https://bugs.webkit.org/show_bug.cgi?id=143291
1974
1975         Reviewed by Sam Weinig.
1976         
1977         ScrollableArea::usesCompositedScrolling() meant "uses aysnc scrolling", but
1978         FrameView::contentsInCompositedLayer() covered a related concept, that scrolling
1979         happens by moving compositing layers around.
1980         
1981         Make the difference between these more explicit by adding ScrollableArea::usesAsyncScrolling(),
1982         which means that scrolling for that ScrollableArea is asynchronous and managed
1983         by a ScrollingCoordinator. This is the meaning that ScrollingCoordinator::computeNonFastScrollableRegion()
1984         understands.
1985         
1986         ScrollableArea::usesCompositedScrolling() is now repurposed to mean "scrolling
1987         occurs by moving layers around, not requiring repaint". FrameView::contentsInCompositedLayer()
1988         is renamed to usesCompositedScrolling(), and overrides the base class function.
1989
1990         This only changes behavior in tests that call setScrollingTreeIncludesFrames(true).
1991
1992         * page/FrameView.cpp:
1993         (WebCore::FrameView::useSlowRepaints):
1994         (WebCore::FrameView::usesCompositedScrolling):
1995         (WebCore::FrameView::usesAsyncScrolling):
1996         (WebCore::FrameView::scrollContentsFastPath):
1997         (WebCore::FrameView::scrollContentsSlowPath):
1998         (WebCore::FrameView::contentsInCompositedLayer): Deleted.
1999         * page/FrameView.h:
2000         * page/scrolling/ScrollingCoordinator.cpp:
2001         (WebCore::ScrollingCoordinator::computeNonFastScrollableRegion):
2002         * platform/ScrollableArea.h:
2003         (WebCore::ScrollableArea::usesAsyncScrolling):
2004         * rendering/RenderLayer.cpp:
2005         (WebCore::RenderLayer::usesAsyncScrolling):
2006         * rendering/RenderLayer.h:
2007
2008 2015-04-04  Xabier Rodriguez Calvar <calvaris@igalia.com> and Youenn Fablet  <youenn.fablet@crf.canon.fr>
2009
2010         [Streams API] Collecting a ReadableStreamReader should not unlock its stream
2011         https://bugs.webkit.org/show_bug.cgi?id=143333
2012
2013         Reviewed by Benjamin Poulain.
2014
2015         This patch stores as a boolean whether the stream is locked to a reader.
2016         In case the reader forget to unlock the stream, the reader can be collected and destructor called.
2017         In that case, the link between reader and stream will be reset but the stream will remain in locked state.
2018
2019         Covered by new test in streams/readablestreamreader-constructor.html.
2020
2021         * Modules/streams/ReadableStream.h:
2022         (WebCore::ReadableStream::isLocked):
2023         (WebCore::ReadableStream::lock):
2024         (WebCore::ReadableStream::release):
2025         (WebCore::ReadableStream::releaseButKeepLocked): Introduced to cut the link between reader and stream but stil keeping the stream locked.
2026         * Modules/streams/ReadableStreamReader.cpp:
2027         (WebCore::ReadableStreamReader::~ReadableStreamReader):
2028         * bindings/js/JSReadableStreamCustom.cpp:
2029         (WebCore::JSReadableStream::getReader):
2030         * bindings/js/JSReadableStreamReaderCustom.cpp:
2031         (WebCore::constructJSReadableStreamReader):
2032
2033 2015-04-03  Zan Dobersek  <zdobersek@igalia.com>
2034
2035         MediaDevices possesses a vtable despite using ImplementationLacksVTable IDL attribute
2036         https://bugs.webkit.org/show_bug.cgi?id=143367
2037
2038         Reviewed by Eric Carlson.
2039
2040         * Modules/mediastream/MediaDevices.idl: MediaDevices ends up with a vtable
2041         because of inheriting from ContextDestructionObserver. This collides with
2042         the ImplementationLacksVTable IDL attribute, causing compilation errors
2043         with Clang. Since MediaDevices isn't being inherited from, but will still
2044         end up with a vtable, the IDL attribute should be removed.
2045
2046 2015-04-03  Alex Christensen  <achristensen@webkit.org>
2047
2048         [Content Extensions] Add memory reporting.
2049         https://bugs.webkit.org/show_bug.cgi?id=143386
2050
2051         Reviewed by Benjamin Poulain.
2052
2053         * contentextensions/CompiledContentExtension.cpp:
2054         (WebCore::ContentExtensions::CompiledContentExtension::globalDisplayNoneSelectors):
2055         * contentextensions/CompiledContentExtension.h:
2056         * contentextensions/ContentExtension.cpp:
2057         (WebCore::ContentExtensions::ContentExtension::globalDisplayNoneStyleSheet):
2058         * contentextensions/ContentExtension.h:
2059         * contentextensions/ContentExtensionsBackend.cpp:
2060         (WebCore::ContentExtensions::ContentExtensionsBackend::actionsForResourceLoad):
2061         * contentextensions/ContentExtensionsDebugging.h:
2062         * contentextensions/DFABytecodeInterpreter.cpp:
2063         (WebCore::ContentExtensions::getBits):
2064         (WebCore::ContentExtensions::DFABytecodeInterpreter::interpretAppendAction):
2065         (WebCore::ContentExtensions::DFABytecodeInterpreter::interpretTestFlagsAndAppendAction):
2066         (WebCore::ContentExtensions::DFABytecodeInterpreter::actionsFromDFARoot):
2067         (WebCore::ContentExtensions::DFABytecodeInterpreter::interpret):
2068         * contentextensions/DFABytecodeInterpreter.h:
2069         (WebCore::ContentExtensions::DFABytecodeInterpreter::DFABytecodeInterpreter):
2070         (WebCore::ContentExtensions::DFABytecodeInterpreter::~DFABytecodeInterpreter):
2071         Keep track of which memory pages in the bytecode are being hit if CONTENT_EXTENSIONS_MEMORY_REPORTING is 1.
2072         When CONTENT_EXTENSIONS_MEMORY_REPORTING is 0, this makes an empty vector in ContentExtension
2073         and passes some pointers on the stack, many of which can be optimized out by the C++ compiler.
2074
2075 2015-04-03  Brent Fulgham  <bfulgham@apple.com>
2076
2077         Expand test infrastructure to support scrolling tests
2078         https://bugs.webkit.org/show_bug.cgi?id=143383
2079
2080         Reviewed by Darin Adler.
2081
2082         No new tests: No change in behavior.
2083
2084         This is an initial set of changes that clean up a few things I noticed while extending testing support
2085         for scroll animations and wheel event gestures.
2086         1. Reduce the amount of #ifdef code in EventHandler{Mac}.
2087         2. Consolidate the idea of an "End Gesture" in the PlatformWheelEvent class.
2088         3. Remove a number of unneeded null checks in EventHandler.
2089         4. ScrollController must always have a client, so hold a reference instead of using a pointer.
2090
2091         * page/EventHandler.cpp:
2092         (WebCore::EventHandler::platformNotifyIfEndGesture): Renamed from 'platformNotifySnapIfNecessary'.
2093         (WebCore::EventHandler::handleWheelEvent): Call 'platformNotifySnapIfNecessary' at method exit points.
2094         (WebCore::EventHandler::platformNotifySnapIfNecessary): Deleted.
2095         * page/EventHandler.h:
2096         * page/mac/EventHandlerMac.mm:
2097         (WebCore::EventHandler::platformCompleteWheelEvent):  Remove unneeded null checks for 'view'. Remove
2098         CSS_SNAP-specific call to 'platformNotifySnapIfNecessary'. This logic is now handled in the new
2099         'platformNotifyIfEndGesture' method.
2100         (WebCore::EventHandler::platformNotifyIfEndGesture): Renamed from 'platformNotifySnapIfNecessary'.
2101         (WebCore::EventHandler::platformNotifySnapIfNecessary): Deleted.
2102         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
2103         (WebCore::ScrollingTreeFrameScrollingNodeMac::ScrollingTreeFrameScrollingNodeMac): Pass 'this' as
2104         reference to ScrollController constructor.
2105         * platform/PlatformWheelEvent.h:
2106         (WebCore::PlatformWheelEvent::shouldResetLatching): Call new 'isEndGesture' method.
2107         (WebCore::PlatformWheelEvent::isEndGesture): Added method to encapsulate some code that was duplicated
2108         in a number of places.
2109         * platform/ScrollAnimator.cpp:
2110         (WebCore::ScrollAnimator::ScrollAnimator): Pass 'this' as reference to ScrollController constructor.
2111         * platform/cocoa/ScrollController.h:
2112         * platform/cocoa/ScrollController.mm:
2113         (WebCore::ScrollController::ScrollController): Update to reflect m_client is now a reference.
2114         (WebCore::ScrollController::handleWheelEvent): Ditto.
2115         (WebCore::ScrollController::snapRubberBandTimerFired): Ditto. Also, a drive-by fix for ending rubberband
2116         snapping. This end-state wasn't deactivating the timer (even when the animation finished). This isn't a
2117         huge problem, but I (will) rely on the state of the animation timer in a future patch to decide if
2118         tests should run or continue waiting.
2119         (WebCore::ScrollController::isRubberBandInProgress): Ditto.
2120         (WebCore::ScrollController::startSnapRubberbandTimer): Ditto.
2121         (WebCore::ScrollController::stopSnapRubberbandTimer): Ditto.
2122         (WebCore::ScrollController::shouldRubberBandInHorizontalDirection): Ditto.
2123         (WebCore::ScrollController::processWheelEventForScrollSnapOnAxis): Ditto.
2124         (WebCore::ScrollController::startScrollSnapTimer): Ditto.
2125         (WebCore::ScrollController::stopScrollSnapTimer): Ditto.
2126         (WebCore::ScrollController::scrollSnapAnimationUpdate): Ditto.
2127         (WebCore::ScrollController::beginScrollSnapAnimation): Ditto.
2128         (WebCore::ScrollController::computeSnapDelta): Ditto.
2129         (WebCore::ScrollController::computeGlideDelta): Ditto.
2130         * platform/mac/ScrollAnimatorMac.mm:
2131         (WebCore::gestureShouldBeginSnap): Use new PlatformWheelEvent::isEndGesture() method.
2132
2133 2015-04-03  Chris Fleizach  <cfleizach@apple.com>
2134
2135         AX: Toggling check box state not speaking using plain space, not VO space.
2136         https://bugs.webkit.org/show_bug.cgi?id=143356
2137
2138         Reviewed by Darin Adler.
2139
2140         The checkbox state change needs to result in a value change being generated, otherwise accessibility won't know the value has changed through keyboard usage.
2141   
2142         Test: platform/mac/accessibility/checkbox-posts-value-change-notification-after-activation-with-space.html
2143
2144         * accessibility/mac/AXObjectCacheMac.mm:
2145         (WebCore::AXObjectCache::postPlatformNotification):
2146
2147 2015-04-03  Zalan Bujtas  <zalan@apple.com>
2148
2149         Simple line layout: Use pre-computed simple line runs to produce innerText content.
2150         https://bugs.webkit.org/show_bug.cgi?id=143351
2151
2152         Reviewed by Antti Koivisto.
2153
2154         This is in preparation to cover <br> with simple line layout.
2155         Runs provide line layout information that can be used to cover hard line break cases.
2156         (similar to TextIterator::handleTextBox())
2157
2158         Covered by existing tests.
2159
2160         * editing/TextIterator.cpp:
2161         (WebCore::TextIterator::handleTextNode):
2162         (WebCore::TextIterator::emitCharacter):
2163         (WebCore::TextIterator::emitText):
2164         * editing/TextIterator.h:
2165         * rendering/SimpleLineLayoutResolver.h:
2166         (WebCore::SimpleLineLayout::RunResolver::Run::isEndOfLine):
2167
2168 2015-04-03  Antti Koivisto  <antti@apple.com>
2169
2170         Add non-counting bloom filter class
2171         https://bugs.webkit.org/show_bug.cgi?id=143366
2172
2173         Reviewed by Sam Weinig.
2174
2175         * css/SelectorFilter.cpp:
2176         (WebCore::SelectorFilter::setupParentStack):
2177         * css/SelectorFilter.h:
2178
2179         Update names.
2180
2181 2015-04-03  Alex Christensen  <achristensen@webkit.org>
2182
2183         Remove dead code.
2184         https://bugs.webkit.org/show_bug.cgi?id=143352
2185
2186         Reviewed by Gyuyoung Kim.
2187
2188         * html/BaseChooserOnlyDateAndTimeInputType.cpp:
2189         (WebCore::BaseChooserOnlyDateAndTimeInputType::handleDOMActivateEvent):
2190         * loader/EmptyClients.cpp:
2191         (WebCore::EmptyChromeClient::openDateTimeChooser): Deleted.
2192         * loader/EmptyClients.h:
2193         * page/Chrome.cpp:
2194         (WebCore::Chrome::openDateTimeChooser): Deleted.
2195         * page/Chrome.h:
2196         * page/ChromeClient.h:
2197         Remove ChromeClient::openDateTimeChooser.
2198
2199 2015-04-03  Zan Dobersek  <zdobersek@igalia.com>
2200
2201         Unreviewed, fixing Clang builds of the GTK port on Linux.
2202
2203         * Modules/mediastream/MediaDevices.h:
2204         Include the <functional> header for uses of std::function<>.
2205
2206 2015-04-01 Xabier Rodriguez Calvar <calvaris@igalia.com> and Youenn Fablet <youenn.fablet@crf.canon.fr>
2207
2208         [Streams API] Split ReadableStream/Reader implementation according source type (JS vs native)
2209         https://bugs.webkit.org/show_bug.cgi?id=143130
2210
2211         Reviewed by Benjamin Poulain.
2212
2213         Introduce ReadableJSStream and ReadableJSStreamReader as subclasses of ReadableStream and ReadableStreamReader.
2214         These classes manage JS based sources: ReadableStream JS constructor instantiates ReadableJStream.
2215         These classes are expected to handle JS source specific handling, in particular JSValue error storage and JSValue chunk queue.
2216         Making ReadableStream and ReadableStreamReader abstract, to be subclassed for native sources.
2217
2218         Current tests cover the changes.
2219
2220         * Modules/streams/ReadableStream.cpp:
2221         (WebCore::ReadableStream::ReadableStream): Moved suspendIfNeeded inside constructor to ease subclassing.
2222         (WebCore::ReadableStream::create): Deleted as ReadableStream is now abstarct.
2223         * Modules/streams/ReadableStream.h: Made createReader virtual pure.
2224         * Modules/streams/ReadableStream.idl: Skipping VTable validation as subclasses of ReadableStream may be JS wrapped.
2225         * Modules/streams/ReadableStreamReader.cpp: Removed ReadableStreamReader::create.
2226         * Modules/streams/ReadableStreamReader.h: Ditto.
2227         * Modules/streams/ReadableStreamReader.idl: Skipping VTable validation as subclasses of ReadableStreamReader may be JS wrapped.
2228         * bindings/js/JSReadableStreamCustom.cpp:
2229         (WebCore::constructJSReadableStream): Instantiating ReadableJSStream in lieu of ReadableStream within JS constructor.
2230         * bindings/js/ReadableStreamJSSource.cpp:
2231         (WebCore::ReadableJSStream::create):
2232         (WebCore::ReadableJSStream::createReader): Instantiating ReadableJSStreamReader.
2233         (WebCore::ReadableJSStream::ReadableJSStream):
2234         (WebCore::ReadableJSStreamReader::create):
2235         (WebCore::ReadableJSStreamReader::ReadableJSStreamReader):
2236         * bindings/js/ReadableStreamJSSource.h: Definition of ReadableJSStream and ReadableJSStreamReader.
2237
2238 2015-04-02  Timothy Horton  <timothy_horton@apple.com>
2239
2240         Scrollbars are left in the wrong position when resizing a fixed layout view
2241         https://bugs.webkit.org/show_bug.cgi?id=143360
2242
2243         Reviewed by Beth Dakin.
2244
2245         Test: fast/fixed-layout/fixed-layout.html
2246
2247         * platform/ScrollView.cpp:
2248         (WebCore::ScrollView::setFrameRect):
2249         Update scrollbars when the ScrollView frameRect changes. We were previously
2250         depending on the layout that always happens after this to update scrollbars,
2251         but with fixed layout mode, there won't be a layout! Also, FrameView's
2252         setFrameRect override will sync this scrollbar update with the scrollbar
2253         layers (via RenderLayerCompositor::frameViewDidChangeSize) immediately afterwards.
2254
2255         * testing/Internals.cpp:
2256         (WebCore::Internals::resetToConsistentState):
2257         Turn off fixed layout when resetting state.
2258
2259         (WebCore::Internals::setUseFixedLayout):
2260         (WebCore::Internals::setFixedLayoutSize):
2261         * testing/Internals.h:
2262         * testing/Internals.idl:
2263         Add internals functions to set the fixed layout size and to turn on fixed layout.
2264
2265 2015-04-02  Brady Eidson  <beidson@apple.com>
2266
2267         Unreviewed: Reapplied Change after rollout.
2268
2269         Expose the "Share" menu for text selections on platforms where it's available.
2270         rdar://problem/20034174 and https://bugs.webkit.org/show_bug.cgi?id=143318
2271
2272         * page/ContextMenuClient.h:
2273         (WebCore::ContextMenuClient::shareSelectedTextMenuItem):
2274
2275         * page/ContextMenuContext.h:
2276         (WebCore::ContextMenuContext::setSelectedText):
2277         (WebCore::ContextMenuContext::selectedText):
2278
2279         * page/ContextMenuController.cpp:
2280         (WebCore::ContextMenuController::populate): Add a Share menu item returned from the client.
2281         (WebCore::ContextMenuController::checkOrEnableIfNeeded):
2282
2283         * platform/ContextMenuItem.cpp:
2284         (WebCore::ContextMenuItem::shareSelectedTextMenuItem):
2285
2286         * platform/ContextMenuItem.h:
2287         (WebCore::ContextMenuItem::supportsShareMenu):
2288
2289         * platform/gtk/ContextMenuItemGtk.cpp:
2290         (WebCore::ContextMenuItem::shareSelectedTextMenuItem):
2291
2292         * platform/mac/ContextMenuItemMac.mm:
2293         (WebCore::ContextMenuItem::releasePlatformDescription):
2294         (WebCore::ContextMenuItem::getPlatformDescription):
2295         (WebCore::ContextMenuItem::supportsShareMenu):
2296         (WebCore::ContextMenuItem::shareSelectedTextMenuItem): Use NSMenu SPI to get the Share menu.
2297
2298         * platform/spi/mac/NSMenuSPI.h: Forward declare instead of #include
2299
2300 2015-04-02  Commit Queue  <commit-queue@webkit.org>
2301
2302         Unreviewed, rolling out r182293.
2303         https://bugs.webkit.org/show_bug.cgi?id=143355
2304
2305         Broke GTK and EFL builds. (Requested by bfulgham on #webkit).
2306
2307         Reverted changeset:
2308
2309         "Expose the "Share" menu for text selections on platforms
2310         where it's available."
2311         https://bugs.webkit.org/show_bug.cgi?id=143318
2312         http://trac.webkit.org/changeset/182293
2313
2314 2015-04-02  Brent Fulgham  <bfulgham@apple.com>
2315
2316         REGRESSION: Caption Menus show language codes instead of display names.
2317         https://bugs.webkit.org/show_bug.cgi?id=143350
2318         <rdar://problem/20094145>
2319
2320         Reviewed by Jer Noble.
2321
2322         The generic caption/track label handling in CaptionUserPreferences does not convert language codes
2323         (e.g. 'fr-CA') into display names (e.g., 'French (Canada)'). Because we did not have an AudioTrack
2324         override to process these types of menu items, they were being handled using the generic code.
2325
2326         * page/CaptionUserPreferencesMediaAF.cpp:
2327         (WebCore::buildStringForTrackBase): Helper function to share code with the two flavors
2328         of 'trackDisplayName'.
2329         (WebCore::trackDisplayName): Add a version to support AudioTracks, and modify the TextTrack
2330         version to use the new 'buildStringForTrackBase' function.
2331         (WebCore::CaptionUserPreferencesMediaAF::displayNameForTrack): Add an AudioTrack override so
2332         our AVFoundation tracks are processed in our CaptionUserPreferencesMediaAF implementation, not the
2333         generic version.
2334         (WebCore::CaptionUserPreferencesMediaAF::sortedTrackListForMenu): Add an AudioTrack override so
2335         that the menu items are sorted in order of display name, not language code.
2336         * page/CaptionUserPreferencesMediaAF.h:
2337
2338 2015-04-02  Brady Eidson  <beidson@apple.com>
2339
2340         Expose the "Share" menu for text selections on platforms where it's available.
2341         rdar://problem/20034174 and https://bugs.webkit.org/show_bug.cgi?id=143318
2342
2343         Reviewed by Sam Weinig.
2344
2345         * page/ContextMenuClient.h:
2346         (WebCore::ContextMenuClient::shareSelectedTextMenuItem):
2347
2348         * page/ContextMenuContext.h:
2349         (WebCore::ContextMenuContext::setSelectedText):
2350         (WebCore::ContextMenuContext::selectedText):
2351
2352         * page/ContextMenuController.cpp:
2353         (WebCore::ContextMenuController::populate): Add a Share menu item returned from the client.
2354         (WebCore::ContextMenuController::checkOrEnableIfNeeded):
2355
2356         * platform/ContextMenuItem.cpp:
2357         (WebCore::ContextMenuItem::shareSelectedTextMenuItem):
2358
2359         * platform/ContextMenuItem.h:
2360         (WebCore::ContextMenuItem::supportsShareMenu):
2361
2362         * platform/gtk/ContextMenuItemGtk.cpp:
2363         (WebCore::ContextMenuItem::shareSelectedTextMenuItem):
2364
2365         * platform/mac/ContextMenuItemMac.mm:
2366         (WebCore::ContextMenuItem::releasePlatformDescription):
2367         (WebCore::ContextMenuItem::getPlatformDescription):
2368         (WebCore::ContextMenuItem::supportsShareMenu):
2369         (WebCore::ContextMenuItem::shareSelectedTextMenuItem): Use NSMenu SPI to get the Share menu.
2370
2371         * platform/spi/mac/NSMenuSPI.h: Forward declare instead of #include
2372
2373 2015-04-02  Jer Noble  <jer.noble@apple.com>
2374
2375         [Mac] Only pass in the AVURLAssetClientBundleIdentifierKey on iOS.
2376         https://bugs.webkit.org/show_bug.cgi?id=143347
2377
2378         Reviewed by Brent Fulgham.
2379
2380         Only pass in the main app bundle id into AVURLAsset via the AVURLAssetClientBundleIdentifierKey option
2381         on iOS. On OS X, setting this key can cause media playback to fail.
2382
2383         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2384         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
2385
2386 2015-04-02  Roger Fong  <roger_fong@apple.com>
2387
2388         Show audio media controls on OSX.
2389         https://bugs.webkit.org/show_bug.cgi?id=143346.
2390         <rdar://problem/20306240>
2391
2392         Reviewed by Dean Jackson.
2393
2394         * Modules/mediacontrols/mediaControlsApple.css:
2395         (audio::-webkit-media-controls-panel:hover):
2396         Revert part of r180893.
2397
2398 2015-04-02  Myles C. Maxfield  <mmaxfield@apple.com>
2399
2400         Disallow ruby base from having leading or trailing expansions
2401         https://bugs.webkit.org/show_bug.cgi?id=142608
2402
2403         Reviewed by David Hyatt.
2404
2405         If we determine that a ruby base should have either a leading or trailing expansion,
2406         we shunt that expansion over to the neighboring RenderText, assuming one exists. This
2407         requires that we teach RenderText how to force leading or trailing expansions if one
2408         wouldn't naturally be present.
2409
2410         Tests: fast/ruby/ruby-expansion-cjk-2.html
2411                fast/ruby/ruby-expansion-cjk-3.html
2412                fast/ruby/ruby-expansion-cjk-4.html
2413                fast/ruby/ruby-expansion-cjk-5.html
2414                fast/ruby/ruby-expansion-cjk.html
2415
2416         * rendering/InlineFlowBox.cpp:
2417         (WebCore::InlineFlowBox::removeChild): Delete contentIsKnownToFollow.
2418         * rendering/InlineTextBox.cpp:
2419         (WebCore::InlineTextBox::expansionBehavior): Support forced leading and trailing
2420         expansions.
2421         * rendering/InlineTextBox.h:
2422         (WebCore::InlineTextBox::expansionBehavior): Moved to .cpp
2423         * rendering/RenderBlockLineLayout.cpp:
2424         (WebCore::RenderBlockFlow::updateRubyForJustifiedText): Perform relayout even if
2425         there are no expansions left. This is so that ruby bases with no expansions will get
2426         centered.
2427         (WebCore::expansionBehaviorForInlineTextBox): Update to inspect neighboring rubies.
2428         (WebCore::RenderBlockFlow::computeInlineDirectionPositionsForSegment): Use updated
2429         expansionBehaviorForInlineTextBox(). Also center ruby bases if they have no expansion
2430         opportunities.
2431         (WebCore::RenderBlockFlow::createLineBoxesFromBidiRuns): Use nullptr.
2432         (WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange): Ditto.
2433         * rendering/RenderText.cpp:
2434         (WebCore::RenderText::RenderText): Delete contentIsKnownToFollow.
2435         * rendering/RenderText.h:
2436         (WebCore::RenderText::contentIsKnownToFollow): Deleted.
2437         (WebCore::RenderText::setContentIsKnownToFollow): Deleted.
2438
2439 2015-04-02  Alexey Proskuryakov  <ap@apple.com>
2440
2441         Clean up access checks in JSHistoryCustom.cpp
2442         https://bugs.webkit.org/show_bug.cgi?id=143227
2443
2444         Reviewed by Sam Weinig.
2445
2446         * bindings/js/JSHistoryCustom.cpp:
2447         (WebCore::JSHistory::putDelegate):
2448         (WebCore::JSHistory::deleteProperty):
2449         (WebCore::JSHistory::deletePropertyByIndex):
2450         (WebCore::JSHistory::getOwnPropertyNames):
2451         (WebCore::JSHistory::pushState):
2452         (WebCore::JSHistory::replaceState):
2453
2454 2015-04-02  Alex Christensen  <achristensen@webkit.org>
2455
2456         [Content Extensions] Only add unique universal action locations.
2457         https://bugs.webkit.org/show_bug.cgi?id=143325
2458
2459         Reviewed by Benjamin Poulain.
2460
2461         * contentextensions/ContentExtensionCompiler.cpp:
2462         (WebCore::ContentExtensions::compileRuleList):
2463         Use a HashSet instead of a Vector for the universal action locations to remove duplicates.
2464
2465 2015-04-01  Roger Fong  <roger_fong@apple.com>
2466
2467         Fix slider colors for media controls on OSX.
2468         https://bugs.webkit.org/show_bug.cgi?id=143328.
2469         <rdar://problem/20357858>
2470
2471         Reviewed by Darin Adler.
2472
2473         Fill in bottom portion of volume slider.
2474         Adjust colors to make slider controls look better. Will likely be tweaked later.
2475         * Modules/mediacontrols/mediaControlsApple.js:
2476         (Controller.prototype.drawTimelineBackground):
2477         (Controller.prototype.drawVolumeBackground):
2478
2479 2015-04-02  Yusuke Suzuki  <utatane.tea@gmail.com>
2480
2481         Clean up EnumerationMode to easily extend
2482         https://bugs.webkit.org/show_bug.cgi?id=143276
2483
2484         Reviewed by Geoffrey Garen.
2485
2486         Use default EnumerationMode().
2487
2488         * bindings/js/Dictionary.cpp:
2489         (WebCore::Dictionary::getOwnPropertiesAsStringHashMap):
2490         (WebCore::Dictionary::getOwnPropertyNames):
2491         * bindings/js/SerializedScriptValue.cpp:
2492         (WebCore::CloneSerializer::serialize):
2493         * bindings/scripts/CodeGeneratorJS.pm:
2494         (GenerateHeader):
2495         * bindings/scripts/test/JS/JSFloat64Array.h:
2496         * bindings/scripts/test/JS/JSTestEventTarget.h:
2497         * bridge/NP_jsobject.cpp:
2498         (_NPN_Enumerate):
2499         * bridge/runtime_array.cpp:
2500         (JSC::RuntimeArray::getOwnPropertyNames):
2501
2502 2015-04-02  David Hyatt  <hyatt@apple.com>
2503
2504         [New Block-Inside-Inline Model] Implement the correct paint order for blocks inside inlines.
2505         https://bugs.webkit.org/show_bug.cgi?id=143320
2506
2507         Reviewed by Darin Adler.
2508
2509         Added new tests in fast/block/inside-inlines.
2510
2511         * rendering/EllipsisBox.cpp:
2512         (WebCore::EllipsisBox::nodeAtPoint):
2513         * rendering/EllipsisBox.h:
2514         * rendering/InlineBox.h:
2515         * rendering/InlineElementBox.cpp:
2516         (WebCore::InlineElementBox::paint):
2517         (WebCore::InlineElementBox::nodeAtPoint):
2518         * rendering/InlineElementBox.h:
2519         * rendering/InlineFlowBox.cpp:
2520         (WebCore::InlineFlowBox::nodeAtPoint):
2521         (WebCore::InlineFlowBox::paint):
2522         * rendering/InlineFlowBox.h:
2523         * rendering/InlineTextBox.cpp:
2524         (WebCore::InlineTextBox::nodeAtPoint):
2525         * rendering/InlineTextBox.h:
2526         The HitTestAction has to be passed to nodeAtPoint so that hit test actions can be honored. All the nodeAtPoint
2527         functions have been patched to include this argument. Painting and hit testing have been patched for InlineElementBox
2528         to honor phases/actions when the element is an anonymous inline block.
2529
2530         The phase filter on RenderLineBoxList has been pushed in to InlineFlowBox::paint and InlineFlowBox::nodeAtPoint so that
2531         we can respect it properly when inlines are painting by themselves (e.g., because they have a layer).
2532
2533         * rendering/RenderBlockLineLayout.cpp:
2534         (WebCore::RenderBlockFlow::createLineBoxes):
2535         (WebCore::RenderBlockFlow::constructLine):
2536         Go ahead and include all of the inline flow boxes between the root and the anonymous inline block if it turns out they
2537         need to be constructed. This will end up being relevant for outlines and for self-painting layers (e.g., opacity).
2538
2539         * rendering/RenderLineBoxList.cpp:
2540         (WebCore::RenderLineBoxList::paint):
2541         (WebCore::RenderLineBoxList::hitTest):
2542         Remove the filters here, since they get pushed in to InlineFlowBox.
2543
2544         * rendering/RootInlineBox.cpp:
2545         (WebCore::RootInlineBox::nodeAtPoint):
2546         * rendering/RootInlineBox.h:
2547         * rendering/svg/SVGInlineTextBox.cpp:
2548         (WebCore::SVGInlineTextBox::nodeAtPoint):
2549         * rendering/svg/SVGInlineTextBox.h:
2550         More patching to pass the HitTestAction into nodeAtPoint.
2551
2552 2015-04-02  Adam Bergkvist  <adam.bergkvist@ericsson.com>
2553
2554         WebRTC: Add support for Promise-based MediaDevices.getUserMedia()
2555         https://bugs.webkit.org/show_bug.cgi?id=143255
2556
2557         Reviewed by Eric Carlson.
2558
2559         The MediaDevices object collects functionality related to local media
2560         devices. This patch adds the Promise-based version of getUserMedia()
2561         (unprefixed). Other functionality, like enumerateDevices(), will be
2562         added in later patches.
2563
2564         The old callback-based webkitGetUserMedia() (on Navigator) is kept for
2565         legacy purposes (according to the Media Capture and Streams API spec [1]).
2566         Both versions of getUserMedia are backed up by UserMediaRequest where
2567         the callbacks from the callback-based version are wrapped inside c++
2568         lambda functions. The new Promise-based getUserMedia() uses the lambda
2569         functions directly as created by the Promise bindings.
2570
2571         [1] http://w3c.github.io/mediacapture-main/archives/20150324/getusermedia.html#navigatorusermedia-interface-extensions
2572
2573         Test: fast/mediastream/MediaDevices-getUserMedia.html
2574
2575         * CMakeLists.txt:
2576         * DerivedSources.make:
2577         * Modules/mediastream/MediaDevices.cpp: Added.
2578         (WebCore::MediaDevices::create):
2579         (WebCore::MediaDevices::MediaDevices):
2580         (WebCore::MediaDevices::~MediaDevices):
2581         (WebCore::MediaDevices::document):
2582         (WebCore::MediaDevices::getUserMedia):
2583         * Modules/mediastream/MediaDevices.h: Added.
2584         * Modules/mediastream/MediaDevices.idl: Added.
2585         * Modules/mediastream/NavigatorMediaDevices.cpp: Added.
2586         (WebCore::NavigatorMediaDevices::NavigatorMediaDevices):
2587         (WebCore::NavigatorMediaDevices::~NavigatorMediaDevices):
2588         (WebCore::NavigatorMediaDevices::from):
2589         (WebCore::NavigatorMediaDevices::mediaDevices):
2590         (WebCore::NavigatorMediaDevices::supplementName):
2591         * Modules/mediastream/NavigatorMediaDevices.h: Added.
2592         * Modules/mediastream/NavigatorMediaDevices.idl: Added.
2593         * Modules/mediastream/UserMediaRequest.cpp:
2594         (WebCore::UserMediaRequest::create):
2595         (WebCore::UserMediaRequest::UserMediaRequest):
2596         (WebCore::UserMediaRequest::didCreateStream):
2597         (WebCore::UserMediaRequest::failedToCreateStreamWithConstraintsError):
2598         (WebCore::UserMediaRequest::failedToCreateStreamWithPermissionError):
2599         * Modules/mediastream/UserMediaRequest.h:
2600         * PlatformGTK.cmake:
2601         * WebCore.xcodeproj/project.pbxproj:
2602         * bindings/js/JSMediaDevicesCustom.cpp: Added.
2603         (WebCore::JSMediaDevices::getUserMedia):
2604
2605 2015-04-02  Eric Carlson  <eric.carlson@apple.com>
2606
2607         [iOS] Fix AirPlay problem caused by r182240
2608         https://bugs.webkit.org/show_bug.cgi?id=143337
2609
2610         Reviewed by Jer Noble.
2611
2612         * html/HTMLMediaSession.cpp:
2613         (WebCore::HTMLMediaSession::wirelessVideoPlaybackDisabled): Return false if the legacy attribute
2614             "x-webkit-airplay" has the value "allow".
2615         * html/HTMLVideoElement.cpp:
2616         (WebCore::HTMLVideoElement::parseAttribute): Don't call webkitWirelessVideoPlaybackDisabled when
2617             processing "x-webkit-airplay" and "x-webkit-wirelessvideoplaybackdisabled", just consider
2618             the attribute/value.
2619
2620 2015-04-02  Commit Queue  <commit-queue@webkit.org>
2621
2622         Unreviewed, rolling out r182265.
2623         https://bugs.webkit.org/show_bug.cgi?id=143338
2624
2625         Caused an assertion on
2626         http/tests/contentextensions/whitelist.html (Requested by ap
2627         on #webkit).
2628
2629         Reverted changeset:
2630
2631         "[Content Extensions] Only add unique universal action
2632         locations."
2633         https://bugs.webkit.org/show_bug.cgi?id=143325
2634         http://trac.webkit.org/changeset/182265
2635
2636 2015-04-01  Antti Koivisto  <antti@apple.com>
2637
2638         Use std::chrono types to represent time in response and cache classes
2639         https://bugs.webkit.org/show_bug.cgi?id=143316
2640
2641         Reviewed by Andreas Kling.
2642
2643         Use std::chrono::system_clock::time_point to represent clock times and std::chrono::microseconds to
2644         represent durations. Also use WTF::Optional for optional values (instead of coding them as NaNs).
2645
2646         * dom/Document.cpp:
2647         (WebCore::Document::lastModified):
2648         * loader/cache/CachedResource.cpp:
2649         (WebCore::CachedResource::CachedResource):
2650         (WebCore::CachedResource::freshnessLifetime):
2651         (WebCore::CachedResource::responseReceived):
2652         (WebCore::CachedResource::updateResponseAfterRevalidation):
2653         * loader/cache/CachedResource.h:
2654         * platform/network/CacheValidation.cpp:
2655         (WebCore::computeCurrentAge):
2656         (WebCore::computeFreshnessLifetimeForHTTPFamily):
2657         (WebCore::updateRedirectChainStatus):
2658         (WebCore::redirectChainAllowsReuse):
2659         (WebCore::parseCacheControlDirectives):
2660         * platform/network/CacheValidation.h:
2661         (WebCore::RedirectChainCacheStatus::RedirectChainCacheStatus):
2662         * platform/network/HTTPParsers.cpp:
2663         (WebCore::parseHTTPDate):
2664         (WebCore::parseDate): Deleted.
2665         * platform/network/HTTPParsers.h:
2666         * platform/network/ResourceResponseBase.cpp:
2667         (WebCore::ResourceResponseBase::ResourceResponseBase):
2668         (WebCore::ResourceResponseBase::cacheControlMaxAge):
2669         (WebCore::parseDateValueInHeader):
2670         (WebCore::ResourceResponseBase::date):
2671         (WebCore::ResourceResponseBase::age):
2672         (WebCore::ResourceResponseBase::expires):
2673         (WebCore::ResourceResponseBase::lastModified):
2674         * platform/network/ResourceResponseBase.h:
2675
2676 2015-04-02  Joonghun Park  <jh718.park@samsung.com>
2677
2678         [CSS MultiColumn] Parse "columns: auto <length>" shorthand property value properly
2679         https://bugs.webkit.org/show_bug.cgi?id=143248
2680
2681         Reviewed by Darin Adler.
2682
2683         Test: fast/multicol/columns-shorthand-parsing-2.html
2684
2685         The two longhands for the 'columns' property ('column-count' and
2686         'column-width') may both take 'auto' as a value. When we encounter
2687         'auto' during parsing the value list of a declaration, we cannot just
2688         make a guess at which property/properties that's meant for. Instead,
2689         don't assign anything to 'auto' right away, but wait until all values
2690         have been processed and at that point set the still unassigned
2691         properties to 'auto'. If 'auto' isn't in the value list at all, set
2692         unassigned properties to 'initial' for the 'columns' property, just
2693         like we do for any other property.
2694
2695         * css/CSSParser.cpp:
2696         (WebCore::CSSParser::parseValue):
2697         (WebCore::CSSParser::parseColumnWidth):
2698         (WebCore::CSSParser::parseColumnCount):
2699         (WebCore::CSSParser::parseColumnsShorthand):
2700         * css/CSSParser.h:
2701
2702 2015-04-01  Commit Queue  <commit-queue@webkit.org>
2703
2704         Unreviewed, rolling out r182247.
2705         https://bugs.webkit.org/show_bug.cgi?id=143326
2706
2707         unfortunately broke some tests (Requested by dino on #webkit).
2708
2709         Reverted changeset:
2710
2711         "Async loading of image resources"
2712         https://bugs.webkit.org/show_bug.cgi?id=134488
2713         http://trac.webkit.org/changeset/182247
2714
2715 2015-04-01  Alex Christensen  <achristensen@webkit.org>
2716
2717         [Content Extensions] Only add unique universal action locations.
2718         https://bugs.webkit.org/show_bug.cgi?id=143325
2719
2720         Reviewed by Benjamin Poulain.
2721
2722         * contentextensions/ContentExtensionCompiler.cpp:
2723         (WebCore::ContentExtensions::compileRuleList):
2724         Use a HashSet instead of a Vector for the universal action locations to remove duplicates.
2725
2726 2015-04-01  Roger Fong  <roger_fong@apple.com>
2727
2728         Fixes to material of inline media controls on OSX.
2729         https://bugs.webkit.org/show_bug.cgi?id=143317
2730         <rdar://problem/20357847>
2731
2732         Reviewed by Dean Jackson.
2733
2734         There are many existing tests for the media controls appearance.
2735         They are currently skipped while we are still updating the controls.
2736
2737         Expand backgrounds of control panel and volume box.
2738         Clip the darker edges away.
2739         * Modules/mediacontrols/mediaControlsApple.css:
2740         (audio::-webkit-media-controls-panel):
2741         (audio::-webkit-media-controls-panel-background-container):
2742         (audio::-webkit-media-controls-panel-tint):
2743         (audio::-webkit-media-controls-panel-background):
2744         (audio::-webkit-media-controls-panel .volume-box):
2745         (audio::-webkit-media-controls-volume-slider-container-background):
2746         (audio::-webkit-media-controls-volume-slider-container-tint):
2747         (audio::-webkit-media-controls-panel .volume-box:active):
2748         (video::-webkit-media-controls-volume-slider): 
2749         This needs to be above the background so it can be interacted with.
2750         (video:-webkit-full-screen::-webkit-media-controls-panel .volume-box):
2751         * Modules/mediacontrols/mediaControlsApple.js:
2752         (Controller.prototype.createControls): Create a new div for the control material.
2753         We need to clip the material and not the controls themselves.
2754         (Controller.prototype.configureInlineControls): Use new div.
2755         Remove some unnecessary logic involving hiding materials here.
2756         It just causes the materials to turn on and off at the wrong times. 
2757         (Controller.prototype.handlePanelTransitionEnd):
2758         (Controller.prototype.setPlaying):
2759         (Controller.prototype.showControls):
2760         (Controller.prototype.hideControls):
2761
2762 2015-04-01  Eric Carlson  <eric.carlson@apple.com>
2763
2764         Media controls should not always auto-hide
2765         https://bugs.webkit.org/show_bug.cgi?id=143322
2766
2767         Reviewed by Dean Jackson.
2768
2769         * Modules/mediacontrols/mediaControlsApple.js:
2770         (Controller): Intialize new properties.
2771         (Controller.prototype.hideControls): Do nothing if controlsAlwaysVisible() returns true;
2772         (Controller.prototype.controlsAlwaysVisible): New.
2773         (Controller.prototype.controlsAreHidden): Consult controlsAlwaysVisible().
2774         (Controller.prototype.currentPlaybackTargetIsWireless): Use new properties.
2775         (Controller.prototype.updateWirelessTargetAvailable): Cache video.webkitCurrentPlaybackTargetIsWireless
2776             and video.webkitWirelessVideoPlaybackDisabled because we know when they change and
2777             use them frequently.
2778         * Modules/mediacontrols/mediaControlsiOS.js:
2779         (ControllerIOS.prototype.controlsAlwaysVisible): New.
2780         * platform/graphics/MediaPlaybackTarget.h:
2781
2782 2015-04-01  Alexey Proskuryakov  <ap@apple.com>
2783
2784         REGRESSION (r182121): SVG animation macros cause warnings in MSVC
2785         https://bugs.webkit.org/show_bug.cgi?id=143313
2786
2787         Reviewed by Darin Adler.
2788
2789         * svg/SVGExternalResourcesRequired.h: Undo the change that caused a type mismatch.
2790
2791 2015-04-01  Eric Carlson  <eric.carlson@apple.com>
2792
2793         Another attempt to fixi the iOS build after r182240.
2794
2795         Reviewed by Dean Jackson.
2796
2797         * platform/graphics/MediaPlaybackTarget.h:
2798         (WebCore::MediaPlaybackTarget::hasActiveRoute):
2799
2800 2015-04-01  Eric Carlson  <eric.carlson@apple.com>
2801
2802         Fix the iOS build after r182240.
2803
2804         * platform/graphics/MediaPlaybackTarget.h:
2805
2806 2015-04-01  Yoav Weiss  <yoav@yoav.ws>
2807
2808         Async loading of image resources
2809         https://bugs.webkit.org/show_bug.cgi?id=134488
2810
2811         Reviewed by Dean Jackson.
2812
2813         This patch changes image loading to be asynchronous (per spec), in order
2814         for it to be agnostic to property setting order when it comes to src, srcset and crossorigin,
2815         as well as to enable future hooking of the <picture>-based selection logic on top of it.
2816
2817         Tests: fast/dom/HTMLImageElement/image-load-post-onload.html
2818         fast/dom/HTMLImageElement/sizes/image-sizes-js-change-reverse.html
2819
2820         * WebCore.xcodeproj/project.pbxproj: Change MicroTask.h to be private.
2821         * bindings/js/JSEventListener.cpp:
2822         (WebCore::JSEventListener::handleEvent): Add a microtask checkpoint after event handling.
2823         * bindings/js/ScheduledAction.cpp:
2824         (WebCore::ScheduledAction::execute): Add a microtask checkpoint after running of a scheduled action.
2825         * html/HTMLImageElement.cpp:
2826         (WebCore::HTMLImageElement::didMoveToNewDocument): Add the old document to call of elementDidMoveToNewDocument.
2827         * html/HTMLImageLoader.cpp:
2828         (WebCore::HTMLImageLoader::notifyFinished): Avoid a crash when notifyFinished is called and there's no CachedImage.
2829         * html/HTMLInputElement.cpp:
2830         (WebCore::HTMLInputElement::didMoveToNewDocument): Add the old document to call of elementDidMoveToNewDocument.
2831         * html/HTMLPlugInImageElement.cpp:
2832         (WebCore::HTMLPlugInImageElement::didMoveToNewDocument): Add the old document to call of elementDidMoveToNewDocument.
2833         * html/HTMLVideoElement.cpp:
2834         (WebCore::HTMLVideoElement::didMoveToNewDocument): Add the old document to call of elementDidMoveToNewDocument.
2835         * html/parser/HTMLDocumentParser.cpp:
2836         (WebCore::HTMLDocumentParser::attemptToRunDeferredScriptsAndEnd): Add a microtask checkpoint.
2837         * loader/ImageLoader.cpp: Move image resource loading to be asynchronous.
2838         (WebCore::ImageLoader::ImageLoaderTask::create):
2839         (WebCore::ImageLoader::ImageLoaderTask::run): Run the image loading microtask and called doUpdateFromElement.
2840         (WebCore::ImageLoader::ImageLoaderTask::ImageLoaderTask):
2841         (WebCore::ImageLoader::ImageLoader):
2842         (WebCore::ImageLoader::doUpdateFromElement): This is split from the previous updateFromElement, and performs the actual resource loading.
2843         (WebCore::ImageLoader::updateFromElement): Now only prepares the stage for the actual image resource loading.
2844         (WebCore::ImageLoader::shouldLoadImmediately): If this returns true, the image resource is loaded immediately, without queueing a microtask.
2845         (WebCore::ImageLoader::notifyFinished): Add asserts.
2846         (WebCore::ImageLoader::elementDidMoveToNewDocument): Handle document load event counters decrementing and incrementing.
2847         * loader/ImageLoader.h:
2848         (WebCore::ImageLoader::imageComplete): Make sure that the image is complete only if there aren't any pending tasks.
2849         (WebCore::ImageLoader::hasPendingActivity): Make sure that pending activity takes pending tasks into account.
2850         (WebCore::ImageLoader::hasPendingTask): Getter to know if an ImageLoader has a pending task. (Used by the image loading microtask)
2851         (WebCore::ImageLoader::createWeakPtr): Create a weakPtr to be used by the microtask, so it can called back the loader if it's still alive.
2852         * loader/cache/CachedResourceLoader.cpp:
2853         (WebCore::CachedResourceLoader::canRequest): Add a 'shouldBypassMainWorldContentSecurityPolicy' flag and act upon it.
2854         (WebCore::CachedResourceLoader::requestImage): Add a 'shouldBypassMainWorldContentSecurityPolicy' flag.
2855         (WebCore::CachedResourceLoader::requestResource): Add a 'shouldBypassMainWorldContentSecurityPolicy' flag.
2856         * loader/cache/CachedResourceLoader.h:
2857         (WebCore::CachedResourceLoader::canRequest): Add a 'shouldBypassMainWorldContentSecurityPolicy' flag and act upon it.
2858         (WebCore::CachedResourceLoader::requestImage): Add a 'shouldBypassMainWorldContentSecurityPolicy' flag.
2859         (WebCore::CachedResourceLoader::requestResource): Add a 'shouldBypassMainWorldContentSecurityPolicy' flag.
2860         * svg/SVGImageElement.cpp:
2861         (WebCore::SVGImageElement::didMoveToNewDocument): Add the old document to call of elementDidMoveToNewDocument.
2862         * xml/parser/XMLDocumentParser.cpp:
2863         (WebCore::XMLDocumentParser::end): Add a microtask checkpoint after XML finishes parsing.
2864
2865 2015-04-01  Alex Christensen  <achristensen@webkit.org>
2866
2867         Unreviewed build fix when using content extensions performance reporting.
2868
2869         * contentextensions/ContentExtensionCompiler.cpp:
2870         (WebCore::ContentExtensions::compileRuleList):
2871         Time how long it takes to build the DFAs.
2872
2873 2015-04-01  Alex Christensen  <achristensen@webkit.org>
2874
2875         Progress towards CMake on Windows and Mac.
2876         https://bugs.webkit.org/show_bug.cgi?id=143293
2877
2878         Reviewed by Filip Pizlo.
2879
2880         * PlatformMac.cmake:
2881         Tell open source builders where to find unicode headers.
2882         * PlatformWin.cmake:
2883         Include PlatformWinCairo.cmake.
2884         * PlatformWinCairo.cmake:
2885         Added from bug 115944 by Patrick Gansterer.
2886         * bindings/js/JSDOMStringListCustom.cpp:
2887         * bindings/js/JSDOMWrapper.cpp:
2888         * bindings/js/JSMessageChannelCustom.cpp:
2889         * bindings/js/JSPopStateEventCustom.cpp:
2890         * bindings/js/JSReadableStreamCustom.cpp:
2891         * bindings/js/ReadableStreamJSSource.cpp:
2892         * bindings/js/ScriptController.cpp:
2893         * css/CSSComputedStyleDeclaration.cpp:
2894         * dom/Attr.cpp:
2895         * dom/CollectionIndexCache.cpp:
2896         * platform/graphics/ANGLEWebKitBridge.h:
2897         Fixed include quirks.
2898
2899 2015-03-31  Simon Fraser  <simon.fraser@apple.com>
2900
2901         Remove scrolling tree dependency on wheel event handler counts, and use fast scrolling even when there are wheel handlers
2902         https://bugs.webkit.org/show_bug.cgi?id=143288
2903         rdar://problem/16049624
2904
2905         Reviewed by Beth Dakin.
2906
2907         Remove the wheel event counting that Document does, and passes into the scrolling tree.
2908         The ScrollingTree now just uses the non-fast scrollable region to determine when to
2909         fast scroll on pages with wheel event handlers.
2910         
2911         If a handler includes position:fixed renderers, we just cover the whole document
2912         with the slow-scrolling region currently. This could be improved.
2913         
2914         * dom/Document.cpp:
2915         (WebCore::Document::Document):
2916         (WebCore::Document::didBecomeCurrentDocumentInFrame):
2917         (WebCore::Document::wheelEventHandlersChanged):
2918         (WebCore::Document::didAddWheelEventHandler):
2919         (WebCore::Document::didRemoveWheelEventHandler):
2920         (WebCore::Document::wheelEventHandlerCount):
2921         (WebCore::Document::touchEventHandlerCount):
2922         (WebCore::Document::absoluteRegionForEventTargets): Changed to return a pair<Region, bool>
2923         where the bool indicates whether any handler includes position:fixed content.
2924         (WebCore::pageWheelEventHandlerCountChanged): Deleted.
2925         (WebCore::wheelEventHandlerCountChanged): Deleted.
2926         * dom/Document.h:
2927         (WebCore::Document::wheelEventHandlerCount): Deleted.
2928         * loader/EmptyClients.h:
2929         * page/ChromeClient.h:
2930         * page/DebugPageOverlays.cpp:
2931         (WebCore::MouseWheelRegionOverlay::updateRegion):
2932         * page/scrolling/AsyncScrollingCoordinator.cpp:
2933         (WebCore::AsyncScrollingCoordinator::frameViewNonFastScrollableRegionChanged):
2934         (WebCore::AsyncScrollingCoordinator::recomputeWheelEventHandlerCountForFrameView): Deleted.
2935         * page/scrolling/AsyncScrollingCoordinator.h:
2936         * page/scrolling/ScrollingCoordinator.cpp:
2937         (WebCore::ScrollingCoordinator::computeNonFastScrollableRegion):
2938         (WebCore::ScrollingCoordinator::frameViewRootLayerDidChange):
2939         (WebCore::ScrollingCoordinator::computeCurrentWheelEventHandlerCount): Deleted.
2940         (WebCore::ScrollingCoordinator::frameViewWheelEventHandlerCountChanged): Deleted.
2941         * page/scrolling/ScrollingCoordinator.h:
2942         (WebCore::ScrollingCoordinator::recomputeWheelEventHandlerCountForFrameView): Deleted.
2943         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
2944         (WebCore::ScrollingStateFrameScrollingNode::ScrollingStateFrameScrollingNode):
2945         (WebCore::ScrollingStateFrameScrollingNode::setWheelEventHandlerCount): Deleted.
2946         * page/scrolling/ScrollingStateFrameScrollingNode.h:
2947         * page/scrolling/ScrollingTree.cpp:
2948         (WebCore::ScrollingTree::ScrollingTree):
2949         (WebCore::ScrollingTree::shouldHandleWheelEventSynchronously):
2950         (WebCore::ScrollingTree::commitNewTreeState):
2951         * page/scrolling/ScrollingTree.h:
2952         * page/scrolling/mac/ScrollingCoordinatorMac.mm:
2953         (WebCore::ScrollingCoordinatorMac::updateTiledScrollingIndicator):
2954         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
2955         (WebCore::ScrollingTreeFrameScrollingNodeMac::updateBeforeChildren):
2956         (WebCore::logWheelEventHandlerCountChanged): Deleted.
2957         * testing/Internals.cpp:
2958         (WebCore::Internals::touchEventHandlerCount):
2959
2960 2015-04-01  David Hyatt  <hyatt@apple.com>
2961
2962         [New Block-Inside-Inline Model] Floats need to be allowed to intrude into anonymous inline-blocks.
2963         https://bugs.webkit.org/show_bug.cgi?id=143307
2964
2965         Reviewed by Dean Jackson.
2966
2967         Added fast/block/inside-inlines/basic-float-intrusion.html
2968
2969         * rendering/InlineFlowBox.cpp:
2970         (WebCore::InlineFlowBox::placeBoxesInBlockDirection):
2971         Make sure to exclude the margins of an anonymous inline-block when considering the height of the line.
2972
2973         * rendering/RenderBlock.cpp:
2974         (WebCore::RenderBlock::lineHeight):
2975         (WebCore::RenderBlock::baselinePosition):
2976         Anonymous inline-block lines ignore line-height and just return the height of the block. For baseline position, the baseline
2977         is considered to be at the bottom border edge of the anonymous inline-block.
2978
2979         * rendering/RenderBlockFlow.cpp:
2980         (WebCore::RenderBlockFlow::rebuildFloatingObjectSetFromIntrudingFloats):
2981         (WebCore::RenderBlockFlow::addIntrudingFloats):
2982         * rendering/RenderBlockFlow.h:
2983         Patch float intrusion to handle the case of anonymous inline-blocks. Instead of collecting the floats from our parent(), we
2984         collect them from the containingBlock() in the anonymous inline-block case. Patch addIntrudingFloats to pass in the container
2985         that acts as the "parent", since it is not the parent() in the anonymous inline-block case.
2986
2987         * rendering/RenderBlockLineLayout.cpp:
2988         (WebCore::updateLogicalInlinePositions):
2989         Make sure to use the full available width for content always in the anonymous inline-block case, since we don't avoid the
2990         floats, but instead let them intrude into the inline-block.
2991
2992         (WebCore::RenderBlockFlow::computeInlineDirectionPositionsForLine):
2993         Patch callers of updateLogicalInlinePositions to pass in the root line box that we're checking for.
2994
2995         (WebCore::RenderBlockFlow::layoutLineBoxes):
2996         Defer the layout of anonymous inline-blocks, since they need to only lay out once the vertical position to lay them out
2997         at is known.
2998
2999         * rendering/RenderBox.cpp:
3000         (WebCore::RenderBox::createsNewFormattingContext):
3001         (WebCore::RenderBox::avoidsFloats):
3002         Anonymous inline-blocks do not establish a new block formatting context, nor do they avoid floats.
3003
3004         * rendering/line/BreakingContext.h:
3005         (WebCore::BreakingContext::handleReplaced):
3006         Add code to do a just-in-time layout of the anonymous inline-block at the time it is being examined (after the break before
3007         it was handled).
3008
3009 2015-04-01  Eric Carlson  <eric.carlson@apple.com>
3010
3011         [Mac] Do not include route button if element does not support target playback
3012         https://bugs.webkit.org/show_bug.cgi?id=143251
3013
3014         Reviewed by Jer Noble.
3015
3016         * Modules/mediacontrols/mediaControlsApple.js:
3017         (Controller.prototype.currentPlaybackTargetIsWireless): Return false if target playback is disabled.
3018         (Controller.prototype.updateWirelessTargetAvailable): Do not show the picker if target 
3019             playback is disabled.
3020         (Controller.prototype.handleWirelessPlaybackChange): Call updateWirelessTargetAvailable.
3021
3022         * dom/Document.cpp:
3023         (WebCore::Document::showPlaybackTargetPicker): Update for Page::showPlaybackTargetPicker change.
3024         (WebCore::Document::didChoosePlaybackTarget): Notify clients in vector-order, lower level code
3025             now tracks which one requested the picker.
3026
3027         * html/HTMLMediaElement.cpp:
3028         (WebCore::HTMLMediaElement::loadResource): Don't call applyMediaPlayerRestrictions, it is done
3029             in mediaPlayerEngineFailedToLoad.
3030         (WebCore::HTMLMediaElement::setReadyState): Enqueue a target availability event if there are
3031             listeners readyState reaches HAVE_METADATA so controls are setup correctly.
3032         (WebCore::HTMLMediaElement::mediaPlayerEngineFailedToLoad): Call applyMediaPlayerRestrictions.
3033         (WebCore::HTMLMediaElement::clearMediaPlayer): Enqueue a target availability event in so controls
3034             have a chance to hide the picker.
3035         (WebCore::HTMLMediaElement::webkitCurrentPlaybackTargetIsSupported): New, passthrough to the
3036             media engine.
3037         (WebCore::HTMLMediaElement::canPlayToWirelessPlaybackTarget): Ditto.
3038         (WebCore::HTMLMediaElement::startPlayingToPlaybackTarget): Ditto.
3039         (WebCore::HTMLMediaElement::stopPlayingToPlaybackTarget): Ditto.
3040         * html/HTMLMediaElement.h:
3041         * html/HTMLMediaElement.idl:
3042
3043         * html/HTMLMediaSession.cpp:
3044         (WebCore::HTMLMediaSession::HTMLMediaSession): Initialize m_playbackTarget.
3045         (WebCore::HTMLMediaSession::currentPlaybackTargetIsSupported): New.
3046         (WebCore::HTMLMediaSession::showPlaybackTargetPicker): Pull logic from showingPlaybackTargetPickerPermitted 
3047             inline. Don't refuse to show a picker if the element doesn't support target playback, it is up
3048             to script to decide which elements can display a picker.
3049         (WebCore::HTMLMediaSession::wirelessVideoPlaybackDisabled): Return true if there is no player.
3050         (WebCore::HTMLMediaSession::didChoosePlaybackTarget): Call startPlayingToPlaybackTarget or 
3051             stopPlayingToPlaybackTarget because setWirelessPlaybackTarget doesn't apply the target.
3052         (WebCore::HTMLMediaSession::externalOutputDeviceAvailableDidChange): Add logging.
3053         (WebCore::HTMLMediaSession::showingPlaybackTargetPickerPermitted): Deleted.
3054         * html/HTMLMediaSession.h:
3055
3056         * page/Page.cpp:
3057         (WebCore::Page::Page): Initialize m_playbackTarget.
3058         (WebCore::Page::showPlaybackTargetPicker): Don't set m_documentRequestingPlaybackTargetPicker.
3059         (WebCore::Page::didChoosePlaybackTarget): Notify Pages in vector-order, lower level code
3060             now tracks which one requested the picker.
3061         (WebCore::Page::configurePlaybackTargetMonitoring): Don't track m_requiresPlaybackTargetMonitoring, it
3062             is too easy for it to get out of sync with the UI process state.
3063         * page/Page.h:
3064
3065         * platform/audio/MediaSession.cpp:
3066         (WebCore::MediaSession::canPlayToWirelessPlaybackTarget): New, client passthrough.
3067         (WebCore::MediaSession::startPlayingToPlaybackTarget): Ditto.
3068         (WebCore::MediaSession::stopPlayingToPlaybackTarget): Ditto.
3069         * platform/audio/MediaSession.h:
3070         (WebCore::MediaSessionClient::canPlayToWirelessPlaybackTarget):
3071         (WebCore::MediaSessionClient::startPlayingToPlaybackTarget):
3072         (WebCore::MediaSessionClient::stopPlayingToPlaybackTarget):
3073
3074         * platform/audio/MediaSessionManager.cpp:
3075         (WebCore::MediaSessionManager::sessionWillBeginPlayback): Call startPlayingToPlaybackTarget &
3076             stopPlayingToPlaybackTarget as necessary.
3077         * platform/audio/MediaSessionManager.h:
3078
3079         * platform/graphics/MediaPlaybackTarget.h:
3080         (WebCore::MediaPlaybackTarget::hasActiveRoute): New.
3081         * platform/graphics/MediaPlaybackTargetPickerClient.h:
3082         * platform/graphics/MediaPlayer.cpp:
3083         (WebCore::MediaPlayer::isCurrentPlaybackTargetSupported): New, engine passthrough.
3084         (WebCore::MediaPlayer::canPlayToWirelessPlaybackTarget): Ditto.
3085         (WebCore::MediaPlayer::startPlayingToPlaybackTarget): Ditto.
3086         (WebCore::MediaPlayer::stopPlayingToPlaybackTarget): Ditto.
3087         * platform/graphics/MediaPlayer.h:
3088         * platform/graphics/MediaPlayerPrivate.h:
3089         (WebCore::MediaPlayerPrivateInterface::isCurrentPlaybackTargetSupported):
3090         (WebCore::MediaPlayerPrivateInterface::wirelessVideoPlaybackDisabled):
3091         (WebCore::MediaPlayerPrivateInterface::canPlayToWirelessPlaybackTarget):
3092         (WebCore::MediaPlayerPrivateInterface::startPlayingToPlaybackTarget):
3093         (WebCore::MediaPlayerPrivateInterface::stopPlayingToPlaybackTarget):
3094
3095         * platform/graphics/avfoundation/MediaPlaybackTargetMac.mm:
3096         (WebCore::MediaPlaybackTarget::hasActiveRoute): New.
3097
3098         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
3099         (WebCore::MediaPlayerPrivateAVFoundationObjC::canPlayToWirelessPlaybackTarget):
3100         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3101         (WebCore::MediaPlayerPrivateAVFoundationObjC::cancelLoad): Use playerKVOProperties. Drive-by
3102             code cleanup.
3103         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer): Use playerKVOProperties.
3104         (WebCore::MediaPlayerPrivateAVFoundationObjC::wirelessPlaybackTargetName): Implement for Mac.
3105         (WebCore::MediaPlayerPrivateAVFoundationObjC::setWirelessVideoPlaybackDisabled): Delay callbacks
3106             while setting AVPlayer property.
3107         (WebCore::MediaPlayerPrivateAVFoundationObjC::setWirelessPlaybackTarget): Add logging. Don't set
3108             the AVPlayer outputContext immediately.
3109         (WebCore::MediaPlayerPrivateAVFoundationObjC::startPlayingToPlaybackTarget): New.
3110         (WebCore::MediaPlayerPrivateAVFoundationObjC::stopPlayingToPlaybackTarget): New.
3111         (WebCore::playerKVOProperties): New.
3112         (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]): Notify when
3113             allowsExternalPlayback changes.
3114
3115         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
3116         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
3117         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::isCurrentPlaybackTargetSupported): New.
3118         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setWirelessPlaybackTarget): Ditto.
3119         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::togglePlayingToPlaybackTarget): Ditto.
3120         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::startPlayingToPlaybackTarget): Ditto.
3121         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::stopPlayingToPlaybackTarget): Ditto.
3122
3123         * platform/graphics/mac/MediaPlayerPrivateQTKit.h:
3124         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
3125         (WebCore::MediaPlayerPrivateQTKit::isCurrentPlaybackTargetSupported): Ditto.
3126         (WebCore::MediaPlayerPrivateQTKit::setWirelessPlaybackTarget): Ditto.
3127         (WebCore::MediaPlayerPrivateQTKit::togglePlayingToPlaybackTarget): Ditto.
3128         (WebCore::MediaPlayerPrivateQTKit::startPlayingToPlaybackTarget): Ditto.
3129         (WebCore::MediaPlayerPrivateQTKit::stopPlayingToPlaybackTarget): Ditto.
3130
3131 2015-04-01  Alex Christensen  <achristensen@webkit.org>
3132
3133         [Content Extensions] Properly handle regexes that match everything.
3134         https://bugs.webkit.org/show_bug.cgi?id=143281
3135
3136         Reviewed by Benjamin Poulain.
3137
3138         * contentextensions/ContentExtensionCompiler.cpp:
3139         (WebCore::ContentExtensions::compileRuleList):
3140         Make sure we always have at least one NFA for rule lists with triggers that all match everything.
3141         * contentextensions/DFABytecodeInterpreter.cpp:
3142         (WebCore::ContentExtensions::DFABytecodeInterpreter::interpretAppendAction):
3143         (WebCore::ContentExtensions::DFABytecodeInterpreter::interpretTestFlagsAndAppendAction):
3144         Add helper functions to reduce duplicate code.
3145         (WebCore::ContentExtensions::DFABytecodeInterpreter::actionsFromDFARoot):
3146         Get all actions without flags from the DFA root.
3147         (WebCore::ContentExtensions::DFABytecodeInterpreter::interpret):
3148         Remove branches when interpreting.
3149         * contentextensions/DFABytecodeInterpreter.h:
3150         Add helper functions to reduce duplicate code.
3151
3152 2015-04-01  Myles C. Maxfield  <mmaxfield@apple.com>
3153
3154         Addressing post-review comments.
3155         https://bugs.webkit.org/show_bug.cgi?id=143292
3156
3157         Unreviewed.
3158
3159         * platform/graphics/FontCascade.cpp:
3160         (WebCore::FontCascade::leadingExpansionOpportunity):
3161         (WebCore::FontCascade::trailingExpansionOpportunity):
3162
3163 2015-04-01  Per Arne Vollan  <peavo@outlook.com>
3164
3165         [WinCairo] Link errors, unresolved texture mapper methods.
3166         https://bugs.webkit.org/show_bug.cgi?id=143308
3167
3168         Reviewed by Alex Christensen.
3169
3170         New texture mapper files should be included in the project.
3171
3172         * WebCore.vcxproj/WebCore.vcxproj:
3173         * WebCore.vcxproj/WebCore.vcxproj.filters:
3174
3175 2015-04-01  Myles C. Maxfield  <mmaxfield@apple.com>
3176
3177         Support forcing expansion opportunities at the beginning and ending of a run
3178         https://bugs.webkit.org/show_bug.cgi?id=143292
3179
3180         Reviewed by David Hyatt.
3181
3182         Migrate ExpansionBehavior to an enum comprised of two values: one for leading behavior
3183         and one for trailing behavior. Each of these two values can take on a value of
3184         "force," "forbid," and neither. All calls that interact with justification are
3185         migrated to use this new structure.
3186
3187         Note that in this terminology, "leading" and "trailing" are with respect to the order
3188         that elements get laid out in a line. Therefore, leading is always on the left, since
3189         lines get laid out that way regardless of their bidi attributes.
3190
3191         This is getting ready for https://bugs.webkit.org/show_bug.cgi?id=142608
3192
3193         No new tests because there is no behavior change.
3194
3195         * platform/graphics/FontCascade.cpp:
3196         (WebCore::FontCascade::expansionOpportunityCountInternal): Migrate to these new
3197         values.
3198         (WebCore::FontCascade::expansionOpportunityCount): Ditto.
3199         (WebCore::FontCascade::leadingExpansionOpportunity): Returns whether one is present
3200         or not.
3201         (WebCore::FontCascade::trailingExpansionOpportunity): Ditto.
3202         * platform/graphics/FontCascade.h:
3203         * platform/graphics/GlyphBuffer.h: New leading expansion field.
3204         (WebCore::GlyphBuffer::setLeadingExpansion):
3205         (WebCore::GlyphBuffer::leadingExpansion):
3206         * platform/graphics/TextRun.h: m_expansionBehavior needs more bits.
3207         (WebCore::TextRun::expansionBehavior):
3208         (WebCore::TextRun::allowsLeadingExpansion): Deleted.
3209         (WebCore::TextRun::allowsTrailingExpansion): Deleted.
3210         * platform/graphics/WidthIterator.cpp: Update to support new type.
3211         (WebCore::WidthIterator::WidthIterator):
3212         (WebCore::expansionLocation): Where should we insert expansions?
3213         (WebCore::WidthIterator::advanceInternal): Use expansionLocation()
3214         * platform/graphics/cocoa/FontCascadeCocoa.mm:
3215         (WebCore::FontCascade::adjustSelectionRectForComplexText):
3216         (WebCore::FontCascade::getGlyphsAndAdvancesForComplexText):
3217         * platform/graphics/mac/ComplexTextController.cpp: Same as WidthIterator
3218         (WebCore::ComplexTextController::ComplexTextController):
3219         (WebCore::ComplexTextController::advance):
3220         (WebCore::expansionLocation):
3221         (WebCore::ComplexTextController::adjustGlyphsAndAdvances):
3222         * platform/graphics/mac/ComplexTextController.h:
3223         (WebCore::ComplexTextController::leadingExpansion):
3224         * platform/text/TextFlags.h: Add new enum values
3225         * rendering/InlineBox.h: Update to include new values.
3226         (WebCore::InlineBox::InlineBoxBitfields::InlineBoxBitfields):
3227         (WebCore::InlineBox::canHaveTrailingExpansion):
3228         (WebCore::InlineBox::setCanHaveTrailingExpansion):
3229         (WebCore::InlineBox::setForceTrailingExpansion):
3230         (WebCore::InlineBox::forceTrailingExpansion):
3231         (WebCore::InlineBox::setForceLeadingExpansion):
3232         (WebCore::InlineBox::forceLeadingExpansion):
3233         * rendering/InlineTextBox.h:
3234         * rendering/RenderBlockLineLayout.cpp: Update to use new FontCascade signatures.
3235         (WebCore::expansionBehaviorForInlineTextBox):
3236         (WebCore::applyExpansionBehavior):
3237         (WebCore::RenderBlockFlow::computeInlineDirectionPositionsForSegment):
3238
3239 2015-04-01  Zalan Bujtas  <zalan@apple.com>
3240
3241         Lots of time spent querying table cell borders, when there are none.
3242         https://bugs.webkit.org/show_bug.cgi?id=143277
3243
3244         Reviewed by Simon Fraser.
3245
3246         This patch speeds up collapsed border queries by using existing collapsed border
3247         cache to calculate repaint rects and by introducing a fast path for zero width collapsed borders.
3248
3249         It reduces the number of calls to recompute collapsed borders from 36 000 to 1 600, while loading a page with a table of 400 rows (1 cell per row).
3250         When scrolling the same page all the way down to the bottom, the number of calls to recompute collapsed borders falls from 290 000 to 0.
3251
3252         Covered by existing tests.
3253
3254         * rendering/RenderTable.cpp:
3255         (WebCore::RenderTable::styleDidChange): This moves invalidation time from RenderTable::layout() to styleDidChange(). 
3256         (WebCore::RenderTable::invalidateCollapsedBorders):
3257         (WebCore::RenderTable::recalcCollapsedBorders):
3258         * rendering/RenderTable.h:
3259         (WebCore::RenderTable::collapsedBordersAreValid):
3260         (WebCore::RenderTable::invalidateCollapsedBorders): Deleted.
3261         * rendering/RenderTableCell.cpp:
3262         (WebCore::RenderTableCell::RenderTableCell):
3263         (WebCore::RenderTableCell::willBeRemovedFromTree): Invalidate caches so that when repaint rect is calculated, we don't end up using stale values.
3264         (WebCore::RenderTableCell::styleDidChange): Same as willBeRemovedFromTree.
3265         (WebCore::RenderTableCell::collapsedStartBorder): Check if collapsed border is zero -also query cache. 
3266         (WebCore::RenderTableCell::collapsedEndBorder):
3267         (WebCore::RenderTableCell::collapsedBeforeBorder):
3268         (WebCore::RenderTableCell::collapsedAfterBorder):
3269         (WebCore::RenderTableCell::cachedCollapsedLeftBorder):
3270         (WebCore::RenderTableCell::cachedCollapsedRightBorder):
3271         (WebCore::RenderTableCell::cachedCollapsedTopBorder):
3272         (WebCore::RenderTableCell::cachedCollapsedBottomBorder):
3273         (WebCore::RenderTableCell::paintCollapsedBorders):
3274         (WebCore::RenderTableCell::cellAtLeft): Deleted.
3275         (WebCore::RenderTableCell::cellAtRight): Deleted.
3276         (WebCore::RenderTableCell::cellAtTop): Deleted.
3277         (WebCore::RenderTableCell::cellAtBottom): Deleted.
3278         * rendering/RenderTableCell.h:
3279         (WebCore::RenderTableCell::invalidateHasEmptyCollapsedBorders):
3280         * rendering/RenderTableCol.cpp:
3281         (WebCore::RenderTableCol::styleDidChange):
3282         * rendering/RenderTableRow.cpp:
3283         (WebCore::RenderTableRow::styleDidChange):
3284         (WebCore::RenderTableRow::addChild):
3285         * rendering/RenderTableSection.cpp:
3286         (WebCore::RenderTableSection::styleDidChange):
3287         (WebCore::RenderTableSection::clearCachedCollapsedBorders): This is just an extra safety to invalidate collapsed border cache. This is always
3288         called together with RenderTable::invalidateCollapsedBorders() -and that should prevent the RenderCells to use the cache.  
3289         (WebCore::RenderTableSection::removeCachedCollapsedBorders):
3290         (WebCore::RenderTableSection::setCachedCollapsedBorder):
3291         (WebCore::RenderTableSection::cachedCollapsedBorder):
3292         * rendering/RenderTableSection.h:
3293
3294 2015-04-01  Carlos Alberto Lopez Perez  <clopez@igalia.com>
3295
3296         [CMake][GTK] Use the right variable to include the Wayland headers.
3297         https://bugs.webkit.org/show_bug.cgi?id=143304
3298
3299         Reviewed by Carlos Garcia Campos.
3300
3301         No new tests, no behavior changes.
3302
3303         * PlatformGTK.cmake: Use the right variable WAYLAND_INCLUDE_DIRS.
3304
3305 2015-03-30  Philippe Normand  <pnormand@igalia.com>
3306
3307         [GStreamer] Move synchronous message handler to MediaPlayerPrivateGStreamerBase
3308         https://bugs.webkit.org/show_bug.cgi?id=143218
3309
3310         Reviewed by Carlos Garcia Campos.
3311
3312         Moved the pipeline pointer to the base class, sub-classes should
3313         now invoke setPipeline() when loading a resource. The base class
3314         now takes care of configuring the GL shared context, this is more
3315         logical because video rendering is also managed by this class.
3316
3317         No new tests, this is only a code refactoring.
3318
3319         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3320         (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer):
3321         (WebCore::MediaPlayerPrivateGStreamer::load):
3322         (WebCore::MediaPlayerPrivateGStreamer::playbackPosition):
3323         (WebCore::MediaPlayerPrivateGStreamer::changePipelineState):
3324         (WebCore::MediaPlayerPrivateGStreamer::pause):
3325         (WebCore::MediaPlayerPrivateGStreamer::duration):
3326         (WebCore::MediaPlayerPrivateGStreamer::currentTime):
3327         (WebCore::MediaPlayerPrivateGStreamer::seek):
3328         (WebCore::MediaPlayerPrivateGStreamer::doSeek):
3329         (WebCore::MediaPlayerPrivateGStreamer::updatePlaybackRate):
3330         (WebCore::MediaPlayerPrivateGStreamer::paused):
3331         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideo):
3332         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfAudio):
3333         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfText):
3334         (WebCore::MediaPlayerPrivateGStreamer::setRate):
3335         (WebCore::MediaPlayerPrivateGStreamer::buffered):
3336         (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
3337         (WebCore::MediaPlayerPrivateGStreamer::fillTimerFired):
3338         (WebCore::MediaPlayerPrivateGStreamer::didLoadingProgress):
3339         (WebCore::MediaPlayerPrivateGStreamer::sourceChanged):
3340         (WebCore::MediaPlayerPrivateGStreamer::cancelLoad):
3341         (WebCore::MediaPlayerPrivateGStreamer::asyncStateChangeDone):
3342         (WebCore::MediaPlayerPrivateGStreamer::updateStates):
3343         (WebCore::MediaPlayerPrivateGStreamer::loadNextLocation):
3344         (WebCore::MediaPlayerPrivateGStreamer::cacheDuration):
3345         (WebCore::MediaPlayerPrivateGStreamer::setDownloadBuffering):
3346         (WebCore::MediaPlayerPrivateGStreamer::audioSink):
3347         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
3348         (WebCore::MediaPlayerPrivateGStreamer::simulateAudioInterruption):
3349         (WebCore::mediaPlayerPrivateSyncMessageCallback): Deleted.
3350         (WebCore::MediaPlayerPrivateGStreamer::handleSyncMessage): Deleted.
3351         (WebCore::MediaPlayerPrivateGStreamer::ensureGstGLContext): Deleted.
3352         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
3353         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: