Safari 6 notifications' onclick handlers can't call window.open()
https://bugs.webkit.org/show_bug.cgi?id=96959
<rdar://problem/12132427>

Reviewed by Darin Adler.

Source/WebKit2:

The click is not being treated as a user gesture when the message is sent to the web process.

* WebProcess/Notifications/WebNotificationManager.cpp:
(WebKit::WebNotificationManager::didClickNotification): Gets called when the user clicks on the
platform notification. Set UserGestureIndicator to show the click event is due to user gesture.

LayoutTests:

The test shows and clicks a platform notification. The onclick handler calls window.open(),
which in turn calls a function on the main page to confirm that a window was opened.

* http/tests/notifications/legacy/window-show-on-click-expected.txt: Added.
* http/tests/notifications/legacy/window-show-on-click.html: Added.
* http/tests/notifications/resources/window-show-on-click.html: Added.
* http/tests/notifications/window-show-on-click-expected.txt: Added.
* http/tests/notifications/window-show-on-click.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129140 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] ControlsPanel string is not localized in LocalizedStringsGtk
https://bugs.webkit.org/show_bug.cgi?id=96502

Patch by Joanmarie Diggs <jdiggs@igalia.com> on 2012-09-20
Reviewed by Chris Fleizach.

Source/WebCore:

Adds the ControlsPanel string to the strings localized in LocalizedStringsGtk.

Test: platform/gtk/accessibility/media-controls-panel-title.html

* platform/gtk/LocalizedStringsGtk.cpp:
(WebCore::localizedMediaControlElementString):

LayoutTests:

Added a new test to verify that the accessible object associated with the
MediaControlsPanel has the expected accessible name.

* platform/gtk/accessibility/media-controls-panel-title-expected.txt: Added.
* platform/gtk/accessibility/media-controls-panel-title.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129141 268f45cc-cd09-0410-ab3c-d52691b4dbfc
IndexedDB: Rewrite confusing call sequence layout tests
https://bugs.webkit.org/show_bug.cgi?id=97051

Reviewed by Tony Chang.

Rewrite some convoluted and hard to understand/maintain tests in a more idiomatic fashion.
This patch maintains the bulk of the non-standard output to verify that the tests have not
changed in behavior; follow-ups will make the output more standard and split the tests
into separate files.

* storage/indexeddb/factory-deletedatabase-interactions-expected.txt:
* storage/indexeddb/open-close-version-expected.txt:
* storage/indexeddb/resources/factory-deletedatabase-interactions.js:
* storage/indexeddb/resources/open-close-version.js:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129142 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Support paths in Content Security Policy directives.
https://bugs.webkit.org/show_bug.cgi?id=89750

Patch by Mike West <mkwst@chromium.org> on 2012-09-20
Reviewed by Adam Barth.

Source/WebCore:

In CSP 1.0, paths are simply ignored: 'script-src
http://example.com/path/to/a/file' would allow script to be loaded from
http://example.com/path/to/a/file/javascript.js, but also from
http://example.com/javascript.js.

This patch is an experimental implementation of more granular path
support in CSP source lists as proposed in the current editor's draft of
CSP 1.1. Paths are treated as specifying directories in which resources
can be found, and are implicitly terminated with a '/': in other words,
'script-src http://a.com/path' is the same as
'script-src http://a.com/path/'. Moreover, paths cannot contain either
'?' or '#' characters.

This is implemented outside the CSP_NEXT flag. All ports will be
effected.

Spec: https://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp-specification.dev.html#matching

Tests: http/tests/security/contentSecurityPolicy/source-list-parsing-paths-01.html
       http/tests/security/contentSecurityPolicy/source-list-parsing-paths-02.html

* page/ContentSecurityPolicy.cpp:
(WebCore::CSPSource::CSPSource):
    Store a path along with each CSP source.
(WebCore::CSPSource::matches):
    Check the path when comparing a URL to the source.
(WebCore::CSPSource::pathMatches):
    Compare the URL-decoded version of the resource to validate against
    the source's stored path. If the resource's path begins with the
    stored path, then it matches! If not, it doesn't.
(CSPSource):
    Store a path along with each CSP source.
(WebCore::CSPSourceList::parse):
    Pass a 'path' in when creating CSPSource objects.
(WebCore::CSPSourceList::parsePath):
    Actually parse the path, flagging errors if '?' or '#' are present,
    URL-decoding the result, and ensuring that a terminal '/' is
    added if necessary.
(WebCore::CSPSourceList::addSourceSelf):
    Ensure that 'self' sources have an empty path.
* page/ContentSecurityPolicy.h:
    Dropping the "ignored path component" console warning.

LayoutTests:

* http/tests/security/contentSecurityPolicy/source-list-parsing-05-expected.txt:
* http/tests/security/contentSecurityPolicy/source-list-parsing-05.html:
* http/tests/security/contentSecurityPolicy/source-list-parsing-06-expected.txt:
* http/tests/security/contentSecurityPolicy/source-list-parsing-06.html:
    The behavior of these tests changes based on the new functionality.
* http/tests/security/contentSecurityPolicy/source-list-parsing-paths-01-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/source-list-parsing-paths-01.html: Added.
* http/tests/security/contentSecurityPolicy/source-list-parsing-paths-02-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/source-list-parsing-paths-02.html: Added.
    New tests for various path cases.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129143 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Prevent reading stale data from InlineTextBoxes
https://bugs.webkit.org/show_bug.cgi?id=94750

Reviewed by Eric Seidel.

Text from dirty InlineTextBoxes should never be read or used. This change enforces this
design goal by forcefully zero-ing out the start and length of InlineTextBoxes when 
they're being marked dirty. It also adds asserts to accessors for those members.

This change involves making markDirty virtual. Running the line-layout performance test
as well as profiling resizing the html5 spec showed negligable impact with this change.

No new tests as this doesn't change any proper behavior.

* rendering/InlineBox.h:
(WebCore::InlineBox::markDirty): Making virtual to allow InlineTextBox to overload and
zero out its start and length.
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::markDirty): Zeroing out start and length when we mark the box dirty.
* rendering/InlineTextBox.h:
(WebCore::InlineTextBox::start): Adding an assert when we hit this case.
(WebCore::InlineTextBox::end): Ditto.
(WebCore::InlineTextBox::len): Ditto.
(WebCore::InlineTextBox::offsetRun): Ditto.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129144 268f45cc-cd09-0410-ab3c-d52691b4dbfc
MediaStream API: Extend UserMediaRequest with a ownerDocument method
https://bugs.webkit.org/show_bug.cgi?id=97095

Reviewed by Adam Barth.

Source/WebCore:

Chromium need to know exactly which frame called getUserMedia so that it can
clean away the stream when the frame goes away.
Since that information is available in webkit add an accessor method.

Chromium mock class extended to test the added method.

* Modules/mediastream/UserMediaRequest.cpp:
(WebCore::UserMediaRequest::ownerDocument):
(WebCore):
* Modules/mediastream/UserMediaRequest.h:
(WebCore):
(UserMediaRequest):

Source/WebKit/chromium:

Chromium need to know exactly which frame called getUserMedia so that it can clean
away the stream when the frame goes away.
Since that information is available in webkit add an accessor method.

Also taking the opportunity to remove an unused deprecated method,
and adding asserts in case the object is empty.

* public/WebUserMediaRequest.h:
(WebKit):
(WebUserMediaRequest):
* src/WebUserMediaRequest.cpp:
(WebKit::WebUserMediaRequest::ownerDocument):

Tools:

Extending WebUserMediaClientMock to check that the owning document is valid,
and that the document has a frame.

* DumpRenderTree/chromium/WebUserMediaClientMock.cpp:
(WebKit::WebUserMediaClientMock::requestUserMedia):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129145 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[MathML] Increase visual space around fraction parts, italic variables, and operators
https://bugs.webkit.org/show_bug.cgi?id=97228

Reviewed by Eric Seidel.

Source/WebCore: 

This makes MathML more readable, and more in agreement with Firefox and TeX.

Tested by existing tests.

* css/mathml.css:
(mfrac > :first-child):
(mfrac > :last-child):
(mfrac):
(mi):
(msub > mi:first-child, msubsup > mi:first-child):
    - Subscripts don't need to move right after an italic <mi>.
(msubsup > mi:first-child + * + *):
    - Superscripts do need to move right after an italic <mi>.
(math > mo, mrow > mo, msqrt > mo, mtd > mo):
    - These are ok values for now. It will be better to use different values for different operators, as the FIXME says.
(math > mo:last-child, mrow > mo:last-child, msqrt > mo:last-child, mtd > mo:last-child):
    - Prefix and postfix operators, including fences, generally get less spacing than infix operators.
        
* rendering/mathml/RenderMathMLFenced.cpp:
(WebCore::RenderMathMLFenced::createMathMLOperator):
    - Usually the separator is a comma or semicolon, so we only put space after it for now.
(WebCore::RenderMathMLFenced::makeFences):
(WebCore::RenderMathMLFenced::addChild):
(WebCore::RenderMathMLFenced::styleDidChange):
* rendering/mathml/RenderMathMLFenced.h:
(RenderMathMLFenced):
        
* rendering/mathml/RenderMathMLFraction.cpp:
(WebCore):
(WebCore::RenderMathMLFraction::updateFromElement):
    - gDenominatorPad is now handled by mathml.css.
        
* rendering/mathml/RenderMathMLSubSup.cpp:
(WebCore):
(WebCore::RenderMathMLSubSup::fixScriptsStyle):
    - gSubsupScriptMargin is now handled by mathml.css.

LayoutTests: 

* platform/mac/mathml/presentation/attributes-expected.png:
* platform/mac/mathml/presentation/attributes-expected.txt:
* platform/mac/mathml/presentation/fenced-expected.png:
* platform/mac/mathml/presentation/fenced-expected.txt:
* platform/mac/mathml/presentation/fenced-mi-expected.png:
* platform/mac/mathml/presentation/fenced-mi-expected.txt:
* platform/mac/mathml/presentation/fractions-expected.png:
* platform/mac/mathml/presentation/fractions-expected.txt:
* platform/mac/mathml/presentation/fractions-vertical-alignment-expected.png:
* platform/mac/mathml/presentation/fractions-vertical-alignment-expected.txt:
* platform/mac/mathml/presentation/mo-expected.png:
* platform/mac/mathml/presentation/mo-expected.txt:
* platform/mac/mathml/presentation/mo-stretch-expected.png:
* platform/mac/mathml/presentation/mo-stretch-expected.txt:
* platform/mac/mathml/presentation/mroot-pref-width-expected.png:
* platform/mac/mathml/presentation/mroot-pref-width-expected.txt:
* platform/mac/mathml/presentation/over-expected.png:
* platform/mac/mathml/presentation/over-expected.txt:
* platform/mac/mathml/presentation/roots-expected.png:
* platform/mac/mathml/presentation/roots-expected.txt:
* platform/mac/mathml/presentation/row-alignment-expected.png:
* platform/mac/mathml/presentation/row-alignment-expected.txt:
* platform/mac/mathml/presentation/row-expected.png:
* platform/mac/mathml/presentation/row-expected.txt:
* platform/mac/mathml/presentation/style-expected.png:
* platform/mac/mathml/presentation/style-expected.txt:
* platform/mac/mathml/presentation/sub-expected.txt:
* platform/mac/mathml/presentation/subsup-expected.png:
* platform/mac/mathml/presentation/subsup-expected.txt:
* platform/mac/mathml/presentation/sup-expected.png:
* platform/mac/mathml/presentation/sup-expected.txt:
* platform/mac/mathml/presentation/tokenElements-expected.png:
* platform/mac/mathml/presentation/tokenElements-expected.txt:
* platform/mac/mathml/presentation/under-expected.txt:
* platform/mac/mathml/presentation/underover-expected.png:
* platform/mac/mathml/presentation/underover-expected.txt:
* platform/mac/mathml/xHeight-expected.png:
* platform/mac/mathml/xHeight-expected.txt:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129146 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION: layout test results doesn't show diffs
https://bugs.webkit.org/show_bug.cgi?id=97182

Reviewed by Ojan Vafai.

Go back to storing TEXT, AUDIO, and IMAGE+TEXT in results.json
so that results.html (and hopefully garden-o-matic) can
determine which things actually failed. However, we keep mapping
these results to Failure so that we still only have a single
expectation type for them.

* Scripts/webkitpy/layout_tests/layout_package/json_layout_results_generator.py:
(JSONLayoutResultsGenerator):
* Scripts/webkitpy/layout_tests/models/test_expectations.py:
(TestExpectationParser):
(TestExpectations):
(TestExpectations.result_was_expected):
* Scripts/webkitpy/layout_tests/models/test_failures.py:
(determine_result_type):
* Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py:
(MainTest.test_missing_and_unexpected_results):
(MainTest.test_retrying_and_flaky_tests):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129148 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add WK2-specific result for this frame-flattening test (seems to be a scrollbars difference).
Tracked by https://bugs.webkit.org/show_bug.cgi?id=97240.

* platform/mac-wk2/fast/frames/flattening/frameset-flattening-simple-expected.txt: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129149 268f45cc-cd09-0410-ab3c-d52691b4dbfc
CSP reports should send an empty 'referrer' rather than nothing.
https://bugs.webkit.org/show_bug.cgi?id=97233

Patch by Mike West <mkwst@chromium.org> on 2012-09-20
Reviewed by Adam Barth.

Source/WebCore:

Currently, if a protected resource doesn't have a referrer, then any
Content Security Policy violations send a report that doesn't contain
a referrer attribute. It's arguably friendlier to developers to include
an explicitly empty attribute.

This new behavior is covered by updates to existing test expectations
around the reporting functionality.

* page/ContentSecurityPolicy.cpp:
(WebCore::ContentSecurityPolicy::reportViolation):
    Drop the 'if', and always write out a referrer.

LayoutTests:

* http/tests/security/contentSecurityPolicy/report-and-enforce-expected.txt:
* http/tests/security/contentSecurityPolicy/report-blocked-uri-cross-origin-expected.txt:
* http/tests/security/contentSecurityPolicy/report-blocked-uri-expected.txt:
* http/tests/security/contentSecurityPolicy/report-only-expected.txt:
* http/tests/security/contentSecurityPolicy/report-only-from-header-expected.txt:
* http/tests/security/contentSecurityPolicy/report-uri-expected.txt:
    Adding the empty 'referrer' attribute to the expectations.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129150 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Marking http/tests/media/video-referer.html as flakey in TestExpectations
https://bugs.webkit.org/show_bug.cgi?id=34331

* platform/mac/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129151 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed, rolling out r129144.
http://trac.webkit.org/changeset/129144
https://bugs.webkit.org/show_bug.cgi?id=97244

causing lots of assertions in tests (Requested by smfr on
#webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2012-09-20

* rendering/InlineBox.h:
(WebCore::InlineBox::markDirty):
* rendering/InlineTextBox.cpp:
* rendering/InlineTextBox.h:
(WebCore::InlineTextBox::start):
(WebCore::InlineTextBox::end):
(WebCore::InlineTextBox::len):
(WebCore::InlineTextBox::offsetRun):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129152 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Remove now passing test.
* platform/chromium/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129153 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Implement absolutely positioned flex items
https://bugs.webkit.org/show_bug.cgi?id=93798

Reviewed by Ojan Vafai.

Source/WebCore:

Previously, we treated absolutely positioned flex items as a 0x0 placeholder element.
Now we position the 0x0 placeholder where the next item would go. This causes the
following changes:
- justify-content: space-{around,between} no longer change due to the existence of absolutely positioned flex items.
- alignment doesn't change the placement of absolutely positioned flex items.
- auto margins in the alignment direction don't do anything on absolutely positioned flex items.

Test: css3/flexbox/position-absolute-children.html

* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::availableAlignmentSpaceForChild): Absolutely positioned flex items should not use this.
(WebCore::RenderFlexibleBox::updateAutoMarginsInCrossAxis): Absolutely positioned flex items should not use this.
(WebCore::initialJustifyContentOffset): If there are no flex items, space-around should center an absolutely positioned flex item.
(WebCore::RenderFlexibleBox::numberOfInFlowPositionedChildren): Helper method for helping to compute space-between and space-around.
(WebCore::RenderFlexibleBox::layoutAndPlaceChildren): Fix spacing when space-between or space-around.
(WebCore::RenderFlexibleBox::layoutColumnReverse): Fix spacing when space-between or space-around.
(WebCore::RenderFlexibleBox::alignChildren): Treat absolutely positioned children like flex-start.
* rendering/RenderFlexibleBox.h: numberOfInFlowPositionedChildren method.

LayoutTests:

Fix position of absolute flex items and add some additional tests.

* css3/flexbox/align-absolute-child-expected.txt:
* css3/flexbox/align-absolute-child.html: New test cases and update expectations.
* css3/flexbox/position-absolute-child.html: Update expectations.
* css3/flexbox/position-absolute-children-expected.txt: Added.
* css3/flexbox/position-absolute-children.html: Added. Tests having only absolutely positioned children.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129154 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Qt] Fix production builds

Unreviewed trivial fix: Follow up r129119 and avoid clobbering LIBS through the use of LIBS_PRIVATE.

Otherwise the libQtWebKit.prl file for example contains -lWebKit1 -lWebCore, etc.

* qmake/mkspecs/features/functions.prf:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129155 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Refactored the interpreter and JIT so they don't dictate closure layout
https://bugs.webkit.org/show_bug.cgi?id=97221

Reviewed by Oliver Hunt.

Source/JavaScriptCore: 

Capture may change the location of an argument for space efficiency. This
patch removes static assumptions about argument location from the interpreter
and JIT.

* bytecode/CodeBlock.h:
(JSC::CodeBlock::argumentIndexAfterCapture):
(JSC::ExecState::argumentAfterCapture): Factored out a helper function
so the compiler could share this logic.

* bytecompiler/NodesCodegen.cpp:
(JSC::BracketAccessorNode::emitBytecode): Don't emit optimized bracket
access on arguments if a parameter has been captured by name. This case is
rare and, where I've seen it in the wild, the optimization mostly failed
anyway due to arguments escape, so I didn't feel like writing and testing
five copies of the code that would handle it in the baseline engines.

The DFG can still synthesize this optimization even if we don't emit the
optimized bytecode for it.

* dfg/DFGArgumentsSimplificationPhase.cpp:
(JSC::DFG::ArgumentsSimplificationPhase::run):
* dfg/DFGAssemblyHelpers.h:
(JSC::DFG::AssemblyHelpers::symbolTableFor):
(AssemblyHelpers): Use the right helper function to account for the fact
that a parameter may have been captured by name and moved.

* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::parseBlock): ASSERT that we haven't inlined
a .apply on captured arguments. Once we do start inlining such things,
we'll need to do a little bit of math here to get them right.

* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile): Added support for bracket access on
an arguments object where arguments have also been captured by name. We
load the true index of the argument from a side vector. Arguments elision
is very powerful in the DFG, so I wanted to keep it working, even in this
rare case.

* interpreter/Interpreter.cpp:
(JSC::loadVarargs): Use the right helper function to account for the fact
that a parameter may have been captured by name and moved.

* jit/JITCall.cpp:
(JSC::JIT::compileLoadVarargs):
* jit/JITCall32_64.cpp:
(JSC::JIT::compileLoadVarargs): Don't use the inline copy loop if some
of our arguments have moved, since it would copy stale values. (We still
optimize the actual call, and elide the arguments object.)

LayoutTests: 

* fast/js/dfg-arguments-alias-activation-expected.txt: Added.
* fast/js/dfg-arguments-alias-activation.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129156 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fixed a missing semicolon in the C++ llint backend.
https://bugs.webkit.org/show_bug.cgi?id=97252.

Reviewed by Geoff Garen.

* offlineasm/cloop.rb:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129157 268f45cc-cd09-0410-ab3c-d52691b4dbfc
run-perf-tests should record individual value instead of statistics
https://bugs.webkit.org/show_bug.cgi?id=97155

Reviewed by Hajime Morita.

PerformanceTests: 

Report the list of values as "values" so that run-perf-tests can parse them.

* resources/runner.js:
(PerfTestRunner.computeStatistics):
(PerfTestRunner.printStatistics):

Tools: 

Parse the list of individual value reported by tests and include them as "values".
We strip "values" from the output JSON when uploading it to the perf-o-matic
since it doesn't know how to parse "values" or ignore it.

* Scripts/webkitpy/performance_tests/perftest.py:
(PerfTest):
(PerfTest.parse_output): Parse and report "values".
(PageLoadingPerfTest.run): Report indivisual page loading time in "values".
* Scripts/webkitpy/performance_tests/perftest_unittest.py:
(MainTest.test_parse_output):
(MainTest.test_parse_output_with_failing_line):
(TestPageLoadingPerfTest.test_run):
* Scripts/webkitpy/performance_tests/perftestsrunner.py:
(PerfTestsRunner._generate_and_show_results): Strip "values" from each result
until we update perf-o-matic.
* Scripts/webkitpy/performance_tests/perftestsrunner_unittest.py:
(test_run_memory_test):
(test_run_with_json_output):
(test_run_with_description):
(test_run_with_slave_config_json):
(test_run_with_multiple_repositories):

LayoutTests: 

The expected result now contains individual value.

* fast/harness/perftests/runs-per-second-log-expected.txt:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129158 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Mark plugins/netscape-dom-access-and-reload.html as flakey
https://bugs.webkit.org/show_bug.cgi?id=82752

* platform/mac/TestExpectations:

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