Make JavaScript binding for Clipboard::types more normal
https://bugs.webkit.org/show_bug.cgi?id=120271

Reviewed by Anders Carlsson.

* bindings/js/JSClipboardCustom.cpp:
(WebCore::JSClipboard::types): Make a simple custom binding. Only needed because
there is a special value, null, this can return.

* dom/Clipboard.cpp:
(WebCore::Clipboard::types): Return Vector<String> instead of ListHashSet<String>.
* dom/Clipboard.h: Ditto.
* platform/Pasteboard.h: Ditto.
* platform/blackberry/PasteboardBlackBerry.cpp:
(WebCore::Pasteboard::types): Ditto.
* platform/efl/PasteboardEfl.cpp:
(WebCore::Pasteboard::types): Ditto.
* platform/gtk/PasteboardGtk.cpp:
(WebCore::Pasteboard::types): Ditto.
* platform/ios/PasteboardIOS.mm:
(WebCore::Pasteboard::types): Ditto.
* platform/mac/PasteboardMac.mm:
(WebCore::Pasteboard::types): Ditto.
* platform/qt/PasteboardQt.cpp:
(WebCore::Pasteboard::types): Ditto.
* platform/win/PasteboardWin.cpp:
(WebCore::Pasteboard::types): Ditto.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154578 268f45cc-cd09-0410-ab3c-d52691b4dbfc
BUILD FIX (r154578): Return Vector<String>() from Pasteboard::types() for iOS

* platform/ios/PasteboardIOS.mm:
(WebCore::Pasteboard::types): Return Vector<String>() instead of
ListHashSet<String>() after r154578.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154579 268f45cc-cd09-0410-ab3c-d52691b4dbfc
RenderObject::document() should return a reference.
<https://webkit.org/b/120272>

Reviewed by Antti Koivisto.

There's always a Document. We were allocated in someone's arena, after all.
Various null checks and assertions neutralized.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154580 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Element child and descendant iterators
https://bugs.webkit.org/show_bug.cgi?id=120248

Reviewed by Sam Weinig and Andreas Kling.

Add iterators for Element children and descendants.
        
To iterate over element children:
        
#include "ChildIterator.h"
        
for (auto it = elementChildren(this).begin(), end = elementChildren(this).end(); it != end; ++it) {
    Element& element = *it;
    ...

for (auto it = childrenOfType<HTMLAreaElement>(this).begin(), end = childrenOfType<HTMLAreaElement>(this).end(); it != end; ++it) {
    HTMLAreaElement& area = *it;
    ...

To iteratate over element descendants in pre-order:
        
#include "DescendantIterator.h"
        
for (auto it = elementDescendants(this).begin(), end = elementDescendants(this).end(); it != end; ++it) {
    Element& element = *it;
    ...

for (auto it = descendantsOfType<HTMLAreaElement>(this).begin(), end = descendantsOfType<HTMLAreaElement>(this).end(); it != end; ++it) {
    HTMLAreaElement& area = *it;
    ...
            
The iterators assert against DOM mutations and event dispatch while iterating in debug builds.
            
They are compatible with C++11 range-based for loops. In the future we can use
        
for (auto& element : elementChildren(this))
    ...

etc.
        
The patch all uses the new iterators in a few places.

* WebCore.xcodeproj/project.pbxproj:
* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::canvasHasFallbackContent):
(WebCore::siblingWithAriaRole):
* accessibility/AccessibilityRenderObject.cpp:
* accessibility/AccessibilityTable.cpp:
(WebCore::AccessibilityTable::isDataTable):
* dom/ChildIterator.h: Added.
(WebCore::ChildIterator::operator*):
(WebCore::ChildIterator::operator->):
(WebCore::::ChildIterator):
(WebCore::::operator):
(WebCore::=):
(WebCore::::ChildIteratorAdapter):
(WebCore::::begin):
(WebCore::::end):
(WebCore::elementChildren):
(WebCore::childrenOfType):
* dom/DescendantIterator.h: Added.
(WebCore::DescendantIterator::operator*):
(WebCore::DescendantIterator::operator->):
(WebCore::::DescendantIterator):
(WebCore::::operator):
(WebCore::=):
(WebCore::::DescendantIteratorAdapter):
(WebCore::::begin):
(WebCore::::end):
(WebCore::elementDescendants):
(WebCore::descendantsOfType):
* dom/Document.cpp:
(WebCore::Document::buildAccessKeyMap):
(WebCore::Document::childrenChanged):
(WebCore::Document::attach):
(WebCore::Document::detach):
* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::cleanupUnstyledAppleStyleSpans):
* editing/markup.cpp:
(WebCore::completeURLs):
* html/HTMLMapElement.cpp:
(WebCore::HTMLMapElement::mapMouseEvent):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::selectMediaResource):
(WebCore::HTMLMediaElement::textTrackModeChanged):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154581 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Improve srcset's layout tests
https://bugs.webkit.org/show_bug.cgi?id=120274

Moved srcset's tests to use js-test-pre, and output text with clear PASS/FAILED statements.
Added expected.txt files to the test directory, since there shouldn't be any platform variance in the results.
For some of the tests, added an equivalent 1x/2x test, to make sure the feature behaves on both DPRs.
Added preload tests on the "change-dynamically" tests, to make sure the 'src' resource is not loaded when it shouldn't.

Patch by Yoav Weiss <yoav@yoav.ws> on 2013-08-25
Reviewed by Andreas Kling.

* fast/hidpi/image-srcset-change-dynamically-from-js-1x-expected.txt: Added.
* fast/hidpi/image-srcset-change-dynamically-from-js-1x.html: Added.
* fast/hidpi/image-srcset-change-dynamically-from-js-2x-expected.txt: Added.
* fast/hidpi/image-srcset-change-dynamically-from-js-2x.html: Added.
* fast/hidpi/image-srcset-change-dynamically-from-js.html: Removed.
* fast/hidpi/image-srcset-data-src-expected.txt: Added.
* fast/hidpi/image-srcset-data-src.html:
* fast/hidpi/image-srcset-data-srcset-expected.txt: Added.
* fast/hidpi/image-srcset-data-srcset.html:
* fast/hidpi/image-srcset-invalid-inputs-correct-src-expected.txt: Added.
* fast/hidpi/image-srcset-invalid-inputs-correct-src.html:
* fast/hidpi/image-srcset-invalid-inputs-except-one-expected.txt: Added.
* fast/hidpi/image-srcset-invalid-inputs-except-one.html:
* fast/hidpi/image-srcset-remove-dynamically-from-js-expected.txt: Added.
* fast/hidpi/image-srcset-remove-dynamically-from-js.html:
* fast/hidpi/image-srcset-same-alternative-for-both-attributes-expected.txt: Added.
* fast/hidpi/image-srcset-same-alternative-for-both-attributes.html:
* fast/hidpi/image-srcset-simple-1x-expected.txt: Added.
* fast/hidpi/image-srcset-simple-1x.html: Added.
* fast/hidpi/image-srcset-simple-2x-expected.txt: Added.
* fast/hidpi/image-srcset-simple-2x.html: Added.
* fast/hidpi/image-srcset-simple.html: Removed.
* fast/hidpi/image-srcset-src-selection-1x-expected.txt: Added.
* fast/hidpi/image-srcset-src-selection-1x.html: Added.
* fast/hidpi/image-srcset-src-selection-2x-expected.txt: Added.
* fast/hidpi/image-srcset-src-selection-2x.html: Added.
* fast/hidpi/image-srcset-src-selection.html: Removed.
* fast/hidpi/image-srcset-viewport-modifiers-expected.txt: Added.
* fast/hidpi/image-srcset-viewport-modifiers.html:
* platform/mac/fast/hidpi/image-srcset-change-dynamically-from-js-expected.txt: Removed.
* platform/mac/fast/hidpi/image-srcset-data-src-expected.txt: Removed.
* platform/mac/fast/hidpi/image-srcset-data-srcset-expected.txt: Removed.
* platform/mac/fast/hidpi/image-srcset-invalid-inputs-correct-src-expected.txt: Removed.
* platform/mac/fast/hidpi/image-srcset-invalid-inputs-except-one-expected.txt: Removed.
* platform/mac/fast/hidpi/image-srcset-remove-dynamically-from-js-expected.txt: Removed.
* platform/mac/fast/hidpi/image-srcset-same-alternative-for-both-attributes-expected.txt: Removed.
* platform/mac/fast/hidpi/image-srcset-simple-expected.txt: Removed.
* platform/mac/fast/hidpi/image-srcset-src-selection-expected.txt: Removed.
* platform/mac/fast/hidpi/image-srcset-viewport-modifiers-expected.txt: Removed.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154582 268f45cc-cd09-0410-ab3c-d52691b4dbfc
RenderLayer::renderer() should return a reference.
<https://webkit.org/b/120276>

Reviewed by Anders Carlsson.

RenderLayer is always created with a renderer, so make renderer() (and m_renderer) references.
Nuked an assortment of useless null checks.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154583 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add toSVGMissingGlyphElement(), and use it.
https://bugs.webkit.org/show_bug.cgi?id=120197

Reviewed by Andreas Kling.

As a step to clean-up static_cast<SVGXXX>, toSVGMissingGlyphElement() is added to clean-up
static_cast<SVGMissingGlyphElement*>.

* svg/SVGFontElement.cpp:
(WebCore::SVGFontElement::firstMissingGlyphElement):
(WebCore::SVGFontElement::ensureGlyphCache):
* svg/SVGMissingGlyphElement.h:
(WebCore::toSVGMissingGlyphElement):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154584 268f45cc-cd09-0410-ab3c-d52691b4dbfc
RenderLayerBacking::renderer() should return a reference.
<https://webkit.org/b/120280>

Reviewed by Anders Carlsson.

It's just a forwarding call to RenderLayer::renderer() which already returns a reference.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154585 268f45cc-cd09-0410-ab3c-d52691b4dbfc
JSHTMLFormElement::canGetItemsForName needlessly allocates a Vector
https://bugs.webkit.org/show_bug.cgi?id=120277

Reviewed by Sam Weinig.

Added HTMLFormElement::hasNamedElement and used it in JSHTMLFormElement::canGetItemsForName.

This required fixing a bug in HTMLFormElement::getNamedElements that the first call to getNamedElements
after replacing an element A with another element B of the same name caused it to erroneously append A
to namedItems via the aliases mapping. Because getNamedElements used to be always called in pairs, this
wrong behavior was never visible to the Web. Fixed the bug by not adding the old element to namedItem
when namedItem's size is 1.

Also renamed m_elementAliases to m_pastNamesMap along with related member functions.

No new tests are added since there should be no Web exposed behavioral change.

* bindings/js/JSHTMLFormElementCustom.cpp:
(WebCore::JSHTMLFormElement::canGetItemsForName):
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::elementFromPastNamesMap):
(WebCore::HTMLFormElement::addElementToPastNamesMap):
(WebCore::HTMLFormElement::hasNamedElement):
(WebCore::HTMLFormElement::getNamedElements):
* html/HTMLFormElement.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154586 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EFL] EWebLauncher is executed as full screen with device pixel ratio
https://bugs.webkit.org/show_bug.cgi?id=120282

Reviewed by Gyuyoung Kim.

* EWebLauncher/main.c:
Use double instead of float for device_pixel_ratio which is passed to ECORE_GETOPT_VALUE_DOUBLE.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154587 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] Fix compile warning in WebKitDOMCustom
https://bugs.webkit.org/show_bug.cgi?id=120286

Reviewed by Philippe Normand.

* bindings/gobject/WebKitDOMCustom.cpp:
(webkit_dom_html_element_get_item_type): Add return 0.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154588 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] webkitCredentialGetCredential returns a temporary in g_return_val_if_fail
https://bugs.webkit.org/show_bug.cgi?id=120287

Reviewed by Philippe Normand.

* UIProcess/API/gtk/WebKitCredential.cpp:
(webkitCredentialGetCredential): Use ASSERT() instead of
g_return_val_if_fail() since this is a private function.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154589 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] Add WillLoad test files to the TestWebKitAPI/TestWebKit2 program
https://bugs.webkit.org/show_bug.cgi?id=120288

Reviewed by Carlos Garcia Campos.

* TestWebKitAPI/GNUmakefile.am: Add the WillLoad.cpp build target that should be compiled
into the TestWebKit2 program. The InjectedBundle counterpart file is added to the build as well.
These unit tests are at the moment failing in debug configurations, so it would be nice to
have the GTK builds report these failures as well.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154590 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] Add missing initializer for pluginLoadPolicy in WKPageLoaderClient
https://bugs.webkit.org/show_bug.cgi?id=120289

Reviewed by Philippe Normand.

* UIProcess/API/gtk/WebKitLoaderClient.cpp:
(attachLoaderClientToView): Add initializer for pluginLoadPolicy
and rename the comment of the previous one as
pluginLoadPolicy_deprecatedForUseWithV2.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154591 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] Silence MiniBrowser compile warnings due to recent GTK+ deprecations
https://bugs.webkit.org/show_bug.cgi?id=120290

Reviewed by Philippe Normand.

* MiniBrowser/gtk/GNUmakefile.am: Add
-DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_6 compile option.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Qt] Remove the fix in QWebPage::javaScriptConsoleMessage introduced by (r61433)
https://bugs.webkit.org/show_bug.cgi?id=119791

Source/WebKit/qt:

Patch by Arunprasad Rajkumar <arurajku@cisco.com> on 2013-08-26
Reviewed by Jocelyn Turcotte.

* WidgetApi/qwebpage.cpp:
(QWebPage::javaScriptConsoleMessage): Removed hack specific to DRT, introduced by
(r61433).

Tools:

Patch by Arunprasad Rajkumar <arurajku@cisco.com> on 2013-08-26
Reviewed by Jocelyn Turcotte.

Load empty url to send onunload event to currently running page. onunload event is
mandatory for LayoutTests/plugins/open-and-close-window-with-plugin.html and
LayoutTests/plugins/geturlnotify-during-document-teardown.html.

* DumpRenderTree/qt/DumpRenderTreeQt.cpp:
(WebPage::~WebPage):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154593 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] Improve the stop/reload button implementation in MiniBrowser
https://bugs.webkit.org/show_bug.cgi?id=120292

Reviewed by Philippe Normand.

- Use an instance member of BrowserWindow for the button widget
  instead of a global variable.
- Use notify::is-loading to monitor the WebView load instead of
  the estimated-load-progress property.
- Use webkit_web_view_is_loading() to check whether the view
  is loading to change the button icon instead of a string
  comparison of the gtk stock icon id.
- Use the right casts to fix compile warning.

* MiniBrowser/gtk/BrowserWindow.c:
(reloadOrStopCallback):
(webViewLoadProgressChanged):
(webViewIsLoadingChanged):
(browser_window_init):
(browserWindowConstructed):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154594 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] Add support for passing test directories to run-gtk-tests
https://bugs.webkit.org/show_bug.cgi?id=120296

Reviewed by Philippe Normand.

* Scripts/run-gtk-tests:
(TestRunner._get_tests_from_dir): Helper function to return all
unit tests found in a given directory.
(TestRunner._get_tests): Check the given tests passed in the
command line, so that if a directory is found the tests contained
in the directory are added to the list of tests to run.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154595 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed, EFL gardening. EFL WK1 DRT doesn't support exif-orientation tests

* platform/efl-wk1/TestExpectations: Add fast/images/exif-orientation-composited.html as failure.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154596 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Move DocumentTiming inside ENABLE(WEB_TIMING) guards.
<https://webkit.org/b/120281>

Reviewed by Anders Carlsson.

Looks like this struct is only used by other ENABLE(WEB_TIMING) code, so don't bother
filling it in if we're not building like that.

* dom/Document.cpp:
(WebCore::Document::setReadyState):
(WebCore::Document::finishedParsing):
* dom/Document.h:
* dom/DocumentTiming.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154597 268f45cc-cd09-0410-ab3c-d52691b4dbfc