JSC should dump object size inference statistics
https://bugs.webkit.org/show_bug.cgi?id=97618

Reviewed by Filip Pizlo.

Added an option to dump object size inference statistics.

To see statistics on live objects:

    jsc --showHeapStatistics=1

To see cumulative statistics on all objects ever allocated:

    jsc --showHeapStatistics=1 --objectsAreImmortal=1

    (This is useful for showing GC churn caused by over-allocation.)

To support this second mode, I refactored Zombies to separate out their
immortality feature so I could reuse it.

* heap/Heap.cpp:
(JSC::MarkObject): Helper for making things immortal. We have to checked
for being zapped because blocks start out in this state.

(JSC::StorageStatistics): Gather statistics by walking the heap. Ignore
arrays and hash tables for now because they're not our focus. (We'll
remove these exceptions in future.)

(JSC::Heap::collect): Moved zombify to the end so it wouldn't interfere
with statistics gathering.

(JSC::Heap::showStatistics):
(JSC::Heap::markAllObjects): Factored out helper, so statistics could
take advantage of immortal objects.

(Zombify): Don't mark immortal objects -- that's another class's job now.

(JSC::Zombify::operator()):
(JSC::Heap::zombifyDeadObjects): Take advantage of forEachDeadCell instead
of rolling our own.

* heap/Heap.h:
(Heap):
* heap/MarkedSpace.h:
(MarkedSpace):
(JSC::MarkedSpace::forEachDeadCell): Added, so clients don't have to do
the iteration logic themselves.

* runtime/Options.cpp:
(JSC::Options::initialize):
* runtime/Options.h: New options, listed above. Make sure to initialize
based on environment variable first, so we can override with specific settings.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129586 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fat Fingers doesn't work on non-scrollable pages.
PR #209609
https://bugs.webkit.org/show_bug.cgi?id=97607

Patch by Genevieve Mak <gmak@rim.com> on 2012-09-25
Reviewed by Antonio Gomes.

Only bypass Fat Fingers and use the actual touch point if its specifically
requested and the page has a mouse move listener or if using the Touch Event
Mode meta-tag.

* WebKitSupport/TouchEventHandler.cpp:
(BlackBerry::WebKit::TouchEventHandler::handleTouchPoint):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129587 268f45cc-cd09-0410-ab3c-d52691b4dbfc
DFG ArrayPush, ArrayPop don't handle clobbering or having a bad time correctly
https://bugs.webkit.org/show_bug.cgi?id=97535

Source/JavaScriptCore: 

Reviewed by Oliver Hunt.

* dfg/DFGAbstractState.cpp:
(JSC::DFG::AbstractState::execute):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::handleIntrinsic):
* dfg/DFGStructureCheckHoistingPhase.cpp:
(JSC::DFG::StructureCheckHoistingPhase::run):

LayoutTests: 

Rubber stamped by Oliver Hunt.

* fast/js/dfg-array-pop-side-effects-expected.txt: Added.
* fast/js/dfg-array-pop-side-effects.html: Added.
* fast/js/dfg-array-push-bad-time-expected.txt: Added.
* fast/js/dfg-array-push-bad-time.html: Added.
* fast/js/dfg-array-push-slow-put-expected.txt: Added.
* fast/js/dfg-array-push-slow-put.html: Added.
* fast/js/jsc-test-list:
* fast/js/script-tests/dfg-array-pop-side-effects.js: Added.
(foo):
(.b):
* fast/js/script-tests/dfg-array-push-bad-time.js: Added.
* fast/js/script-tests/dfg-array-push-slow-put.js: Added.
(foo):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129588 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Build fix. "values" doesn't necessarily contain multiple values but it needs to be always parsed as an array.

* Scripts/webkitpy/performance_tests/perftest.py:
(PerfTest.parse_output):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129589 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CSS Exclusions] shape-inside line segment layout should be based on line position and height
https://bugs.webkit.org/show_bug.cgi?id=95479

Patch by Bear Travis <betravis@adobe.com> on 2012-09-25
Reviewed by Levi Weintraub.

Source/WebCore:

This patch adds line height to line top to calculate line segments using the line's upper
and lower logical edges. The last line in a shape is allowed to overflow the shape,
using line top and shape bottom to calculate the available line segments. Overflow
behavior will develop in greater detail as the specification advances. For more on
overflow, see:
- http://dev.w3.org/csswg/css3-exclusions/#shape-inside-property and
- https://www.w3.org/Bugs/Public/show_bug.cgi?id=16460

As more shapes are added, line positions within a shape are no longer guaranteed to
have segments (eg, the first line in a circular shape inside), and so many instances
of lineState were replaced with hasSegments. Layout code also uses lineOverlapsShapeBounds
rather than lineState, now that lines may partially overlap a shape without being
completely contained by it. Because layout begins at the shape's logical top, however,
we only run into this edge case laying out the last line within a shape-inside.

Test: fast/exclusions/shape-inside/shape-inside-rounded-rectangle.html

* rendering/RenderBlockLineLayout.cpp:
(WebCore::LineWidth::LineWidth): Use WrapShapeInfo::hasSegments rather than
WrapShapeInfo::lineState, as line positions within a shape are no longer
guaranteed to always have line segments.
(WebCore::RenderBlock::computeInlineDirectionPositionsForLine): Ditto.
(WebCore::RenderBlock::layoutRunsAndFloatsInRange): Pass lineBottom as well as lineTop
to computeSegmentsForLine.
* rendering/WrapShapeInfo.cpp:
(WebCore::WrapShapeInfo::computeSegmentsForLine): Pass lineBottom as well as lineTop
to ExclusionShape::getInsideIntervals.
* rendering/WrapShapeInfo.h:
(WrapShapeInfo):
(WebCore::WrapShapeInfo::shapeLogicalBottom): Calculate the logical bottom of an
Exclusion Shape.
(WebCore::WrapShapeInfo::hasSegments): Allow hasSegments to be called even when
a line does not overlap a shape.
(WebCore::WrapShapeInfo::lineOverlapsShapeBounds): Test whether a line's top/bottom
overlap a shape's top/bottom. This includes lines that begin before or end after
a shape but still overlap it.

LayoutTests:

Test that line bottom as well as line top is used when calculating line segments
for a rounded rectangle.

* fast/exclusions/shape-inside/shape-inside-rounded-rectangle-expected.html: Added.
* fast/exclusions/shape-inside/shape-inside-rounded-rectangle.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129590 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Forms] We should disconnect DateTimeEditElement and DateTimeFieldElement on layout()
https://bugs.webkit.org/show_bug.cgi?id=97438

Reviewed by Kent Tamura.

This patch is for code cleanup. It is better to disconnect DateTimeFieldElement
from DateTimeEditElement when DateTimeEditElement doesn't have
pointers to DateTimeFieldElement.

No new tests. This patch doesn't change behavior.

* html/shadow/DateTimeEditElement.cpp:
(WebCore::DateTimeEditElement::resetFields): Changed to call DateTimeFieldElement::removeEventHandler()
for existing fields to disconnect DateTimeEditElement and DateTimeFieldElement.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129591 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION (r129456): http/tests/security/xss-eval.html is failing on JSC platforms
https://bugs.webkit.org/show_bug.cgi?id=97529

Reviewed by Filip Pizlo.

A recent patch changed JSC's EvalError behaviour; bring this more into line with other browsers.

Source/JavaScriptCore: 

JSC currently throws an EvalError if you try to call eval with a this object that doesn't
match the given eval function. This does not match other browsers, which generally just
ignore the this value that was passed, and eval the string in the eval function's environment.

* runtime/JSGlobalObjectFunctions.cpp:
(JSC::globalFuncEval):
    - Remove EvalError, ignore passed this value.

LayoutTests: 

* fast/js/eval-cross-window-expected.txt:
* fast/js/eval-cross-window.html:
    - Changed not to expect EvalErrors (this matches other browsers), and modified testThis
      to check that the this object is always set to the global object.
* http/tests/security/resources/xss-eval2.html:
* http/tests/security/resources/xss-eval3.html:
* http/tests/security/xss-eval-expected.txt:
* http/tests/security/xss-eval.html:
    - Updated. Access via the global environment is not a security risk, since the eval is
      accessing it's own document's informantion. Access via the shell attempts to access
      the navigated pages document, tripping an access check & throwing a TypeError.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129592 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit/mac: WebKit/mac part of <rdar://problem/11455228> [mac] Stop using screen fonts
https://bugs.webkit.org/show_bug.cgi?id=97620

Reviewed by John Sullivan.

* WebView/WebPreferences.mm:
(+[WebPreferences initialize]): Changed the default value of the screenFontSubstitutionEnabled
preference to NO.
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):  Changed to enable screen font substitution also if
the value of the NSFontDefaultScreenFontSubstitutionEnabled user defaults key is YES.

Source/WebKit2: WebKit2 part of <rdar://problem/11455228> [mac] Stop using screen fonts
https://bugs.webkit.org/show_bug.cgi?id=97620

Reviewed by John Sullivan.

* Shared/WebPreferencesStore.h:
(WebKit): Changed the default value of the screenFontSubstitutionEnabled preference to false.
* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::WebProcessCreationParameters): Added an initializer for
the new shouldForceScreenFontSubstitution data member.
(WebKit::WebProcessCreationParameters::encode): Added encoding of shouldForceScreenFontSubstitution.
(WebKit::WebProcessCreationParameters::decode): Added decoding of shouldForceScreenFontSubstitution.
* Shared/WebProcessCreationParameters.h:
(WebProcessCreationParameters): Added shouldForceScreenFontSubstitution boolean data member.
* UIProcess/mac/WebContextMac.mm:
(WebKit::WebContext::platformInitializeWebProcess): Added code to set shouldForceScreenFontSubstitution
in the process creation parameters to the value of the NSFontDefaultScreenFontSubstitutionEnabled user
defaults key.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences): Changed to enable screen font substitution also if
shouldForceScreenFontSubstitution() is true.
* WebProcess/WebProcess.h:
(WebKit::WebProcess::shouldForceScreenFontSubstitution): Added this getter.
(WebProcess): Added m_shouldForceScreenFontSubstitution boolean data member.
* WebProcess/mac/WebProcessMac.mm:
(WebKit::WebProcess::platformInitializeWebProcess): Added initialization of
m_shouldForceScreenFontSubstitution from the creation parameters.

Tools: Tools part of <rdar://problem/11455228> [mac] Stop using screen fonts
https://bugs.webkit.org/show_bug.cgi?id=97620

Reviewed by John Sullivan.

* DumpRenderTree/mac/DumpRenderTree.mm:
(resetDefaultsToConsistentValues): Enable screen font substitution when
running the tests.
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetStateToConsistentValues): Ditto.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129593 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EFL] Add fullscreen set/get APIs and callbacks
https://bugs.webkit.org/show_bug.cgi?id=97421

Patch by Jinwoo Song <jinwoo7.song@samsung.com> on 2012-09-25
Reviewed by Gyuyoung Kim.

Add setting APIs for JavaScript Fullscreen API and also add two callbacks to ewk_view API,
so that UI could customise behavior when fullscreen mode is requested.

* WebCoreSupport/ChromeClientEfl.cpp:
(WebCore::ChromeClientEfl::enterFullScreenForElement):
(WebCore::ChromeClientEfl::exitFullScreenForElement):
* ewk/ewk_view.cpp:
(_Ewk_View_Private_Data):
(_ewk_view_priv_new):
(ewk_view_setting_enable_fullscreen_get):
(ewk_view_setting_enable_fullscreen_set):
(ewk_view_fullscreen_enter):
(ewk_view_fullscreen_exit):
* ewk/ewk_view.h:
* ewk/ewk_view_private.h:
* tests/test_ewk_view.cpp:
(ewkViewEnableFullscreenCb):
(TEST):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129594 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: Fix logging in pure protocol test harness
https://bugs.webkit.org/show_bug.cgi?id=97579

Patch by Peter Rybin <peter.rybin@gmail.com> on 2012-09-25
Reviewed by Yury Semikhatsky.

Tools:

JavaScript alert implementation in DumpRenderTree gets immediate flush to make sure that
the message survives crash or kill by timeout.

* DumpRenderTree/blackberry/DumpRenderTree.cpp:
(BlackBerry::WebKit::DumpRenderTree::runJavaScriptAlert):
* DumpRenderTree/chromium/WebViewHost.cpp:
(WebViewHost::runModalAlertDialog):
* DumpRenderTree/efl/DumpRenderTreeView.cpp:
(onJavaScriptAlert):
* DumpRenderTree/gtk/DumpRenderTree.cpp:
(webViewScriptAlert):
* DumpRenderTree/mac/UIDelegate.mm:
(-[UIDelegate webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:]):
* DumpRenderTree/qt/DumpRenderTreeQt.cpp:
(WebCore::WebPage::javaScriptAlert):
* DumpRenderTree/win/UIDelegate.cpp:
(UIDelegate::runJavaScriptAlertPanelWithMessage):

LayoutTests:

Logging facility is fixed and improved for inspector protocol harness.

* http/tests/inspector-protocol/resources/InspectorTest.js:
(InspectorTest.log): proper escaping is added
(InspectorTest.debugLog): new method is added for crash-proof debug messaging
* http/tests/inspector-protocol/resources/protocol-test.js:
(debugLog): new method is added for crash-proof debug messaging

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129595 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Try to fix non-Mac builds.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129596 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Update master.cfg to invoke run-perf-tests with --no-show-results and --reset-results
https://bugs.webkit.org/show_bug.cgi?id=97613

Reviewed by Dirk Pranke.

Use options added in r129580.

* BuildSlaveSupport/build.webkit.org-config/master.cfg:
(RunAndUploadPerfTests):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129597 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WIN] Fix ASSERT in BString after r128988.

* platform/win/BString.cpp:
(WebCore::BString::~BString):
(WebCore::BString::adoptBSTR):
(WebCore::BString::clear): Set pointer to 0 after freeing.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129598 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EFL] Unskip passing test after r129592.

* platform/efl/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129599 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION (r126189): No more mismatch-did-not-occur failures in reftests
https://bugs.webkit.org/show_bug.cgi?id=97112

Reviewed by Dirk Pranke.

Don't use the reftest's image hash when gathering output of its reference.
This indirectly forces the driver to return the reference's image output
as well. This specifically solves the problem when the reftest and its
mismatch reference are equal but the unexpected match failure is not
reported due to missing image output of the reference file.

* Scripts/webkitpy/layout_tests/controllers/single_test_runner.py:
(SingleTestRunner._run_reftest):
* Scripts/webkitpy/layout_tests/port/test.py:
(TestPort.diff_image):
(TestDriver.run_test):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129600 268f45cc-cd09-0410-ab3c-d52691b4dbfc
String.localeCompare should normalize input
https://bugs.webkit.org/show_bug.cgi?id=97639

Reviewed by Filip Pizlo.

From the spec: "It is strongly recommended that this function treat Strings that are
canonically equivalent according to the Unicode standard as identical (in other words,
compare the Strings as if they had both been converted to Normalised Form C or D first).
It is also recommended that this function not honour Unicode compatibility equivalences
or decompositions."

Source/WTF: 

* wtf/unicode/icu/CollatorICU.cpp:
(WTF::Collator::createCollator):
    - Enable normalization.

LayoutTests: 

* fast/js/script-tests/string-localeCompare.js: Added.
* fast/js/string-localeCompare-expected.txt: Added.
* fast/js/string-localeCompare.html: Added.
    - Add lests for localeCompare.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129601 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix potential build error on LocalFileSystem::deleteFileSystem
https://bugs.webkit.org/show_bug.cgi?id=97632

Patch by Dongwoo Joshua Im <dw.im@samsung.com> on 2012-09-26
Reviewed by Yuta Kitamura.

Non-Chrome build of WebKit with FILE_SYSTEM flag will be broken at LocalFileSystem::deleteFileSystem.
Type of the third parameter is PassOwnPtr<AsyncFileSystemCallbacks> in header file,
but PassRefPtr<AsyncFileSystemCallbacks> in cpp file.

Non-Chrome WebKit build with FILE_SYSTEM should be finished successfully.

* Modules/filesystem/LocalFileSystem.cpp:
(WebCore::LocalFileSystem::deleteFileSystem):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129602 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EFL] Fix the typo in the ewk_view_fullscreen_exit()
https://bugs.webkit.org/show_bug.cgi?id=97635

Patch by Jinwoo Song <jinwoo7.song@samsung.com> on 2012-09-26
Reviewed by Gyuyoung Kim.

Fix the silly typo in the ewk_view_fullscreen_exit() API.

* ewk/ewk_view.cpp:
(ewk_view_fullscreen_exit):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129603 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] Enable some of the unstable CSS features
https://bugs.webkit.org/show_bug.cgi?id=97572

Reviewed by Martin Robinson.

.: 

Export the required RuntimeEnabledFeatures symbol.

* Source/autotools/symbols.filter:

Source/WebCore: 

Enable the CSS sticky position, CSS3 text decoration and <style scoped>
features by default but disable them if unstable features are not meant
to be enabled.

No new tests - the related tests are being unskipped or are having failure
expectations removed.

* GNUmakefile.am:
* GNUmakefile.features.am:

Source/WebKit/gtk: 

Add a helper DumpRenderTreeSupportGtk method for enabling
the <style scoped> support in WebCore. This is used in DumpRenderTree.

* WebCoreSupport/DumpRenderTreeSupportGtk.cpp:
(DumpRenderTreeSupportGtk::setShadowDOMEnabled): Add missing
ENABLE(SHADOW_DOM) compilation guards.
(DumpRenderTreeSupportGtk::setStyleScopedEnabled):
* WebCoreSupport/DumpRenderTreeSupportGtk.h:
(DumpRenderTreeSupportGtk): Remove the 'enabled' parameter name from both
setShadowDOMEnabled and setStyleScopedEnabled method declarations as it adds
no information and is causing style warnings.

Tools: 

Enable the <style scoped> support via DumpRenderTreeSupportGtk method
whenever resetting defualts to consistent values.

* DumpRenderTree/gtk/DumpRenderTree.cpp:
(resetDefaultsToConsistentValues):

LayoutTests: 

Remove expectations for the features being enabled and
add more specific failure expectations for tests that are
still failing.

* platform/gtk/TestExpectations:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129604 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[DRT][WTR] Support overriding the 'WebKitDisplayImagesKey' preference
https://bugs.webkit.org/show_bug.cgi?id=96883

Reviewed by Kenneth Rohde Christiansen.

Source/WebKit2:

* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): Add
support for changing
WebPreferencesKey::loadsImagesAutomaticallyKey().

Tools:

* DumpRenderTree/efl/TestRunnerEfl.cpp:
(TestRunner::overridePreference): Support the
'WebKitDisplayImagesKey' preference.

LayoutTests:

* platform/efl/TestExpectations: Unskip test that only fails on
WK2.

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