HTML parser should not associate elements inside templates with forms
https://bugs.webkit.org/show_bug.cgi?id=117779

Reviewed by Antti Koivisto.

Source/WebCore:

Merge https://chromium.googlesource.com/chromium/blink/+/45aadf7ee7ee010327eb692066cf013315ef3ed7

When parsing <form><template><input>, the previous behavior was to associate the <input> with the <form>,
even though they're not in the same tree (or even the same document).

This patch changes that by checking, prior to creating a form control element, whether the element to be
created lives in a document with a browsing context.

We don't update m_form as needed to faithfully match the HTML5 specification's form element pointer
http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#form-element-pointer
and its algorithm for creating and inserting nodes:
http://www.whatwg.org/specs/web-apps/current-work/multipage/tree-construction.html#creating-and-inserting-nodes

While this leaves isindex's reference to form element pointer stale:
http://www.whatwg.org/specs/web-apps/current-work/multipage/tree-construction.html#isindex
The HTML5 specification matches the behaviors of Chrome and Firefox so we leave it as is.

Test: fast/dom/HTMLTemplateElement/no-form-association.html

* html/parser/HTMLConstructionSite.cpp:
(WebCore::HTMLConstructionSite::createHTMLElement):

LayoutTests:

* fast/dom/HTMLTemplateElement/no-form-association-expected.txt: Added.
* fast/dom/HTMLTemplateElement/no-form-association.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159618 268f45cc-cd09-0410-ab3c-d52691b4dbfc
nextBoundary and previousBoundary are very slow when there is a password field
https://bugs.webkit.org/show_bug.cgi?id=123973

Reviewed by Antti Koivisto.

Source/WebCore:

Merge https://chromium.googlesource.com/chromium/blink/+/57366eec5e3edea54062d4e74c0e047f8681dbad

When iterating through DOM nodes nextBoundary and previousBoundary convert the contents of nodes using
text security to a sequence of 'x' characters. The SimplifiedBackwardsTextIterator and TextIterator
may iterate past node boundaries. Before this patch, the transformation was done looking at the starting
node rather than the current node. In some situations, this replaced all boundaries with 'x' and caused
the text iterator to continue iterating and transforming until the extent of the document.

Test: editing/deleting/password-delete-performance.html

* editing/TextIterator.h:
(WebCore::SimplifiedBackwardsTextIterator::node):
* editing/VisibleUnits.cpp:
(WebCore::previousBoundary):
(WebCore::nextBoundary):

LayoutTests:

* editing/deleting/password-delete-performance-expected.txt: Added.
* editing/deleting/password-delete-performance.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159619 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix Range.insertNode when the inserted node is in the same container as the Range
https://bugs.webkit.org/show_bug.cgi?id=123957

Reviewed by Antti Koivisto.

Source/WebCore:

Inspired by https://chromium.googlesource.com/chromium/blink/+/fb6ca1f488703e8d4f20ce6449cc8ea210be6edb

When a node from the same container is inserted, we can't simply adjust m_end with the offset.
Compute m_start and m_end from the inserted nodes instead.

Also, don't adjust m_start and m_end to nodes outside of the document if the inserted nodes had been
removed by mutation events.

Test: fast/dom/Range/range-insertNode-same-container.html

* dom/Range.cpp:
(WebCore::Range::insertNode):

LayoutTests:

Merge https://chromium.googlesource.com/chromium/blink/+/fb6ca1f488703e8d4f20ce6449cc8ea210be6edb

Used better labels between divs, and added more evalAndLog and shouldBe so that
the expected result is self-explanatory.

* fast/dom/Range/range-insertNode-same-container-expected.txt: Added.
* fast/dom/Range/range-insertNode-same-container.html: Added.


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

Update baselines after r159575.

* platform/efl/fast/block/float/024-expected.txt:
* platform/efl/fast/block/margin-collapse/025-expected.txt:
* platform/efl/fast/block/margin-collapse/block-inside-inline/025-expected.txt:
* platform/efl/fast/block/margin-collapse/empty-clear-blocks-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159621 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EFL] Fix accessibility media-element expectation
https://bugs.webkit.org/show_bug.cgi?id=124711

Unreviewed EFL gardening.

Changing main element AXRole AXUnknown -> AXEmbedded.

Patch by Andrzej Badowski <a.badowski@samsung.com> on 2013-11-21

* platform/efl/accessibility/media-element-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159622 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] Release compilation fails when defining "LOG_DISABLED=0"
https://bugs.webkit.org/show_bug.cgi?id=124661

Patch by Andres Gomez <agomez@igalia.com> on 2013-11-21
Reviewed by Mario Sanchez Prada.

In a "Debug" build the CString.h header comes from another
indirect dependency. Now, we explicitly add this missing include.

* html/HTMLTrackElement.cpp: Explicitly adding missing include.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159623 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Added test for visual overflow with transformed content in regions.

[CSS Regions] Transform applied to content node causes overflow to be hidden
https://bugs.webkit.org/show_bug.cgi?id=116242

Reviewed by Antti Koivisto.

* fast/regions/region-visual-overflow-transform-expected.html: Added.
* fast/regions/region-visual-overflow-transform.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159624 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Created test for positioned fragmented content which overflows the regions.

[CSS Regions] Fragmented content that is relatively positioned get sliced (and overflows in the next region)
https://bugs.webkit.org/show_bug.cgi?id=117122

Reviewed by Antti Koivisto.

* fast/regions/positioned-fragmented-content-expected.html: Added.
* fast/regions/positioned-fragmented-content.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159625 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix hover area for divs with css transforms
https://bugs.webkit.org/show_bug.cgi?id=124647

Patch by Mihai Maerean <mmaerean@adobe.com> on 2013-11-21
Reviewed by Allan Sandfeld Jensen.

Source/WebCore:

Non transformed layers are now being hit last, not through or in-between transformed layers.
The paint order says that the divs creating stacking contexts (including transforms) are painted after the
other siblings so they should be hit tested in the reverse order. Also, a rotated div in a non-rotated parent
should be hit in its entire area, not hit its parent's background, even if the z-coordinate is negative where
the mouse is located.

Test: transforms/3d/hit-testing/hover-rotated-negative-z.html

* rendering/RenderLayer.cpp:
(WebCore::computeZOffset):

LayoutTests:

* transforms/3d/hit-testing/hover-rotated-negative-z.html: Added.
* transforms/3d/hit-testing/hover-rotated-negative-z-expected.txt: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159626 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CSS Regions] Float get sliced if its container has forced break and is less tall than float
https://bugs.webkit.org/show_bug.cgi?id=124205

Added test for the case when a float is overflowing a region due to a forced break.

Reviewed by Antti Koivisto.

* fast/regions/float-slicing-on-forced-break-expected.html: Added.
* fast/regions/float-slicing-on-forced-break.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159627 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Added test for the overflow of a region being painted across multiple tiles.
Added test for correct repainting of a region's overflow.

[CSS Regions] Overflow areas from regions do not redraw
https://bugs.webkit.org/show_bug.cgi?id=117329

Reviewed by Antti Koivisto.

* fast/regions/regions-overflow-tile-expected.html: Added.
* fast/regions/regions-overflow-tile.html: Added.
* fast/repaint/repaint-regions-overflow-expected.txt: Added.
* fast/repaint/repaint-regions-overflow.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159628 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix sh4 build after r159545.
https://bugs.webkit.org/show_bug.cgi?id=124713

Patch by Julien Brianceau <jbriance@cisco.com> on 2013-11-21
Reviewed by Michael Saboff.

Add missing implementations in macro assembler and LLINT for sh4.

* assembler/MacroAssemblerSH4.h:
(JSC::MacroAssemblerSH4::load8):
(JSC::MacroAssemblerSH4::store8):
(JSC::MacroAssemblerSH4::memoryFence):
* assembler/SH4Assembler.h:
(JSC::SH4Assembler::synco):
* offlineasm/sh4.rb: Handle "memfence" opcode.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159629 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WinCairo] Building ANGLE libraries fails.
https://bugs.webkit.org/show_bug.cgi?id=124679

Patch by peavo@outlook.com <peavo@outlook.com> on 2013-11-21
Reviewed by Brent Fulgham.

Source/ThirdParty/ANGLE:

Added/removed files to/from project, and re-added constants.h file.

* ANGLE.vcxproj/libEGL.vcxproj:
* ANGLE.vcxproj/libEGL.vcxproj.filters:
* ANGLE.vcxproj/libGLESv2.vcxproj:
* ANGLE.vcxproj/libGLESv2.vcxproj.filters:
* ANGLE.vcxproj/libGLESv2Common.props:
* ANGLE.vcxproj/translator_common.vcxproj:
* ANGLE.vcxproj/translator_common.vcxproj.filters:
* ANGLE.vcxproj/translator_glsl.vcxproj:
* ANGLE.vcxproj/translator_glsl.vcxproj.filters:
* ANGLE.vcxproj/translator_hlsl.vcxproj:
* ANGLE.vcxproj/translator_hlsl.vcxproj.filters:
* src/libGLESv2/libGLESv2.def:

Source/WebKit:

* WebKit.vcxproj/WebKit/WebKitCFLite.props: Link with translator_hlsl.lib.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159630 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Reverted r159603, as it appears to have caused Safari’s Web processes to crash on launch.

Requested by Sam Weinig.

* Scripts/webkit2/messages.py:
(struct_or_class):
* Shared/UserMessageCoders.h:
(WebKit::UserMessageEncoder::baseEncode):
* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
* Shared/mac/ObjCObjectGraphCoders.h:
* Shared/mac/ObjCObjectGraphCoders.mm:
(WebKit::ObjCObjectGraphEncoder::baseEncode):
(WebKit::WebContextObjCObjectGraphEncoderImpl::WebContextObjCObjectGraphEncoderImpl):
(WebKit::WebContextObjCObjectGraphEncoderImpl::encode):
(WebKit::InjectedBundleObjCObjectGraphEncoderImpl::encode):
(WebKit::WebContextObjCObjectGraphEncoder::WebContextObjCObjectGraphEncoder):
(WebKit::WebContextObjCObjectGraphEncoder::encode):
* UIProcess/WebConnectionToWebProcess.cpp:
(WebKit::WebConnectionToWebProcess::encodeMessageBody):
* UIProcess/WebContext.cpp:
(WebKit::WebContext::createNewWebProcess):
(WebKit::WebContext::createWebPage):
(WebKit::WebContext::postMessageToInjectedBundle):
(WebKit::WebContext::didReceiveSyncMessage):
* UIProcess/WebContextUserMessageCoders.h:
(WebKit::WebContextUserMessageEncoder::WebContextUserMessageEncoder):
(WebKit::WebContextUserMessageEncoder::encode):
(WebKit::WebContextUserMessageDecoder::decode):
* UIProcess/WebPageGroup.cpp:
* UIProcess/WebPageGroup.h:
(WebKit::WebPageGroup::sendToAllProcessesInGroup):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::create):
(WebKit::WebPageProxy::WebPageProxy):
(WebKit::WebPageProxy::initializeWebPage):
(WebKit::WebPageProxy::loadURL):
(WebKit::WebPageProxy::loadURLRequest):
(WebKit::WebPageProxy::loadFile):
(WebKit::WebPageProxy::loadData):
(WebKit::WebPageProxy::loadHTMLString):
(WebKit::WebPageProxy::loadAlternateHTMLString):
(WebKit::WebPageProxy::loadPlainTextString):
(WebKit::WebPageProxy::loadWebArchiveData):
(WebKit::WebPageProxy::postMessageToInjectedBundle):
(WebKit::WebPageProxy::initializeCreationParameters):
* UIProcess/WebPageProxy.h:
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::disconnect):
(WebKit::WebProcessProxy::createWebPage):
* UIProcess/WebProcessProxy.h:
* WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h:
(WebKit::InjectedBundleUserMessageEncoder::encode):
(WebKit::InjectedBundleUserMessageDecoder::decode):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::webPageGroup):
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159631 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[curl]Improve ssl certificate storage and check
https://bugs.webkit.org/show_bug.cgi?id=124569

Patch by Robert Sipka <sipka@inf.u-szeged.hu> on 2013-11-21
Reviewed by Brent Fulgham.

Storage and check the whole certificate chain, not just the root certificate.

* platform/network/curl/SSLHandle.cpp:
(WebCore::allowsAnyHTTPSCertificateHosts):
(WebCore::sslIgnoreHTTPSCertificate):
(WebCore::pemData):
(WebCore::certVerifyCallback):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159632 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Remove the stderr_write attribute from StyleProcessorConfiguration.
https://bugs.webkit.org/show_bug.cgi?id=124703

Patch by László Langó <lango@inf.u-szeged.hu> on 2013-11-21
Reviewed by Brent Fulgham.

* Scripts/webkitpy/style/checker.py:
(check_webkit_style_configuration):
(CheckerDispatcher.dispatch):
(StyleProcessorConfiguration):
(StyleProcessorConfiguration.__init__):
(StyleProcessorConfiguration.write_style_error):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159633 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Clean up WebKit2 initialization
https://bugs.webkit.org/show_bug.cgi?id=124696

Reviewed by Sam Weinig.

Call InitializeWebKit2() everywhere we need to do one-time
initialization in WebKit2, rather than having a hotch-potch
of init code.

* Shared/APIObject.cpp:
(API::Object::Object):
* UIProcess/API/mac/WKView.mm:
(-[WKView initWithFrame:contextRef:pageGroupRef:relatedToPage:]):
* UIProcess/Launcher/mac/ProcessLauncherMac.mm: Removed an unused #include.
* UIProcess/WebContext.cpp:
(WebKit::WebContext::create):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159634 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[MIPS] Build fails since r159545.
https://bugs.webkit.org/show_bug.cgi?id=124716

Patch by Balazs Kilvady <kilvadyb@homejinni.com> on 2013-11-21
Reviewed by Michael Saboff.

Add missing implementations in MacroAssembler and LLInt for MIPS.

* assembler/MIPSAssembler.h:
(JSC::MIPSAssembler::sync):
* assembler/MacroAssemblerMIPS.h:
(JSC::MacroAssemblerMIPS::store8):
(JSC::MacroAssemblerMIPS::memoryFence):
* offlineasm/mips.rb:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159635 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed, rolling out r159633.
http://trac.webkit.org/changeset/159633
https://bugs.webkit.org/show_bug.cgi?id=124726

it broke 10 webkitpy tests (Requested by dino_ on #webkit).

* Scripts/webkitpy/style/checker.py:
(check_webkit_style_configuration):
(CheckerDispatcher.dispatch):
(StyleProcessorConfiguration):
(StyleProcessorConfiguration.__init__):
(StyleProcessorConfiguration.write_style_error):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159636 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Implement WebCrypto unwrapKey
https://bugs.webkit.org/show_bug.cgi?id=124725

Reviewed by Anders Carlsson.

Source/WebCore: 

Tests: crypto/subtle/aes-cbc-unwrap-failure.html
       crypto/subtle/aes-cbc-unwrap-rsa.html

* bindings/js/JSCryptoAlgorithmDictionary.cpp:
* bindings/js/JSCryptoAlgorithmDictionary.h:
Removed calls for wrap/unwrap parameter parsing, these are just the same as encrypt/decrypt.

* bindings/js/JSCryptoOperationData.cpp:
(WebCore::cryptoOperationDataFromJSValue):
* bindings/js/JSCryptoOperationData.h:
* crypto/CryptoKeySerialization.h:
More Vector<char> elimination.

* bindings/js/JSDOMPromise.cpp:
* bindings/js/JSDOMPromise.h:
Removed unneccessary copy constructor and assignment operator, they are no diffdrent
than compiler generated ones.

* bindings/js/JSSubtleCryptoCustom.cpp:
(WebCore::cryptoKeyUsagesFromJSValue): Minor style fixes.
(WebCore::JSSubtleCrypto::encrypt): Ditto.
(WebCore::JSSubtleCrypto::decrypt): Ditto.
(WebCore::JSSubtleCrypto::sign): Ditto.
(WebCore::JSSubtleCrypto::verify): Ditto.
(WebCore::JSSubtleCrypto::generateKey): Ditto.
(WebCore::importKey): Separated actual import operation and the parts that read
arguments from ExecState, and call the promise. Logically, this should be outside
of bindings code even, but JWK makes that quite challenging.
(WebCore::JSSubtleCrypto::importKey): This only does the more mundane arguments
and return parts now.
(WebCore::JSSubtleCrypto::exportKey): Minor style fixes.
(WebCore::JSSubtleCrypto::unwrapKey): Chain decrypt and import.

* crypto/CryptoAlgorithm.cpp:
(WebCore::CryptoAlgorithm::encryptForWrapKey):
(WebCore::CryptoAlgorithm::decryptForUnwrapKey):
* crypto/CryptoAlgorithm.h:
There are algorithms that expose wrap/unwrap, but not encrypt/decrypt. These will
override these new functions, and leave encrypt/decrypt to raise NOT_SUPPORTED_ERR.

* crypto/SubtleCrypto.idl: Added unwrapKey.

LayoutTests: 

* crypto/subtle/aes-cbc-unwrap-failure-expected.txt: Added.
* crypto/subtle/aes-cbc-unwrap-failure.html: Added.
* crypto/subtle/aes-cbc-unwrap-rsa-expected.txt: Added.
* crypto/subtle/aes-cbc-unwrap-rsa.html: Added.



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