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