[iOS] Add optimized version of StringImpl's equal(LChar*,LChar*) for Apple CPUs
https://bugs.webkit.org/show_bug.cgi?id=112202

Patch by Benjamin Poulain <bpoulain@apple.com> on 2013-03-13
Reviewed by Gavin Barraclough.

* Source/WTF/wtf/Platform.h:
Make the macro WTF_ARM_ARCH_VERSION valid on any architecture.
* wtf/text/StringImpl.h:
(WTF::equal):
On ARMv7S, the new version is about 11% percent faster than the simple loop.
On ARMv7 classic, memcmp is a little faster than the simple loop on Apple A5.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@145748 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Force clip in fast/regions/autoheight-break-after-expected.html to match test
https://bugs.webkit.org/show_bug.cgi?id=112283

Reviewed by David Hyatt.

Regions always set a clip rect when rendering their contents. On Mountain Lion, the Ahem glyphs very slightly
visually overflow their bounds if there's no clip set. This sets a clip in the reference file so we get the same
rendering.

* fast/regions/autoheight-break-after-expected.html:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@145749 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add the default video poster if it doesn't exist in video tag
https://bugs.webkit.org/show_bug.cgi?id=110263

Patch by Tao Bai <michaelbai@chromium.org> on 2013-03-13
Reviewed by Eric Carlson.

Source/WebCore:

Tests: media/video-default-poster.html
       media/video-no-default-poster.html

The Android web view application could provide the default poster
for a video that doesn't have the poster attribute.

To provide the default poster, the application must set defaultVideoPosterURL
setting and return the image in the response of that URL.

The way to do this would be:

A) Replace the Element::imageSourceAttributeName function with an
   Element::imageSourceURL function that returns the imageSourceURL as a
   const AtomicString&. The body will be the same as before, it will just also
   include a call to getAttribute. Also will need to revise the four classes
   that override that function.

B) Add a new HTMLVideoElement::posterImageURL function that implements the
   default poster URL logic.

C) Update the four functions that get the poster attribute to handle poster
   loading and display to call posterImageURL.

   1) HTMLVideoElement::imageSourceURL.
   2) HTMLVideoElement::setDisplayMode.
   3) HTMLVideoElement::updateDisplayState.
   4) HTMLMediaElement::getPluginProxyParams. Will need to cast to
      HTMLVideoElement after checking isVideo.

* dom/Element.cpp:
(WebCore::Element::imageSourceURL): Replace imageSourceAttributeName() with imageSourceURL()
* dom/Element.h: Replace imageSourceAttributeName() with imageSourceURL()
* html/HTMLEmbedElement.cpp:
(WebCore::HTMLEmbedElement::imageSourceURL): Replace imageSourceAttributeName() with imageSourceURL()
* html/HTMLEmbedElement.h: Replace imageSourceAttributeName() with imageSourceURL()
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::getPluginProxyParams): Change to use posterImageURL
* html/HTMLObjectElement.cpp:
(WebCore::HTMLObjectElement::imageSourceURL): Replace imageSourceAttributeName() with imageSourceURL()
* html/HTMLObjectElement.h: Replace imageSourceAttributeName with imageSourceURL
* html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::HTMLVideoElement): set m_defaultPosterURL if there is such settings
(WebCore::HTMLVideoElement::imageSourceURL): Replace imageSourceAttributeName() with imageSourceURL()
(WebCore::HTMLVideoElement::setDisplayMode): Use imageSourceURL()
(WebCore::HTMLVideoElement::updateDisplayState): Use imageSourceURL()
(WebCore::HTMLVideoElement::posterImageURL): Return image source's KURL
* html/HTMLVideoElement.h: Replace imageSourceAttributeName() with imageSourceURL() and add m_defaultPosterURL
* loader/ImageLoader.cpp:
(WebCore::ImageLoader::updateFromElement): Use imageSourceURL()
* page/Settings.in: Add defaultVideoPosterURL setting.
* platform/chromium/PasteboardChromium.cpp:
(WebCore::Pasteboard::writeImage): use imageSourceURL()
* platform/gtk/PasteboardGtk.cpp:
(WebCore::getURLForImageNode): use imageSourceURL()
* rendering/HitTestResult.cpp:
(WebCore::HitTestResult::absoluteImageURL): use imageSourceURL()
* svg/SVGImageElement.cpp:
(WebCore::SVGImageElement::imageSourceURL): Replace imageSourceAttributeName() with imageSourceURL()
* svg/SVGImageElement.h: Replace imageSourceAttributeName() with imageSourceURL()
* testing/InternalSettings.cpp:
(WebCore::InternalSettings::Backup::Backup): support backup defaultVideoPosterURL.
(WebCore::InternalSettings::Backup::restoreTo): support restore defaultVideoPosterURL.
(WebCore::InternalSettings::setDefaultVideoPosterURL): set defaultVideoPosterURL.
* testing/InternalSettings.h:
(Backup): support backup defaultVideoPosterURL.
(InternalSettings): Add setDefaultVidoePosterURL method.
* testing/InternalSettings.idl: Add setDefaultVideoPosterURL for test purpose.
* testing/Internals.cpp:
(WebCore::Internals::getImageSourceURL): Add getImageSourceURL method.
* testing/Internals.h: Add getImageSourceURL method.
* testing/Internals.idl: Add getImageSourceURL method.

LayoutTests:

The Android web view application could provide the default poster
for a video that doesn't have the poster attribute.

To provide the default poster, the application must set defaultVideoPosterURL
setting and return the image in the response of that URL.

The way to do this would be:

A) Replace the Element::imageSourceAttributeName function with an
   Element::imageSourceURL function that returns the imageSourceURL as a
   const AtomicString&. The body will be the same as before, it will just also
   include a call to getAttribute. Also will need to revise the four classes
   that override that function.

B) Add a new HTMLVideoElement::posterImageURL function that implements the
   default poster URL logic.

C) Update the four functions that get the poster attribute to handle poster
   loading and display to call posterImageURL.

   1) HTMLVideoElement::imageSourceURL.
   2) HTMLVideoElement::setDisplayMode.
   3) HTMLVideoElement::updateDisplayState.
   4) HTMLMediaElement::getPluginProxyParams. Will need to cast to
      HTMLVideoElement after checking isVideo.

* media/video-default-poster-expected.txt: Added.
* media/video-default-poster.html: Added.
* media/video-no-default-poster-expected.txt: Added.
* media/video-no-default-poster.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@145750 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed attempted build fix for Windows. SchedulePair.cpp -> SchedulePairCF.cpp

* WTF.vcproj/WTF.vcproj:
* WTF.vcxproj/WTF.vcxproj:
* WTF.vcxproj/WTF.vcxproj.filters:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@145751 268f45cc-cd09-0410-ab3c-d52691b4dbfc
chromium's WebFrameTest.ReplaceNavigationAfterHistoryNavigation failing after r145734
https://bugs.webkit.org/show_bug.cgi?id=112281

Reviewed by Adam Barth.

Fixes the aforementioned chromiun webkit_unit_test

* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::maybeFinishLoadingMultipartContent): FrameLoader::isReplacing() is not quite
    synonymous with loading multipart content. Check that it's actually loading multipart before doing
    multipart-specific things.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@145752 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Small ResourceLoader cleanups.
https://bugs.webkit.org/show_bug.cgi?id=112279

Reviewed by Geoff Garen.

Source/WebCore:

No new tests (Refactor with no behavior change).

1 - Add "OVERRIDE" to virtual methods in subclasses of ResourceLoader to catch future mistakes.
2 - Replace the "bool allAtOnce" flag with a descriptive enum to make reading code easier.

* GNUmakefile.list.am:
* Target.pri:
* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:

* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::substituteResourceDeliveryTimerFired):

* loader/NetscapePlugInStreamLoader.cpp:
(WebCore::NetscapePlugInStreamLoader::didReceiveData):
* loader/NetscapePlugInStreamLoader.h:

* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::addData):
(WebCore::ResourceLoader::didReceiveData):
* loader/ResourceLoader.h:
* loader/ResourceLoaderTypes.h: Added.

* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::didReceiveData):
* loader/SubresourceLoader.h:

Source/WebKit2:

Replace the "bool allAtOnce" flag with a descriptive enum to make reading code easier.

* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::didReceiveData):

* WebProcess/Network/WebResourceLoader.cpp:
(WebKit::WebResourceLoader::didReceiveData):
(WebKit::WebResourceLoader::didReceiveResource):
* WebProcess/Network/WebResourceLoader.h:
* WebProcess/Network/WebResourceLoader.messages.in: Get rid of the "allAtOnce" flag since it was always false.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@145753 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Crash in CompositeEditCommand::insertNodeAt.
https://bugs.webkit.org/show_bug.cgi?id=112280

Reviewed by Ryosuke Niwa.

* editing/CompositeEditCommand.cpp:
(WebCore::CompositeEditCommand::insertNodeAt): Fix incorrect cast use of toElement.
Subsitute with toContainerNode.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@145754 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Account for review feedback in https://bugs.webkit.org/show_bug.cgi?id=112279
that I'd mistakenly left out of my commit.

* loader/ResourceLoaderTypes.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@145755 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Qt] Prospective trivial build fix after r145744

Add missing closing parentheses.

* xml/parser/XMLDocumentParserQt.cpp:
(WebCore::XMLDocumentParser::parseDtd):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@145756 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] Add Proximity Detector.
https://bugs.webkit.org/show_bug.cgi?id=112278

Patch by Genevieve Mak <gmak@rim.com> on 2013-03-13
Reviewed by Rob Buis.

Internally Reviewed by Mike Lattanzio.
PR #243385

Source/WebKit:

* PlatformBlackBerry.cmake:

Source/WebKit/blackberry:

* WebKitSupport/ProximityDetector.cpp: Added.
(WebKit):
(BlackBerry::WebKit::getPriorityLevel):
(BlackBerry::WebKit::ProximityDetector::ProximityDetector):
(BlackBerry::WebKit::ProximityDetector::~ProximityDetector):
(BlackBerry::WebKit::ProximityDetector::findBestPoint):
* WebKitSupport/ProximityDetector.h: Added.
(WebCore):
(WebKit):
(ProximityDetector):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@145757 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CSS Grid Layout] Handle min-width / max-width on the grid element
https://bugs.webkit.org/show_bug.cgi?id=112269

Reviewed by Ojan Vafai.

Source/WebCore:

Test: fast/css-grid-layout/grid-element-min-max-width.html

* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::GridIterator::GridIterator):
Added some sanity checks that the starting indexes are in the grid.

(WebCore::RenderGrid::computeIntrinsicLogicalWidths):
Updated the code to use m_grid to iterate: this is the correct way to
go as it will handle implicit rows / columns properly. Added a comment
about the current way being inefficient and incorrect with spanning grid
items.

(WebCore::RenderGrid::computePreferredLogicalWidths):
Updated the comments.

(WebCore::RenderGrid::gridTrackSize):
* rendering/RenderGrid.h:
Constified gridTrackSize.

LayoutTests:

* fast/css-grid-layout/grid-element-min-max-width-expected.txt: Added.
* fast/css-grid-layout/grid-element-min-max-width.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@145758 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Simplify Checked<> multiplication
https://bugs.webkit.org/show_bug.cgi?id=112286

Reviewed by James Robinson.

Source/WTF:

Trying to correctly identify multiplication by zero complicated the
unsigned * unsigned multiply, and still didn't handle all cases correctly.
Now we just do the normal division based approach to overflow detection
leading to much simpler reasoning.

Would be nice if we could have a jo style intrinsic one day.

* wtf/CheckedArithmetic.h:

Tools:

Add tests for multiplication by zero and max to ensure we don't
mess them up should we ever make changes to Checked<> in future.

* TestWebKitAPI/Tests/WTF/CheckedArithmeticOperations.cpp:
(TestWebKitAPI):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@145759 268f45cc-cd09-0410-ab3c-d52691b4dbfc
IndexedDB: Record attemps to open a path with non-ascii characters
https://bugs.webkit.org/show_bug.cgi?id=112224

Reviewed by Tony Chang.

We want to see if that's correlated with errors on open.

No new tests, there's no way to test histogramming that I know of. I
ran chrome locally with a non ascii path though.

* Modules/indexeddb/IDBBackingStore.cpp:
(WebCore::IDBBackingStore::open):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@145760 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Also don't log error messages from the GraphicsContext3D if webGLErrorsToConsoleEnabled is false
https://bugs.webkit.org/show_bug.cgi?id=112284

Reviewed by Adam Barth.

When running layout tests in content_shell, we end up logging more information.
Since webGLErrorsToConsoleEnabled is false during layout tests, this change makes
sure we match the baselines.

* html/canvas/WebGLRenderingContext.cpp:
(WebCore):
(WebCore::WebGLRenderingContextErrorMessageCallback::onErrorMessage):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@145761 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CSS Grid Layout] Refactor GridCoordinate to hold GridSpans
https://bugs.webkit.org/show_bug.cgi?id=112211

Reviewed by Tony Chang.

In order to bring more spanning knowledge to RenderGrid without having
duplicated GridSpan resolution, it became needed to store them into
GridCoordinate. Note that this change is needed as we can only resolve
all the positions with enough context in one place: when we place the
item in the grid.

Refactoring, no change in behavior expected.

* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::GridIterator::nextEmptyGridArea):
Updated to create 2 GridSpans. Also fixed a style violation (PassOwnPtr
as local member, not sure why it wasn't caught earlier).

(WebCore::RenderGrid::placeItemsOnGrid):
(WebCore::RenderGrid::placeSpecifiedMajorAxisItemsOnGrid):
(WebCore::RenderGrid::placeAutoMajorAxisItemOnGrid):
(WebCore::RenderGrid::gridAreaBreadthForChild):
(WebCore::RenderGrid::findChildLogicalPosition):
Updated the original function after GridCoordinate internal representation change.

(WebCore::RenderGrid::insertItemIntoGrid):
Ditto. Also added a new overloaded function that does resolution after auto-placement.

(WebCore::RenderGrid::resolveGridPositionsFromAutoPlacementPosition):
Removed the extra GridSpan computation, which was wrong.

* rendering/RenderGrid.h:
(WebCore::RenderGrid::GridCoordinate::GridCoordinate):
Updated GridCoordinate to hold 2 GridSpan. Also removed the 2 position
constructor (it would have been a hazard), replaced by a 2 GridSpan constructor.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@145762 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] Do not do scroll position adjustment if selecting in a subframe
https://bugs.webkit.org/show_bug.cgi?id=112290

Patch by Iris Wu <shuwu@blackberry.com> on 2013-03-13
Reviewed by Rob Buis.

PR 267394

In SelectionHandler::ensureSelectedTextVisible(), scroll position
animation is based on main frame. If selecting in a subframe, don't
do animation.

Internally Reviewed By Genevieve Mak.

* WebKitSupport/SelectionHandler.cpp:
(BlackBerry::WebKit::SelectionHandler::ensureSelectedTextVisible):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@145763 268f45cc-cd09-0410-ab3c-d52691b4dbfc
run-perf-tests should support content_shell
https://bugs.webkit.org/show_bug.cgi?id=112291

Reviewed by Eric Seidel.

* Scripts/webkitpy/performance_tests/perftestsrunner.py:
(PerfTestsRunner._parse_args):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@145764 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[V8] Get rid of more function-level static FunctionTemplates and ObjectTemplates in bindings
https://bugs.webkit.org/show_bug.cgi?id=112262

Patch by Marja Hölttä <marja@chromium.org> on 2013-03-13
Reviewed by Jochen Eisinger.

In the future we'll create and store function templates for main world
and non-main worlds separately (see bug 111724), having function
templates and object templates as static variables inside functions will
break the functionality.

No new tests (no changes in functionality yet; existing bindings
tests still pass).

* bindings/scripts/CodeGeneratorV8.pm:
(GenerateHeader):
(GenerateImplementation):
* bindings/v8/V8DOMWindowShell.cpp:
(WebCore::V8DOMWindowShell::createContext):
* bindings/v8/V8PerIsolateData.cpp:
(WebCore::V8PerIsolateData::hasPrivateTemplate):
(WebCore):
* bindings/v8/V8PerIsolateData.h:
(V8PerIsolateData):
* bindings/v8/custom/V8HTMLDocumentCustom.cpp:
(WebCore::V8HTMLDocument::wrapInShadowObject):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@145765 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Remove svn:executable from a file that isn't supposed to be executable.

Rubber-stamped by Geoff Garen.

* wtf/MediaTime.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@145766 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add a test case for flexbox with negative overflow having an out of flow flex item
https://bugs.webkit.org/show_bug.cgi?id=112294

Reviewed by Ojan Vafai.

* css3/flexbox/negative-overflow-expected.txt:
* css3/flexbox/negative-overflow.html:


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