Add local to/from operand helpers similar to argument to/from operand2
https://bugs.webkit.org/show_bug.cgi?id=121056

Reviewed by Geoffrey Garen.

Added localToOperand(), operandToLocal() and operandIsLocal() to Operands.h, very similar to
argumentToOperand(), et al.  Used the new helpers everywhere where an index into a data
structure is intended instead of the actual virtual register offset.  When the stack is
changed to grow down, local register offsets can be negative.  Also added the helper
DFG::SpeculativeJIT::generationInfoFromVirtualRegister() for the common case accessing 
m_generationInfo[operandToLocal(val)].

* bytecode/CodeBlock.cpp:
* bytecode/CodeBlock.h:
* bytecode/Operands.h:
(JSC::localToOperand):
(JSC::operandIsLocal):
(JSC::operandToLocal):
* bytecompiler/BytecodeGenerator.h:
* dfg/DFGAbstractInterpreterInlines.h:
* dfg/DFGByteCodeParser.cpp:
* dfg/DFGCFGSimplificationPhase.cpp:
* dfg/DFGCPSRethreadingPhase.cpp:
* dfg/DFGOSREntry.cpp:
* dfg/DFGOSRExitCompiler32_64.cpp:
* dfg/DFGOSRExitCompiler64.cpp:
* dfg/DFGScoreBoard.h:
* dfg/DFGSpeculativeJIT.cpp:
* dfg/DFGSpeculativeJIT.h:
(JSC::DFG::SpeculativeJIT::generationInfoFromVirtualRegister):
* dfg/DFGSpeculativeJIT32_64.cpp:
* dfg/DFGSpeculativeJIT64.cpp:
* dfg/DFGValidate.cpp:
* dfg/DFGVariableEventStream.cpp:
* dfg/DFGVirtualRegisterAllocationPhase.cpp:
* jit/JITInlines.h:
* jit/JITOpcodes.cpp:
* jit/JITOpcodes32_64.cpp:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155415 268f45cc-cd09-0410-ab3c-d52691b4dbfc
ScriptRunner should have a Document& internally.
<https://webkit.org/b/121072>

Reviewed by Anders Carlsson.

Change ScriptRunner::m_document to a reference since it's tied to
the lifetime of the Document.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155416 268f45cc-cd09-0410-ab3c-d52691b4dbfc
ScriptController should have a Frame& internally.
<https://webkit.org/b/121071>

Reviewed by Anders Carlsson.

Change ScriptController::m_frame to a reference since it's tied to
the lifetime of the owning Frame.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155417 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Change virtual register function arguments from unsigned to int
https://bugs.webkit.org/show_bug.cgi?id=121055

Reviewed by Filip Pizlo.

This is a largely mechanical change.  This changes function paramaters and local variables used to
represent bytecode operands from being unsigned to be int.

* bytecode/CodeOrigin.h:
* dfg/DFGByteCodeParser.cpp:
* jit/JIT.h:
* jit/JITArithmetic.cpp:
* jit/JITArithmetic32_64.cpp:
* jit/JITInlines.h:
* jit/JITOpcodes.cpp:
* jit/JITOpcodes32_64.cpp:
* jit/JITPropertyAccess.cpp:
* jit/JITPropertyAccess32_64.cpp:
* jit/JITStubCall.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155418 268f45cc-cd09-0410-ab3c-d52691b4dbfc
HTMLTextAreaElement no longer needs custom style resolve callbacks.
<https://webkit.org/b/121073>

Reviewed by Ryosuke Niwa.

After r155408 HTMLTextAreaElement doesn't override didAttachRenderer() anymore,
so we don't need to fire callbacks on textarea elements during style resolve.

* html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::HTMLTextAreaElement):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155419 268f45cc-cd09-0410-ab3c-d52691b4dbfc
There should be one "invalid" virtual register constant
https://bugs.webkit.org/show_bug.cgi?id=121057

Reviewed by Filip Pizlo.

Unify all references to an invalid virtual register to be the enum InvalidVirtualRegister.
Changed the value of InvalidVirtualRegister to be maximum integer value.

* bytecode/CodeBlock.h:
(JSC::CodeBlock::setArgumentsRegister):
(JSC::CodeBlock::usesArguments):
* bytecode/LazyOperandValueProfile.h:
(JSC::LazyOperandValueProfileKey::LazyOperandValueProfileKey):
(JSC::LazyOperandValueProfileKey::operator!):
(JSC::LazyOperandValueProfileKey::isHashTableDeletedValue):
(JSC::LazyOperandValueProfile::LazyOperandValueProfile):
* bytecode/UnlinkedCodeBlock.cpp:
(JSC::UnlinkedCodeBlock::UnlinkedCodeBlock):
* bytecode/UnlinkedCodeBlock.h:
(JSC::UnlinkedCodeBlock::usesArguments):
(JSC::UnlinkedCodeBlock::usesGlobalObject):
* bytecode/VirtualRegister.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155420 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Remove unreviewed gunk I just accidentally committed :|

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155421 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Adding "explicit" keyword in DOM related classes constructor
https://bugs.webkit.org/show_bug.cgi?id=121031

Patch by Santosh Mahto <santosh.ma@samsung.com> on 2013-09-09
Reviewed by Ryosuke Niwa.

Added the explicit keyword in constructors.

* dom/ActiveDOMObject.h:
* dom/ContainerNode.h:
* dom/DocumentStyleSheetCollection.h:
* dom/ElementAncestorIterator.h:
* dom/ElementData.h:
* dom/ElementRareData.h:
* dom/EventListenerMap.h:
* dom/QualifiedName.h:
(WebCore::QualifiedName::QualifiedName):
* dom/TreeScope.h:
* dom/ViewportArguments.h:
(WebCore::ViewportArguments::ViewportArguments):
* dom/VisitedLinkState.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155422 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Remove more references to the deleted js-test-style.css.
https://bugs.webkit.org/show_bug.cgi?id=120899.

Reviewed by Ryosuke Niwa.

Tools: 

* Scripts/webkitpy/to_be_moved/update_webgl_conformance_tests.py:
(translate_includes):

LayoutTests: 

* fast/canvas/webgl/array-unit-tests.html:
* fast/canvas/webgl/context-lost-restored.html:
* fast/canvas/webgl/context-lost.html:
* fast/canvas/webgl/typed-arrays-in-workers.html:
* fast/css/aspect-ratio-parsing-tests.html:
* fast/forms/fieldset/fieldset-disabled.html:
* fast/js/apply-varargs.html:
* fast/js/line-column-numbers.html:
* fast/js/stack-at-creation-for-error-objects.html:
* fast/js/stack-trace.html:
* platform/iphone-simulator/accessibility/accessibility-aria-table-children.html:
* platform/iphone-simulator/accessibility/accessibility-crash-in-axcontainer.html:
* platform/iphone-simulator/accessibility/accessibility-hint.html:
* platform/iphone-simulator/accessibility/aria-label-with-internal-text.html:
* platform/iphone-simulator/accessibility/aria-pressed-state.html:
* platform/iphone-simulator/accessibility/centerpoint.html:
* platform/iphone-simulator/accessibility/file-upload-button.html:
* platform/iphone-simulator/accessibility/focus-change-notifications.html:
* platform/iphone-simulator/accessibility/header-elements.html:
* platform/iphone-simulator/accessibility/identifier.html:
* platform/iphone-simulator/accessibility/internal-link.html:
* platform/iphone-simulator/accessibility/landmark-type.html:
* platform/iphone-simulator/accessibility/link-with-images-text.html:
* platform/iphone-simulator/accessibility/link-with-only-image.html:
* platform/iphone-simulator/accessibility/math.html:
* platform/iphone-simulator/accessibility/mixed-checkboxes.html:
* platform/iphone-simulator/accessibility/password-value.html:
* platform/iphone-simulator/accessibility/placeholder-value.html:
* platform/iphone-simulator/accessibility/popup-button-value-label.html:
* platform/iphone-simulator/accessibility/progressbar.html:
* platform/iphone-simulator/accessibility/selected-buttons.html:
* platform/iphone-simulator/accessibility/selected-text.html:
* platform/iphone-simulator/accessibility/svg-path-crash.html:
* platform/iphone-simulator/accessibility/tab-role.html:
* platform/iphone-simulator/accessibility/table-cell-for-row-col.html:
* platform/iphone-simulator/accessibility/table-cell-ranges.html:
* platform/iphone-simulator/accessibility/tables-lists.html:
* platform/iphone-simulator/accessibility/text-line-no-ignored-elements.html:
* platform/iphone-simulator/accessibility/text-marker-list-item.html:
* platform/iphone-simulator/accessibility/text-marker-validation.html:
* platform/iphone-simulator/accessibility/text-role.html:
* platform/iphone-simulator/accessibility/textfield-in-axvalue.html:
* platform/iphone-simulator/accessibility/url-test.html:
* platform/mac/accessibility/document-title-used-for-description.html:
* platform/mac/accessibility/iframe-aria-hidden.html:
* platform/mac/accessibility/scrollbars.html:
* platform/mac/accessibility/search-with-frames.html:
* platform/mac/accessibility/selected-tab-crash.html:
* platform/mac/accessibility/submit-button-default-value.html:
* platform/mac/accessibility/supports-focus-setting.html:
* platform/mac/fast/forms/input-appearance-spinbutton-up.html:
* platform/mac/fast/forms/input-appearance-spinbutton.html:
* svg/dom/css-transforms.xhtml:
* svg/dynamic-updates/SVG-dynamic-css-transform.html:
* svg/dynamic-updates/SVGClipPathElement-css-transform-influences-hitTesting.html:
* webaudio/audiobuffersource-loop-comprehensive.html:
* webaudio/audiobuffersource-start.html:
* webaudio/audioparam-connect-audioratesignal.html:
* webaudio/audioparam-summingjunction.html:
* webaudio/biquad-allpass.html:
* webaudio/biquad-bandpass.html:
* webaudio/biquad-highpass.html:
* webaudio/biquad-highshelf.html:
* webaudio/biquad-lowpass.html:
* webaudio/biquad-lowshelf.html:
* webaudio/biquad-notch.html:
* webaudio/biquad-peaking.html:
* webaudio/convolution-mono-mono.html:
* webaudio/convolver-setBuffer-null.html:
* webaudio/distance-exponential.html:
* webaudio/distance-inverse.html:
* webaudio/distance-linear.html:
* webaudio/javascriptaudionode-zero-input-channels.html:
* webaudio/oscillator-basic.html:
* webaudio/panner-equalpower-stereo.html:
* webaudio/panner-equalpower.html:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155423 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Some refinements in FrameView::layout
https://bugs.webkit.org/show_bug.cgi?id=121076

Reviewed by Andreas Kling.

* page/FrameView.cpp:
(WebCore::FrameView::layout): Use a reference for the document in
this function since code assumes it's non-null anyway. Change code to
only call styleResolverIfExists once. Rewrite comments about blocks
and the scopes they create for better clarity. Make m_nestedLayoutCount
easier to read. Use HTMLElement* for the pointer to the body element.
Moved the call to calculateScrollbarModesForLayout in so we don't
waste time doing it for subtree layouts. Get rid of the unhelpful
currentHMode and currentVMode local variables. Get rid of an extra
block scope we did not need.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155424 268f45cc-cd09-0410-ab3c-d52691b4dbfc
When deleting editable content, typing style should be reset when moving into another node.
https://bugs.webkit.org/show_bug.cgi?id=120726

Reviewed by Ryosuke Niwa.

Source/WebCore:

When moving from one text node to the other, while deleting characters,
the deleted text node's style was being applied to any new characters
added into the existing text node.

Typing Style in the frame selection maintains the editing style for the
deleted text node, so that if new characters are inserted at the position
of the deleted text node, it's style can be applied to them.

However, when moving into another text node, we should reset or clear the
typing style maintained by the frame selection. This ensures that any new
content inserted within the existing node does not take on any uncleared
style of the deleted node.

Test: editing/deleting/maintain-style-after-delete.html

* editing/DeleteSelectionCommand.cpp:
(WebCore::DeleteSelectionCommand::saveTypingStyleState):
Calling clearTypingStyle() on frame selection whenever deletion occurs
within the same text node. Thus any existing typing styleh held by the
frame selection shall be cleared.

LayoutTests:

* editing/deleting/maintain-style-after-delete-expected.txt: Added.
* editing/deleting/maintain-style-after-delete.html: Added.
Testcase added for verifying that style of the text node being deleted
is maintained.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155425 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] Test /webkit/atk/getTextInParagraphAndBodyModerate fails
https://bugs.webkit.org/show_bug.cgi?id=105538

Reviewed by Chris Fleizach.

Source/WebCore:

Expose '\n' for linebreaks when they were explicitly set by the
author of the web content with a <br> tag.

Tests: accessibility/paragraph-with-linebreaks.html

* accessibility/AccessibilityNodeObject.cpp:
(WebCore::shouldAddSpaceBeforeAppendingNextElement): Helper
function to decide when to append spaces when building the text
under an element, considering line breaks.
(WebCore::AccessibilityNodeObject::textUnderElement): Use the
shouldAddSpaceBeforeAppendingNextElement() function here.
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::textUnderElement): Return the
renderer's text for accessibility objects exposing <br> elements.
* html/parser/HTMLParserIdioms.h:
(WebCore::isHTMLSpaceButNotLineBreak): New helper function, useful
to be passed to other functions like simplifyWhiteSpace().

Tools:

Unskip passing test getTextInParagraphAndBodyModerate.

* Scripts/run-gtk-tests:
(TestRunner): Unskip pasing test.

LayoutTests:

Added new Layout test and platform specific expectations.

* platform/efl/accessibility/paragraph-with-linebreaks-expected.txt: Added.
* platform/gtk/accessibility/paragraph-with-linebreaks-expected.txt: Added.
* accessibility/paragraph-with-linebreaks.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155428 268f45cc-cd09-0410-ab3c-d52691b4dbfc
toFooElement() should use static_cast, not reinterpret_cast.
<https://webkit.org/b/121087>

Reviewed by Antti Koivisto.

reinterpret_cast is not safe for downcasting with multiple inheritance.
Add a ELEMENT_TYPE_CASTS(classname) macro that goes after class definitions.
It expands into the following methods:

    - FooElement* toFooElement(Node*)
    - const FooElement* toFooElement(const Node*)
    - FooElement& toFooElement(Node&)
    - const FooElement& toFooElement(const Node&)

As a bonus, it also adds these to catch unnecessary casting:

    - void toFooElement(const Node*)
    - void toFooElement(const Node&)

There might be a more clever way of doing this, but this gets us to a
correct place so we can think in peace.

* bridge/qt/qt_pixmapruntime.cpp:
(JSC::Bindings::assignToHTMLImageElement):
(JSC::Bindings::QtPixmapRuntime::toQt):
* dom/Element.h:
(WebCore::isElement):
* dom/make_names.pl:
(printTypeHelpers):
* html/HTMLAnchorElement.h:
* html/HTMLAreaElement.h:
* html/HTMLAudioElement.h:
* html/HTMLBaseElement.h:
* html/HTMLCanvasElement.h:
* html/HTMLElement.h:
(WebCore::isHTMLElement):
* html/HTMLFieldSetElement.h:
* html/HTMLFormElement.h:
* html/HTMLFrameSetElement.h:
* html/HTMLImageElement.h:
* html/HTMLInputElement.h:
* html/HTMLLabelElement.h:
* html/HTMLLegendElement.h:
* html/HTMLMapElement.h:
* html/HTMLMeterElement.h:
* html/HTMLOptGroupElement.h:
* html/HTMLOptionElement.h:
* html/HTMLParamElement.h:
* html/HTMLProgressElement.h:
* html/HTMLScriptElement.h:
* html/HTMLSourceElement.h:
* html/HTMLStyleElement.h:
* html/HTMLTableElement.h:
* html/HTMLTableRowElement.h:
* html/HTMLTextAreaElement.h:
* html/HTMLTitleElement.h:
* html/HTMLTrackElement.h:
* svg/SVGAltGlyphDefElement.h:
* svg/SVGAltGlyphElement.h:
* svg/SVGAltGlyphItemElement.h:
* svg/SVGAnimateMotionElement.h:
* svg/SVGAnimateTransformElement.h:
* svg/SVGCircleElement.h:
* svg/SVGClipPathElement.h:
* svg/SVGCursorElement.h:
* svg/SVGEllipseElement.h:
* svg/SVGFEDistantLightElement.h:
* svg/SVGFEFuncAElement.h:
* svg/SVGFEFuncBElement.h:
* svg/SVGFEFuncGElement.h:
* svg/SVGFEFuncRElement.h:
* svg/SVGFEMergeNodeElement.h:
* svg/SVGFEPointLightElement.h:
* svg/SVGFESpotLightElement.h:
* svg/SVGFilterElement.h:
* svg/SVGFontElement.h:
* svg/SVGFontFaceElement.h:
* svg/SVGFontFaceNameElement.h:
* svg/SVGFontFaceSrcElement.h:
* svg/SVGFontFaceUriElement.h:
* svg/SVGForeignObjectElement.h:
* svg/SVGGlyphElement.h:
* svg/SVGGlyphRefElement.h:
* svg/SVGHKernElement.h:
* svg/SVGImageElement.h:
* svg/SVGLineElement.h:
* svg/SVGLinearGradientElement.h:
* svg/SVGMPathElement.h:
* svg/SVGMarkerElement.h:
* svg/SVGMaskElement.h:
* svg/SVGMissingGlyphElement.h:
* svg/SVGPathElement.h:
* svg/SVGPatternElement.h:
* svg/SVGRadialGradientElement.h:
* svg/SVGRectElement.h:
* svg/SVGSVGElement.h:
* svg/SVGScriptElement.h:
* svg/SVGStyleElement.h:
* svg/SVGTextElement.h:
* svg/SVGTextPathElement.h:
* svg/SVGTitleElement.h:
* svg/SVGUseElement.h:
* svg/SVGVKernElement.h:
* svg/SVGViewElement.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155429 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] /webkit2/WebKitWebView/default-menu fails when GtkSettings:gtk-show-input-method-menu is disabled
https://bugs.webkit.org/show_bug.cgi?id=121088

Reviewed by Xan Lopez.

* UIProcess/API/gtk/tests/TestContextMenu.cpp: Always check
Unicode submenu is present in default context menu for editable
content.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155430 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed. Add myself as a committer.

* Scripts/webkitpy/common/config/contributors.json:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155431 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed. Add myself as a committer.

Patch by Michał Pakuła vel Rutka <m.pakula@samsung.com> on 2013-09-10

* Scripts/webkitpy/common/config/contributors.json:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155432 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Qt] make use of qtHaveModule()
https://bugs.webkit.org/show_bug.cgi?id=121090

Reviewed by Jocelyn Turcotte.

Use qtHaveModule instead of our own haveQtModule.

Source/WebKit2:

* WebProcess.pro:

Tools:

* QtTestBrowser/QtTestBrowser.pro:
* qmake/mkspecs/features/configure.prf:
* qmake/mkspecs/features/features.prf:
* qmake/mkspecs/features/functions.prf:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155433 268f45cc-cd09-0410-ab3c-d52691b4dbfc
MediaStream API: Enhance MediaStreamDescriptor add/remove component
https://bugs.webkit.org/show_bug.cgi?id=120874

Merge blink https://chromium.googlesource.com/chromium/blink/+/67fcacf13ce922a762d7a1c6fb9e1b8e51e662ea

Patch by Thiago de Barros Lacerda <thiago.lacerda@openbossa.org> on 2013-09-10
Reviewed by Eric Carlson.

No new tests needed.

* Modules/mediastream/MediaStream.cpp:
(WebCore::MediaStream::addTrack):
(WebCore::MediaStream::removeTrack):
(WebCore::MediaStream::addRemoteTrack):
(WebCore::MediaStream::removeRemoteTrack):
* platform/mediastream/MediaStreamDescriptor.h:
(WebCore::MediaStreamDescriptor::addRemoteTrack):
(WebCore::MediaStreamDescriptor::removeRemoteTrack):
(WebCore::MediaStreamDescriptor::addComponent):
(WebCore::MediaStreamDescriptor::removeComponent):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155434 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[GTK] The code generator produces a warning if a parameter can be NULL
https://bugs.webkit.org/show_bug.cgi?id=121093

Reviewed by Christophe Dumez.

Return an empty string instead of an undefined value if a
particular parameter doesn't need to be checked.

* bindings/scripts/CodeGeneratorGObject.pm:
(GetGReturnMacro):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155435 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[l10n] [pt_BR] Updated Brazilian Portuguese translation of WebKitGTK+
https://bugs.webkit.org/show_bug.cgi?id=120642

Patch by Enrico Nicoletto <liverig@gmail.com> on 2013-09-10
Reviewed by Gustavo Noronha.

* pt_BR.po: updated.

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