AX:Null pointer may be dereferenced.
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2013-08-28  Lukasz Gajowy  <l.gajowy@samsung.com>
2
3         AX:Null pointer may be dereferenced.
4         https://bugs.webkit.org/show_bug.cgi?id=120300
5
6         Reviewed by Chris Fleizach.
7
8         Added a check if newObj is not null and an assert in order to avoid dereferecing null pointer.
9
10         * accessibility/AXObjectCache.cpp:
11         (WebCore::AXObjectCache::getOrCreate):
12
13 2013-08-28  Pratik Solanki  <psolanki@apple.com>
14
15         Document::elementSheet() should return a reference
16         https://bugs.webkit.org/show_bug.cgi?id=120433
17
18         Reviewed by Andreas Kling.
19
20         Since elementSheet() always retruns a valid pointer, we can simply return a reference
21         instead. Also rename m_elemSheet to m_elementSheet.
22
23         * css/CSSParser.cpp:
24         (WebCore::CSSParser::parseInlineStyleDeclaration):
25         * css/PropertySetCSSStyleDeclaration.cpp:
26         (WebCore::InlineCSSStyleDeclaration::parentStyleSheet):
27         * dom/Document.cpp:
28         (WebCore::Document::~Document):
29         (WebCore::Document::recalcStyle):
30         (WebCore::Document::updateBaseURL):
31         (WebCore::Document::elementSheet):
32         * dom/Document.h:
33         * dom/StyledElement.cpp:
34         (WebCore::StyledElement::setInlineStyleFromString):
35         (WebCore::StyledElement::setInlineStyleProperty):
36         (WebCore::StyledElement::addSubresourceAttributeURLs):
37         (WebCore::StyledElement::addPropertyToPresentationAttributeStyle):
38         * inspector/InspectorStyleSheet.cpp:
39         (WebCore::InspectorStyleSheetForInlineStyle::getStyleAttributeRanges):
40
41 2013-08-28  Ryosuke Niwa  <rniwa@webkit.org>
42
43         REGRESSION(r154586): Past names map should only be used when named item is empty
44         https://bugs.webkit.org/show_bug.cgi?id=120432
45
46         Reviewed by Anders Carlsson.
47
48         Don't add the element from the past names map if we've found elements of the given name.
49
50         Test: fast/forms/past-names-map-should-be-used-only-when-named-item-is-empty.html
51
52         * html/HTMLFormElement.cpp:
53         (WebCore::HTMLFormElement::getNamedElements):
54
55 2013-08-27  Ryosuke Niwa  <rniwa@webkit.org>
56
57         Don't keep unassociated elements in the past names map
58         https://bugs.webkit.org/show_bug.cgi?id=120328
59
60         Reviewed by Darin Adler.
61
62         Remove elements from the past names map of a form element when they are disassociated with the form to match
63         the behaviors of Firefox 24 and Internet Explorer 10. The specification feedback has been submitted to WHATWG
64         in http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2013-August/040586.html
65
66         Also fix a memory leak via the past names map when the elements in the map becomes an ancestor of the form
67         element by storing a raw pointer in the map. This is safe because the form associated elements are kept alive
68         by another mechanism.
69
70         Because ~FormAssociatedElement removes entries from the past names map, we could no longer store HTMLElement*
71         in HTMLFormElement::m_pastNamesMap as that requires casting FormAssociatedElement* to HTMLElement*, which is
72         not possible in ~FormAssociatedElement. We instead store pointers to FormNamedItem, new base class of
73         FormAssociatedElement and HTMLImageElement.
74
75         Test: fast/forms/past-names-map-should-not-contained-disassociated-elements.html
76
77         * Target.pri:
78         * WebCore.exp.in:
79         * WebCore.vcxproj/WebCore.vcxproj:
80         * WebCore.vcxproj/WebCore.vcxproj.filters:
81         * WebCore.xcodeproj/project.pbxproj:
82         * html/FormAssociatedElement.cpp:
83         * html/FormAssociatedElement.h:
84         (WebCore::toHTMLElement):
85
86         * html/FormNamedItem.h: Added.
87         (WebCore::FormNamedItem::~FormNamedItem):
88
89         * html/HTMLElement.h:
90         (WebCore::HTMLElement::asFormNamedItem): Added. This allows the conversion from a HTMLFormControlElement,
91         HTMLObjectElement, HTMLImageElement to FormNamedItem in getNamedElements to update the past names map.
92
93         * html/HTMLFormControlElement.h:
94         * html/HTMLFormElement.cpp:
95         (WebCore::HTMLFormElement::removeFormElement):
96         (WebCore::HTMLFormElement::removeImgElement):
97         (WebCore::HTMLFormElement::assertItemCanBeInPastNamesMap): Asserts that FormNamedItem added to or obtained
98         from the past names map is either a form associated element or an image element; the condition guarantees
99         that the item will be removed from the map before its element gets destructed.
100
101         (WebCore::HTMLFormElement::elementFromPastNamesMap):
102         (WebCore::HTMLFormElement::addToPastNamesMap):
103         (WebCore::HTMLFormElement::removeFromPastNamesMap): Finds and removes the obsolete item from the map in O(n).
104         Note that removeFromVector, which is called on m_associatedElements or m_imageElements before this function is called,
105         is already O(n).
106
107         (WebCore::HTMLFormElement::getNamedElements):
108
109         * html/HTMLFormElement.h:
110         * html/HTMLImageElement.h:
111         * html/HTMLObjectElement.h:
112
113 2013-08-28  Brendan Long  <b.long@cablelabs.com>
114
115         Duplicate in-band tracks when switching <source> elements
116         https://bugs.webkit.org/show_bug.cgi?id=120369
117
118         Reviewed by Eric Carlson.
119
120         Test: media/track/track-in-band-duplicate-tracks-when-source-changes.html
121
122         * html/HTMLMediaElement.cpp:
123         (WebCore::HTMLMediaElement::createMediaPlayer):
124         Delete existing in-band tracks before creating a new media player.
125
126 2013-08-28  Bem Jones-Bey  <bjonesbe@adobe.com>
127
128         Code cleanup: rename FloatIntervalSearchAdapter and remove unnecessary inlines
129         https://bugs.webkit.org/show_bug.cgi?id=120378
130
131         Reviewed by Darin Adler.
132
133         Rename FloatIntervalSearchAdapter to ComputeFloatOffsetAdapter. The
134         naming of this adapter has caused much confusion in reading the code,
135         as it wasn't apparent that calls to it were actually doing anything
136         other than searching the interval tree. The new name is a much better
137         description of what it actually does.
138
139         Also, rename m_lowValue and m_highValue member variables to make it
140         easier to read the code that uses them.
141
142         Removed the inlines based on a change by eseidel in Blink.
143
144         No new tests, no behavior change.
145
146         * rendering/RenderBlock.cpp:
147         (WebCore::::updateOffsetIfNeeded): Update for renames.
148         (WebCore::::collectIfNeeded): Ditto.
149         (WebCore::::getHeightRemaining): Ditto.
150         (WebCore::RenderBlock::logicalLeftFloatOffsetForLine): Ditto.
151         (WebCore::RenderBlock::logicalRightFloatOffsetForLine): Ditto.
152         * rendering/RenderBlock.h:
153         (WebCore::RenderBlock::FloatingObject::x): Remove unnecessary inline.
154         (WebCore::RenderBlock::FloatingObject::maxX): Ditto.
155         (WebCore::RenderBlock::FloatingObject::y): Ditto.
156         (WebCore::RenderBlock::FloatingObject::maxY): Ditto.
157         (WebCore::RenderBlock::FloatingObject::width): Ditto.
158         (WebCore::RenderBlock::FloatingObject::height): Ditto.
159         (WebCore::RenderBlock::ComputeFloatOffsetAdapter::ComputeFloatOffsetAdapter): Rename.
160         (WebCore::RenderBlock::ComputeFloatOffsetAdapter::lowValue): Rename m_lowValue.
161         (WebCore::RenderBlock::ComputeFloatOffsetAdapter::highValue): Rename m_highValue.
162
163 2013-08-28  Tamas Czene  <tczene@inf.u-szeged.hu>
164
165         Resolve unused parameter warning in ScriptedAnimationController.cpp.
166         https://bugs.webkit.org/show_bug.cgi?id=120408
167
168         Reviewed by Darin Adler.
169
170         * dom/ScriptedAnimationController.cpp:
171         (WebCore::ScriptedAnimationController::setThrottled):
172
173 2013-08-28  Sergio Villar Senin  <svillar@igalia.com>
174
175         [CSS Grid Layout] Handle 'span' positions during layout
176         https://bugs.webkit.org/show_bug.cgi?id=119756
177
178         Reviewed by Andreas Kling.
179
180         From Blink r149133 by <jchaffraix@chromium.org>
181
182         Properly handle the 'span' keyword during layout. We only had
183         parsing support so far but with this change we are able to
184         recognize these positions and act accordingly.
185
186         * rendering/RenderGrid.cpp:
187         (WebCore::RenderGrid::resolveGridPositionsFromStyle):
188         (WebCore::RenderGrid::resolveGridPositionAgainstOppositePosition):
189         * rendering/RenderGrid.h:
190         * rendering/style/GridPosition.h:
191         (WebCore::GridPosition::shouldBeResolvedAgainstOppositePosition):
192
193 2013-08-28  Antti Koivisto  <antti@apple.com>
194
195         Factor descendant iterator assertions into a class.
196         https://bugs.webkit.org/show_bug.cgi?id=120422
197
198         Reviewed by Darin Adler.
199
200         Share the assertions between ChildIterator and DescendantIterator. We can use it for future const iterators too.
201
202         * GNUmakefile.list.am:
203         * Target.pri:
204         * WebCore.vcxproj/WebCore.vcxproj:
205         * WebCore.xcodeproj/project.pbxproj:
206         * dom/ChildIterator.h:
207         (WebCore::::ChildIterator):
208         (WebCore::::operator):
209         (WebCore::=):
210         * dom/DescendantIterator.h:
211         (WebCore::::DescendantIterator):
212         (WebCore::::operator):
213         (WebCore::=):
214         * dom/DescendantIteratorAssertions.h: Added.
215         (WebCore::DescendantIteratorAssertions::DescendantIteratorAssertions):
216         (WebCore::DescendantIteratorAssertions::domTreeHasMutated):
217         (WebCore::DescendantIteratorAssertions::dropEventDispatchAssertion):
218
219 2013-08-28  Darin Adler  <darin@apple.com>
220
221         Eliminate Pasteboard::generalPasteboard
222         https://bugs.webkit.org/show_bug.cgi?id=120392
223
224         Reviewed by Anders Carlsson.
225
226         * WebCore.exp.in: Removed the generalPasteboard function.
227         It didn't need to be exported, because no one was using it.
228
229         * editing/Editor.cpp:
230         (WebCore::Editor::paste): Added an overload that takes a Pasteboard.
231         (WebCore::Editor::copyURL): Ditto.
232         * editing/Editor.h: Added overloads.
233
234         * editing/EditorCommand.cpp:
235         (WebCore::executePasteGlobalSelection): Put this function inside the same
236         platform #if that the global selection code in the Pasteboard class was in.
237         Changed to use Pasteboard::createForGlobalSelection instead of using the
238         Pasteboard::setSelectionMode approach.
239         (WebCore::createCommandMap): Put PasteGlobalSelection inside the platform #if.
240
241         * inspector/InjectedScriptHost.cpp:
242         (WebCore::InjectedScriptHost::copyText): Use Pasteboard::createForCopyAndPaste()
243         instead of Pasteboard::generalPasteboard().
244         * inspector/InspectorFrontendHost.cpp:
245         (WebCore::InspectorFrontendHost::copyText): Ditto.
246
247         * platform/Pasteboard.h: Removed generalPasteboard. Replaced isSelectionMode
248         and setSelectionMode with createForGlobalSelection.
249
250         * platform/blackberry/PasteboardBlackBerry.cpp: Deleted generalPasteboard.
251         * platform/efl/PasteboardEfl.cpp: Deleted generalPasteboard.
252
253         * platform/gtk/PasteboardGtk.cpp: Deleted selectionClipboard, primaryClipboard,
254         generalPasteboard, isSelectionMode, and setSelectionMode.
255         (WebCore::Pasteboard::createForGlobalSelection): Added.
256         * platform/gtk/PasteboardHelper.cpp: Deleted m_usePrimarySelectionClipboard,
257         getCurrentClipboard, and getClipboard.
258         * platform/gtk/PasteboardHelper.h: Deleted the above, plus
259         setUsePrimarySelectionClipboard and usePrimarySelectionClipboard.
260
261         * platform/ios/PasteboardIOS.mm: Deleted generalPasteboard.
262         * platform/mac/PasteboardMac.mm: Deleted generalPasteboard.
263
264         * platform/qt/PasteboardQt.cpp: Deleted generalPasteboard, isSelectionMode,
265         and setSelectionMode.
266         (WebCore::Pasteboard::createForGlobalSelection): Added.
267
268         * platform/win/PasteboardWin.cpp: Deleted generalPasteboard.
269
270 2013-08-28  Antti Koivisto  <antti@apple.com>
271
272         Share attach loops between Elements and ShadowRoots
273         https://bugs.webkit.org/show_bug.cgi?id=120414
274
275         Reviewed Andreas Kling.
276
277         * style/StyleResolveTree.cpp:
278         (WebCore::Style::attachChildren):
279         (WebCore::Style::attachShadowRoot):
280         (WebCore::Style::detachChildren):
281         (WebCore::Style::detachShadowRoot):
282
283 2013-08-28  Anders Carlsson  <andersca@apple.com>
284
285         Clean up XPathExpressionNode and XPath::Function
286         https://bugs.webkit.org/show_bug.cgi?id=120411
287
288         Reviewed by Antti Koivisto.
289
290         Rename the subexpression and function argument getters to be more descriptive,
291         remove the non-const overloads (they were never used) and change the getters to return
292         references since they can never be null.
293
294         * xml/XPathExpressionNode.cpp:
295         * xml/XPathExpressionNode.h:
296         (WebCore::XPath::ParseNode::~ParseNode):
297         (WebCore::XPath::Expression::addSubExpression):
298         (WebCore::XPath::Expression::isContextNodeSensitive):
299         (WebCore::XPath::Expression::setIsContextNodeSensitive):
300         (WebCore::XPath::Expression::isContextPositionSensitive):
301         (WebCore::XPath::Expression::setIsContextPositionSensitive):
302         (WebCore::XPath::Expression::isContextSizeSensitive):
303         (WebCore::XPath::Expression::setIsContextSizeSensitive):
304         (WebCore::XPath::Expression::subExpressionCount):
305         (WebCore::XPath::Expression::subExpression):
306         * xml/XPathFunctions.cpp:
307         (WebCore::XPath::Function::setArguments):
308         (WebCore::XPath::FunId::evaluate):
309         (WebCore::XPath::FunLocalName::evaluate):
310         (WebCore::XPath::FunNamespaceURI::evaluate):
311         (WebCore::XPath::FunName::evaluate):
312         (WebCore::XPath::FunCount::evaluate):
313         (WebCore::XPath::FunString::evaluate):
314         (WebCore::XPath::FunConcat::evaluate):
315         (WebCore::XPath::FunStartsWith::evaluate):
316         (WebCore::XPath::FunContains::evaluate):
317         (WebCore::XPath::FunSubstringBefore::evaluate):
318         (WebCore::XPath::FunSubstringAfter::evaluate):
319         (WebCore::XPath::FunSubstring::evaluate):
320         (WebCore::XPath::FunStringLength::evaluate):
321         (WebCore::XPath::FunNormalizeSpace::evaluate):
322         (WebCore::XPath::FunTranslate::evaluate):
323         (WebCore::XPath::FunBoolean::evaluate):
324         (WebCore::XPath::FunNot::evaluate):
325         (WebCore::XPath::FunLang::evaluate):
326         (WebCore::XPath::FunNumber::evaluate):
327         (WebCore::XPath::FunSum::evaluate):
328         (WebCore::XPath::FunFloor::evaluate):
329         (WebCore::XPath::FunCeiling::evaluate):
330         (WebCore::XPath::FunRound::evaluate):
331         * xml/XPathFunctions.h:
332         (WebCore::XPath::Function::setName):
333         (WebCore::XPath::Function::argumentCount):
334         (WebCore::XPath::Function::argument):
335         (WebCore::XPath::Function::name):
336         * xml/XPathPredicate.cpp:
337         (WebCore::XPath::Negative::evaluate):
338         (WebCore::XPath::NumericOp::evaluate):
339         (WebCore::XPath::EqTestOp::evaluate):
340         (WebCore::XPath::LogicalOp::evaluate):
341         (WebCore::XPath::Union::evaluate):
342
343 2013-08-28  Andreas Kling  <akling@apple.com>
344
345         Page::pluginData() should return a reference.
346         <https://webkit.org/b/120386>
347
348         Reviewed by Darin Adler.
349
350         The PluginData is lazily constructed by pluginData(); it never returns null.
351         A small number of null checks were harmed in the making of this patch.
352
353 2013-08-28  Andrei Parvu  <parvu@adobe.com>
354
355         <https://webkit.org/b/120002> [CSS Masking] Add -webkit-mask-source-type shorthand property
356
357         Added the -webkit-mask-source-type property to the -webkit-mask shorthand property.
358
359         Reviewed by Dirk Schulze.
360
361         Test cases added in LayoutTests/fast/masking/parsing-mask.html
362
363         * css/CSSParser.cpp: Added the CSSPropertyWebkitMaskSourceType property to the array of shorthand properties.
364         (WebCore::CSSParser::parseValue):
365         * css/StylePropertyShorthand.cpp: Added the CSSPropertyWebkitMaskSourceType to the list of shorthands.
366         (WebCore::webkitMaskShorthand):
367         (WebCore::matchingShorthandsForLonghand):
368
369 2013-08-28  Zan Dobersek  <zdobersek@igalia.com>
370
371         REGRESSION(r154708): It broke all plugin tests on GTK and Qt WK1
372         https://bugs.webkit.org/show_bug.cgi?id=120398
373
374         Reviewed by Anders Carlsson.
375
376         * bridge/c/c_class.cpp:
377         (JSC::Bindings::CClass::methodNamed): Keep the pointer of the new CMethod object
378         to return it after it's adopted by the new HashMap entry.
379         (JSC::Bindings::CClass::fieldNamed): The pointer to the newly created CField object
380         should be returned in this branch, matching the behavior before r154708.
381
382 2013-08-28  Antti Koivisto  <antti@apple.com>
383
384         Fix Qt no-libxml2 build.
385         
386         Not reviewed.
387
388         * xml/parser/XMLDocumentParserQt.cpp:
389         (WebCore::XMLDocumentParser::parseCdata):
390
391 2013-08-28  Antti Koivisto  <antti@apple.com>
392
393         Don't use NodeRenderingContext when attaching text renderers
394         https://bugs.webkit.org/show_bug.cgi?id=120402
395
396         Reviewed by Andreas Kling.
397
398         This patch moves various functions for creating text renderers from NodeRenderingContext and Text to StyleResolveTree.
399         It also tightens the logic and combines some functions.
400
401         * dom/CharacterData.cpp:
402         (WebCore::CharacterData::parserAppendData):
403         (WebCore::CharacterData::setDataAndUpdate):
404         * dom/ContainerNode.cpp:
405         (WebCore::attachChild):
406         (WebCore::detachChild):
407         * dom/NodeRenderingContext.cpp:
408         * dom/NodeRenderingContext.h:
409         * dom/Text.cpp:
410         (WebCore::Text::~Text):
411         * dom/Text.h:
412         * html/HTMLViewSourceDocument.cpp:
413         (WebCore::HTMLViewSourceDocument::addText):
414         * html/parser/HTMLConstructionSite.cpp:
415         (WebCore::executeTask):
416         * html/shadow/InsertionPoint.cpp:
417         (WebCore::InsertionPoint::willAttachRenderers):
418         (WebCore::InsertionPoint::willDetachRenderers):
419         * style/StyleResolveTree.cpp:
420         (WebCore::Style::isRendererReparented):
421         (WebCore::Style::previousSiblingRenderer):
422         (WebCore::Style::nextSiblingRenderer):
423         
424             From NodeRenderingContext::next/previousRenderer
425
426         (WebCore::Style::createTextRenderersForSiblingsAfterAttachIfNeeded):
427         
428             From Text::createTextRenderersForSiblingsAfterAttachIfNeeded()
429
430         (WebCore::Style::textRendererIsNeeded):
431         
432             From Text::textRendererIsNeeded
433
434         (WebCore::Style::createTextRendererIfNeeded):
435         
436             Combines code from Text::createTextRendererIfNeeded, NodeRenderingContext::createRendererForTextIfNeeded,
437             NodeRenderingContext constructor and text node relevant code NodeRenderingContext::shouldCreateRenderer.
438
439         (WebCore::Style::attachTextRenderer):
440         (WebCore::Style::detachTextRenderer):
441         
442             New functions of attaching text renderers. From Text::attach/detachText()
443
444         (WebCore::Style::updateTextRendererAfterContentChange):
445         
446             From Text::updateTextRenderer.
447
448         (WebCore::Style::attachShadowRoot):
449         (WebCore::Style::attachChildren):
450         (WebCore::Style::attachRenderTree):
451         (WebCore::Style::detachShadowRoot):
452         (WebCore::Style::detachChildren):
453         (WebCore::Style::updateTextStyle):
454         * style/StyleResolveTree.h:
455         * xml/parser/XMLDocumentParser.cpp:
456         (WebCore::XMLDocumentParser::exitText):
457         * xml/parser/XMLDocumentParserLibxml2.cpp:
458         (WebCore::XMLDocumentParser::cdataBlock):
459
460 2013-08-28  Antti Koivisto  <antti@apple.com>
461
462         Make descendant iterators always require ContainerNode root
463         https://bugs.webkit.org/show_bug.cgi?id=120393
464
465         Reviewed by Andreas Kling.
466
467         Remove Node* root versions of the iterators. 
468         Fix the few call sites that required them to have tighter typing.
469
470         * accessibility/AccessibilityNodeObject.cpp:
471         (WebCore::AccessibilityNodeObject::canvasHasFallbackContent):
472         (WebCore::siblingWithAriaRole):
473         * dom/ChildIterator.h:
474         (WebCore::::ChildIteratorAdapter):
475         (WebCore::::begin):
476         (WebCore::::end):
477         (WebCore::elementChildren):
478         (WebCore::childrenOfType):
479         * dom/DescendantIterator.h:
480         (WebCore::::DescendantIterator):
481         (WebCore::::DescendantIteratorAdapter):
482         (WebCore::::begin):
483         (WebCore::::end):
484         (WebCore::elementDescendants):
485         (WebCore::descendantsOfType):
486         * editing/ApplyStyleCommand.cpp:
487         (WebCore::dummySpanAncestorForNode):
488         (WebCore::ApplyStyleCommand::cleanupUnstyledAppleStyleSpans):
489         (WebCore::ApplyStyleCommand::applyInlineStyle):
490         * editing/ApplyStyleCommand.h:
491
492 2013-08-28  Sergio Villar Senin  <svillar@igalia.com>
493
494         WorkerGlobalScopeWebDatabase requires ENABLE(WORKERS)
495         https://bugs.webkit.org/show_bug.cgi?id=120395
496
497         Reviewed by Christophe Dumez.
498
499         WorkerGlobalScopeDatabase uses the WorkerGlobalScope object which is
500         defined only when WORKERS are enabled. We should guard that code.
501
502         * Modules/webdatabase/WorkerGlobalScopeWebDatabase.cpp:
503         * Modules/webdatabase/WorkerGlobalScopeWebDatabase.h:
504         * Modules/webdatabase/WorkerGlobalScopeWebDatabase.idl:
505
506 2013-08-28  Sergio Villar Senin  <svillar@igalia.com>
507
508         [CSS Grid Layout] Fix grid position resolution
509         https://bugs.webkit.org/show_bug.cgi?id=119801
510
511         Reviewed by Andreas Kling.
512
513         From Blink r148833, r148878, r150403 by <jchaffraix@chromium.org>
514
515         Both grid-{column|row}-end and negative positions were not
516         properly handled in our grid position resolution code. We were
517         using the same code to resolve all the grid positions without
518         considering the edges of the grid.
519
520         Also refactored the grid size estimation in
521         resolveGridPositionsFromStyle() so we can use it for the grid size
522         estimation. The code no longer requires the grid to be filled at
523         that moment as the specs changed to use the "explicit grid" which
524         is independent of grid items (only depends on style).
525
526         Test: fast/css-grid-layout/grid-item-negative-position-resolution.html
527
528         * rendering/RenderGrid.cpp:
529         (WebCore::RenderGrid::maximumIndexInDirection):
530         (WebCore::RenderGrid::resolveGridPositionsFromStyle):
531         (WebCore::adjustGridPositionForSide):
532         (WebCore::RenderGrid::resolveGridPositionFromStyle):
533         * rendering/RenderGrid.h:
534
535 2013-08-28  Sergio Villar Senin  <svillar@igalia.com>
536
537         [CSS Grid Layout] infinity should be defined as a negative value
538         https://bugs.webkit.org/show_bug.cgi?id=107053
539
540         Reviewed by Andreas Kling.
541
542         From Blink r154805 by <jchaffraix@chromium.org>
543
544         Reject negative values for track-breadth at parse time as
545         mentioned in the latest versions of the spec.
546
547         Added some extra checks to the existing tests.
548
549         * css/CSSParser.cpp:
550         (WebCore::CSSParser::parseGridBreadth):
551         * rendering/RenderGrid.cpp:
552         (WebCore::RenderGrid::computeUsedBreadthOfMaxLength):
553
554 2013-08-28  Sergio Villar Senin  <svillar@igalia.com>
555
556         [Soup] WebTiming information not shown in the inspector
557         https://bugs.webkit.org/show_bug.cgi?id=118395
558
559         Reviewed by Martin Robinson.
560
561         WebTiming information was not correctly provided to WebCore
562         because the gotHeadersCallback was incorrectly resetting the
563         original ResourceResponse (which had the ResourceLoadTiming
564         object) instead of simply updating their contents using the
565         SoupMessage.
566
567         No new test required as this feature is already covered by the
568         existing webtiming tests. In any case this change includes a fix
569         for the http/tests/misc/webtiming-ssl.php test which was not
570         failing even if it should because it was not correct.
571
572         * platform/network/soup/ResourceHandleSoup.cpp:
573         (WebCore::gotHeadersCallback):
574         (WebCore::restartedCallback): restartedCallback should be
575         available only if WEB_TIMING is defined.
576         (WebCore::createSoupMessageForHandleAndRequest): Ditto.
577
578 2013-08-26  Antonio Gomes  <a1.gomes@sisa.samsung.com>
579
580         Scrolling allowed when overflow:hidden (seen on Acid2)
581         https://bugs.webkit.org/show_bug.cgi?id=22769
582
583         Reviewed by Darin Adler.
584
585         Autoscroll, as well as other user-driven scroll actions,
586         has to respect the scrollability styled into the web page.
587         More specifically, if a html or body tags are styled with
588         overflow:hidden, autoscroll should not scroll the containing document.
589
590         In order to fix this, patch hardens RenderBox::canAutoscroll as
591         following: previously, ::canAutoscroll was relying solemnly in
592         ::canBeScrolledAndHasScrollableArea to determine the scrollability
593         of #document node, which was unconditionally returned as 'true'.
594         Patch extends ::canAutoscroll to handle the #document case for
595         main and inner frames, and now it asks through ::isScrollable if
596         the corresponding document's FrameView is actually user-scrollable.
597
598         Note, that the patch change ::canAutoscroll to cover the non-mainFrame
599         #document case, so the comment specific to Apple's Mail app can be omited
600         now.
601
602         Test: fast/events/autoscroll-in-overflow-hidden-html.html
603
604         * rendering/RenderBox.cpp:
605         (WebCore::RenderBox::canAutoscroll):
606
607 2013-08-27  Santosh Mahto  <santosh.ma@samsung.com>
608
609         Adding  "explicit" keyword in  forms related classes constructor
610         https://bugs.webkit.org/show_bug.cgi?id=120366
611
612         Reviewed by Darin Adler.
613
614         Adding "explicit" keyword in constructors.
615
616         * html/BaseButtonInputType.h:
617         (WebCore::BaseButtonInputType::BaseButtonInputType):
618         * html/BaseCheckableInputType.h:
619         (WebCore::BaseCheckableInputType::BaseCheckableInputType):
620         * html/BaseChooserOnlyDateAndTimeInputType.h:
621         (WebCore::BaseChooserOnlyDateAndTimeInputType::BaseChooserOnlyDateAndTimeInputType):
622         * html/BaseClickableWithKeyInputType.h:
623         (WebCore::BaseClickableWithKeyInputType::BaseClickableWithKeyInputType):
624         * html/BaseTextInputType.h:
625         (WebCore::BaseTextInputType::BaseTextInputType):
626         * html/ColorInputType.h:
627         (WebCore::ColorInputType::ColorInputType):
628         * html/DateInputType.h:
629         * html/DateTimeInputType.h:
630         (WebCore::DateTimeInputType::DateTimeInputType):
631         * html/DateTimeLocalInputType.h:
632         (WebCore::DateTimeLocalInputType::DateTimeLocalInputType):
633         * html/EmailInputType.h:
634         (WebCore::EmailInputType::EmailInputType):
635         * html/FileInputType.h:
636         * html/HiddenInputType.h:
637         (WebCore::HiddenInputType::HiddenInputType):
638         * html/ImageData.h:
639         * html/ImageInputType.h:
640         * html/InputType.h:
641         (WebCore::InputType::InputType):
642         * html/MediaController.h:
643         * html/MonthInputType.h:
644         (WebCore::MonthInputType::MonthInputType):
645         * html/RadioInputType.h:
646         (WebCore::RadioInputType::RadioInputType):
647         * html/RangeInputType.h:
648         * html/ResetInputType.h:
649         (WebCore::ResetInputType::ResetInputType):
650         * html/SearchInputType.h:
651         * html/SubmitInputType.h:
652         (WebCore::SubmitInputType::SubmitInputType):
653         * html/TelephoneInputType.h:
654         (WebCore::TelephoneInputType::TelephoneInputType):
655         * html/TextFieldInputType.h:
656         * html/TextInputType.h:
657         (WebCore::TextInputType::TextInputType):
658         * html/TimeInputType.h:
659         * html/URLInputType.h:
660         (WebCore::URLInputType::URLInputType):
661         * html/ValidationMessage.h:
662         * html/WeekInputType.h:
663         (WebCore::WeekInputType::WeekInputType):
664
665 2013-08-27  Benjamin Poulain  <benjamin@webkit.org>
666
667         Fix the indentation of SpaceSplitString
668         https://bugs.webkit.org/show_bug.cgi?id=120390
669
670         Reviewed by Ryosuke Niwa.
671
672         * dom/SpaceSplitString.h:
673         (WebCore::SpaceSplitStringData::contains):
674         (WebCore::SpaceSplitStringData::isUnique):
675         (WebCore::SpaceSplitStringData::size):
676         (WebCore::SpaceSplitStringData::operator[]):
677         (WebCore::SpaceSplitString::SpaceSplitString):
678         (WebCore::SpaceSplitString::operator!=):
679         (WebCore::SpaceSplitString::clear):
680         (WebCore::SpaceSplitString::contains):
681         (WebCore::SpaceSplitString::containsAll):
682         (WebCore::SpaceSplitString::size):
683         (WebCore::SpaceSplitString::isNull):
684         (WebCore::SpaceSplitString::operator[]):
685         (WebCore::SpaceSplitString::spaceSplitStringContainsValue):
686         (WebCore::SpaceSplitString::ensureUnique):
687
688 2013-08-27  Andreas Kling  <akling@apple.com>
689
690         Make it less awkward to check if a Frame is the main Frame.
691         <https://webkit.org/b/120382>
692
693         Reviewed by Anders Carlsson.
694
695         Added Page::frameIsMainFrame(const Frame*) so code that wants to find out if a given
696         Frame is a Page's main frame doesn't have to do a manual pointer compare.
697
698         * page/Page.h:
699         (WebCore::Page::frameIsMainFrame):
700
701             Added. Replaces (frame == &page->mainFrame()) idiom.
702
703 2013-08-27  Morten Stenshorne  <mstensho@opera.com>
704
705         Improve multicol intrinsic width calculation
706         https://bugs.webkit.org/show_bug.cgi?id=116677
707
708         Reviewed by David Hyatt.
709
710         Test: fast/css-intrinsic-dimensions/multicol.html
711
712         * rendering/RenderBlock.cpp:
713         (WebCore::RenderBlock::computeIntrinsicLogicalWidths):
714         (WebCore::RenderBlock::adjustIntrinsicLogicalWidthsForColumns):
715         * rendering/RenderBlock.h:
716
717 2013-08-27  Rob Buis  <rwlbuis@webkit.org>
718
719         feImage fails if referenced node contains radialGradient declaration
720         https://bugs.webkit.org/show_bug.cgi?id=118735
721
722         Reviewed by Darin Adler.
723
724         Only call parent's updateRelativeLengthsInformation for graphics elements.
725
726         Tests: svg/custom/feImage-pserver-with-percentage-expected.svg
727                svg/custom/feImage-pserver-with-percentage.svg
728
729         * svg/SVGElement.cpp:
730         (WebCore::SVGElement::updateRelativeLengthsInformation):
731
732 2013-08-27  Darin Adler  <darin@apple.com>
733
734         No need for generalPasteboard (aside from "global selection mode")
735         https://bugs.webkit.org/show_bug.cgi?id=120367
736
737         Reviewed by Alexey Proskuryakov.
738
739         * editing/Editor.cpp:
740         (WebCore::Editor::pasteAsPlainTextBypassingDHTML):
741         (WebCore::Editor::dispatchCPPEvent):
742         (WebCore::Editor::cut):
743         (WebCore::Editor::copy):
744         (WebCore::Editor::paste):
745         (WebCore::Editor::pasteAsPlainText):
746         (WebCore::Editor::copyURL):
747         (WebCore::Editor::copyImage):
748         Use Pasteboard::createForCopyAndPaste rather than the single general pasteboard
749         for editing operations.
750
751 2013-08-27  Chris Fleizach  <cfleizach@apple.com>
752
753         <https://webkit.org/b/120117> AX: <noscript> contents are exposed as static text
754
755         Reviewed by Tim Horton.
756
757         If <noscript> is not being used (because there is script) then we need to ignore its contents for AX.
758
759         Test: accessibility/noscript-ignored.html
760
761         * accessibility/AccessibilityRenderObject.cpp:
762         (WebCore::AccessibilityRenderObject::addCanvasChildren):
763         * accessibility/AccessibilityNodeObject.cpp:
764         (WebCore::AccessibilityNodeObject::canHaveChildren):
765
766 2013-08-27  Anders Carlsson  <andersca@apple.com>
767
768         Stop using deleteAllValues in CClass
769         https://bugs.webkit.org/show_bug.cgi?id=120376
770
771         Reviewed by Andreas Kling.
772
773         * bridge/c/c_class.cpp:
774         (JSC::Bindings::CClass::CClass):
775         (JSC::Bindings::CClass::~CClass):
776         (JSC::Bindings::CClass::methodNamed):
777         (JSC::Bindings::CClass::fieldNamed):
778         * bridge/c/c_class.h:
779         * bridge/jsc/BridgeJSC.h:
780
781 2013-08-27  Benjamin Poulain  <benjamin@webkit.org>
782
783         Clean ClassList and DOMSettableTokenList
784         https://bugs.webkit.org/show_bug.cgi?id=120344
785
786         Reviewed by Ryosuke Niwa.
787
788         This patch cleans ClassList and DOMSettableTokenList to make it simpler to update
789         SpaceSplitString:
790         - Move the implementation of virtual functions to the cpp file.
791         - Clean the #includes.
792         - Make the implemented pure virtual methods final.
793         - Make the element() accessor const.
794
795         * html/ClassList.cpp:
796         (WebCore::ClassList::create):
797         (WebCore::ClassList::element):
798         (WebCore::ClassList::value):
799         (WebCore::ClassList::setValue):
800         (WebCore::ClassList::classNames):
801         * html/ClassList.h:
802         * html/DOMSettableTokenList.cpp:
803         (WebCore::DOMSettableTokenList::create):
804         (WebCore::DOMSettableTokenList::ref):
805         (WebCore::DOMSettableTokenList::deref):
806         (WebCore::DOMSettableTokenList::length):
807         (WebCore::DOMSettableTokenList::value):
808         * html/DOMSettableTokenList.h:
809         * html/DOMTokenList.h:
810         (WebCore::DOMTokenList::element):
811
812 2013-08-27  Arunprasad Rajkumar  <arurajku@cisco.com>
813
814         Replace currentTime() with monotonicallyIncreasingTime() in WebCore
815         https://bugs.webkit.org/show_bug.cgi?id=119958
816
817         Reviewed by Alexey Proskuryakov.
818
819         WTF::currentTime() is prone to NTP and manual adjustments, so use
820         WTF::monotonicallyIncreasingTime() to measure elapsed time.
821
822         It is a continuation of r154201.
823
824         * history/CachedPage.cpp:
825         (WebCore::CachedPage::CachedPage):
826         (WebCore::CachedPage::hasExpired):
827         * html/parser/HTMLParserScheduler.h:
828         (WebCore::HTMLParserScheduler::checkForYieldBeforeToken):
829         * loader/CrossOriginPreflightResultCache.cpp:
830         (WebCore::CrossOriginPreflightResultCacheItem::parse):
831         (WebCore::CrossOriginPreflightResultCacheItem::allowsRequest):
832         * loader/FrameLoader.cpp:
833         (WebCore::FrameLoader::setState):
834         * loader/ProgressTracker.cpp:
835         (WebCore::ProgressTracker::incrementProgress):
836         * loader/cache/CachedCSSStyleSheet.cpp:
837         (WebCore::CachedCSSStyleSheet::restoreParsedStyleSheet):
838         * loader/cache/CachedImage.cpp:
839         (WebCore::CachedImage::didDraw):
840         * loader/cache/MemoryCache.cpp:
841         (WebCore::MemoryCache::pruneLiveResourcesToSize):
842         * loader/icon/IconDatabase.cpp:
843         (WebCore::IconDatabase::iconDatabaseSyncThread):
844         (WebCore::IconDatabase::syncThreadMainLoop):
845         (WebCore::IconDatabase::readFromDatabase):
846         (WebCore::IconDatabase::writeToDatabase):
847         (WebCore::IconDatabase::cleanupSyncThread):
848         * page/animation/AnimationBase.cpp:
849         (WebCore::AnimationBase::freezeAtTime):
850         * page/animation/AnimationController.cpp:
851         (WebCore::AnimationControllerPrivate::beginAnimationUpdateTime):
852         * platform/graphics/GraphicsLayerAnimation.cpp:
853         (WebCore::GraphicsLayerAnimation::computeTotalRunningTime):
854         (WebCore::GraphicsLayerAnimation::resume):
855         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
856         (WebCore::AVFWrapper::createImageForTimeInRect):
857         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
858         (WebCore::MediaPlayerPrivateAVFoundationObjC::createImageForTimeInRect):
859         (WebCore::MediaPlayerPrivateAVFoundationObjC::createPixelBuffer):
860         * platform/graphics/ca/GraphicsLayerCA.cpp:
861         (WebCore::GraphicsLayerCA::suspendAnimations):
862         * platform/graphics/ca/PlatformCALayer.h:
863         (WebCore::PlatformCALayer::currentTimeToMediaTime):
864         * platform/graphics/ca/mac/LayerPool.mm:
865         (WebCore::LayerPool::addLayer):
866         (WebCore::LayerPool::decayedCapacity):
867         (WebCore::LayerPool::pruneTimerFired):
868         * platform/graphics/ca/mac/PlatformCALayerMac.mm:
869         (mediaTimeToCurrentTime):
870         * platform/graphics/ca/win/CACFLayerTreeHost.cpp:
871         (WebCore::CACFLayerTreeHost::notifyAnimationsStarted):
872         * platform/graphics/ca/win/PlatformCALayerWin.cpp:
873         (PlatformCALayer::printTree):
874         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
875         (WebCore::GraphicsLayerTextureMapper::addAnimation):
876         * platform/graphics/texmap/TextureMapperFPSCounter.cpp:
877         (WebCore::TextureMapperFPSCounter::TextureMapperFPSCounter):
878         (WebCore::TextureMapperFPSCounter::updateFPSAndDisplay):
879         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
880         (WebCore::CoordinatedGraphicsLayer::addAnimation):
881         * platform/network/DNSResolveQueue.cpp:
882         (WebCore::DNSResolveQueue::isUsingProxy):
883         * plugins/win/PluginMessageThrottlerWin.cpp:
884         (WebCore::PluginMessageThrottlerWin::appendMessage):
885         * rendering/RenderLayerCompositor.cpp:
886         (WebCore::RenderLayerCompositor::didPaintBacking):
887         (WebCore::RenderLayerCompositor::updateCompositingLayers):
888         * rendering/RenderProgress.cpp:
889         (WebCore::RenderProgress::animationProgress):
890         (WebCore::RenderProgress::updateAnimationState):
891         * svg/animation/SMILTimeContainer.cpp:
892         (WebCore::SMILTimeContainer::elapsed):
893         (WebCore::SMILTimeContainer::begin):
894         (WebCore::SMILTimeContainer::pause):
895         (WebCore::SMILTimeContainer::resume):
896         (WebCore::SMILTimeContainer::setElapsed):
897
898 2013-08-27  Robert Hogan  <robert@webkit.org>
899
900         cell width / offsetTop incorrect
901         https://bugs.webkit.org/show_bug.cgi?id=11582
902
903         Reviewed by David Hyatt.
904
905         The offsetTop and offsetLeft of sections, rows and cells should include the table's border. There are separate
906         problems with the offset[Top|Left] of table sections and the offsetLeft of rows which are covered under bugs 119020
907         and 119021 respectively - here we stick to just fixing the inclusion of the border as it doesn't require rebaselining
908         a lot of tests.
909
910         Test: fast/table/offset-top-includes-border.html
911
912         * rendering/RenderBoxModelObject.cpp:
913         (WebCore::RenderBoxModelObject::adjustedPositionRelativeToOffsetParent):
914         * rendering/RenderTableSection.cpp:
915         (WebCore::RenderTableSection::layoutRows):
916
917 2013-08-27  Jacky Jiang  <zhajiang@blackberry.com>
918
919         [BlackBerry] Rotate device from landscape to portrait during youtube streaming will cause device screen flash with video list page
920         https://bugs.webkit.org/show_bug.cgi?id=120364
921
922         Reviewed by Rob Buis.
923         Internally reviewed by Arvid Nilsson.
924
925         JIRA 461232
926         When rotating device from landscape mode to portrait mode, we updated
927         texture contents based on landscape mode front visibility and back
928         visibility on WebKit thread at the very beginning and the landscape mode
929         tiles wouldn't be able to cover the portrait mode screen which resulted
930         in the screen flash.
931         It's hard to compute front visibility information on WebKit thread because
932         it doesn't know where the layers will be on the screen. Therefore, the
933         front visibility won't be updated until the first time we draw textures
934         on compositing thread.
935         The patch traverses through LayerWebKitThread and LayerCompositingThread
936         and discards back visibility and front visibility respectively if there
937         is a pending orientation. In this way, we can pick up layerTilerPrefillRect
938         as visibleRect instead of the visibleRect from the stale visibilities
939         and add more tiles for uncovered screen when updating texture contents
940         on WebKit thread.
941         The patch also fixes a bug that we prune tiles based on the stale
942         m_requiredTextureSize in pruneTextures(). We should prune tiles based
943         on the updated pendingTextureSize instead.
944
945         * platform/graphics/blackberry/LayerCompositingThread.cpp:
946         (WebCore::LayerCompositingThread::discardFrontVisibility):
947         * platform/graphics/blackberry/LayerCompositingThread.h:
948         * platform/graphics/blackberry/LayerCompositingThreadClient.h:
949         (WebCore::LayerCompositingThreadClient::discardFrontVisibility):
950         * platform/graphics/blackberry/LayerRenderer.cpp:
951         (WebCore::LayerRenderer::discardFrontVisibility):
952         * platform/graphics/blackberry/LayerRenderer.h:
953         * platform/graphics/blackberry/LayerTiler.cpp:
954         (WebCore::LayerTiler::discardFrontVisibility):
955         (WebCore::LayerTiler::processTextureJob):
956         (WebCore::LayerTiler::pruneTextures):
957         (WebCore::LayerTiler::discardBackVisibility):
958         * platform/graphics/blackberry/LayerTiler.h:
959         * platform/graphics/blackberry/LayerWebKitThread.cpp:
960         (WebCore::LayerWebKitThread::discardBackVisibility):
961         * platform/graphics/blackberry/LayerWebKitThread.h:
962
963 2013-08-27  Antti Koivisto  <antti@apple.com>
964
965         Better mutation and event assertions for descendant iterators
966         https://bugs.webkit.org/show_bug.cgi?id=120368
967
968         Reviewed by Andreas Kling.
969
970         Add mutation assertions to all functions.
971         Drop the no-event-dispatch assertion when the iterator reaches the end. This reduces need for iterator scoping
972         just to avoid assertions.
973
974         * dom/ChildIterator.h:
975         (WebCore::::domTreeHasMutated):
976         (WebCore::::operator):
977         (WebCore::=):
978         * dom/DescendantIterator.h:
979         (WebCore::::domTreeHasMutated):
980         (WebCore::::operator):
981         (WebCore::=):
982         * dom/Document.cpp:
983         (WebCore::Document::childrenChanged):
984         
985             Make idiomatic.
986
987 2013-08-27  Renata Hodovan  <reni@webkit.org>
988
989         Missing null-check of parent renderer in WebCore::HTMLEmbedElement::rendererIsNeeded()
990         https://bugs.webkit.org/show_bug.cgi?id=120343
991
992         Reviewed by Darin Adler.
993
994         Null-check the parent renderer of HTMLEmbedElement in WebCore::HTMLEmbedElement::rendererIsNeeded()
995         and early return.
996
997         Test: fast/html/HTMLEmbedElement_without_parent_renderer_assert_crash.html
998
999         * html/HTMLEmbedElement.cpp:
1000         (WebCore::HTMLEmbedElement::rendererIsNeeded):
1001
1002 2013-08-27  Brent Fulgham  <bfulgham@apple.com>
1003
1004         [Windows] Correct method call for characteristic update.
1005
1006         Reviewed by Eric Carlson.
1007
1008         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
1009         (WebCore::MediaPlayerPrivateAVFoundationCF::tracksChanged):
1010         [Windows] Correct method call (should have been "characteristicsChanged", not
1011         "player()->characteristicChanged()"
1012
1013 2013-08-26  Brent Fulgham  <bfulgham@apple.com>
1014
1015         [Windows] some track language tags are not recognized
1016         https://bugs.webkit.org/show_bug.cgi?id=120335
1017
1018         Reviewed by Eric Carlson.
1019
1020         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp: Revise implementation
1021         to match logic in platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjc.mm
1022
1023 2013-08-27  Andreas Kling  <akling@apple.com>
1024
1025         Clumsily fix Gtk+ build. Not my proudest moment.
1026
1027         * rendering/svg/RenderSVGResourceFilter.cpp:
1028
1029 2013-08-27  Andreas Kling  <akling@apple.com>
1030
1031         Fix Qt build.
1032
1033         * rendering/svg/RenderSVGResourceFilter.cpp:
1034
1035 2013-08-27  Andreas Kling  <akling@apple.com>
1036
1037         RenderView::availableLogicalHeight() should be self-contained.
1038         <https://webkit.org/b/120356>
1039
1040         Reviewed by Antti Koivisto.
1041
1042         Instead of checking isRenderView() in RenderBox::availableLogicalHeightUsing()
1043         and doing an early return, do everything needed without leaving RenderView instead.
1044         Document style never has min-/max-height so there's no need to apply constraints.
1045
1046         * rendering/RenderBox.cpp:
1047         (WebCore::RenderBox::availableLogicalHeightUsing):
1048         * rendering/RenderView.cpp:
1049         (WebCore::RenderView::availableLogicalHeight):
1050
1051 2013-08-27  Andreas Kling  <akling@apple.com>
1052
1053         Simplify some more Settings access where we have a Frame in reach.
1054         <https://webkit.org/b/120256>
1055
1056         Reviewed by Darin Adler.
1057
1058         RenderObjects can always find Settings through the Frame.
1059
1060         * rendering/InlineTextBox.cpp:
1061         (WebCore::InlineTextBox::paint):
1062         * rendering/RenderBoxModelObject.cpp:
1063         (WebCore::RenderBoxModelObject::paintFillLayerExtended):
1064         * rendering/svg/RenderSVGResourceFilter.cpp:
1065         (WebCore::RenderSVGResourceFilter::applyResource):
1066
1067 2013-08-27  Andreas Kling  <akling@apple.com>
1068
1069         RenderView::flowThreadController() should return a reference.
1070         <https://webkit.org/b/120363>
1071
1072         Reviewed by Antti Koivisto.
1073
1074         This function does lazy construction and always returns an object.
1075
1076 2013-08-27  Andreas Kling  <akling@apple.com>
1077
1078         HTMLAppletElement: Use child iterator to walk <param> children.
1079         <https://webkit.org/b/120361>
1080
1081         Reviewed by Antti Koivisto.
1082
1083         Take Antti's fancy new child iterator for a quick spin.
1084
1085         * html/HTMLAppletElement.cpp:
1086         (WebCore::HTMLAppletElement::updateWidget):
1087
1088 2013-08-27  Andre Moreira Magalhaes   <andre.magalhaes@collabora.co.uk>
1089
1090         [gstreamer] Make sure gstreamer source element is thread-safe
1091         https://bugs.webkit.org/show_bug.cgi?id=115352
1092
1093         Reviewed by Philippe Normand.
1094
1095         GStreamer source element may be created by any gstreamer element on any thread by calling
1096         gst_element_make_from_uri with the URIs handled by the source element.
1097         This patch makes sure the gstreamer source element is thread-safe to avoid issues with it
1098         being created outside the main thread.
1099
1100         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
1101         (webkit_web_src_init):
1102         (webKitWebSrcDispose):
1103         (webKitWebSrcFinalize):
1104         (webKitWebSrcSetProperty):
1105         (webKitWebSrcGetProperty):
1106         (removeTimeoutSources):
1107         (webKitWebSrcStop):
1108         (webKitWebSrcStart):
1109         (webKitWebSrcChangeState):
1110         (webKitWebSrcQueryWithParent):
1111         (webKitWebSrcGetUri):
1112         (webKitWebSrcSetUri):
1113         (webKitWebSrcNeedDataMainCb):
1114         (webKitWebSrcNeedDataCb):
1115         (webKitWebSrcEnoughDataMainCb):
1116         (webKitWebSrcEnoughDataCb):
1117         (webKitWebSrcSeekMainCb):
1118         (webKitWebSrcSeekDataCb):
1119         (webKitWebSrcSetMediaPlayer):
1120         (StreamingClient::StreamingClient):
1121         (StreamingClient::~StreamingClient):
1122         (StreamingClient::createReadBuffer):
1123         (StreamingClient::handleResponseReceived):
1124         (StreamingClient::handleDataReceived):
1125         (StreamingClient::handleNotifyFinished):
1126         (CachedResourceStreamingClient::CachedResourceStreamingClient):
1127         (CachedResourceStreamingClient::~CachedResourceStreamingClient):
1128         (CachedResourceStreamingClient::loadFailed):
1129         (CachedResourceStreamingClient::setDefersLoading):
1130         (CachedResourceStreamingClient::getOrCreateReadBuffer):
1131         (CachedResourceStreamingClient::responseReceived):
1132         (CachedResourceStreamingClient::dataReceived):
1133         (CachedResourceStreamingClient::notifyFinished):
1134         (ResourceHandleStreamingClient::ResourceHandleStreamingClient):
1135         (ResourceHandleStreamingClient::~ResourceHandleStreamingClient):
1136         (ResourceHandleStreamingClient::loadFailed):
1137         (ResourceHandleStreamingClient::setDefersLoading):
1138         (ResourceHandleStreamingClient::getOrCreateReadBuffer):
1139         (ResourceHandleStreamingClient::willSendRequest):
1140         (ResourceHandleStreamingClient::didReceiveResponse):
1141         (ResourceHandleStreamingClient::didReceiveData):
1142         (ResourceHandleStreamingClient::didFinishLoading):
1143         (ResourceHandleStreamingClient::didFail):
1144         (ResourceHandleStreamingClient::wasBlocked):
1145         (ResourceHandleStreamingClient::cannotShowURL):
1146         Make element thread-safe, add support to use the element without a player associated (e.g.
1147         the DASH plugin using the webkitsrc to download fragments), use GMutexLocker to simplify
1148         locks and other general improvements.
1149
1150 2013-08-27  Antti Koivisto  <antti@apple.com>
1151
1152         Remove branch from DescendantIteratorAdapter::begin() when invoking for ContainerNode
1153         https://bugs.webkit.org/show_bug.cgi?id=120358
1154
1155         Reviewed by Andreas Kling.
1156
1157         * dom/ContainerNode.h:
1158         
1159             Delete isContainerNode() so it can't be called if there is static knowledge that the object is a ContainerNode.
1160
1161         * dom/DescendantIterator.h:
1162         (WebCore::::DescendantIterator):
1163
1164             Make DescendantIterator use Node* as root instead of ContainerNode*. It is only used for equality comparison.
1165
1166         (WebCore::::begin):
1167         
1168             Remove branch. Rely on ElementTraversal specialization for ContainerNodes.
1169
1170 2013-08-27  Joseph Pecoraro  <pecoraro@apple.com>
1171
1172         Web Inspector: Column Breakpoint not working, may be off by 1
1173         https://bugs.webkit.org/show_bug.cgi?id=120334
1174
1175         Reviewed by David Kilzer.
1176
1177         JavaScriptCore changed to 1-based column numbers at some point. We
1178         need to update the ScriptDebugger assumption that they were 0-based.
1179
1180         Test: inspector-protocol/debugger/column-breakpoint.html
1181
1182         * bindings/js/ScriptDebugServer.cpp:
1183         (WebCore::ScriptDebugServer::createCallFrame):
1184         (WebCore::ScriptDebugServer::updateCallFrameAndPauseIfNeeded):
1185
1186 2013-08-27  Antti Koivisto  <antti@apple.com>
1187
1188         Switch some more code to element child/descendant iterators
1189         https://bugs.webkit.org/show_bug.cgi?id=120355
1190
1191         Reviewed by Andreas Kling.
1192
1193         Move from Traversal<ElementType>::next() and Traversal<ElementType>::nextSibling() to iterators.
1194
1195         * css/CSSFontFaceSource.cpp:
1196         (WebCore::CSSFontFaceSource::getFontData):
1197         * dom/Document.cpp:
1198         (WebCore::Document::removeTitle):
1199         (WebCore::Document::updateBaseURL):
1200         (WebCore::Document::processBaseElement):
1201         * dom/TreeScope.cpp:
1202         (WebCore::TreeScope::labelElementForId):
1203         (WebCore::TreeScope::findAnchor):
1204         * html/HTMLFieldSetElement.cpp:
1205         (WebCore::HTMLFieldSetElement::invalidateDisabledStateUnder):
1206         (WebCore::HTMLFieldSetElement::childrenChanged):
1207         * html/HTMLLabelElement.cpp:
1208         (WebCore::HTMLLabelElement::control):
1209         * html/HTMLMediaElement.cpp:
1210         (WebCore::HTMLMediaElement::cancelPendingEventsAndCallbacks):
1211         * html/HTMLObjectElement.cpp:
1212         (WebCore::HTMLObjectElement::parametersForPlugin):
1213         * rendering/FilterEffectRenderer.cpp:
1214         (WebCore::FilterEffectRenderer::buildReferenceFilter):
1215         * svg/SVGFilterPrimitiveStandardAttributes.h:
1216         (WebCore::isSVGFilterPrimitiveStandardAttributes):
1217         (WebCore::SVGFilterPrimitiveStandardAttributes):
1218         * svg/animation/SMILTimeContainer.cpp:
1219         (WebCore::SMILTimeContainer::updateDocumentOrderIndexes):
1220         * svg/graphics/SVGImage.cpp:
1221         (WebCore::SVGImage::hasSingleSecurityOrigin):
1222
1223 2013-08-26  Andreas Kling  <akling@apple.com>
1224
1225         FocusController::focusedOrMainFrame() should return a reference.
1226         <https://webkit.org/b/120339>
1227
1228         Reviewed by Antti Koivisto.
1229
1230         Now that Page::mainFrame() returns a reference, we can make this return a reference
1231         too, since there's always either a focused or a main frame.
1232
1233         One hectogram of null checks removed as a result.
1234
1235 2013-08-26  Andreas Kling  <akling@apple.com>
1236
1237         Document's renderer is always a RenderView.
1238         <https://webkit.org/b/120304>
1239
1240         Reviewed by Darin Adler.
1241
1242         Let's enforce this better by storing a RenderView* instead of a plain RenderObject*.
1243         We should switch callers that grab at Document::renderer() to calling renderView()
1244         instead, but that's better done separately.
1245
1246         * dom/Document.cpp:
1247         (WebCore::Document::Document):
1248         (WebCore::Document::~Document):
1249         (WebCore::Document::setRenderView):
1250         (WebCore::Document::createRenderTree):
1251         (WebCore::Document::detach):
1252         (WebCore::Document::setInPageCache):
1253         * dom/Document.h:
1254         (WebCore::Document::renderView):
1255         (WebCore::Document::renderer):
1256         * html/parser/HTMLResourcePreloader.cpp:
1257         * rendering/RenderObject.cpp:
1258         (WebCore::RenderObject::setStyle):
1259         * rendering/RenderView.h:
1260         * svg/SVGSVGElement.cpp:
1261         (WebCore::SVGSVGElement::updateCurrentTranslate):
1262
1263 2013-08-27  Allan Sandfeld Jensen  <allan.jensen@digia.com>
1264
1265         Font's fast code path doesn't handle partial runs correctly when kerning or ligatures are enabled
1266         https://bugs.webkit.org/show_bug.cgi?id=100050
1267
1268         Reviewed by Darin Adler.
1269
1270         Renamed m_characterIndex to m_characterIndexOfGlyph and gave it an inline size of 10,
1271         which covers around 66% of all cases. The rest of the cases are now preallocated to the
1272         upper limit which is length of the original TextRun.
1273
1274         * platform/graphics/FontFastPath.cpp:
1275         (WebCore::Font::getGlyphsAndAdvancesForSimpleText):
1276         (WebCore::Font::selectionRectForSimpleText):
1277         (WebCore::Font::offsetForPositionForSimpleText):
1278         * platform/graphics/WidthIterator.cpp:
1279         (WebCore::WidthIterator::WidthIterator):
1280         (WebCore::WidthIterator::advanceInternal):
1281         * platform/graphics/WidthIterator.h:
1282
1283 2013-08-27  Christophe Dumez  <ch.dumez@sisa.samsung.com>
1284
1285         Implement DOM3 wheel event
1286         https://bugs.webkit.org/show_bug.cgi?id=94081
1287
1288         Reviewed by Darin Adler.
1289
1290         Add support for DOM Level 3 WheelEvent:
1291         http://www.w3.org/TR/DOM-Level-3-Events/#events-WheelEvent
1292
1293         Firefox, IE10 and since recently Blink already support it so
1294         it increases our cross-browser compatibility.
1295
1296         The non-standard 'mousewheel' event is still supported for backward
1297         compatibility. Note that the deltas returned by the mousewheel and
1298         the wheel events are not identical:
1299         - They have opposite signs.
1300         - The wheel event reports the actual amount of pixels that should be
1301         scrolled while the legacy mousewheel event reports a factor of the
1302         number of mouse wheel ticks (using a constant multiplier).
1303
1304         Tests: fast/events/wheelevent-basic.html
1305                fast/events/wheelevent-constructor.html
1306                fast/events/wheelevent-mousewheel-interaction.html
1307
1308         * dom/Document.h:
1309         * dom/Document.idl:
1310         * dom/Element.h:
1311         * dom/Element.idl:
1312         * dom/EventNames.h:
1313         * dom/EventTarget.cpp:
1314         (WebCore::legacyType):
1315         (WebCore::EventTarget::shouldObserveLegacyType):
1316         (WebCore::EventTarget::setupLegacyTypeObserverIfNeeded):
1317         (WebCore::EventTarget::fireEventListeners):
1318         * dom/EventTarget.h:
1319         * dom/Node.cpp:
1320         (WebCore::Node::didMoveToNewDocument):
1321         (WebCore::tryAddEventListener):
1322         (WebCore::tryRemoveEventListener):
1323         (WebCore::Node::defaultEventHandler):
1324         * dom/WheelEvent.cpp:
1325         (WebCore::WheelEventInit::WheelEventInit):
1326         (WebCore::WheelEvent::WheelEvent):
1327         (WebCore::WheelEvent::initWheelEvent):
1328         * dom/WheelEvent.h:
1329         (WebCore::WheelEvent::deltaX):
1330         (WebCore::WheelEvent::deltaY):
1331         (WebCore::WheelEvent::deltaZ):
1332         (WebCore::WheelEvent::wheelDelta):
1333         (WebCore::WheelEvent::wheelDeltaX):
1334         (WebCore::WheelEvent::wheelDeltaY):
1335         * dom/WheelEvent.idl:
1336         * html/HTMLAttributeNames.in:
1337         * html/HTMLElement.cpp:
1338         (WebCore::HTMLElement::eventNameForAttributeName):
1339         * page/DOMWindow.cpp:
1340         (WebCore::DOMWindow::addEventListener):
1341         (WebCore::DOMWindow::removeEventListener):
1342         * page/DOMWindow.h:
1343         * page/DOMWindow.idl:
1344         * page/EventHandler.cpp:
1345         (WebCore::EventHandler::defaultWheelEventHandler):
1346         * plugins/blackberry/PluginViewBlackBerry.cpp:
1347         (WebCore::PluginView::handleWheelEvent):
1348         * svg/SVGElementInstance.cpp:
1349         * svg/SVGElementInstance.h:
1350         * svg/SVGElementInstance.idl:
1351
1352 2013-08-27  Allan Sandfeld Jensen  <allan.jensen@digia.com>
1353
1354         Assertion while scrolling news.google.com
1355         https://bugs.webkit.org/show_bug.cgi?id=115303
1356
1357         Reviewed by Anders Carlsson.
1358
1359         Do not relayout when accessing script elements during painting.
1360
1361         * html/HTMLEmbedElement.cpp:
1362         (WebCore::HTMLEmbedElement::renderWidgetForJSBindings):
1363
1364 2013-08-27  Benjamin Poulain  <benjamin@webkit.org>
1365
1366         Remove DOMSettableTokenList's overload of add() and remove()
1367         https://bugs.webkit.org/show_bug.cgi?id=120341
1368
1369         Reviewed by Ryosuke Niwa.
1370
1371         Little refactoring to make other cleanups easier. Instead of modifying
1372         SpaceSplitString directly, rely on DOMTokenList ultimately changing
1373         the value, which in turn updates the tokens.
1374
1375         * html/DOMSettableTokenList.cpp:
1376         * html/DOMSettableTokenList.h:
1377         * html/DOMTokenList.h:
1378
1379 2013-08-27  Xabier Rodriguez Calvar  <calvaris@igalia.com>
1380
1381         [GTK] Volume slider shows incorrect track when muted
1382         https://bugs.webkit.org/show_bug.cgi?id=120253
1383
1384         Reviewed by Philippe Normand.
1385
1386         When painting the volume bar, consider that it could be muted even
1387         then volume is different than zero.
1388
1389         * platform/gtk/RenderThemeGtk.cpp:
1390         (WebCore::RenderThemeGtk::paintMediaVolumeSliderTrack): Asign
1391         painted volume as 0 when media is muted.
1392
1393 2013-08-26  Sam Weinig  <sam@webkit.org>
1394
1395         EditorInternalCommand should use Frame& where possible
1396         https://bugs.webkit.org/show_bug.cgi?id=120340
1397
1398         Reviewed by Andreas Kling.
1399
1400         Only isSupportedFromDOM still takes a Frame*, as it still has callers that expect null to work.
1401
1402         * dom/UserTypingGestureIndicator.cpp:
1403         * dom/UserTypingGestureIndicator.h:
1404         * editing/Editor.cpp:
1405         * editing/EditorCommand.cpp:
1406         * page/EventHandler.cpp:
1407
1408 2013-08-26  Ryosuke Niwa  <rniwa@webkit.org>
1409
1410         Elements in a node list of the form element's name getter should not be added to the past names map
1411         https://bugs.webkit.org/show_bug.cgi?id=120279
1412
1413         Reviewed by Darin Adler.
1414
1415         Don't add the element in the named items to the past names map when there are multiple elements.
1416         This matches IE10's behavior and the specified behavior in HTML5:
1417         http://www.w3.org/TR/2013/WD-html51-20130528/forms.html#dom-form-nameditem
1418
1419         Test: fast/forms/past-names-map-should-not-contain-nodelist-item.html
1420
1421         * html/HTMLFormElement.cpp:
1422         (WebCore::HTMLFormElement::getNamedElements):
1423
1424 2013-08-26  Ryosuke Niwa  <rniwa@webkit.org>
1425
1426         Windows build fix after r154658.
1427
1428         * page/AutoscrollController.cpp:
1429         (WebCore::getMainFrame):
1430
1431 2013-08-26  Andreas Kling  <akling@apple.com>
1432
1433         Page::mainFrame() should return a reference.
1434         <http://webkit.org/b/119677>
1435
1436         Reviewed by Antti Koivisto.
1437
1438         Page always creates the main Frame by itself now, so it will never be null during the Page's lifetime.
1439
1440         Let Page::mainFrame() return Frame& and remove a sea of null checks.
1441
1442 2013-08-26  Sam Weinig  <sam@webkit.org>
1443
1444         Remove two unnecessary .get()s.
1445
1446         Reviewed by Anders Carlsson.
1447
1448         * editing/Editor.h:
1449         (WebCore::Editor::killRing):
1450         (WebCore::Editor::spellChecker):
1451
1452 2013-08-26  Joseph Pecoraro  <pecoraro@apple.com>
1453
1454         Web Inspector: We should regenerate InspectorBackendCommands.js for Legacy Inspector.json versions
1455         https://bugs.webkit.org/show_bug.cgi?id=120242
1456
1457         Reviewed by Timothy Hatcher.
1458
1459         - Update the Inspector.json CodeGenerator to include an output_js_dir.
1460         - Cleanup multiple trailing newlines in some of the generated files.
1461         - Provide a way to not verify runtime casts, needed for Legacy inputs.
1462
1463         * CMakeLists.txt:
1464         * DerivedSources.make:
1465         * DerivedSources.pri:
1466         * GNUmakefile.am:
1467         * inspector/CodeGeneratorInspector.py:
1468         (resolve_all_types):
1469         (SmartOutput.close):
1470
1471 2013-08-26  Sam Weinig  <sam@webkit.org>
1472
1473         AlternativeTextController should hold onto Frame as a reference
1474         https://bugs.webkit.org/show_bug.cgi?id=120327
1475
1476         Reviewed by Andreas Kling.
1477
1478         While in the area I also:
1479           - Reference-ified Editor::killRing().
1480           - Const-ified Editor::m_killRing, Editor::m_spellChecker, and Editor::m_alternativeTextController.
1481
1482         * editing/AlternativeTextController.cpp:
1483         (WebCore::AlternativeTextController::AlternativeTextController):
1484         (WebCore::AlternativeTextController::stopPendingCorrection):
1485         (WebCore::AlternativeTextController::isSpellingMarkerAllowed):
1486         (WebCore::AlternativeTextController::applyAlternativeTextToRange):
1487         (WebCore::AlternativeTextController::applyAutocorrectionBeforeTypingIfAppropriate):
1488         (WebCore::AlternativeTextController::respondToUnappliedSpellCorrection):
1489         (WebCore::AlternativeTextController::timerFired):
1490         (WebCore::AlternativeTextController::handleAlternativeTextUIResult):
1491         (WebCore::AlternativeTextController::rootViewRectForRange):
1492         (WebCore::AlternativeTextController::respondToChangedSelection):
1493         (WebCore::AlternativeTextController::respondToAppliedEditing):
1494         (WebCore::AlternativeTextController::respondToUnappliedEditing):
1495         (WebCore::AlternativeTextController::alternativeTextClient):
1496         (WebCore::AlternativeTextController::editorClient):
1497         (WebCore::AlternativeTextController::markPrecedingWhitespaceForDeletedAutocorrectionAfterCommand):
1498         (WebCore::AlternativeTextController::processMarkersOnTextToBeReplacedByResult):
1499         (WebCore::AlternativeTextController::respondToMarkerAtEndOfWord):
1500         (WebCore::AlternativeTextController::insertDictatedText):
1501         (WebCore::AlternativeTextController::applyDictationAlternative):
1502         * editing/AlternativeTextController.h:
1503         (WebCore::AlternativeTextController::UNLESS_ENABLED):
1504         * editing/Editor.cpp:
1505         (WebCore::Editor::Editor):
1506         (WebCore::Editor::addToKillRing):
1507         * editing/Editor.h:
1508         (WebCore::Editor::killRing):
1509         * editing/EditorCommand.cpp:
1510         (WebCore::executeYank):
1511         (WebCore::executeYankAndSelect):
1512
1513 2013-08-23  Andy Estes  <aestes@apple.com>
1514
1515         Fix issues found by the Clang Static Analyzer
1516         https://bugs.webkit.org/show_bug.cgi?id=120230
1517
1518         Reviewed by Darin Adler.
1519
1520         * WebCore.xcodeproj/project.pbxproj: Removed FoundationExtras.h.
1521         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: Removed CFAutoreleaseHelper().
1522         (AXTextMarkerRange): Used HardAutorelease() instead of
1523         CFAutoreleaseHelper().
1524         (AXTextMarkerRangeStart): Ditto.
1525         (AXTextMarkerRangeEnd): Ditto.
1526         (textMarkerForVisiblePosition): Ditto.
1527         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1528         (-[WebCoreAVFMovieObserver initWithCallback:]): Called [super init]
1529         first so that we don't later use ivars from the wrong self.
1530         (-[WebCoreAVFLoaderDelegate initWithCallback:]): Ditto.
1531         * platform/mac/FoundationExtras.h: Removed.
1532         * platform/mac/KURLMac.mm:
1533         (WebCore::KURL::operator NSURL *): Used WTF's HardAutorelease().
1534         * platform/mac/WebCoreNSURLExtras.mm:
1535         (WebCore::mapHostNameWithRange): Used HardAutorelease() instead of
1536         WebCoreCFAutorelease().
1537         (WebCore::URLWithData): Ditto.
1538         (WebCore::userVisibleString): Ditto.
1539         (WebCore::URLByRemovingComponentAndSubsequentCharacter): Used Vector<>
1540         with an inline capacity rather than heap-allocating a buffer.
1541         * platform/mac/WebCoreObjCExtras.h: Used HardAutorelease() instead of
1542         WebCoreCFAutorelease().
1543         * platform/text/mac/StringImplMac.mm:
1544         (WTF::StringImpl::operator NSString *): Used WTF's HardAutorelease().
1545
1546 2013-08-26  Pratik Solanki  <psolanki@apple.com>
1547
1548         Page::console() should return a reference
1549         https://bugs.webkit.org/show_bug.cgi?id=120320
1550
1551         Reviewed by Darin Adler.
1552
1553         Page::m_console is never NULL so console() can just return a reference.
1554
1555         * css/CSSParser.cpp:
1556         (WebCore::CSSParser::logError):
1557         * dom/Document.cpp:
1558         (WebCore::Document::addConsoleMessage):
1559         (WebCore::Document::addMessage):
1560         * page/DOMWindow.cpp:
1561         (WebCore::DOMWindow::pageConsole):
1562         * page/Page.h:
1563         (WebCore::Page::console):
1564         * xml/XSLStyleSheetLibxslt.cpp:
1565         (WebCore::XSLStyleSheet::parseString):
1566         * xml/XSLTProcessorLibxslt.cpp:
1567         (WebCore::docLoaderFunc):
1568
1569 2013-08-26  Rob Buis  <rwlbuis@webkit.org>
1570
1571         Lonely stop crashes
1572         https://bugs.webkit.org/show_bug.cgi?id=87964
1573
1574         Reviewed by Darin Adler.
1575
1576         Provide a nodeAtFloatPoint implementation for RenderSVGGradientStop to avoid hitting the assert in RenderObject::nodeAtFloatPoint.
1577
1578         Test: svg/custom/stop-crash-hittest.svg
1579
1580         * rendering/svg/RenderSVGGradientStop.h:
1581
1582 2013-08-26  Sam Weinig  <sam@webkit.org>
1583
1584         Editor::spellChecker() should return a reference
1585         https://bugs.webkit.org/show_bug.cgi?id=120325
1586
1587         Reviewed by Anders Carlsson.
1588
1589         * editing/Editor.cpp:
1590         (WebCore::Editor::Editor):
1591         * editing/Editor.h:
1592         (WebCore::Editor::spellChecker):
1593         * editing/SpellChecker.cpp:
1594         (WebCore::SpellChecker::SpellChecker):
1595         (WebCore::SpellChecker::client):
1596         (WebCore::SpellChecker::isAsynchronousEnabled):
1597         (WebCore::SpellChecker::didCheck):
1598         (WebCore::SpellChecker::didCheckSucceed):
1599         * editing/SpellChecker.h:
1600         * page/EditorClient.h:
1601         * testing/Internals.cpp:
1602         (WebCore::Internals::lastSpellCheckRequestSequence):
1603         (WebCore::Internals::lastSpellCheckProcessedSequence):
1604
1605 2013-08-26  Bem Jones-Bey  <bjonesbe@adobe.com>
1606
1607         Optimize FloatIntervalSearchAdapter::collectIfNeeded
1608         https://bugs.webkit.org/show_bug.cgi?id=120237
1609
1610         Reviewed by David Hyatt.
1611
1612         This is a port of 3 Blink patches:
1613         https://codereview.chromium.org/22463002 (By shatch@chromium.org)
1614         https://chromiumcodereview.appspot.com/22909005 (By me)
1615         https://chromiumcodereview.appspot.com/23084002 (By me)
1616
1617         shatch optimized FloatIntervalSearchAdapter by having it store the
1618         outermost float instead of making a bunch of calls to
1619         logical(Left/Right/Bottom)ForFloat, and then only making that call
1620         once when heightRemaining needs to be computed.
1621
1622         I noticed that now we were storing both the last float encountered and
1623         the outermost float, and that the behavior for shape-outside wasn't
1624         significantly changed by using the outermost float instead of the last
1625         float encountered (and in most cases, using the outermost float gives
1626         more reasonable behavior). Since this isn't covered in the spec yet, I
1627         changed shape-outside to use the outermost float, making it so that we
1628         only need to store one float pointer when walking the placed floats
1629         tree, and keeping the performance win.
1630
1631         Also while changing updateOffsetIfNeeded, removed const, since that is
1632         a lie. Nothing about that method is const.
1633
1634         Test: fast/shapes/shape-outside-floats/shape-outside-floats-outermost.html
1635
1636         * rendering/RenderBlock.cpp:
1637         (WebCore::::updateOffsetIfNeeded):
1638         (WebCore::::collectIfNeeded):
1639         (WebCore::::getHeightRemaining):
1640         (WebCore::RenderBlock::logicalLeftFloatOffsetForLine):
1641         (WebCore::RenderBlock::logicalRightFloatOffsetForLine):
1642         * rendering/RenderBlock.h:
1643         (WebCore::RenderBlock::FloatIntervalSearchAdapter::FloatIntervalSearchAdapter):
1644         (WebCore::RenderBlock::FloatIntervalSearchAdapter::outermostFloat):
1645
1646 2013-08-26  Alexey Proskuryakov  <ap@apple.com>
1647
1648         [Mac] can-read-in-dragstart-event.html and can-read-in-copy-and-cut-events.html fail
1649         https://bugs.webkit.org/show_bug.cgi?id=113094
1650
1651         Reviewed by Darin Adler.
1652
1653         Mac platform implementation has checks for pasteboard change count, but it
1654         didn't use to update the count when writing to pasteboad from JavaScript.
1655
1656         * platform/PasteboardStrategy.h: Changed changeCount function to return a long
1657         instead of an int, as the underlying Mac type is NSInteger. Changed all methods
1658         that modify the pasteboard to return a new change count.
1659
1660         * platform/PlatformPasteboard.h: Changed all methods that modify the pasteboard
1661         to return a new change count.
1662
1663         * platform/mac/PasteboardMac.mm:
1664         (WebCore::Pasteboard::clear): Update m_changeCount.
1665         (WebCore::Pasteboard::writeSelectionForTypes): Ditto.
1666         (WebCore::Pasteboard::writePlainText): Ditto.
1667         (WebCore::writeURLForTypes): Ditto.
1668         (WebCore::Pasteboard::writeURL): Ditto.
1669         (WebCore::writeFileWrapperAsRTFDAttachment): Ditto.
1670         (WebCore::Pasteboard::writeImage): Ditto.
1671         (WebCore::Pasteboard::writePasteboard): Ditto.
1672         (WebCore::addHTMLClipboardTypesForCocoaType): Ditto.
1673         (WebCore::Pasteboard::writeString): Ditto.
1674
1675         * platform/mac/PlatformPasteboardMac.mm:
1676         (WebCore::PlatformPasteboard::changeCount): Changed returned type to long to avoid
1677         data loss.
1678         (WebCore::PlatformPasteboard::copy): Return new change count.
1679         (WebCore::PlatformPasteboard::addTypes): Ditto.
1680         (WebCore::PlatformPasteboard::setTypes): Ditto.
1681         (WebCore::PlatformPasteboard::setBufferForType): Ditto.
1682         (WebCore::PlatformPasteboard::setPathnamesForType): Ditto.
1683         (WebCore::PlatformPasteboard::setStringForType): Ditto. Replaced -[NSURL writeToPasteboard:]
1684         with an equivalent implemnentation that tells use whether writing was successful.
1685         There is difference with invalid URL string handling - we used to silently ignore
1686         such requets, but set pasteboard content to empty URL now.
1687
1688 2013-08-24  Sam Weinig  <sam@webkit.org>
1689
1690         Add support for Promises
1691         https://bugs.webkit.org/show_bug.cgi?id=120260
1692
1693         Reviewed by Darin Adler.
1694
1695         Add an initial implementation of Promises - http://dom.spec.whatwg.org/#promises.
1696         - Despite Promises being defined in the DOM, the implementation is being put in JSC
1697           in preparation for the Promises eventually being defined in ECMAScript.
1698
1699         Tests: fast/js/Promise-already-fulfilled.html
1700                fast/js/Promise-already-rejected.html
1701                fast/js/Promise-already-resolved.html
1702                fast/js/Promise-catch-in-workers.html
1703                fast/js/Promise-catch.html
1704                fast/js/Promise-chain.html
1705                fast/js/Promise-exception.html
1706                fast/js/Promise-fulfill-in-workers.html
1707                fast/js/Promise-fulfill.html
1708                fast/js/Promise-init-in-workers.html
1709                fast/js/Promise-init.html
1710                fast/js/Promise-reject-in-workers.html
1711                fast/js/Promise-reject.html
1712                fast/js/Promise-resolve-chain.html
1713                fast/js/Promise-resolve-in-workers.html
1714                fast/js/Promise-resolve-with-then-exception.html
1715                fast/js/Promise-resolve-with-then-fulfill.html
1716                fast/js/Promise-resolve-with-then-reject.html
1717                fast/js/Promise-resolve.html
1718                fast/js/Promise-simple-fulfill-inside-callback.html
1719                fast/js/Promise-simple-fulfill.html
1720                fast/js/Promise-simple-in-workers.html
1721                fast/js/Promise-simple.html
1722                fast/js/Promise-static-fulfill.html
1723                fast/js/Promise-static-reject.html
1724                fast/js/Promise-static-resolve.html
1725                fast/js/Promise-then-in-workers.html
1726                fast/js/Promise-then-without-callbacks-in-workers.html
1727                fast/js/Promise-then-without-callbacks.html
1728                fast/js/Promise-then.html
1729                fast/js/Promise-types.html
1730                fast/js/Promise.html
1731
1732         * GNUmakefile.list.am:
1733         * Target.pri:
1734         * UseJSC.cmake:
1735         * WebCore.vcxproj/WebCore.vcxproj:
1736         * WebCore.vcxproj/WebCore.vcxproj.filters:
1737         * WebCore.xcodeproj/project.pbxproj:
1738         * bindings/js/JSBindingsAllInOne.cpp:
1739         Add new files.
1740
1741         * bindings/js/JSDOMGlobalObjectTask.cpp: Added.
1742         (WebCore::JSGlobalObjectCallback::create):
1743         (WebCore::JSGlobalObjectCallback::~JSGlobalObjectCallback):
1744         (WebCore::JSGlobalObjectCallback::call):
1745         (WebCore::JSGlobalObjectCallback::JSGlobalObjectCallback):
1746         (WebCore::JSGlobalObjectTask::JSGlobalObjectTask):
1747         (WebCore::JSGlobalObjectTask::~JSGlobalObjectTask):
1748         (WebCore::JSGlobalObjectTask::performTask):
1749         * bindings/js/JSDOMGlobalObjectTask.h: Added.
1750         (WebCore::JSGlobalObjectTask::create):
1751         Add a new task type to be used with the GlobalObjectMethodTable's new QueueTaskToEventLoop callback.
1752
1753         * bindings/js/JSDOMWindowBase.cpp:
1754         (WebCore::JSDOMWindowBase::queueTaskToEventLoop):
1755         * bindings/js/JSDOMWindowBase.h:
1756         Implement the GlobalObjectMethodTable callback, QueueTaskToEventLoop. 
1757
1758         * bindings/js/JSMainThreadExecState.h:
1759         All using JSMainThreadExecState as a simple RAII object.
1760
1761         * bindings/js/JSWorkerGlobalScopeBase.cpp:
1762         (WebCore::JSWorkerGlobalScopeBase::JSWorkerGlobalScopeBase):
1763         (WebCore::JSWorkerGlobalScopeBase::allowsAccessFrom):
1764         (WebCore::JSWorkerGlobalScopeBase::supportsProfiling):
1765         (WebCore::JSWorkerGlobalScopeBase::supportsRichSourceInfo):
1766         (WebCore::JSWorkerGlobalScopeBase::shouldInterruptScript):
1767         (WebCore::JSWorkerGlobalScopeBase::javaScriptExperimentsEnabled):
1768         (WebCore::JSWorkerGlobalScopeBase::queueTaskToEventLoop):
1769         * bindings/js/JSWorkerGlobalScopeBase.h:
1770         Add a GlobalObjectMethodTable and implement QueueTaskToEventLoop. Forward the other callbacks
1771         to JSGlobalObject so they retain their existing behavior.
1772
1773 2013-08-26  Rob Buis  <rwlbuis@webkit.org>
1774
1775         Computed style of fill/stroke properties incorrect on references
1776         https://bugs.webkit.org/show_bug.cgi?id=114761
1777
1778         Reviewed by Darin Adler.
1779
1780         The computed style of the fill and stroke properties did not include
1781         the url() function. Added the url() string to output.
1782
1783         Updated existing tests to cover the issue.
1784
1785         * css/CSSPrimitiveValue.cpp: Cleanup.
1786         (WebCore::CSSPrimitiveValue::customCssText):
1787         * svg/SVGPaint.cpp: Added "url("
1788         (WebCore::SVGPaint::customCssText):
1789
1790 2013-08-26  Zan Dobersek  <zdobersek@igalia.com>
1791
1792         Prettify generated build guards in HTMLElementFactory.cpp
1793         https://bugs.webkit.org/show_bug.cgi?id=120310
1794
1795         Reviewed by Darin Adler.
1796
1797         Build guards should wrap the constructor definitions without empty lines between
1798         the guards and the constructor code. Similarly, build guards for addTag calls
1799         shouldn't put an empty line after the build guard closure.
1800
1801         * dom/make_names.pl:
1802         (printConstructorInterior):
1803         (printConstructors):
1804         (printFunctionInits):
1805
1806 2013-08-26  Robert Hogan  <robert@webkit.org>
1807
1808         Avoid painting every non-edge collapsed border twice over
1809         https://bugs.webkit.org/show_bug.cgi?id=119759
1810
1811         Reviewed by David Hyatt.
1812
1813         Every collapsed border that isn't on the edge of a table gets painted at least twice, once by each 
1814         adjacent cell. The joins are painted four times. This is unnecessary and results in tables with semi-transparent
1815         borders getting rendered incorrectly - each border adjoing two cells is painted twice and ends up darker than it should be. 
1816
1817         Fixing the overpainting at joins is another day's work. This patch ensures each collapsed border inside a table is only
1818         painted once. It does this by only allowing cells at the top and left edge of the table to paint their top and left collapsed borders.
1819         All the others can only paint their right and bottom collapsed border. This works because the borders are painted from bottom right to top left.
1820
1821         Tests: fast/table/border-collapsing/collapsed-borders-adjoining-sections-vertical-rl.html
1822                fast/table/border-collapsing/collapsed-borders-adjoining-sections.html
1823
1824         * rendering/RenderTableCell.cpp:
1825         (WebCore::RenderTableCell::paintCollapsedBorders):
1826
1827 2013-08-26  Andreas Kling  <akling@apple.com>
1828
1829         Unreviewed build fix.
1830
1831         * page/Page.cpp:
1832         (WebCore::Page::setNeedsRecalcStyleInAllFrames):
1833
1834 2013-08-26  Brent Fulgham  <bfulgham@apple.com>
1835
1836         Unreviewed buid fix.
1837
1838         * page/Page.cpp: 
1839         (WebCore::Page::setNeedsRecalcStyleInAllFrames): Remove extra '{' character.
1840
1841 2013-08-26  Pratik Solanki  <psolanki@apple.com>
1842
1843         PageGroup::groupSettings() should return a reference
1844         https://bugs.webkit.org/show_bug.cgi?id=120319
1845
1846         Reviewed by Andreas Kling.
1847
1848         PageGroup::m_groupSettings is never NULL so we can just return a reference from groupSettings().
1849
1850         * Modules/indexeddb/IDBFactory.cpp:
1851         * page/PageGroup.h:
1852         (WebCore::PageGroup::groupSettings):
1853         * storage/StorageNamespaceImpl.cpp:
1854         (WebCore::StorageNamespaceImpl::localStorageNamespace):
1855         * workers/DefaultSharedWorkerRepository.cpp:
1856         (WebCore::SharedWorkerProxy::groupSettings):
1857         * workers/WorkerMessagingProxy.cpp:
1858         (WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
1859
1860 2013-08-26  Andreas Kling  <akling@apple.com>
1861
1862         WebCore: Let Page create the main Frame.
1863         <https://webkit.org/b/119964>
1864
1865         Reviewed by Anders Carlsson.
1866
1867         Previously, Frame::create() would call Page::setMainFrame() when constructing the
1868         main Frame for a Page. Up until that point, Page had a null mainFrame().
1869
1870         To guarantee that Page::mainFrame() is never null, we re-order things so that
1871         Page is responsible for creating its own main Frame. We do this at the earliest
1872         possible point; in the Page constructor initializer list.
1873
1874         Constructing a Frame requires a FrameLoaderClient*, so I've added such a field to
1875         the PageClients struct.
1876
1877         When creating a WebKit-layer frame, we now wrap the already-instantiated
1878         Page::mainFrame() instead of creating a new Frame.
1879
1880         * loader/EmptyClients.cpp:
1881         (WebCore::fillWithEmptyClients):
1882
1883             Add an EmptyFrameLoaderClient to the PageClients constructed here.
1884
1885         * inspector/InspectorOverlay.cpp:
1886         (WebCore::InspectorOverlay::overlayPage):
1887         * svg/graphics/SVGImage.cpp:
1888         (WebCore::SVGImage::dataChanged):
1889
1890             Updated to wrap Page::mainFrame() in a FrameView instead of creating their
1891             own Frame manually.
1892
1893         * page/Frame.cpp:
1894         (WebCore::Frame::create):
1895         * page/Page.h:
1896
1897             Remove Page::setMainFrame() and the only call site.
1898
1899         * page/Page.cpp:
1900         (WebCore::Page::Page):
1901
1902             Construct Page::m_mainFrame in the initializer list.
1903
1904         (WebCore::Page::PageClients::PageClients):
1905
1906             Add "FrameLoaderClient* loaderClientForMainFrame" to PageClients.
1907
1908         (WebCore::Page::setNeedsRecalcStyleInAllFrames):
1909
1910             Null-check the Frame::document() before calling through on it. This would
1911             otherwise crash when changing font-related Settings before calling init() on
1912             the Frame (like InspectorOverlay does.)
1913
1914 2013-08-26  Brent Fulgham  <bfulgham@apple.com>
1915
1916         [Windows] Unreviewed build fix.
1917
1918         * rendering/RenderMediaControls.cpp: Remove references to QuickTime controls
1919         that are no longer part of WKSI.
1920         (wkHitTestMediaUIPart): 
1921         (wkMeasureMediaUIPart):
1922         (wkDrawMediaUIPart):
1923         (wkDrawMediaSliderTrack):
1924
1925 2013-08-26  Gurpreet Kaur  <gur.trio@gmail.com>
1926
1927         <https://webkit.org/b/106133> document.body.scrollTop & document.documentElement.scrollTop differ cross-browser
1928
1929         Reviewed by Darin Adler.
1930
1931         Webkit always uses document.body.scrollTop whether quirks or
1932         standard mode. Similiar behaviour is for document.body.scrollLeft.
1933         As per the specification webkit should return document.body.scrollTop
1934         for quirks mode and document.documentElement.scrollTop for standard mode.
1935         Same for document.body.scrollLeft and document.documentElement.scrollLeft.
1936
1937         Tests: fast/dom/Element/scrollLeft-Quirks.html
1938                fast/dom/Element/scrollLeft.html
1939                fast/dom/Element/scrollTop-Quirks.html
1940                fast/dom/Element/scrollTop.html
1941
1942         * dom/Element.cpp:
1943         (WebCore::Element::scrollLeft):
1944         (WebCore::Element::scrollTop): 
1945         If the element does not have any associated CSS layout box or the element
1946         is the root element and the Document is in quirks mode return zero.
1947         Else If the element is the root element return the value of scrollY
1948         for scrollTop and scrollX for scrollLeft.
1949         * html/HTMLBodyElement.cpp:
1950         (WebCore::HTMLBodyElement::scrollLeft):
1951         (WebCore::HTMLBodyElement::scrollTop):
1952         If the element is the HTML body element, the Document is in quirks mode,
1953         return the value of scrollY for scrollTop and scrollX for scrollLeft.
1954
1955 2013-08-26  Antti Koivisto  <antti@apple.com>
1956
1957         REGRESSION (r154581): Some plugin tests failing in debug bots
1958         https://bugs.webkit.org/show_bug.cgi?id=120315
1959
1960         Reviewed by Darin Adler.
1961         
1962         We are hitting the new no-event-dispatch-while-iterating assertion.
1963
1964         Detaching deletes a plugin which modifies DOM while it dies.
1965
1966         * dom/Document.cpp:
1967         (WebCore::Document::createRenderTree):
1968         (WebCore::Document::detach):
1969         
1970             Don't iterate at all. Document never has more than one Element child anyway.
1971
1972 2013-08-26  David Kilzer  <ddkilzer@apple.com>
1973
1974         BUILD FIX (r154580): RenderObject::document() returns a reference
1975
1976         See: <https://webkit.org/b/120272>
1977
1978         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1979         (-[WebAccessibilityObjectWrapper _accessibilityParentForSubview:]):
1980         (AXAttributeStringSetHeadingLevel):
1981
1982 2013-08-26  Brent Fulgham  <bfulgham@apple.com>
1983
1984         [Windows] Build fix after r154578.  Return Vector<String>() instead
1985         of ListHashSet<String>().
1986
1987         * platform/win/PasteboardWin.cpp:
1988         (WebCore::Pasteboard::types):
1989
1990 2013-08-26  Brent Fulgham  <bfulgham@apple.com>
1991
1992         [Windows] Build fix after r154580.
1993
1994         * rendering/RenderThemeWin.cpp: Mirror changes made for other ports now that
1995         Frame is known to always be valid when in a render tree. This allows us to
1996         get rid of some unneeded null checks.
1997         (WebCore::RenderThemeWin::getThemeData):
1998         (WebCore::RenderThemeWin::paintMenuList):
1999
2000 2013-08-26  Brent Fulgham  <bfulgham@apple.com>
2001
2002         [Windows] Build fix after r154554.
2003
2004         * page/AutoscrollController.cpp: Correct various places where pointers are now
2005         references.
2006         (WebCore::AutoscrollController::stopAutoscrollTimer):
2007         (WebCore::AutoscrollController::startPanScrolling):
2008         (WebCore::AutoscrollController::autoscrollTimerFired):
2009
2010 2013-08-26  Andreas Kling  <akling@apple.com>
2011
2012         Move DocumentTiming inside ENABLE(WEB_TIMING) guards.
2013         <https://webkit.org/b/120281>
2014
2015         Reviewed by Anders Carlsson.
2016
2017         Looks like this struct is only used by other ENABLE(WEB_TIMING) code, so don't bother
2018         filling it in if we're not building like that.
2019
2020         * dom/Document.cpp:
2021         (WebCore::Document::setReadyState):
2022         (WebCore::Document::finishedParsing):
2023         * dom/Document.h:
2024         * dom/DocumentTiming.h:
2025
2026 2013-08-26  Carlos Garcia Campos  <cgarcia@igalia.com>
2027
2028         [GTK] Fix compile warning in WebKitDOMCustom
2029         https://bugs.webkit.org/show_bug.cgi?id=120286
2030
2031         Reviewed by Philippe Normand.
2032
2033         * bindings/gobject/WebKitDOMCustom.cpp:
2034         (webkit_dom_html_element_get_item_type): Add return 0.
2035
2036 2013-08-25  Ryosuke Niwa  <rniwa@webkit.org>
2037
2038         JSHTMLFormElement::canGetItemsForName needlessly allocates a Vector
2039         https://bugs.webkit.org/show_bug.cgi?id=120277
2040
2041         Reviewed by Sam Weinig.
2042
2043         Added HTMLFormElement::hasNamedElement and used it in JSHTMLFormElement::canGetItemsForName.
2044
2045         This required fixing a bug in HTMLFormElement::getNamedElements that the first call to getNamedElements
2046         after replacing an element A with another element B of the same name caused it to erroneously append A
2047         to namedItems via the aliases mapping. Because getNamedElements used to be always called in pairs, this
2048         wrong behavior was never visible to the Web. Fixed the bug by not adding the old element to namedItem
2049         when namedItem's size is 1.
2050
2051         Also renamed m_elementAliases to m_pastNamesMap along with related member functions.
2052
2053         No new tests are added since there should be no Web exposed behavioral change.
2054
2055         * bindings/js/JSHTMLFormElementCustom.cpp:
2056         (WebCore::JSHTMLFormElement::canGetItemsForName):
2057         * html/HTMLFormElement.cpp:
2058         (WebCore::HTMLFormElement::elementFromPastNamesMap):
2059         (WebCore::HTMLFormElement::addElementToPastNamesMap):
2060         (WebCore::HTMLFormElement::hasNamedElement):
2061         (WebCore::HTMLFormElement::getNamedElements):
2062         * html/HTMLFormElement.h:
2063
2064 2013-08-25  Andreas Kling  <akling@apple.com>
2065
2066         RenderLayerBacking::renderer() should return a reference.
2067         <https://webkit.org/b/120280>
2068
2069         Reviewed by Anders Carlsson.
2070
2071         It's just a forwarding call to RenderLayer::renderer() which already returns a reference.
2072
2073 2013-08-25  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
2074
2075         Add toSVGMissingGlyphElement(), and use it.
2076         https://bugs.webkit.org/show_bug.cgi?id=120197
2077
2078         Reviewed by Andreas Kling.
2079
2080         As a step to clean-up static_cast<SVGXXX>, toSVGMissingGlyphElement() is added to clean-up
2081         static_cast<SVGMissingGlyphElement*>.
2082
2083         * svg/SVGFontElement.cpp:
2084         (WebCore::SVGFontElement::firstMissingGlyphElement):
2085         (WebCore::SVGFontElement::ensureGlyphCache):
2086         * svg/SVGMissingGlyphElement.h:
2087         (WebCore::toSVGMissingGlyphElement):
2088
2089 2013-08-25  Andreas Kling  <akling@apple.com>
2090
2091         RenderLayer::renderer() should return a reference.
2092         <https://webkit.org/b/120276>
2093
2094         Reviewed by Anders Carlsson.
2095
2096         RenderLayer is always created with a renderer, so make renderer() (and m_renderer) references.
2097         Nuked an assortment of useless null checks.
2098
2099 2013-08-25  Antti Koivisto  <antti@apple.com>
2100
2101         Element child and descendant iterators
2102         https://bugs.webkit.org/show_bug.cgi?id=120248
2103
2104         Reviewed by Sam Weinig and Andreas Kling.
2105
2106         Add iterators for Element children and descendants.
2107         
2108         To iterate over element children:
2109         
2110         #include "ChildIterator.h"
2111         
2112         for (auto it = elementChildren(this).begin(), end = elementChildren(this).end(); it != end; ++it) {
2113             Element& element = *it;
2114             ...
2115
2116         for (auto it = childrenOfType<HTMLAreaElement>(this).begin(), end = childrenOfType<HTMLAreaElement>(this).end(); it != end; ++it) {
2117             HTMLAreaElement& area = *it;
2118             ...
2119
2120         To iteratate over element descendants in pre-order:
2121         
2122         #include "DescendantIterator.h"
2123         
2124         for (auto it = elementDescendants(this).begin(), end = elementDescendants(this).end(); it != end; ++it) {
2125             Element& element = *it;
2126             ...
2127
2128         for (auto it = descendantsOfType<HTMLAreaElement>(this).begin(), end = descendantsOfType<HTMLAreaElement>(this).end(); it != end; ++it) {
2129             HTMLAreaElement& area = *it;
2130             ...
2131             
2132         The iterators assert against DOM mutations and event dispatch while iterating in debug builds.
2133             
2134         They are compatible with C++11 range-based for loops. In the future we can use
2135         
2136         for (auto& element : elementChildren(this))
2137             ...
2138
2139         etc.
2140         
2141         The patch all uses the new iterators in a few places.
2142
2143         * WebCore.xcodeproj/project.pbxproj:
2144         * accessibility/AccessibilityNodeObject.cpp:
2145         (WebCore::AccessibilityNodeObject::canvasHasFallbackContent):
2146         (WebCore::siblingWithAriaRole):
2147         * accessibility/AccessibilityRenderObject.cpp:
2148         * accessibility/AccessibilityTable.cpp:
2149         (WebCore::AccessibilityTable::isDataTable):
2150         * dom/ChildIterator.h: Added.
2151         (WebCore::ChildIterator::operator*):
2152         (WebCore::ChildIterator::operator->):
2153         (WebCore::::ChildIterator):
2154         (WebCore::::operator):
2155         (WebCore::=):
2156         (WebCore::::ChildIteratorAdapter):
2157         (WebCore::::begin):
2158         (WebCore::::end):
2159         (WebCore::elementChildren):
2160         (WebCore::childrenOfType):
2161         * dom/DescendantIterator.h: Added.
2162         (WebCore::DescendantIterator::operator*):
2163         (WebCore::DescendantIterator::operator->):
2164         (WebCore::::DescendantIterator):
2165         (WebCore::::operator):
2166         (WebCore::=):
2167         (WebCore::::DescendantIteratorAdapter):
2168         (WebCore::::begin):
2169         (WebCore::::end):
2170         (WebCore::elementDescendants):
2171         (WebCore::descendantsOfType):
2172         * dom/Document.cpp:
2173         (WebCore::Document::buildAccessKeyMap):
2174         (WebCore::Document::childrenChanged):
2175         (WebCore::Document::attach):
2176         (WebCore::Document::detach):
2177         * editing/ApplyStyleCommand.cpp:
2178         (WebCore::ApplyStyleCommand::cleanupUnstyledAppleStyleSpans):
2179         * editing/markup.cpp:
2180         (WebCore::completeURLs):
2181         * html/HTMLMapElement.cpp:
2182         (WebCore::HTMLMapElement::mapMouseEvent):
2183         * html/HTMLMediaElement.cpp:
2184         (WebCore::HTMLMediaElement::selectMediaResource):
2185         (WebCore::HTMLMediaElement::textTrackModeChanged):
2186
2187 2013-08-25  Andreas Kling  <akling@apple.com>
2188
2189         RenderObject::document() should return a reference.
2190         <https://webkit.org/b/120272>
2191
2192         Reviewed by Antti Koivisto.
2193
2194         There's always a Document. We were allocated in someone's arena, after all.
2195         Various null checks and assertions neutralized.
2196
2197 2013-08-25  David Kilzer  <ddkilzer@apple.com>
2198
2199         BUILD FIX (r154578): Return Vector<String>() from Pasteboard::types() for iOS
2200
2201         * platform/ios/PasteboardIOS.mm:
2202         (WebCore::Pasteboard::types): Return Vector<String>() instead of
2203         ListHashSet<String>() after r154578.
2204
2205 2013-08-25  Darin Adler  <darin@apple.com>
2206
2207         Make JavaScript binding for Clipboard::types more normal
2208         https://bugs.webkit.org/show_bug.cgi?id=120271
2209
2210         Reviewed by Anders Carlsson.
2211
2212         * bindings/js/JSClipboardCustom.cpp:
2213         (WebCore::JSClipboard::types): Make a simple custom binding. Only needed because
2214         there is a special value, null, this can return.
2215
2216         * dom/Clipboard.cpp:
2217         (WebCore::Clipboard::types): Return Vector<String> instead of ListHashSet<String>.
2218         * dom/Clipboard.h: Ditto.
2219         * platform/Pasteboard.h: Ditto.
2220         * platform/blackberry/PasteboardBlackBerry.cpp:
2221         (WebCore::Pasteboard::types): Ditto.
2222         * platform/efl/PasteboardEfl.cpp:
2223         (WebCore::Pasteboard::types): Ditto.
2224         * platform/gtk/PasteboardGtk.cpp:
2225         (WebCore::Pasteboard::types): Ditto.
2226         * platform/ios/PasteboardIOS.mm:
2227         (WebCore::Pasteboard::types): Ditto.
2228         * platform/mac/PasteboardMac.mm:
2229         (WebCore::Pasteboard::types): Ditto.
2230         * platform/qt/PasteboardQt.cpp:
2231         (WebCore::Pasteboard::types): Ditto.
2232         * platform/win/PasteboardWin.cpp:
2233         (WebCore::Pasteboard::types): Ditto.
2234
2235 2013-08-25  David Kilzer  <ddkilzer@apple.com>
2236
2237         Unreviewed rollout of r154571. Broke internal iOS build.
2238
2239         Reopened: No need for clearTimers function in Frame
2240         https://bugs.webkit.org/show_bug.cgi?id=120265
2241
2242         * history/CachedFrame.cpp:
2243         (WebCore::CachedFrame::CachedFrame):
2244         (WebCore::CachedFrame::destroy):
2245         * page/Frame.cpp:
2246         (WebCore::Frame::clearTimers):
2247         * page/Frame.h:
2248
2249 2013-08-25  Darin Adler  <darin@apple.com>
2250
2251         No need for hasData in Clipboard
2252         https://bugs.webkit.org/show_bug.cgi?id=120269
2253
2254         Reviewed by Andreas Kling.
2255
2256         This simple forwarder does not belong in the Clipboard class.
2257         The drag code that uses it already works directly with Pasteboard.
2258
2259         * dom/Clipboard.cpp: Removed hasData.
2260         * dom/Clipboard.h: Ditto.
2261
2262         * page/DragController.cpp:
2263         (WebCore::DragController::startDrag): Call through the pasteboard.
2264
2265 2013-08-25  Darin Adler  <darin@apple.com>
2266
2267         No need for documentTypeString function in Frame
2268         https://bugs.webkit.org/show_bug.cgi?id=120262
2269
2270         Reviewed by Andreas Kling.
2271
2272         * WebCore.exp.in: Removed export of Frame::documentTypeString.
2273
2274         * editing/markup.cpp:
2275         (WebCore::documentTypeString): Added. Replaces the old Frame member function.
2276         Makes more sense to have this here since it is both called by and calls code
2277         in this file; somehow this function was left behind.
2278         (WebCore::createFullMarkup): Changed to call the new function.
2279         * editing/markup.h: Added documentTypeString function. Has to be exported
2280         because LegacyWebArchive uses it; might be worth fixing that later.
2281         * loader/archive/cf/LegacyWebArchive.cpp:
2282         (WebCore::LegacyWebArchive::create): Changed to call the new function.
2283         (WebCore::LegacyWebArchive::createFromSelection): Ditto.
2284
2285         * page/Frame.cpp: Removed Frame::documentTypeString.
2286         * page/Frame.h: Ditto.
2287
2288 2013-08-25  Darin Adler  <darin@apple.com>
2289
2290         Clipboard is in DOM directory, but ClipboardMac is in platform directory
2291         https://bugs.webkit.org/show_bug.cgi?id=120267
2292
2293         Reviewed by Andreas Kling.
2294
2295         This file is almost gone; has just one function in it. Move it for now, and later
2296         we can delete it entirely.
2297
2298         * WebCore.xcodeproj/project.pbxproj: Updated for new file location.
2299         * dom/ClipboardMac.mm: Moved from Source/WebCore/platform/mac/ClipboardMac.mm.
2300
2301 2013-08-25  Darin Adler  <darin@apple.com>
2302
2303         No need for notifyChromeClientWheelEventHandlerCountChanged in Frame
2304         https://bugs.webkit.org/show_bug.cgi?id=120264
2305
2306         Reviewed by Andreas Kling.
2307
2308         * dom/Document.cpp:
2309         (WebCore::Document::createRenderTree): Renamed attach to this.
2310         This made it practical to remove a comment that says the same thing and
2311         also helps make the purpose of the function considerably more clear,
2312         although the relationship to the attached and detach functions is now
2313         less clear; should fix that soon.
2314         (WebCore::pageWheelEventHandlerCountChanged): Added. Contains the code
2315         from Frame::notifyChromeClientWheelEventHandlerCountChanged, minus some
2316         assertions that were only needed because the function was passed a frame
2317         rather than a page.
2318         (WebCore::Document::didBecomeCurrentDocumentInFrame): Added. Contains
2319         most of the code from Frame::setDocument. Looking at before and after,
2320         we can see that most of the work is within the document class and matches
2321         up with other code already in this class. Added FIXMEs about many problems
2322         spotted in the code.
2323         (WebCore::Document::topDocument): Added FIXME and tweaked formatting.
2324         (WebCore::wheelEventHandlerCountChanged): Moved the call to the
2325         pageWheelEventHandlerCountChanged in here from the two call sites.
2326         Also added a FIXME.
2327         (WebCore::Document::didAddWheelEventHandler): Removed the call to
2328         notifyChromeClientWheelEventHandlerCountChanged, since that's now handled
2329         inside wheelEventHandlerCountChanged.
2330         (WebCore::Document::didRemoveWheelEventHandler): Ditto.
2331
2332         * dom/Document.h: Renamed attach to createRenderTree, made it private,
2333         and added a new didBecomeCurrentDocumentInFrame function.
2334
2335         * loader/PlaceholderDocument.cpp:
2336         (WebCore::PlaceholderDocument::createRenderTree): Renamed from attach.
2337         * loader/PlaceholderDocument.h: Did the rename and made the function a
2338         private override.
2339
2340         * page/Frame.cpp:
2341         (WebCore::Frame::setDocument): Moved most of this function out of here
2342         into the new Document::didBecomeCurrentDocumentInFrame function.
2343         Also deleted notifyChromeClientWheelEventHandlerCountChanged.
2344
2345         * page/Frame.h: Deleted notifyChromeClientWheelEventHandlerCountChanged.
2346
2347 2013-08-25  Darin Adler  <darin@apple.com>
2348
2349         No need for dispatchVisibilityStateChangeEvent function
2350         https://bugs.webkit.org/show_bug.cgi?id=120261
2351
2352         Reviewed by Andreas Kling.
2353
2354         * dom/Document.cpp: Removed dispatchVisibilityStateChangeEvent.
2355         * dom/Document.h: Ditto.
2356         * page/Frame.cpp: Ditto.
2357         * page/Frame.h: Ditto.
2358
2359         * page/Page.cpp:
2360         (WebCore::Page::setVisibilityState): Put all the logic for dispatching the
2361         visibility state change event. Nothing here requires any special information
2362         about the internals of Frame or Document.
2363
2364 2013-08-25  Darin Adler  <darin@apple.com>
2365
2366         No need for clearTimers function in Frame
2367         https://bugs.webkit.org/show_bug.cgi?id=120265
2368
2369         Reviewed by Andreas Kling.
2370
2371         * history/CachedFrame.cpp:
2372         (WebCore::clearTimers): Added. Moved here from Frame.
2373         (WebCore::CachedFrame::CachedFrame): Call above function.
2374         (WebCore::CachedFrame::destroy): Ditto.
2375
2376         * page/Frame.cpp: Removed the two clearTimers functions.
2377         * page/Frame.h: Ditto.
2378
2379 2013-08-24  Ryuan Choi  <ryuan.choi@samsung.com>
2380
2381         Unreviewed build fix after r154560
2382
2383         * page/FrameTree.cpp:
2384         (WebCore::FrameTree::scopedChild): 
2385         Use tree(). instead of tree()->.
2386
2387 2013-08-24  Benjamin Poulain  <benjamin@webkit.org>
2388
2389         <https://webkit.org/b/120102> Inline SelectorQuery's execution traits
2390
2391         Reviewed by Sam Weinig.
2392
2393         For some reason, clang does not always inline the trait. The operations are so simple
2394         that it shows up in profile.
2395         Force the inlining to match the original speed.
2396
2397         * dom/SelectorQuery.cpp:
2398         (WebCore::AllElementExtractorSelectorQueryTrait::appendOutputForElement):
2399         (WebCore::SingleElementExtractorSelectorQueryTrait::appendOutputForElement):
2400
2401 2013-08-24  Benjamin Poulain  <benjamin@webkit.org>
2402
2403         Remove a useless #include from StyledElement
2404         https://bugs.webkit.org/show_bug.cgi?id=120245
2405
2406         Reviewed by Andreas Kling.
2407
2408         * dom/StyledElement.cpp:
2409
2410 2013-08-24  Darin Adler  <darin@apple.com>
2411
2412         Move Frame::inScope into FrameTree
2413         https://bugs.webkit.org/show_bug.cgi?id=120257
2414
2415         Reviewed by Sam Weinig.
2416
2417         * page/Frame.cpp: Removed inScope.
2418         * page/Frame.h: Ditto.
2419
2420         * page/FrameTree.cpp:
2421         (WebCore::inScope): Moved it here.
2422         (WebCore::FrameTree::scopedChild): Changed to call new function.
2423         (WebCore::FrameTree::scopedChildCount): Ditto.
2424
2425 2013-08-24  David Kilzer  <ddkilzer@apple.com>
2426
2427         BUILD FIX: Include HTMLPlugInImageElement.h for ENABLE(PLUGIN_PROXY_FOR_VIDEO)
2428
2429         Fixes the following build failure for iOS:
2430
2431             In file included from Source/WebCore/accessibility/AccessibilityAllInOne.cpp:28:
2432             In file included from Source/WebCore/accessibility/AXObjectCache.cpp:42:
2433             In file included from Source/WebCore/accessibility/AccessibilityMediaControls.h:36:
2434             In file included from Source/WebCore/html/shadow/MediaControlElements.h:34:
2435             In file included from Source/WebCore/html/shadow/MediaControlElementTypes.h:37:
2436             Source/WebCore/html/HTMLMediaElement.h:324:23: error: unknown type name 'PluginCreationOption'
2437                 void updateWidget(PluginCreationOption);
2438                                   ^
2439
2440         * html/HTMLMediaElement.h:
2441
2442 2013-08-24  Darin Adler  <darin@apple.com>
2443
2444         Frame::tree should return a reference instead of a pointer
2445         https://bugs.webkit.org/show_bug.cgi?id=120259
2446
2447         Reviewed by Andreas Kling.
2448
2449         * page/Frame.h:
2450         (WebCore::Frame::tree): Return a reference instead of a pointer.
2451
2452         * bindings/js/JSDOMWindowCustom.cpp:
2453         (WebCore::childFrameGetter):
2454         (WebCore::indexGetter):
2455         (WebCore::JSDOMWindow::getOwnPropertySlot):
2456         (WebCore::JSDOMWindow::getOwnPropertySlotByIndex):
2457         (WebCore::JSDOMWindow::setLocation):
2458         * bindings/js/PageScriptDebugServer.cpp:
2459         (WebCore::PageScriptDebugServer::setJavaScriptPaused):
2460         * dom/Document.cpp:
2461         (WebCore::canAccessAncestor):
2462         (WebCore::Document::adoptNode):
2463         (WebCore::Document::canNavigate):
2464         (WebCore::Document::findUnsafeParentScrollPropagationBoundary):
2465         (WebCore::Document::notifySeamlessChildDocumentsOfStylesheetUpdate):
2466         (WebCore::Document::openSearchDescriptionURL):
2467         (WebCore::Document::setDesignMode):
2468         (WebCore::Document::parentDocument):
2469         (WebCore::Document::initSecurityContext):
2470         (WebCore::Document::initContentSecurityPolicy):
2471         (WebCore::Document::requestFullScreenForElement):
2472         (WebCore::Document::webkitExitFullscreen):
2473         (WebCore::Document::didRemoveTouchEventHandler):
2474         * dom/TreeScope.cpp:
2475         (WebCore::focusedFrameOwnerElement):
2476         * editing/FrameSelection.cpp:
2477         (WebCore::FrameSelection::selectFrameElementInParentIfFullySelected):
2478         * history/CachedFrame.cpp:
2479         (WebCore::CachedFrameBase::CachedFrameBase):
2480         (WebCore::CachedFrameBase::restore):
2481         (WebCore::CachedFrame::CachedFrame):
2482         * history/CachedPage.cpp:
2483         (WebCore::CachedPage::restore):
2484         * history/PageCache.cpp:
2485         (WebCore::logCanCacheFrameDecision):
2486         (WebCore::PageCache::canCachePageContainingThisFrame):
2487         * html/HTMLDocument.cpp:
2488         (WebCore::HTMLDocument::hasFocus):
2489         * html/HTMLPlugInImageElement.cpp:
2490         (WebCore::HTMLPlugInImageElement::restartSimilarPlugIns):
2491         * inspector/InspectorApplicationCacheAgent.cpp:
2492         (WebCore::InspectorApplicationCacheAgent::getFramesWithManifests):
2493         * inspector/InspectorCanvasAgent.cpp:
2494         (WebCore::InspectorCanvasAgent::findFramesWithUninstrumentedCanvases):
2495         (WebCore::InspectorCanvasAgent::frameNavigated):
2496         * inspector/InspectorDOMAgent.cpp:
2497         (WebCore::InspectorDOMAgent::documents):
2498         * inspector/InspectorFileSystemAgent.cpp:
2499         (WebCore::InspectorFileSystemAgent::assertScriptExecutionContextForOrigin):
2500         * inspector/InspectorPageAgent.cpp:
2501         (WebCore::InspectorPageAgent::getCookies):
2502         (WebCore::InspectorPageAgent::deleteCookie):
2503         (WebCore::InspectorPageAgent::searchInResources):
2504         (WebCore::InspectorPageAgent::findFrameWithSecurityOrigin):
2505         (WebCore::InspectorPageAgent::buildObjectForFrame):
2506         (WebCore::InspectorPageAgent::buildObjectForFrameTree):
2507         * inspector/PageRuntimeAgent.cpp:
2508         (WebCore::PageRuntimeAgent::reportExecutionContextCreation):
2509         * loader/DocumentLoader.cpp:
2510         (WebCore::DocumentLoader::willSendRequest):
2511         (WebCore::DocumentLoader::mainResource):
2512         * loader/DocumentWriter.cpp:
2513         (WebCore::DocumentWriter::createDecoderIfNeeded):
2514         * loader/FrameLoader.cpp:
2515         (WebCore::FrameLoader::submitForm):
2516         (WebCore::FrameLoader::allChildrenAreComplete):
2517         (WebCore::FrameLoader::allAncestorsAreComplete):
2518         (WebCore::FrameLoader::loadURLIntoChildFrame):
2519         (WebCore::FrameLoader::outgoingReferrer):
2520         (WebCore::FrameLoader::updateFirstPartyForCookies):
2521         (WebCore::FrameLoader::setFirstPartyForCookies):
2522         (WebCore::FrameLoader::completed):
2523         (WebCore::FrameLoader::started):
2524         (WebCore::FrameLoader::loadURL):
2525         (WebCore::FrameLoader::loadWithDocumentLoader):
2526         (WebCore::FrameLoader::stopAllLoaders):
2527         (WebCore::FrameLoader::commitProvisionalLoad):
2528         (WebCore::FrameLoader::closeOldDataSources):
2529         (WebCore::FrameLoader::prepareForCachedPageRestore):
2530         (WebCore::FrameLoader::subframeIsLoading):
2531         (WebCore::FrameLoader::subresourceCachePolicy):
2532         (WebCore::FrameLoader::detachChildren):
2533         (WebCore::FrameLoader::closeAndRemoveChild):
2534         (WebCore::FrameLoader::checkLoadComplete):
2535         (WebCore::FrameLoader::numPendingOrLoadingRequests):
2536         (WebCore::FrameLoader::detachFromParent):
2537         (WebCore::FrameLoader::shouldClose):
2538         (WebCore::FrameLoader::handleBeforeUnloadEvent):
2539         (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy):
2540         (WebCore::FrameLoader::shouldInterruptLoadForXFrameOptions):
2541         (WebCore::FrameLoader::findFrameForNavigation):
2542         (WebCore::FrameLoader::effectiveSandboxFlags):
2543         (WebCore::createWindow):
2544         * loader/HistoryController.cpp:
2545         (WebCore::HistoryController::saveDocumentState):
2546         (WebCore::HistoryController::saveDocumentAndScrollState):
2547         (WebCore::HistoryController::restoreDocumentState):
2548         (WebCore::HistoryController::goToItem):
2549         (WebCore::HistoryController::updateForRedirectWithLockedBackForwardList):
2550         (WebCore::HistoryController::recursiveUpdateForCommit):
2551         (WebCore::HistoryController::recursiveUpdateForSameDocumentNavigation):
2552         (WebCore::HistoryController::initializeItem):
2553         (WebCore::HistoryController::createItemTree):
2554         (WebCore::HistoryController::recursiveSetProvisionalItem):
2555         (WebCore::HistoryController::recursiveGoToItem):
2556         (WebCore::HistoryController::currentFramesMatchItem):
2557         * loader/NavigationScheduler.cpp:
2558         (WebCore::NavigationScheduler::mustLockBackForwardList):
2559         (WebCore::NavigationScheduler::scheduleFormSubmission):
2560         * loader/ProgressTracker.cpp:
2561         (WebCore::ProgressTracker::progressStarted):
2562         (WebCore::ProgressTracker::progressCompleted):
2563         (WebCore::ProgressTracker::isMainLoadProgressing):
2564         * loader/appcache/ApplicationCacheGroup.cpp:
2565         (WebCore::ApplicationCacheGroup::selectCache):
2566         (WebCore::ApplicationCacheGroup::selectCacheWithoutManifestURL):
2567         * loader/archive/cf/LegacyWebArchive.cpp:
2568         (WebCore::LegacyWebArchive::create):
2569         * loader/cache/CachedResourceLoader.cpp:
2570         (WebCore::CachedResourceLoader::checkInsecureContent):
2571         * loader/icon/IconController.cpp:
2572         (WebCore::IconController::urlsForTypes):
2573         (WebCore::IconController::startLoader):
2574         * page/Chrome.cpp:
2575         (WebCore::canRunModalIfDuringPageDismissal):
2576         (WebCore::Chrome::windowScreenDidChange):
2577         * page/DOMWindow.cpp:
2578         (WebCore::DOMWindow::length):
2579         (WebCore::DOMWindow::name):
2580         (WebCore::DOMWindow::setName):
2581         (WebCore::DOMWindow::parent):
2582         (WebCore::DOMWindow::top):
2583         (WebCore::DOMWindow::open):
2584         * page/EventHandler.cpp:
2585         (WebCore::EventHandler::scrollRecursively):
2586         (WebCore::EventHandler::logicalScrollRecursively):
2587         (WebCore::EventHandler::handleMouseMoveEvent):
2588         * page/FocusController.cpp:
2589         (WebCore::FocusController::setContainingWindowIsVisible):
2590         * page/Frame.cpp:
2591         (WebCore::parentPageZoomFactor):
2592         (WebCore::parentTextZoomFactor):
2593         (WebCore::Frame::setPrinting):
2594         (WebCore::Frame::shouldUsePrintingLayout):
2595         (WebCore::Frame::dispatchVisibilityStateChangeEvent):
2596         (WebCore::Frame::willDetachPage):
2597         (WebCore::Frame::setPageAndTextZoomFactors):
2598         (WebCore::Frame::deviceOrPageScaleFactorChanged):
2599         (WebCore::Frame::notifyChromeClientWheelEventHandlerCountChanged):
2600         (WebCore::Frame::isURLAllowed):
2601         * page/FrameTree.cpp:
2602         (WebCore::FrameTree::~FrameTree):
2603         (WebCore::FrameTree::setName):
2604         (WebCore::FrameTree::transferChild):
2605         (WebCore::FrameTree::appendChild):
2606         (WebCore::FrameTree::actuallyAppendChild):
2607         (WebCore::FrameTree::removeChild):
2608         (WebCore::FrameTree::uniqueChildName):
2609         (WebCore::FrameTree::scopedChild):
2610         (WebCore::FrameTree::scopedChildCount):
2611         (WebCore::FrameTree::childCount):
2612         (WebCore::FrameTree::child):
2613         (WebCore::FrameTree::find):
2614         (WebCore::FrameTree::isDescendantOf):
2615         (WebCore::FrameTree::traverseNext):
2616         (WebCore::FrameTree::traversePreviousWithWrap):
2617         (WebCore::FrameTree::deepLastChild):
2618         (WebCore::FrameTree::top):
2619         (printFrames):
2620         (showFrameTree):
2621         * page/FrameView.cpp:
2622         (WebCore::FrameView::setFrameRect):
2623         (WebCore::FrameView::hasCompositedContentIncludingDescendants):
2624         (WebCore::FrameView::hasCompositingAncestor):
2625         (WebCore::FrameView::flushCompositingStateIncludingSubframes):
2626         (WebCore::FrameView::updateCanBlitOnScrollRecursively):
2627         (WebCore::FrameView::setIsOverlapped):
2628         (WebCore::FrameView::shouldUseLoadTimeDeferredRepaintDelay):
2629         (WebCore::FrameView::updateLayerFlushThrottlingInAllFrames):
2630         (WebCore::FrameView::serviceScriptedAnimations):
2631         (WebCore::FrameView::updateBackgroundRecursively):
2632         (WebCore::FrameView::parentFrameView):
2633         (WebCore::FrameView::paintContentsForSnapshot):
2634         (WebCore::FrameView::setTracksRepaints):
2635         (WebCore::FrameView::notifyWidgetsInAllFrames):
2636         * page/Location.cpp:
2637         (WebCore::Location::ancestorOrigins):
2638         * page/Page.cpp:
2639         (WebCore::networkStateChanged):
2640         (WebCore::Page::~Page):
2641         (WebCore::Page::renderTreeSize):
2642         (WebCore::Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment):
2643         (WebCore::Page::setNeedsRecalcStyleInAllFrames):
2644         (WebCore::Page::refreshPlugins):
2645         (WebCore::Page::takeAnyMediaCanStartListener):
2646         (WebCore::incrementFrame):
2647         (WebCore::Page::setDefersLoading):
2648         (WebCore::Page::setMediaVolume):
2649         (WebCore::Page::setDeviceScaleFactor):
2650         (WebCore::Page::setShouldSuppressScrollbarAnimations):
2651         (WebCore::Page::didMoveOnscreen):
2652         (WebCore::Page::willMoveOffscreen):
2653         (WebCore::Page::setIsInWindow):
2654         (WebCore::Page::suspendScriptedAnimations):
2655         (WebCore::Page::resumeScriptedAnimations):
2656         (WebCore::Page::userStyleSheetLocationChanged):
2657         (WebCore::Page::allVisitedStateChanged):
2658         (WebCore::Page::visitedStateChanged):
2659         (WebCore::Page::setDebugger):
2660         (WebCore::Page::setMemoryCacheClientCallsEnabled):
2661         (WebCore::Page::setMinimumTimerInterval):
2662         (WebCore::Page::setTimerAlignmentInterval):
2663         (WebCore::Page::dnsPrefetchingStateChanged):
2664         (WebCore::Page::collectPluginViews):
2665         (WebCore::Page::storageBlockingStateChanged):
2666         (WebCore::Page::privateBrowsingStateChanged):
2667         (WebCore::Page::checkSubframeCountConsistency):
2668         (WebCore::Page::suspendActiveDOMObjectsAndAnimations):
2669         (WebCore::Page::resumeActiveDOMObjectsAndAnimations):
2670         (WebCore::Page::captionPreferencesChanged):
2671         * page/PageGroup.cpp:
2672         (WebCore::PageGroup::invalidateInjectedStyleSheetCacheInAllFrames):
2673         * page/PageGroupLoadDeferrer.cpp:
2674         (WebCore::PageGroupLoadDeferrer::PageGroupLoadDeferrer):
2675         (WebCore::PageGroupLoadDeferrer::~PageGroupLoadDeferrer):
2676         * page/PageSerializer.cpp:
2677         (WebCore::PageSerializer::serializeFrame):
2678         * page/PageThrottler.cpp:
2679         (WebCore::PageThrottler::throttlePage):
2680         (WebCore::PageThrottler::unthrottlePage):
2681         * page/Settings.cpp:
2682         (WebCore::setImageLoadingSettings):
2683         (WebCore::Settings::setTextAutosizingFontScaleFactor):
2684         * page/SpatialNavigation.cpp:
2685         (WebCore::rectToAbsoluteCoordinates):
2686         * page/animation/AnimationController.cpp:
2687         (WebCore::AnimationControllerPrivate::suspendAnimations):
2688         (WebCore::AnimationControllerPrivate::resumeAnimations):
2689         * page/mac/PageMac.cpp:
2690         (WebCore::Page::addSchedulePair):
2691         (WebCore::Page::removeSchedulePair):
2692         * page/scrolling/ScrollingCoordinator.cpp:
2693         (WebCore::ScrollingCoordinator::computeNonFastScrollableRegion):
2694         (WebCore::ScrollingCoordinator::computeCurrentWheelEventHandlerCount):
2695         * plugins/PluginView.cpp:
2696         (WebCore::PluginView::performRequest):
2697         (WebCore::PluginView::load):
2698         * rendering/HitTestResult.cpp:
2699         (WebCore::HitTestResult::targetFrame):
2700         * rendering/RenderLayerCompositor.cpp:
2701         (WebCore::RenderLayerCompositor::enclosingCompositorFlushingLayers):
2702         (WebCore::RenderLayerCompositor::updateCompositingLayers):
2703         (WebCore::RenderLayerCompositor::notifyIFramesOfCompositingChange):
2704         * rendering/TextAutosizer.cpp:
2705         (WebCore::TextAutosizer::processSubtree):
2706         * storage/StorageEventDispatcher.cpp:
2707         (WebCore::StorageEventDispatcher::dispatchSessionStorageEvents):
2708         (WebCore::StorageEventDispatcher::dispatchLocalStorageEvents):
2709         * svg/SVGSVGElement.cpp:
2710         (WebCore::SVGSVGElement::currentScale):
2711         (WebCore::SVGSVGElement::setCurrentScale):
2712         * testing/Internals.cpp:
2713         (WebCore::Internals::formControlStateOfPreviousHistoryItem):
2714         (WebCore::Internals::setFormControlStateOfPreviousHistoryItem):
2715         (WebCore::Internals::numberOfScrollableAreas):
2716         * xml/parser/XMLDocumentParserLibxml2.cpp:
2717         (WebCore::hasNoStyleInformation):
2718         Use tree(). instead of tree()->.
2719
2720 2013-08-24  Andreas Kling  <akling@apple.com>
2721
2722         Merge Document::viewportSize() logic into RenderView::viewportSize().
2723         <https://webkit.org/b/120254>
2724
2725         Reviewed by Darin Adler.
2726
2727         RenderView can just ask FrameView (the viewport) about its size directly, no need for
2728         a weirdly-placed method on Document.
2729
2730         * dom/Document.cpp:
2731         * rendering/RenderView.cpp:
2732         (WebCore::RenderView::viewportSize):
2733         * rendering/RenderView.h:
2734
2735 2013-08-24  Andreas Kling  <akling@apple.com>
2736
2737         RenderObject::frame() should return a reference.
2738         <https://webkit.org/b/120251>
2739
2740         Reviewed by Darin Adler.
2741
2742         There is now always a Frame, and we can get to it by walking this path:
2743
2744             RenderObject -> Document -> RenderView -> FrameView -> Frame
2745
2746         Removed the customary horde of null checks.
2747
2748 2013-08-24  Andreas Kling  <akling@apple.com>
2749
2750         RenderLayer::compositor() should return a reference.
2751         <https://webkit.org/b/120250>
2752
2753         Reviewed by Anders Carlsson.
2754
2755         It was already converting from a reference to a pointer.
2756
2757 2013-08-24  Yoav Weiss  <yoav@yoav.ws>
2758
2759         Eliminate a useless comparison in srcset's candidate selection algorithm
2760         https://bugs.webkit.org/show_bug.cgi?id=120235
2761
2762         There is no point in comparing the last item in the candidates vector to the DPR, since it will be returned anyway. Therefore, the
2763         iteration on the candidates vector now skips the last candidate.
2764
2765         Reviewed by Andreas Kling.
2766
2767         * html/parser/HTMLParserIdioms.cpp:
2768         (WebCore::bestFitSourceForImageAttributes):
2769
2770 2013-08-24  Andreas Kling  <akling@apple.com>
2771
2772         RenderObject::view() should return a reference.
2773         <https://webkit.org/b/120247>
2774
2775         Reviewed by Antti Koivisto.
2776
2777         Now that the lifetime and accessibility characteristics of RenderView are well-defined,
2778         we can make RenderObject::view() return a reference, exposing a plethora of unnecessary
2779         null checks.
2780
2781 2013-08-24  Joseph Pecoraro  <pecoraro@apple.com>
2782
2783         Web Inspector: Cleanup Inspector Agents a bit
2784         https://bugs.webkit.org/show_bug.cgi?id=120218
2785
2786         Reviewed by Andreas Kling.
2787
2788         Merge https://chromium.googlesource.com/chromium/blink/+/8693dcb8ba42a5c225f516c664fb0f453c8ba6f0.
2789
2790         * inspector/InspectorCSSAgent.cpp:
2791         (WebCore::InspectorCSSAgent::elementForId):
2792         * inspector/InspectorStyleSheet.cpp:
2793         (ParsedStyleSheet::ParsedStyleSheet):
2794         (WebCore::InspectorStyle::setPropertyText):
2795         (WebCore::InspectorStyle::populateAllProperties):
2796         (WebCore::InspectorStyleSheet::inlineStyleSheetText):
2797
2798 2013-08-24  Andreas Kling  <akling@apple.com>
2799
2800         Let Document keep its RenderView during render tree detach.
2801         <https://webkit.org/b/120233>
2802
2803         Reviewed by Antti Koivisto.
2804
2805         Instead of having "Document::renderer() == NULL" signify that the render tree is being
2806         torn down, give Document an explicit flag for this instead.
2807
2808         This way, we can keep Document's RenderView in place during tree detach.
2809
2810         * dom/Document.cpp:
2811         (WebCore::Document::Document):
2812         (WebCore::Document::detach):
2813         * dom/Document.h:
2814         (WebCore::Document::renderTreeBeingDestroyed):
2815         * rendering/RenderObject.h:
2816         (WebCore::RenderObject::documentBeingDestroyed):
2817
2818 2013-08-24  Antti Koivisto  <antti@apple.com>
2819
2820         Tighten before/after pseudo element accessors
2821         https://bugs.webkit.org/show_bug.cgi?id=120204
2822
2823         Reviewed by Andreas Kling.
2824
2825         We have generic looking Element::pseudoElement(PseudoID) which only returns before/after pseudo elements.
2826         
2827         Switch to Element::before/afterPseudoElement(), similarly for setters.
2828
2829         * WebCore.exp.in:
2830         * css/CSSComputedStyleDeclaration.cpp:
2831         (WebCore::ComputedStyleExtractor::styledNode):
2832         * dom/Element.cpp:
2833         (WebCore::Element::~Element):
2834         (WebCore::beforeOrAfterPseudeoElement):
2835         (WebCore::Element::computedStyle):
2836         (WebCore::Element::updatePseudoElement):
2837         (WebCore::Element::createPseudoElementIfNeeded):
2838         (WebCore::Element::updateBeforePseudoElement):
2839         (WebCore::Element::updateAfterPseudoElement):
2840         (WebCore::Element::beforePseudoElement):
2841         (WebCore::Element::afterPseudoElement):
2842         (WebCore::Element::setBeforePseudoElement):
2843         (WebCore::Element::setAfterPseudoElement):
2844         (WebCore::disconnectPseudoElement):
2845         (WebCore::Element::clearBeforePseudoElement):
2846         (WebCore::Element::clearAfterPseudoElement):
2847         (WebCore::Element::clearStyleDerivedDataBeforeDetachingRenderer):
2848         * dom/Element.h:
2849         * dom/ElementRareData.h:
2850         (WebCore::ElementRareData::beforePseudoElement):
2851         (WebCore::ElementRareData::afterPseudoElement):
2852         (WebCore::ElementRareData::hasPseudoElements):
2853         (WebCore::ElementRareData::~ElementRareData):
2854         (WebCore::ElementRareData::clearBeforePseudoElement):
2855         (WebCore::ElementRareData::clearAfterPseudoElement):
2856         (WebCore::ElementRareData::setBeforePseudoElement):
2857         (WebCore::ElementRareData::setAfterPseudoElement):
2858         
2859             Move detach logic to Element. ElementRareData should not implement semantics.
2860
2861         * dom/Node.cpp:
2862         (WebCore::Node::pseudoAwarePreviousSibling):
2863         (WebCore::Node::pseudoAwareNextSibling):
2864         (WebCore::Node::pseudoAwareFirstChild):
2865         (WebCore::Node::pseudoAwareLastChild):
2866         * dom/NodeRenderingTraversal.cpp:
2867         (WebCore::NodeRenderingTraversal::nextSiblingSlow):
2868         (WebCore::NodeRenderingTraversal::previousSiblingSlow):
2869         * rendering/RenderTreeAsText.cpp:
2870         (WebCore::writeCounterValuesFromChildren):
2871         (WebCore::counterValueForElement):
2872         * style/StyleResolveTree.cpp:
2873         (WebCore::Style::attachRenderTree):
2874         (WebCore::Style::resolveTree):
2875         * testing/Internals.cpp:
2876         (WebCore::Internals::pauseAnimationAtTimeOnPseudoElement):
2877         (WebCore::Internals::pauseTransitionAtTimeOnPseudoElement):
2878
2879 2013-08-23  Simon Fraser  <simon.fraser@apple.com>
2880
2881         Improve scrolling behavior in iTunes
2882         https://bugs.webkit.org/show_bug.cgi?id=120241
2883         <rdar://problem/14825344>
2884
2885         Reviewed by Sam Weinig.
2886
2887         When vertically scrolling a page with horizontally scrollable overflow areas,
2888         vertical scroll gestures would be interrupted when wheel events with non-zero
2889         X deltas were intercepted by the overflow areas.
2890         
2891         Fix by storing a small history of wheel events deltas and using
2892         it to determine of the scroll gesture is primarily vertical or horizontal.
2893         When this is detected, avoid dispatching scroll events on the on the
2894         non-dominant axis.
2895         
2896         Currently this behavior is conditionalized to only apply in iTunes.
2897
2898         * page/EventHandler.cpp:
2899         (WebCore::EventHandler::EventHandler):
2900         (WebCore::EventHandler::recordWheelEventDelta):
2901         (WebCore::deltaIsPredominantlyVertical):
2902         (WebCore::EventHandler::dominantScrollGestureDirection):
2903         (WebCore::EventHandler::handleWheelEvent):
2904         (WebCore::EventHandler::defaultWheelEventHandler):
2905         * page/EventHandler.h:
2906         * platform/RuntimeApplicationChecks.cpp:
2907         (WebCore::applicationIsITunes):
2908         * platform/RuntimeApplicationChecks.h:
2909
2910 2013-08-23  Pratik Solanki  <psolanki@apple.com>
2911
2912         MediaQuery::expressions() should return a reference
2913         <https://webkit.org/b/120215>
2914
2915         Reviewed by Anders Carlsson.
2916
2917         m_expressions is never NULL so we can just return a reference.
2918
2919         * css/MediaList.cpp:
2920         (WebCore::reportMediaQueryWarningIfNeeded):
2921         * css/MediaQuery.cpp:
2922         (WebCore::MediaQuery::MediaQuery):
2923         * css/MediaQuery.h:
2924         (WebCore::MediaQuery::expressions):
2925         * css/MediaQueryEvaluator.cpp:
2926         (WebCore::MediaQueryEvaluator::eval):
2927
2928 2013-08-23  Ryosuke Niwa  <rniwa@webkit.org>
2929
2930         Build fix after r154515.
2931
2932         * dom/ElementTraversal.h:
2933         (WebCore::Traversal<ElementType>::firstChild):
2934         (WebCore::Traversal<ElementType>::lastChild):
2935
2936 2013-08-23  Andreas Kling  <akling@apple.com>
2937
2938         Simplify some Settings access where we have a Frame in reach.
2939         <http://webkit.org/b/120239>
2940
2941         Reviewed by Anders Carlsson.
2942
2943         In three cases where we can grab at a Frame, we can reach all the way to some Settings
2944         without having to use pointers.
2945
2946         * loader/FrameLoader.cpp:
2947         (WebCore::FrameLoader::didBeginDocument):
2948         * rendering/RenderLayerCompositor.cpp:
2949         (WebCore::RenderLayerCompositor::addToOverlapMap):
2950         (WebCore::RenderLayerCompositor::requiresCompositingForPosition):
2951
2952 2013-08-23  Jer Noble  <jer.noble@apple.com>
2953
2954         REGRESSION (r150516): Media controls are messed up on right-to-left webpages
2955         https://bugs.webkit.org/show_bug.cgi?id=120234
2956
2957         Reviewed by Dan Bernstein.
2958
2959         Test: media/video-rtl.html
2960
2961         Make the media control panel explicitly direction:ltr. The captions menu and captions
2962         display are unaffected, so rtl content will continue to appear rtl there.
2963
2964         * css/mediaControls.css:
2965         (audio::-webkit-media-controls-panel, video::-webkit-media-controls-panel):
2966
2967 2013-08-23  Beth Dakin  <bdakin@apple.com>
2968
2969         REGRESSION (r132545): Some PDFs generated by WebKit are blank when viewed in 
2970         Adobe Reader
2971         https://bugs.webkit.org/show_bug.cgi?id=120240
2972         -and corresponding-
2973         <rdar://problem/14634453>
2974
2975         Reviewed by Anders Carlsson.
2976
2977         This patch makes it so that we don’t use the infinite rect for the PDF context, 
2978         and it adds WebCoreSystemInterface API to find out if the current content is the 
2979         PDF context. 
2980
2981         * WebCore.exp.in:
2982         * platform/graphics/cg/GraphicsContextCG.cpp:
2983         (WebCore::GraphicsContext::clipOut):
2984         * platform/mac/WebCoreSystemInterface.h:
2985         * platform/mac/WebCoreSystemInterface.mm:
2986
2987 2013-08-23  Eric Carlson  <eric.carlson@apple.com>
2988
2989         [Mac] some track language tags are not recognized
2990         https://bugs.webkit.org/show_bug.cgi?id=119643
2991
2992         Reviewed by Jere Noble.
2993
2994         No new tests, existing tests updated.
2995
2996         * html/HTMLMediaElement.cpp:
2997         (WebCore::HTMLMediaElement::HTMLMediaElement): Initialize m_captionDisplayMode from settings
2998             if possible.
2999         (WebCore::HTMLMediaElement::configureTextTrackGroup): Don't enable a default track when preferences
3000             say captions should be disabled. Don't disable an already visible track if we don't find
3001             a match unless preferences say captions should be disabled. m_forcedOrAutomaticSubtitleTrackLanguage ->
3002             m_subtitleTrackLanguage.
3003         (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged): If the language of the primary
3004             audio track changes, only kick off a text track recalc if caption preference are set to "automatic".
3005         * html/HTMLMediaElement.h:
3006
3007         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
3008         (WebCore::MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation): Initialize m_characteristicsChanged
3009             and m_delayCharacteristicsChangedNotification.
3010         (WebCore::MediaPlayerPrivateAVFoundation::setHasVideo): Call characteristicsChanged.
3011         (WebCore::MediaPlayerPrivateAVFoundation::setHasAudio): Ditto.
3012         (WebCore::MediaPlayerPrivateAVFoundation::setHasClosedCaptions): Ditto.
3013         (WebCore::MediaPlayerPrivateAVFoundation::characteristicsChanged): New, allows us to coalesce 
3014             calls to the media player when we know several characteristics may change.
3015         (WebCore::MediaPlayerPrivateAVFoundation::setDelayCharacteristicsChangedNotification): Enable or
3016             disable notification delay.
3017         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
3018
3019         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3020         (WebCore::MediaPlayerPrivateAVFoundationObjC::tracksChanged): Always call languageOfPrimaryAudioTrack(),
3021             a track may have changed so we may have a new language.
3022         (WebCore::MediaPlayerPrivateAVFoundationObjC::languageOfPrimaryAudioTrack): Call [AVAssetTrack languageCode]
3023             if [AVAssetTrack extendedLanguageTag] returns NULL in case the media file has an old
3024             QuickTime language code.
3025
3026 2013-08-23  Andreas Kling  <akling@apple.com>
3027
3028         RenderView::compositor() should return a reference.
3029         <https://webkit.org/b/120217>
3030
3031         Reviewed by Beth Dakin.
3032
3033         The RenderLayerCompositor is lazily constructed by compositor() and never returns null.
3034
3035 2013-08-23  Yoav Weiss  <yoav@yoav.ws>
3036
3037         Fix srcset's image candidate algorithm when DPR exceeds all candidates
3038         https://bugs.webkit.org/show_bug.cgi?id=120168
3039
3040         When the DPR exceeded the 'x' qualifier of all image candidates, none was chosen.
3041
3042         From the srcset spec: "If there are any entries in candidates that have an associated pixel density that is less than a
3043         user-agent-defined value giving the nominal pixel density of the display, then remove them, unless that would remove all the
3044         entries, in which case remove only the entries whose associated pixel density is less than the greatest such pixel density."
3045
3046         Fixed by returning the last one in the list of candidates sorted by their qualifier, in case none of them is equal or greater than
3047         DPR.
3048         
3049         Reviewed by Andreas Kling.
3050
3051         Test: fast/hidpi/image-srcset-fraction.html
3052
3053         * html/parser/HTMLParserIdioms.cpp:
3054         (WebCore::bestFitSourceForImageAttributes):
3055
3056 2013-08-23  Chris Fleizach  <cfleizach@apple.com>
3057
3058         <https://webkit.org/b/113895> Webkit exposes aria-expanded="undefined" as aria-expanded="false" (AXExpanded = NO)
3059
3060         Reviewed by Darin Adler.
3061
3062         Don't support the ARIA expanded attribute unless the value is one of the defined ARIA values (true/false).
3063
3064         Test: platform/mac/accessibility/aria-expanded-not-exposed-when-undefined.html
3065
3066         * accessibility/AccessibilityObject.cpp:
3067         (WebCore::AccessibilityObject::supportsARIAExpanded):
3068
3069 2013-08-17  Darin Adler  <darin@apple.com>
3070
3071         <https://webkit.org/b/119945> Some cleanup for PasteboardIOS
3072
3073         Reviewed by Andreas Kling.
3074
3075         * platform/ios/PasteboardIOS.mm:
3076         (WebCore::Pasteboard::setFrame): Moved this function up near the
3077         create functions and constructors.
3078         (WebCore::documentFragmentWithRTF): Tweaked formatting.
3079         (WebCore::Pasteboard::documentFragmentForPasteboardItemAtIndex):
3080         Ditto.
3081         (WebCore::utiTypeFromCocoaType): Changed to use early return and removed
3082         an unneeded local variable.
3083         (WebCore::cocoaTypeFromHTMLClipboardType): Renamed the quaint qType and
3084         pbType local variables, and tweaked formatting.
3085         (WebCore::Pasteboard::clear): Tweaked comment.
3086         (WebCore::Pasteboard::readString): Tweaked formatting.
3087         (WebCore::addHTMLClipboardTypesForCocoaType): Tweaked formatting.
3088         (WebCore::Pasteboard::writeString): Streamlined logic and tweaked formatting
3089         (WebCore::Pasteboard::types): Renamed pbType to just type.
3090
3091 2013-08-23  Bem Jones-Bey  <bjonesbe@adobe.com>
3092
3093         Attempt to make it more clear what FloatIntervalSearchAdaptor::collectIfNeeded is doing
3094         https://bugs.webkit.org/show_bug.cgi?id=119816
3095
3096         Reviewed by David Hyatt.
3097
3098         This is a port from Blink of
3099         https://src.chromium.org/viewvc/blink?revision=155885&view=revision
3100         Original Patch by Eric Seidel
3101
3102         Original comments:
3103
3104         "It seemed to me that template specifications would be clearer than an
3105         if.  They also allow for compile-time error checking were a 3rd type
3106         of float to come into existance in CSS4. :p
3107
3108         For any unfamiliar with this method, this the object used for
3109         performing a search on a RedBlackTree in WTF.
3110
3111         We create one of these adaptors, specifying that we want to search for
3112         values in a specific (logical) Y interval, and this adaptor is called
3113         back for any values in the RBTree cooresponding to that interval
3114         range.
3115
3116         The job of this adaptor is to collect the various values we care
3117         about, including the left or right-most offset of the floats in that
3118         Y-range as well as what the last (document order) float seen in that
3119         range.
3120
3121         It also collects the remaining available height for the block but I'm
3122         less clear on how that parameter is used."
3123
3124         Note that in addition to the original change, I have made the
3125         updateOffsetIfNeeded and rangesIntersect methods inline, as this was
3126         shown to be a performance win in
3127         https://src.chromium.org/viewvc/blink?revision=156064&view=revision
3128         and it seemed a rather trivial change to be subject to a separate
3129         patch when porting.
3130
3131         No new tests, no behavior change.
3132
3133         * rendering/RenderBlock.cpp:
3134         (WebCore::::updateOffsetIfNeeded):
3135         (WebCore::::collectIfNeeded):
3136         * rendering/RenderBlock.h:
3137
3138 2013-08-23  David Kilzer  <ddkilzer@apple.com>
3139
3140         WebCore fails to link due to changes in Objective-C++ ABI in trunk clang
3141         <http://webkit.org/b/120183>
3142         <rdar://problem/14764114>
3143
3144         Reviewed by Eric Carlson.
3145
3146         The trunk version of clang made an ABI change for Objective-C++
3147         parameters that caused WebCore to fail to link.  The short-term
3148         fix is to change the parameter type from id<protocol> to just id
3149         and add an ASSERT that the parameter still conforms to the
3150         protocol.
3151
3152         * platform/DragData.h:
3153         (DragDataRef): Change typedef from id<NSDragInfo> to id.
3154         * platform/mac/DragDataMac.mm:
3155         (WebCore::DragData::DragData): Add ASSERT that checks that the
3156         DragDataRef object implements the NSDragInfo protocol.
3157
3158 2013-08-23  Andreas Kling  <akling@apple.com>
3159
3160         RenderLayerCompositor::m_renderView should be a reference.
3161         <https://webkit.org/b/120210>
3162
3163         Reviewed by Antti Koivisto.
3164
3165         The RenderLayerCompositor is always created by a RenderView passing itself to the constructor.
3166         By making m_renderView a reference, we flush out some unnecessary null checks.
3167         We also gain a pointer-free path to Settings through m_renderView.frameView().frame().settings()
3168         so we don't have to make those blocks conditional anymore, reducing ambiguity.
3169
3170         * rendering/RenderLayerCompositor.cpp:
3171         * rendering/RenderLayerCompositor.h:
3172         * rendering/RenderView.cpp:
3173         (WebCore::RenderView::compositor):
3174
3175 2013-08-23  Andreas Kling  <akling@apple.com>
3176
3177         RenderView::frameView() should return a reference.
3178         <https://webkit.org/b/120208>
3179
3180         Reviewed by Antti Koivisto.
3181
3182         A RenderView should always have a corresponding FrameView, so make frameView()
3183         return a reference. Also remove a myriad of now-impossible null checks.
3184
3185 2013-08-23  Allan Sandfeld Jensen  <allan.jensen@digia.com>
3186
3187         REGRESSION(r153939) Fix typo in Qt build-files
3188
3189         Reviewed by Antti Koivisto.
3190
3191         Fix simple typo in Target.pri introduced in r153939.
3192
3193         * Target.pri:
3194
3195 2013-08-23  Antti Koivisto  <antti@apple.com>
3196
3197         <https://webkit.org/b/120166> Add Traversal<ElementType> template
3198
3199         Reviewed by Andreas Kling.
3200
3201         It is common to traverse through a subtree looking for elements of specific type and then casting to the type. This pattern can be generalized.
3202         
3203         This patch adds a new Traversal<typename ElementType> template. It works like ElementTraversal except that the traversal is limited to the specified type.
3204         The patch also uses the template in a bunch of applicable places.
3205
3206         * WebCore.exp.in:
3207         * accessibility/AccessibilityRenderObject.cpp:
3208         (WebCore::AccessibilityRenderObject::addImageMapChildren):
3209         * dom/Document.cpp:
3210         (WebCore::Document::removeTitle):
3211         (WebCore::Document::updateBaseURL):
3212         (WebCore::Document::processBaseElement):
3213         * dom/Element.h:
3214         * dom/ElementTraversal.h:
3215         (WebCore::::firstChildTemplate):
3216         (WebCore::::firstWithinTemplate):
3217         (WebCore::::lastChildTemplate):
3218         (WebCore::::lastWithinTemplate):
3219         (WebCore::::nextTemplate):
3220         (WebCore::::previousTemplate):
3221         (WebCore::::nextSiblingTemplate):
3222         (WebCore::::previousSiblingTemplate):
3223         (WebCore::::nextSkippingChildrenTemplate):
3224         (WebCore::::firstChild):
3225         (WebCore::::lastChild):
3226         (WebCore::::firstWithin):
3227         (WebCore::::lastWithin):
3228         (WebCore::::next):
3229         (WebCore::::previous):
3230         (WebCore::::nextSibling):
3231         (WebCore::::previousSibling):
3232         (WebCore::::nextSkippingChildren):
3233         (WebCore::ElementTraversal::previousIncludingPseudo):
3234         (WebCore::ElementTraversal::nextIncludingPseudo):
3235         (WebCore::ElementTraversal::nextIncludingPseudoSkippingChildren):
3236         (WebCore::ElementTraversal::pseudoAwarePreviousSibling):
3237         * dom/Node.cpp:
3238         (WebCore::Node::numberOfScopedHTMLStyleChildren):
3239         * dom/NodeIterator.cpp:
3240         (WebCore::NodeIterator::NodeIterator):
3241         * dom/NodeIterator.h:
3242         * dom/Traversal.cpp:
3243         (WebCore::NodeIteratorBase::NodeIteratorBase):
3244         (WebCore::NodeIteratorBase::acceptNode):
3245         * dom/Traversal.h:
3246         
3247             Renamed existing class called Traversal to less generic NodeIteratorBase.
3248
3249         * dom/TreeScope.cpp:
3250         (WebCore::TreeScope::labelElementForId):
3251         (WebCore::TreeScope::findAnchor):
3252         * dom/TreeWalker.cpp:
3253         (WebCore::TreeWalker::TreeWalker):
3254         * dom/TreeWalker.h:
3255         * editing/FrameSelection.cpp:
3256         (WebCore::scanForForm):
3257         * editing/markup.cpp:
3258         (WebCore::createContextualFragment):
3259         * html/HTMLAnchorElement.h:
3260         (WebCore::isHTMLAnchorElement):
3261         (WebCore::HTMLAnchorElement):
3262         * html/HTMLAreaElement.h:
3263         (WebCore::isHTMLAreaElement):
3264         (WebCore::HTMLAreaElement):
3265         * html/HTMLBaseElement.h:
3266         (WebCore::isHTMLBaseElement):
3267         (WebCore::HTMLBaseElement):
3268         * html/HTMLElement.h:
3269         (WebCore::HTMLElement):
3270         * html/HTMLFieldSetElement.cpp:
3271         (WebCore::HTMLFieldSetElement::invalidateDisabledStateUnder):
3272         (WebCore::HTMLFieldSetElement::childrenChanged):
3273         (WebCore::HTMLFieldSetElement::legend):
3274         * html/HTMLFormControlElement.h:
3275         (WebCore::toHTMLFormControlElement):
3276         (WebCore::HTMLFormControlElement):
3277         * html/HTMLLabelElement.cpp:
3278         (WebCore::nodeAsSupportedLabelableElement):
3279         (WebCore::HTMLLabelElement::control):
3280         * html/HTMLLabelElement.h:
3281         (WebCore::isHTMLLabelElement):
3282         (WebCore::HTMLLabelElement):
3283         * html/HTMLLegendElement.h:
3284         (WebCore::isHTMLLegendElement):
3285         (WebCore::HTMLLegendElement):
3286         * html/HTMLMapElement.cpp:
3287         (WebCore::HTMLMapElement::mapMouseEvent):
3288         * html/HTMLMediaElement.cpp:
3289         (WebCore::HTMLMediaElement::finishParsingChildren):
3290         * html/HTMLStyleElement.h:
3291         (WebCore::isHTMLStyleElement):
3292         (WebCore::HTMLStyleElement):
3293         * html/HTMLTitleElement.h:
3294         (WebCore::HTMLTitleElement):
3295         * html/HTMLTrackElement.h:
3296         (WebCore::isHTMLTrackElement):
3297         (WebCore::HTMLTrackElement):
3298         * html/LabelableElement.h:
3299         (WebCore::isLabelableElement):
3300         (WebCore::LabelableElement):
3301         * rendering/FilterEffectRenderer.cpp:
3302         (WebCore::FilterEffectRenderer::buildReferenceFilter):
3303         * svg/SVGElement.h:
3304         (WebCore::SVGElement):
3305         * svg/SVGForeignObjectElement.h:
3306         (WebCore::isSVGForeignObjectElement):
3307         (WebCore::SVGForeignObjectElement):
3308         * svg/SVGSVGElement.cpp:
3309         (WebCore::SVGSVGElement::collectIntersectionOrEnclosureList):
3310         (WebCore::SVGSVGElement::getElementById):
3311         * svg/SVGStyledElement.cpp:
3312         (WebCore::SVGStyledElement::title):
3313         * svg/SVGTitleElement.h:
3314         (WebCore::SVGTitleElement):
3315         * svg/animation/SMILTimeContainer.cpp:
3316         (WebCore::SMILTimeContainer::updateDocumentOrderIndexes):
3317         * svg/animation/SVGSMILElement.cpp:
3318         (WebCore::SVGSMILElement::isSMILElement):
3319         * svg/animation/SVGSMILElement.h:
3320         (WebCore::SVGSMILElement):
3321         * svg/graphics/SVGImage.cpp:
3322         (WebCore::SVGImage::hasSingleSecurityOrigin):
3323
3324 2013-08-23  Arpita Bahuguna  <a.bah@samsung.com>
3325
3326         <br> does not get deleted when inlined after some non-textual content.
3327         https://bugs.webkit.org/show_bug.cgi?id=120006
3328
3329         Reviewed by Ryosuke Niwa.
3330
3331         deleteSelectionCommand does not handle the case when a <br> element is
3332         inlined after some non-textual content (input controls, image etc.).
3333
3334         When doing a back-delete at the start of a line following such a <br>
3335         the two contiguous lines should merge and the <br> should get deleted.
3336         Currently, even though the <br> is deleted, another placeholder <br>
3337         is incorrectly inserted at the same point, thus effectively there is no
3338         change.
3339
3340         We are incorrectly computing the inline <br> to be at the start of an
3341         empty line even though the line is not empty.
3342
3343         Test: editing/deleting/delete-inline-br.html
3344
3345         * editing/DeleteSelectionCommand.cpp:
3346         (WebCore::DeleteSelectionCommand::handleSpecialCaseBRDelete):
3347         Adding a check to verify that the inline <br> is not on an empty line
3348         if the end node is not a <br> element itself and it's previous sibling
3349         is the start <br> element.
3350
3351         Basically we check whether there is another node (end node) following
3352         the <br>, that the node is not a <br> itself, and that the end node's
3353         previous node is the start <br>.
3354
3355 2013-08-23  Renata Hodovan  <reni@webkit.org>
3356
3357         Missing null-check in HTMLFormElement::rendererIsNeeded()
3358         https://bugs.webkit.org/show_bug.cgi?id=120159
3359
3360         Reviewed by Ryosuke Niwa.
3361
3362         Null-check parentRenderer in HTMLFormElement::rendererIsNeeded()
3363         and early return.
3364
3365         Test: fast/forms/missing-parentrenderer-crash.html
3366
3367         * html/HTMLFormElement.cpp:
3368         (WebCore::HTMLFormElement::rendererIsNeeded):
3369
3370 2013-08-23  Zalan Bujtas  <zalan@apple.com>
3371
3372         MathML: ASSERTION FAILED: !isPreferredLogicalHeightDirty() in RenderMathMLBlock::preferredLogicalHeight() const
3373         https://bugs.webkit.org/show_bug.cgi?id=120157
3374
3375         Reviewed by Antti Koivisto.
3376
3377         RenderListMarker needs to be inserted to the render tree before
3378         we start computing the preferred logical widths for the associated
3379         RenderListItem.
3380
3381         Test: mathml/mn-as-list-item-assert.html
3382
3383         * rendering/RenderListItem.cpp:
3384         (WebCore::RenderListItem::insertOrMoveMarkerRendererIfNeeded):
3385         (WebCore::RenderListItem::layout):
3386         (WebCore::RenderListItem::computePreferredLogicalWidths):
3387         * rendering/RenderListItem.h:
3388
3389 2013-08-22  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
3390
3391         Introduce toSVGLinearGradientElement(), and use it
3392         https://bugs.webkit.org/show_bug.cgi?id=120154
3393
3394         Reviewed by Andreas Kling.
3395
3396         As a step to clean-up static_cast<SVGXXX>, toSVGLinearGradientElement() is added to clean-up
3397         static_cast<SVGLinearGradientElement*>.
3398
3399         * rendering/svg/RenderSVGResourceLinearGradient.cpp:
3400         (WebCore::RenderSVGResourceLinearGradient::collectGradientAttributes):
3401         * rendering/svg/SVGRenderTreeAsText.cpp:
3402         (WebCore::writeSVGResourceContainer):
3403         * svg/SVGLinearGradientElement.cpp:
3404         (WebCore::SVGLinearGradientElement::collectGradientAttributes):
3405         * svg/SVGLinearGradientElement.h:
3406         (WebCore::toSVGLinearGradientElement):
3407
3408 2013-08-22  Simon Fraser  <simon.fraser@apple.com>
3409
3410         compositing/geometry/bounds-ignores-hidden-dynamic.html has incorrect initial rendering
3411         https://bugs.webkit.org/show_bug.cgi?id=119825
3412
3413         Reviewed by Tim Horton.
3414         
3415         r137526 and some earlier commits attempted to avoid unconditionally
3416         repainting layers when their size changes, because this was causing
3417         TiledBacking layers to repaint when the document size changed.
3418         
3419         However, the approach required that we have good information about
3420         whether size changes require a repaint, which in some cases is hard
3421         to determine, especially when RenderLayer changes affect our
3422         decisions about which layers are composited.
3423         
3424         Fix by pushing the decision about whether to repaint on size change
3425         into GraphicsLayer. The default is to repaint on size change,
3426         but GraphicsLayer provides a function that can be overridden to
3427         modify this behavior; GraphicsLayerCA does so to avoid repaints
3428         when layers with TiledBackings get resized.
3429
3430         Test: compositing/repaint/repaint-on-layer-grouping-change.html
3431
3432         * WebCore.exp.in: WebKit2 needs GraphicsLayer::setSize, which is no longer inline.
3433         * platform/graphics/GraphicsLayer.cpp:
3434         (WebCore::GraphicsLayer::setOffsetFromRenderer):
3435         (WebCore::GraphicsLayer::setSize):
3436         * platform/graphics/GraphicsLayer.h:
3437         (WebCore::GraphicsLayer::shouldRepaintOnSizeChange):
3438         * platform/graphics/ca/GraphicsLayerCA.cpp:
3439         (WebCore::GraphicsLayerCA::shouldRepaintOnSizeChange):
3440         * platform/graphics/ca/GraphicsLayerCA.h:
3441         * rendering/RenderLayerBacking.h: No longer need m_boundsConstrainedByClipping
3442         * rendering/RenderLayerBacking.cpp:
3443         (WebCore::RenderLayerBacking::RenderLayerBacking):
3444         (WebCore::RenderLayerBacking::updateCompositedBounds):
3445         (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry): setSize takes
3446         care of repainting for us now, so we can remove all the conditional code.
3447
3448 2013-08-22  Simon Fraser  <simon.fraser@apple.com>
3449
3450         Repaint counters are sometimes not in the corner of the compositing layer
3451         https://bugs.webkit.org/show_bug.cgi?id=120176
3452
3453         Reviewed by Beth Dakin.
3454
3455         Sometimes the repaint counters are not in the corner of the compositing layer;
3456         they are either inset, or partially or entirely outside the layer.
3457         
3458         Fix by making sure that we restore the CGContext before drawing
3459         the counter, since the WebCore code may have translated the CTM.
3460         
3461         The counter-painting code saves and restores the context itself,
3462         so this is safe.
3463
3464         * platform/graphics/mac/WebLayer.mm:
3465         (drawLayerContents):
3466
3467 2013-08-22  Tim Horton  <timothy_horton@apple.com>
3468
3469         Unavailable plug-in indicator text is one pixel too low
3470         https://bugs.webkit.org/show_bug.cgi?id=120177
3471         <rdar://problem/14811951>
3472
3473         Reviewed by Kevin Decker.
3474
3475         Move the unavailable plug-in indicator text up one pixel.
3476
3477         * rendering/RenderEmbeddedObject.cpp:
3478         (WebCore::RenderEmbeddedObject::paintReplaced):
3479
3480 2013-08-22  Christophe Dumez  <ch.dumez@sisa.samsung.com>
3481
3482         [SVG2] Merge SVGStyledElement and SVGElement
3483         https://bugs.webkit.org/show_bug.cgi?id=107386
3484
3485         Reviewed by Andreas Kling.
3486
3487         Merge SVGStyledElement into SVGElement to simplify the SVG inheritance
3488         model and match the SVG2 specification:
3489         https://svgwg.org/svg2-draft/single-page.html#types-InterfaceSVGElement
3490
3491         Test: svg/dom/svg2-inheritance.html
3492
3493         * CMakeLists.txt:
3494         * DerivedSources.cpp:
3495         * DerivedSources.make