Fix the iOS build after r172709.

* WebView/WebPDFViewPlaceholder.mm:
(-[WebPDFViewPlaceholder simulateClickOnLinkToURL:]):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@172719 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Mac] Unreviewed merge correction.

* page/mac/EventHandlerMac.mm:
(WebCore::EventHandler::platformCompleteWheelEvent): Revert an
unintended change from r172705.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@172720 268f45cc-cd09-0410-ab3c-d52691b4dbfc
The style is not updated correctly when the pseudo class :empty is applied on anything but the rightmost element
https://bugs.webkit.org/show_bug.cgi?id=135999

Reviewed by Antti Koivisto.

Source/WebCore:

In Element's checkForEmptyStyleChange(), the style invalidation was only considering the invalidation of the element
for which the subtree has changed. When the pseudo class :empty is used with a sibling combinator (e.g. foo:empty+bar),
we were never invalidating the style of the element on which the selector applies.

This patch fixes the issue by invalidating the whole subtree rooted at the parent if the :empty rules applies
to siblings. A new flag "styleOfSiblingsAffectedByEmpty" is introduced to cover this case.

SelectorChecker just sets the flag all the time if any sibling rule exists.
This is overkill but that code is just there for non-jit cases.

SelectorCompiler does a better job and only sets the flag if matching anything else than the rightmost element.
There is a case not optimized, :empty with descendant (e.g. foo:empty>bar). Those cases are useless in practice,
it is not worth optimizing them.

Tests: fast/css/pseudo-element-updates-on-empty.html
       fast/selectors/not-empty-adjacent-style-update.html
       fast/selectors/not-empty-style-update.html

* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::checkOne):
* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::fragmentMatchesTheRightmostElement):
shouldUseRenderStyleFromCheckingContext() is renamed fragmentMatchesTheRightmostElement() because
it is now also used by generateElementIsEmpty() in a context where the Context's style is irrelevant.

(WebCore::SelectorCompiler::SelectorCodeGenerator::generateSelectorChecker):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsActive):
(WebCore::SelectorCompiler::setStyleOfSiblingsAffectedByEmpty):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsEmpty):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsFirstChild):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsHovered):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsLastChild):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsOnlyChild):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthChild):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementHasPseudoElement):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateRequestedPseudoElementEqualsToSelectorPseudoElement):
(WebCore::SelectorCompiler::shouldUseRenderStyleFromCheckingContext): Deleted.
(WebCore::SelectorCompiler::setElementStyleIsAffectedByEmptyAndUpdateRenderStyleIfNecessary): Deleted.
* dom/Element.cpp:
(WebCore::checkForEmptyStyleChange):
(WebCore::Element::setStyleOfSiblingsAffectedByEmpty):
(WebCore::Element::rareDataStyleOfSiblingsAffectedByEmpty):
* dom/Element.h:
(WebCore::Element::styleOfSiblingsAffectedByEmpty):
* dom/ElementRareData.h:
(WebCore::ElementRareData::styleOfSiblingsAffectedByEmpty):
(WebCore::ElementRareData::setStyleOfSiblingsAffectedByEmpty):
(WebCore::ElementRareData::ElementRareData):

LayoutTests:

* fast/css/pseudo-element-updates-on-empty-expected.html: Added.
* fast/css/pseudo-element-updates-on-empty.html: Added.
* fast/selectors/empty-adjacent-style-update-expected.txt:
* fast/selectors/empty-adjacent-style-update.html:
* fast/selectors/empty-style-update-expected.txt:
* fast/selectors/empty-style-update.html:
* fast/selectors/not-empty-adjacent-style-update-expected.txt: Copied from LayoutTests/fast/selectors/empty-adjacent-style-update-expected.txt.
* fast/selectors/not-empty-adjacent-style-update.html: Copied from LayoutTests/fast/selectors/empty-adjacent-style-update.html.
* fast/selectors/not-empty-style-update-expected.txt: Copied from LayoutTests/fast/selectors/empty-style-update-expected.txt.
* fast/selectors/not-empty-style-update.html: Copied from LayoutTests/fast/selectors/empty-style-update.html.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@172721 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: Introduce an inspector Abstract Syntax Tree.
https://bugs.webkit.org/show_bug.cgi?id=135763

Patch by Saam Barati <sbarati@apple.com> on 2014-08-18
Reviewed by Joseph Pecoraro.

This patch adds an Abstract Syntax Tree to the Web inspector.
This syntax tree is modeled off the Esprima.js syntax tree
which complies with the Mozilla Parser API:
https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Parser_API
Script is the owner of the Web Inspector syntax tree, and has an API
for accessing its syntax tree property.

* UserInterface/External/Esprima/esprima.js:
* UserInterface/Main.html:
* UserInterface/Models/Script.js:
(WebInspector.Script):
(WebInspector.Script.prototype.requestScriptSyntaxTree.makeSyntaxTreeAndCallCallback):
(WebInspector.Script.prototype._resolveResource):
(WebInspector.Script.prototype._makeSyntaxTree):
* UserInterface/Models/ScriptSyntaxTree.js: Added.
(WebInspector.ScriptSyntaxTree):
(WebInspector.ScriptSyntaxTree.prototype.get parsedSuccessfully):
(WebInspector.ScriptSyntaxTree.prototype.forEachNode):
(WebInspector.ScriptSyntaxTree.prototype.):
(WebInspector.ScriptSyntaxTree.prototype.filter):
(WebInspector.ScriptSyntaxTree.prototype.filterForNodesInRange):
(WebInspector.ScriptSyntaxTree.prototype.filterByRange):
(WebInspector.ScriptSyntaxTree.prototype.containsNonEmptyReturnStatement.removeFunctionsFilter):
(WebInspector.ScriptSyntaxTree.prototype.containsNonEmptyReturnStatement):
(WebInspector.ScriptSyntaxTree.prototype.updateTypes):
(WebInspector.ScriptSyntaxTree.prototype._defaultParserState):
(WebInspector.ScriptSyntaxTree.prototype._recurse):
(WebInspector.ScriptSyntaxTree.prototype._recurseArray):
(WebInspector.ScriptSyntaxTree.prototype._createInternalSyntaxTree):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@172722 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Implement CanvasRenderingContext2D direction attribute
https://bugs.webkit.org/show_bug.cgi?id=135878

Reviewed by Darin Adler.

Source/WebCore:

The attribute, 'direction', represents the text directionality.
This is an important attribute for the bi-directional text within the CanvasRenderingContext2D.
The allowed set of values are 'rtl', 'ltr' and 'inherit'.

Specification URL: http://www.whatwg.org/specs/web-apps/current-work/multipage/scripting.html#dom-context-2d-direction

Test: fast/canvas/canvas-direction.html

* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::inheritedDirection):
(WebCore::CanvasRenderingContext2D::CanvasRenderingContext2D):
(WebCore::CanvasRenderingContext2D::reset):
(WebCore::CanvasRenderingContext2D::State::State):
(WebCore::CanvasRenderingContext2D::State::operator=):
(WebCore::CanvasRenderingContext2D::direction):
(WebCore::CanvasRenderingContext2D::setDirection):
(WebCore::CanvasRenderingContext2D::drawTextInternal):
* html/canvas/CanvasRenderingContext2D.h:
* html/canvas/CanvasRenderingContext2D.idl:

LayoutTests:

* fast/canvas/canvas-direction-expected.txt: Added.
* fast/canvas/canvas-direction.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@172723 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix resource leak in unclosed file descriptor handles
https://bugs.webkit.org/show_bug.cgi?id=135458

Patch by Przemyslaw Kuczynski <p.kuczynski@samsung.com> on 2014-08-18
Reviewed by Oliver Hunt.

Leaving descriptor unclosed will cause the resources associated with the open
file description never be freed (they are freed on closing the last descriptor
refering to the underlying file).

* Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp:
(WebKit::StdoutDevNullRedirector::StdoutDevNullRedirector): Closed newStdout descriptor.
(WebKit::StdoutDevNullRedirector::~StdoutDevNullRedirector): Closed m_savedStdout descriptor.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@172724 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix unintentional integer overflow before widen
https://bugs.webkit.org/show_bug.cgi?id=135463

Patch by Przemyslaw Kuczynski <p.kuczynski@samsung.com> on 2014-08-18
Reviewed by Oliver Hunt.

Overflowing expression is evaluated using operands arithmetic but then is used in
context which expects an wider integer type. To avoid overflow at least one operand
has to be representative of the wider type.

Source/WebCore:

* loader/FTPDirectoryParser.cpp:
(WebCore::parseOneFTPLine): Changed strtoul to strtoull.
* loader/ProgressTracker.cpp:
(WebCore::ProgressTracker::incrementProgress): Added static_cast to long long.
* platform/efl/FileSystemEfl.cpp:
(WebCore::getVolumeFreeSizeForPath): Added static_cast to uint64_t.

Source/WebKit2:

* WebProcess/soup/WebProcessSoup.cpp:
(WebKit::getMemorySize): Added long long literal.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@172725 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Make update-webkit more lenient for pure git svn repositories
https://bugs.webkit.org/show_bug.cgi?id=135805

Reviewed by Oliver Hunt.

Make the call to git fetch be non fatal. If you have a pure git svn repository, then the
call to git fetch will fail and update-webkit will abort. The purpose of r72966 was to
provide an optimization when you have a git repository setup. We should not fail if the
git setup does not have svn-remote.svn.fetch set.

* Scripts/update-webkit:
(runGitUpdate):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@172726 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION(r168256): JSString can get 8-bit flag wrong when re-using AtomicStrings.
<https://webkit.org/b/133574>
<rdar://problem/18051847>

Source/JavaScriptCore:

The optimization that resolves JSRopeStrings into an existing
AtomicString (to save time and memory by avoiding StringImpl allocation)
had a bug that it wasn't copying the 8-bit flag from the AtomicString.

This could lead to a situation where a 16-bit StringImpl containing
only 8-bit characters is sitting in the AtomicString table, is found
by the rope resolution optimization, and gives you a rope that thinks
it's all 8-bit, but has a fiber with 16-bit characters.

Resolving that rope will then yield incorrect results.

This was all caught by an assertion, but very hard to reproduce.

Test: js/dopey-rope-with-16-bit-propertyname.html

Reviewed by Darin Adler.

* runtime/JSString.cpp:
(JSC::JSRopeString::resolveRopeToAtomicString):
(JSC::JSRopeString::resolveRopeToExistingAtomicString):
* runtime/JSString.h:
(JSC::JSString::setIs8Bit):
(JSC::JSString::toExistingAtomicString):

LayoutTests:

Add a tests that creates a 16-bit AtomicString with only 8-bit characters,
then tiers up into baseline JIT and uses that string as part of a rope-within-a-rope
and serializes that rope to get an incorrect concatenation.

Reviewed by Darin Adler.

* js/dopey-rope-with-16-bit-propertyname-expected.txt: Added.
* js/dopey-rope-with-16-bit-propertyname.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@172727 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Added an update-webkit option to override the ../Internal check.
Part of https://bugs.webkit.org/show_bug.cgi?id=135815

Reviewed by Tim Horton.

* Scripts/update-webkit:
Added an explicit --internal option to control updating ../Internal, defaulting to whether
../Internal exists.
(runSvnUpdate): Moved to webkitdirs.pm.
(runGitUpdate): Ditto.
* Scripts/webkitdirs.pm:
(runSvnUpdateAndResolveChangeLogs): Moved runSvnUpdate from update-webkit and renamed to this.
(runGitUpdate): Moved from update-webkit.



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