Little cleaning of StringImpl::lower() and StringImpl::upper() for ARM
https://bugs.webkit.org/show_bug.cgi?id=118831

Reviewed by Gavin Barraclough.

Clean lower() and upper() before trying some optimizations:
-Prefix the code with the empty() case. Otherwise, each descending loop starts with
 a check for length == 0.
-Change ored to a 32 bits registers. ARM only has 32 bits registers and access to full word.
 To keep the value a UChar, the compiler is adding a bunch of useless value & 0xffff in the loops.
-Change the pointer based loops for index based loops. The compiler does a mighty job at optimizing
 those for each architecture. No need to make the code more complex.
-Don't perform the check for int32 unless we need to. The only code limited to int is Unicode::toLower.

* wtf/text/StringImpl.cpp:
(WTF::StringImpl::lower):
(WTF::StringImpl::upper):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152881 268f45cc-cd09-0410-ab3c-d52691b4dbfc
CodeBlock DFG entry list isn't getting shrunk-to-fit after linking.
<http://webkit.org/b/118875>
<rdar://problem/14488577>

Reviewed by Geoffrey Garen.

Move the CodeBlock::shrinkToFit() call out of JITCompiler::link() and to the call sites
so SpeculativeJIT::linkOSREntries() can fill in CodeBlock::m_dfgData->osrEntry first.

886 kB progression on <http://twitter.com/awesomekling>

* dfg/DFGJITCompiler.cpp:
(JSC::DFG::JITCompiler::link):
(JSC::DFG::JITCompiler::compile):
(JSC::DFG::JITCompiler::compileFunction):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152882 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix the build after r152881

* wtf/text/StringImpl.cpp:
(WTF::StringImpl::lower):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152883 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Build fix after r152876.

* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
(WebCore::MediaPlayerPrivateAVFoundation::processNewAndRemovedTextTracks):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152884 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WorkerGlobalScope should support onoffline/ononline event handlers
https://bugs.webkit.org/show_bug.cgi?id=118832

Reviewed by Alexey Proskuryakov.

HTML5 spec says that WorkerGlobalScope should support
onoffline/ononline event handlers as stated in
http://www.whatwg.org/specs/web-apps/current-work/multipage/offline.html#event-offline

Modified NetworkStateNotifier to support multiple callbacks and added a
callback to dispatch offline and online events to WorkerGlobalScope
when network state is changed.

No new test because the current test infrastructure does not provide a
mock network state notifier.

* page/Page.cpp:
(WebCore::networkStateChanged):
Change the function to take an additional argument, isOnLine so that we
can remove a call to NetworkStateNotifier::onLine().
(WebCore::Page::Page):
Use NetworkStateNotifier::addNetworkStateChangeListener which
allows us to add multiple callbacks.

* platform/network/NetworkStateNotifier.cpp:
(WebCore::NetworkStateNotifier::addNetworkStateChangeListener):
Replace NetworkStateNotifier::setNetworkStateChangedFunction with
NetworkStateNotifier::addNetworkStateChangeListener.
(WebCore::NetworkStateNotifier::notifyNetworkStateChange):
A helper method to notify all registered network state change
callbacks.
* platform/network/NetworkStateNotifier.h:
(WebCore::NetworkStateNotifier::NetworkStateNotifier):
* platform/network/blackberry/NetworkStateNotifierBlackBerry.cpp:
(WebCore::NetworkStateNotifier::NetworkStateNotifier):
(WebCore::NetworkStateNotifier::networkStateChange):
* platform/network/efl/NetworkStateNotifierEfl.cpp:
(WebCore::NetworkStateNotifier::networkInterfaceChanged):
(WebCore::NetworkStateNotifier::NetworkStateNotifier):
* platform/network/mac/NetworkStateNotifierMac.cpp:
(WebCore::NetworkStateNotifier::networkStateChangeTimerFired):
(WebCore::NetworkStateNotifier::NetworkStateNotifier):
* platform/network/qt/NetworkStateNotifierQt.cpp:
(WebCore::NetworkStateNotifier::updateState):
(WebCore::NetworkStateNotifier::NetworkStateNotifier):
* platform/network/win/NetworkStateNotifierWin.cpp:
(WebCore::NetworkStateNotifier::addressChanged):
(WebCore::NetworkStateNotifier::NetworkStateNotifier):
Replace m_networkStateChangedFunction() with notifyNetworkStateChange().

* workers/Worker.cpp:
(WebCore::networkStateChanged):
Notify network state change by iterating all Workers.
(WebCore::Worker::Worker):
Initialize allWorkers and add networkStateChanged to
NetworkStateNotifier in first invocation. Add this Worker to
allWorkers.
(WebCore::Worker::~Worker):
Remove this Worker from allWorkers.
(WebCore::Worker::notifyNetworkStateChange):
* workers/Worker.h:
* workers/WorkerGlobalScope.h:
Add onoffline and ononline event handlers.
* workers/WorkerGlobalScope.idl:
Add onoffline and ononline event handlers
* workers/WorkerGlobalScopeProxy.h:

* workers/WorkerMessagingProxy.cpp:
(WebCore::NotifyNetworkStateChangeTask::create):
(WebCore::NotifyNetworkStateChangeTask::NotifyNetworkStateChangeTask):
(WebCore::NotifyNetworkStateChangeTask::performTask):
A subclass of ScriptExecutionContext::Task to dispatch offline and
online events to WorkerGlobalScope.
(WebCore::WorkerMessagingProxy::notifyNetworkStateChange):
Notify network state change using ScriptExecutionContext::postTask to
dispatch events across threads.
* workers/WorkerMessagingProxy.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152885 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Bindings generation tests are failing
https://bugs.webkit.org/show_bug.cgi?id=118877

Reviewed by Kentaro Hara.

I inadvertently removed the wrong part of the if statement
in r152845, causing hasAttribute() to be used unconditionally
for reflected boolean attributes instead of fastHasAttribute().
This patch fixes the issue.

No new tests, covered by bindings tests.

* bindings/scripts/CodeGenerator.pm:
(GetterExpression):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152886 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Qt] Unreviewed gardening. Rebase failing tests.

Patch by Gabor Abraham <abrhm@inf.u-szeged.hu> on 2013-07-19

* platform/qt-5.0-wk2/tables/mozilla/marvin/backgr_index-expected.png:
* platform/qt-5.0-wk2/tables/mozilla/marvin/backgr_index-expected.txt: Copied from LayoutTests/platform/qt/tables/mozilla/marvin/backgr_index-expected.txt.
* platform/qt/fast/lists/inlineBoxWrapperNullCheck-expected.txt:
* platform/qt/http/tests/security/contentSecurityPolicy/object-src-none-blocked-expected.txt:
* platform/qt/tables/mozilla/marvin/backgr_index-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152887 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Use explicit HTMLFrameElementBase cast and introduce toHTMLFrameElementBase
https://bugs.webkit.org/show_bug.cgi?id=118873

Reviewed by Ryosuke Niwa.

It should be HTMLFrameElementBase that embraces both HTMLFrameElement and HTMLIFrameElement.
This also makes correct toFooElement possible.
Next, to avoid direct use of static_cast, this patch introduces toHTMLFrameElementBase for code cleanup.

* editing/FrameSelection.cpp:
(WebCore::scanForForm):
* html/HTMLBodyElement.cpp:
(WebCore::HTMLBodyElement::didNotifySubtreeInsertions):
* html/HTMLFrameElementBase.h:
(WebCore::toHTMLFrameElementBase):
* loader/SubframeLoader.cpp:
(WebCore::SubframeLoader::loadSubframe):
* page/EventHandler.cpp:
(WebCore::targetIsFrame):
* page/FrameView.cpp:
(WebCore::FrameView::init):
* rendering/RenderFrameBase.cpp:
(WebCore::RenderFrameBase::layoutWithFlattening):
* rendering/RenderLayer.cpp:
(WebCore::frameElementAndViewPermitScroll):
(WebCore::RenderLayer::scrollRectToVisible):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152889 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] media/video-seek-multiple.html is failing
https://bugs.webkit.org/show_bug.cgi?id=117580

Patch by Miguel Gomez <magomez@igalia.com> on 2013-07-19
Reviewed by Philippe Normand.

Source/WebCore:

When receiving several seek calls in a row, ensure that the final position
is the one requested in the last call received.

Already covered in test media/video-seek-multiple.html

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::seek):

LayoutTests:

Change expectation for media/video-seek-multiple.html test

* platform/gtk/TestExpectations:

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

Fix an assertion failure which causes debug bots to fail.

* platform/network/NetworkStateNotifier.cpp:
(WebCore::NetworkStateNotifier::addNetworkStateChangeListener):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152894 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] Fix regression in DumpRenderTree introduced in r152782 by checking if uri is valid
https://bugs.webkit.org/show_bug.cgi?id=118895

Patch by Simon Pena <simon.pena@samsung.com> on 2013-07-19
Reviewed by Philippe Normand.

In r152782 an uri is used to create an string representation without checking first if it
is valid. That fails later when the string is used to check for existing redirections. This
patch ensures that the uri is valid before using it.

* DumpRenderTree/gtk/DumpRenderTree.cpp:
(willSendRequestCallback): Ensure an uri is valid before using it.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152897 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] Merge decamelizations fix ups in the GObject DOM bindings code generator
https://bugs.webkit.org/show_bug.cgi?id=117543

Patch by Diego Pino Garcia <dpino@igalia.com> on 2013-07-19
Reviewed by Carlos Garcia Campos.

Ensure that all the code that calls to decamelize() applies the same fix ups

Now all functions that need to decamelize a string should simply call
to decamelize(). This function calls to FixUpDecamelize to apply some
fix ups.

* bindings/scripts/CodeGeneratorGObject.pm:
(decamelize): decamelizes a string and applies fix ups
(FixUpDecamelize): applies a series of fix ups to a decamelized string
(GetParentGObjType): moved fix ups to FixUpDecamelize()
(GenerateProperties): simply call to decamelize
(GenerateHeader): simply call to decamelize
(GetGReturnMacro): simply call to decamelize
(GenerateFunction): simply call to decamelize
(GenerateCFile): simply call to decamelize
(GenerateEventTargetIface): simply call to decamelize

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152898 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Qt][WK2] Unreviewed cleanup for pixel tester bot.

* platform/qt-5.0-wk2/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152899 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Qt][WK2] More unreviewed cleanup for pixel tester bot.

* platform/qt-5.0-wk2/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152900 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] Unreviewed gardening. Update expectations after r152793, r152777 and r152872
https://bugs.webkit.org/show_bug.cgi?id=118906

Unreviewed GTK gardening.

Patch by Simon Pena <simon.pena@samsung.com> on 2013-07-19

* platform/gtk/TestExpectations: Mark svg/animations/svgenum-animation-6.html as flaky, and
mathml/presentation/bug95404.html, introduced in r152777, as ImageOnlyFailure.
* platform/gtk/editing/pasteboard/emacs-cntl-y-001-expected.txt: New baseline after r152872.
* platform/gtk/editing/pasteboard/emacs-ctrl-k-y-001-expected.txt: Ditto.
* platform/gtk/fast/dom/Range/getClientRects-expected.txt: Ditto.
* platform/gtk/fast/js/function-length-expected.txt: Ditto.
* platform/gtk/plugins/npruntime/object-from-destroyed-plugin-expected.txt: Added after r152872.
* platform/gtk/plugins/npruntime/object-from-destroyed-plugin-in-subframe-expected.txt: Added after r152872.
* platform/gtk/tables/mozilla/marvin/backgr_index-expected.txt: New baseline after r152793.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152901 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Update test expectations for MathML after r152840.
https://bugs.webkit.org/show_bug.cgi?id=118053

Patch by Frédéric Wang <fred.wang@free.fr> on 2013-07-19
Reviewed by Chris Fleizach.

* TestExpectations: unskip mspace tests
* platform/mac/TestExpectations: ImageOnlyFailure for mspace-units

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152902 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add a couple people to the MathML watchlist
https://bugs.webkit.org/show_bug.cgi?id=118909

Reviewed by Andreas Kling.

Add a couple people to the MathML watchlist and add Kalyan's other
email address to fix style checker warnings about the watchlist
contents.

* Scripts/webkitpy/common/config/contributors.json: Add Frédéric to the
list of contributors and add Kalyan's second email address.
* Scripts/webkitpy/common/config/watchlist: Add myself and Frédéric to the MathML
watchlist.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152903 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CSS Shapes][CSS Regions] Modify existing tests to test overflow also when padding is applied on the container
https://bugs.webkit.org/show_bug.cgi?id=117881

Reviewed by David Hyatt.

Currently, we don't have tests which test the overflow behavior when there is padding applied on the container.
I modified the existing tests to cover these cases as well and increase our test coverage.

* fast/shapes/shape-inside/shape-inside-overflow-fixed-dimensions-expected.html:
* fast/shapes/shape-inside/shape-inside-overflow-fixed-dimensions.html:
* fast/regions/shape-inside/shape-inside-on-regions-block-content-overflow-bottom-positioned-multiple-shapes-expected.html:
* fast/regions/shape-inside/shape-inside-on-regions-block-content-overflow-bottom-positioned-multiple-shapes.html:
* fast/regions/shape-inside/shape-inside-on-regions-inline-content-overflow-bottom-positioned-multiple-shapes-expected.html:
* fast/regions/shape-inside/shape-inside-on-regions-inline-content-overflow-bottom-positioned-multiple-shapes.html:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152904 268f45cc-cd09-0410-ab3c-d52691b4dbfc
TrailingObjects shouldn't shrink vector capacity in a loop
https://bugs.webkit.org/show_bug.cgi?id=118322

Reviewed by Darin Adler.

This seems to take about 3% off the profile of loading a large text file.

* rendering/RenderBlockLineLayout.cpp:
(WebCore::TrailingObjects::clear): clear() has the built-in side effect
of throwing away existing capacity. Use shrink(0) to indicate that we
want to keep our existing capacity.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152905 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CSS Shapes] Clear overflowing line's segments in pushShapeContentOverflowBelowTheContentBox
https://bugs.webkit.org/show_bug.cgi?id=118002

Reviewed by David Hyatt.

When the last line in the shape overlaps with the shape bottom boundaries we need to clear the computed segments. (We need to compute
the segments anyway, since shape-outside's code uses the same code path to determine its segments and the line containing is not a
requirement in that case.) Rather then doing the job in RenderBlock::LineBreaker::nextLineBreak I moved the functionality to its correct
place to pushShapeContentOverflowBelowTheContentBox. Now all the overflow related functionality is located in one function. I fixed the
corresponding layout test.

Source/WebCore:

Tests: I modified shape-inside-overflow.html.

* rendering/RenderBlockLineLayout.cpp:
(WebCore::pushShapeContentOverflowBelowTheContentBox): Remove segments if line overlaps with the shape's boundaries.
(WebCore::RenderBlock::LineBreaker::nextLineBreak): Move segments clear logic to pushShapeContentOverflowBelowContentBox.

LayoutTests:

* fast/shapes/shape-inside/shape-inside-overflow-expected.html:
* fast/shapes/shape-inside/shape-inside-overflow.html:


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