Move side-effects on hover/active state out of hit-testing
https://bugs.webkit.org/show_bug.cgi?id=98168

Reviewed by Julien Chaffraix.

Original patch by Allan Sandfeld Jensen; I'm just tweaking things.

Document::updateHoverActiveState is currently called during hit testing
to update the hover and active states of elements effected by mouse
movements (or their keyboard equivalents). This conflates the hit test
algorithm itself with side-effects associated with specific use-cases.

This conflation makes it very difficult to reuse the hover/active logic
for things other than hit testing. 'mouseenter'/'mouseleave' events[1]
are one example of a feature that would be simple to implement on top of
this existing logic if we split it out from the hit testing path, and
instead call it explicitly when necessary. An explicit split between
hit testing and its side-effects will also enable us to simplify the
logic in future patches with well-named parameters, rather than relying
on stuffing properties into HitTestRequest.

This patch drops the call to Document::updateHoverActiveState from
RenderView::hitTest, and adjusts the three call-sites in EventHandler
to explicitly call out to it rather than Document::updateStyleIfNeeded.
The latter call is still necessary but has been folded into
updateHoverActiveState, as the former is never called without calling
the latter.

[1]: http://wkbug.com/18930

* dom/Document.h:
* dom/Document.cpp:
(WebCore::Document::updateHoverActiveState):
    First, this function must now only be called from contexts that were
    performing a read/write hit-test: the code asserts this
    precondition.

    Second, rather than accepting a HitTestResult, the function accepts
    an Element* from which to begin the hover/active chain changes.

    Third, we have to explicitly update the hover/active states for
    documents between the updated element and the top-level document.
    The hit-testing logic was taking care of this for us, now we need to
    take care of it ourselves.

    Fourth, call out to updateStyleIfNeeded rather than making our
    caller do so. The calls were always paired; now that's explicit.
(WebCore::Document::prepareMouseEvent):
* page/EventHandler.cpp:
(WebCore::EventHandler::hitTestResultAtPoint):
(WebCore::EventHandler::sendContextMenuEventForKey):
(WebCore::EventHandler::hoverTimerFired):
    Call out to updateHoverActiveState rather than updateStyleIfNeeded.
* rendering/RenderView.cpp:
(WebCore::RenderView::hitTest):
    Drop the call to updateHoverActiveState.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@145126 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Mac] allow iOS to use CaptionUserPreferencesMac
https://bugs.webkit.org/show_bug.cgi?id=111770

Reviewed by Dean Jackson.

No new tests, covered by existing tests.

* page/CaptionUserPreferencesMac.h:
* page/CaptionUserPreferencesMac.mm:
(WebCore::userCaptionPreferencesChangedNotificationCallback): Respond to notifications on
    the web thread.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@145127 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Re-enable Win EWS tests.

* Scripts/webkitpy/tool/commands/earlywarningsystem.py:
(WinEWS):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@145128 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Build fix for AppleWin VS2010.

* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@145129 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EFL] Bump libsoup dependency to 2.40.3 to fix regressions
https://bugs.webkit.org/show_bug.cgi?id=111756

Reviewed by Kenneth Rohde Christiansen.

.:

Update libsoup required version to v2.40.3 for EFL port.

* Source/cmake/OptionsEfl.cmake:

Tools:

Bump libsoup to v2.40.3 to fix the regressions introduced by
previous v2.40.0 bump.

* efl/jhbuild.modules:

LayoutTests:

Unskip several tests that are passing after the libsoup dependency
bump to 2.40.3.

* platform/efl/TestExpectations:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@145130 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[chromium] Stop using WebTransformationMatrix on WebLayer
https://bugs.webkit.org/show_bug.cgi?id=111635

Reviewed by Adrienne Walker.

Source/Platform:

WebLayer supports setting transforms by using either SkMatrix44 or WebTransformationMatrix,
both of which are wrappers around 16 doubles. There's no need to have both.

* chromium/public/WebLayer.h:
(WebKit):
(WebLayer):

Source/WebCore:

Switches over to the SkMatrix44 transform setters.

* platform/graphics/chromium/GraphicsLayerChromium.cpp:
(WebCore::transformToSkMatrix44):
  Utility for convering a WebCore::TransformationMatrix to an SkMatrix44.
  Will move to a more common location once it gets more callers.
(WebCore::GraphicsLayerChromium::updateTransform):
(WebCore::GraphicsLayerChromium::updateChildrenTransform):

Source/WebKit/chromium:

* src/LinkHighlight.cpp:
(WebKit::LinkHighlight::computeEnclosingCompositingLayer):
* tests/GraphicsLayerChromiumTest.cpp:
(GraphicsLayerChromiumTest):

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

* fast/borders/border-fit-expected.txt: Renamed from LayoutTests/platform/chromium/fast/borders/border-fit-expected.txt.
* platform/chromium-mac/fast/borders/border-fit-expected.txt: Renamed from LayoutTests/platform/mac/fast/borders/border-fit-expected.txt.
* platform/chromium-win/fast/borders/border-fit-expected.txt:
* platform/efl/fast/borders/border-fit-expected.txt: Removed.
* platform/gtk/fast/borders/border-fit-expected.txt: Removed.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@145132 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add a didFocusTextField callback to the injected bundle form client
https://bugs.webkit.org/show_bug.cgi?id=111771

Reviewed by Andreas Kling.

Source/WebCore:

Export a symbol needed by WebKit2.

* WebCore.exp.in:

Source/WebKit2:

Add a new client callback that's invoked whenever a text input field is focused.

* Shared/APIClientTraits.cpp:
(WebKit):
* Shared/APIClientTraits.h:
* WebProcess/InjectedBundle/API/c/WKBundlePage.h:
* WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp:
(WebKit::InjectedBundlePageFormClient::didFocusTextField):
(WebKit):
* WebProcess/InjectedBundle/InjectedBundlePageFormClient.h:
(InjectedBundlePageFormClient):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::focusedNodeChanged):

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

* platform/chromium-mac/fast/repaint/border-fit-lines-expected.txt: Renamed from LayoutTests/platform/chromium/fast/repaint/border-fit-lines-expected.txt.
* platform/chromium-win/fast/repaint/border-fit-lines-expected.txt:

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

* platform/chromium/TestExpectations: http/tests/security/cross-origin-css.html

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@145135 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: provide reasons why a layer was composited in the LayerTreeAgent
https://bugs.webkit.org/show_bug.cgi?id=111703

Source/WebCore:

Introduce a new LayerTree.reasonsForCompositingLayer(layerId) method which returns
the list of reasons why the provided layer was composited as an object with an
optional property for each possible reason. The RenderLayerCompositor already knows
how to provide this information via its own reasonsForCompositing() method, and we
process the returned bitmask to populate the object sent to the front-end.

Reviewed by Timothy Hatcher.

Test: inspector-protocol/layers/layers-compositing-reasons.html

* inspector/Inspector.json:
* inspector/InspectorLayerTreeAgent.cpp:
(WebCore::InspectorLayerTreeAgent::reasonsForCompositingLayer):
(WebCore):
* inspector/InspectorLayerTreeAgent.h:
(InspectorLayerTreeAgent):

LayoutTests:

New test for LayerTree.reasonsForCompositingLayer(layerId).

Reviewed by Timothy Hatcher.

* inspector-protocol/layers/layers-compositing-reasons-expected.txt: Added.
* inspector-protocol/layers/layers-compositing-reasons.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@145136 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION: fast/border/border-fit-2.html needs updating
https://bugs.webkit.org/show_bug.cgi?id=111776

Reviewed by Simon Fraser.

Source/WebCore: 

This test is incorrectly shrinking the border image now.
We need to apply some clamping to the border-fit like the
old code did. The pixel results *are* still changing though,
since a layout-time shrinkage will not result in right-aligned
boxes in an LTR block when the left edge gets chopped. We'll
have to see if this behavioral change ends up being a problem,
but for now we'll rebaseline and assume it will be ok.

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::fitBorderToLinesIfNeeded):

LayoutTests: 

* platform/mac/fast/borders/border-fit-2-expected.png:
* platform/mac/fast/borders/border-fit-2-expected.txt:



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

* platform/win/TestExpectations:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@145140 268f45cc-cd09-0410-ab3c-d52691b4dbfc
run-perf-tests fails due to svn_revision not working on a pure git clone
https://bugs.webkit.org/show_bug.cgi?id=110839

Reviewed by Ryosuke Niwa.

Previously we would call git svn find-rev to look up the commit for
a given revision, and that'll hang in a pure git checkout.

This patch changes the way we look up svn revisions in a git
repository to use git log --grep 'git-svn-id', which is much faster
than grepping ourselves. It also renames timestamp_of_latest_commit()
to timestamp_of_revision() in order to accurately reflect what
the method is doing. Note that this patch only changes the logic
inside latest_revision() and svn_revision(). I'll file a separate
bug to change git_commit_from_svn_revision().

This patch also contains some fixes to unit tests that had bit-rotted
or were otherwise fragile, so that test-webkitpy --all would pass
cleanly, and a fix to outputcapture so that
test-webkitpy -p would work correctly again.

* Scripts/webkitpy/common/checkout/scm/git.py:
(Git.svn_revision):
(Git.timestamp_of_revision):
* Scripts/webkitpy/common/checkout/scm/scm.py:
(SCM.svn_revision):
(SCM.timestamp_of_revision):
* Scripts/webkitpy/common/checkout/scm/scm_mock.py:
(MockSCM.timestamp_of_revision):
* Scripts/webkitpy/common/checkout/scm/scm_unittest.py:
(_shared_test_commit_with_message):
(test_commit_without_authorization):
(test_timestamp_of_revision):
* Scripts/webkitpy/common/checkout/scm/svn.py:
(SVN.timestamp_of_revision):
* Scripts/webkitpy/common/system/outputcapture.py:
  Importing unittest2 directly may not be safe if this module is
  imported before the autoinstaller gets a chance to set things up
  properly. We don't actually need unittest2 here.
* Scripts/webkitpy/performance_tests/perftestsrunner.py:
(PerfTestsRunner._generate_results_dict):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@145141 268f45cc-cd09-0410-ab3c-d52691b4dbfc
        FormData should allow setting filename to empty
        https://bugs.webkit.org/show_bug.cgi?id=111687

        Reviewed by Brady Eidson.

        Tests: http/tests/local/formdata/send-form-data-with-empty-blob-filename.html
               http/tests/local/formdata/send-form-data-with-empty-file-filename.html

        * platform/network/FormData.cpp: (WebCore::FormData::appendKeyValuePairItems):
        Missing value is a null string. If the string is empty, we should treat is as
        authoritative.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@145142 268f45cc-cd09-0410-ab3c-d52691b4dbfc
The DFG fixpoint is not strictly profitable, and should be straight-lined
https://bugs.webkit.org/show_bug.cgi?id=111764

Reviewed by Oliver Hunt and Geoffrey Garen.
        
The DFG previously ran optimizations to fixpoint because there exists a circular dependency:
        
CSE depends on CFG simplification: CFG simplification merges blocks, and CSE is block-local.
        
CFG simplification depends on CFA and constant folding: constant folding reveals branches on
constants.
        
CFA depends on CSE: CSE reveals must-alias relationships by proving that two operations
always produce identical values.
        
Arguments simplification also depends on CSE, but it ought not depend on anything else.
        
Hence we get a cycle like: CFA -> folding -> CFG -> CSE -> CFA.
        
Note that before we had sparse conditional CFA, we also had CFA depending on CFG. This ought
not be the case anymore: CFG simplification should not by itself lead to better CFA results.
        
My guess is that the weakest link in this cycle is CFG -> CSE. CSE cuts both ways: if you
CSE too much then you increase register pressure. Hence it's not clear that you always want
to CSE after simplifying control flow. This leads to an order of optimization as follows:
        
CSE -> arguments -> CFA -> folding -> CFG
        
This is a 2.5% speed-up on SunSpider, a 4% speed-up on V8Spider, a possible 0.3% slow-down
on V8v7, nothing on Kraken, and 1.2% speed-up in the JSRegress geomean. I'll take a 2.5%
speed-up over a 0.3% V8v7 speed-up.

* dfg/DFGDriver.cpp:
(JSC::DFG::compile):



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