Initial advance on the first glyph of the run is not correctly set for rtl text.
https://bugs.webkit.org/show_bug.cgi?id=117839
<rdar://problem/13860717>

Reviewed by Sam Weinig.

Source/WebCore: 

We need to set the initial advance to the glyphBuffer, using the
initial advance of the complex run that will be drawn first.
In order to choose the run correctly we must consider the text direction.

Test: fast/text/complex-first-glyph-with-initial-advance.html

* platform/graphics/mac/ComplexTextController.cpp:
(WebCore::ComplexTextController::advance):

LayoutTests: 

* fast/text/complex-first-glyph-with-initial-advance-expected.html: Added.
* fast/text/complex-first-glyph-with-initial-advance.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151807 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Change stack capacity requirement to be more reasonable.
https://bugs.webkit.org/show_bug.cgi?id=117801.

Reviewed by Geoffrey Garen.

Previously, the requiredStack in StackPolicy::StackPolicy() was set to
to a high value like 256K to reduce the chances of encountering an
undetected stack overflow in a scenario where we have a combination of
deeply nested divs and a large amount recursive re-entries into the VM.

However, this high value of requiredStack still does not completely
ensure that we will never encounter an undetected stack overflow. It
only lessens the probability of encountering it.

Secondly, on some platforms, the total stack size can be less than 256K
to start with. Hence, this high value requiredStack renders the VM
unuseable on those platforms.

This patch will fix the requiredStack to be more reasonable based on
real world stack usage by the VM. We won't (and cannot) try to prevent
undetected stack overflows outside of JSC as well. External code that
do deep recursion (e.g. Documnet::updateLayout()) should do their own
stack checks.

From a previous experiment, we measured the following:

On a debug build on OSX:
1. Stack usage different between recursive calls to interpreter entry:
   7744 bytes
On a release build on OSX:
2. Stack usage difference between recursive calls to interpreter entry:
   6352 bytes

Using these as a guide, we'll pick the following values for the
StackPolicy:
   requiredStack: 32K
   errorModeRequiredStack: 16K

The requiredStack is chosen to be 4x the measured usage above. The
additional 3x is a conservative estimate to account for stack space
that may be needed by other native functions called while in the
interpreter.

The errorModeRequiredStack has to be less than the requiredStack or we
won't be able to reenter the interpreter to do error handling work when
an imminent stack overflow is detected. It is assumed that the error
handling code will only do minimal work to allocate an exception and its
stack trace, and not run any arbitrary JS code. As such, it is safe to
allow re-entry into the interpreter with only 2x the measured usage in
this case.

* interpreter/Interpreter.cpp:
(JSC::Interpreter::StackPolicy::StackPolicy):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151808 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] Send the correct offsets for misspelled words.
https://bugs.webkit.org/show_bug.cgi?id=117846

JIRA116916.
When the caret is placed after a word, the offsets were calculated around
the proceeding space. As such, words that end a sentence worked correctly, but
midsentence words did not. The 'startOfWord' was calculated for the space ahead
and not for the word before it. Now finding the start of the word correctly and
calculating the end from there.

Patch by Nima Ghanavatian <nghanavatian@blackberry.com> on 2013-06-20
Reviewed by Rob Buis.

Internally reviewed by Genevieve Mak.

* WebKitSupport/InputHandler.cpp:
(BlackBerry::WebKit::InputHandler::requestSpellingCheckingOptions):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151809 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Windows] Undoing r150621 to roll r150600 back in as the jsc test
failures have been fixed in r151808.
https://bugs.webkit.org/show_bug.cgi?id=116661.

Reviewed by Brent Fulgham.

* wtf/StackBounds.cpp:
(WTF::StackBounds::initialize):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151810 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed. Roll out part of r150618.

* platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:


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