Appcache fallback URL match should use the longest candidate
https://bugs.webkit.org/show_bug.cgi?id=96126

Reviewed by Alexey Proskuryakov.

Source/WebCore:

Test: http/tests/appcache/multi-fallback.html

* loader/appcache/ApplicationCache.cpp:
(WebCore::fallbackURLLongerThan):
(WebCore::ApplicationCache::setFallbackURLs):

LayoutTests:

Test with multiple candidates of fallback match.

* http/tests/appcache/multi-fallback-expected.txt: Added.
* http/tests/appcache/multi-fallback.html: Added.
* http/tests/appcache/resources/multi-fallback.manifest: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127922 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Enter the creationContext before creating DOM wrappers
https://bugs.webkit.org/show_bug.cgi?id=96044

Patch by Adam Barth <abarth@chromium.org> on 2012-09-07
Reviewed by Eric Seidel.

Source/WebCore:

Now that we have the creationContext available when instantiating DOM
wrappers, we should use it! After this patch, we enter the creation
context so that the DOM wrapper is created in the right context (and
therefore has the right prototype chain).

This patch would have been tested by
fast/dom/prototype-inheritance.html, but that test was removed because
it was too much work to maintain. I'll post what the diff would have
been to the results for that test as an attachment to this bug.

Note: After this patch there are a number of cleanup patches to write,
but I'll do those separately.

* bindings/js/JSGeolocationCustom.cpp:
(WebCore::JSGeolocation::getCurrentPosition):
(WebCore::JSGeolocation::watchPosition):
  - This patch also includes a minor bug fix to the JSC implementations
    of Geolocation and Notifications. Previously, JSC was using the
    current lexical context for the callback object, which makes very
    little sense as it neither cooresponds to the Geolocation (or
    Notification) object or the functions being used for the callback.

    To be consistent with how we do callbacks elsewhere in WebKit, we
    should use the context that corresponds to the Geolocation (or
    Notification) object. This change happened automatically for V8
    when this patch fixed the Geolocation (and Notifications) wrapper
    to use the right context, but for JSC we need to change these lines
    of code explicitly.
* bindings/scripts/CodeGeneratorV8.pm:
(GenerateToV8Converters):

LayoutTests:

Update the Geolocation tests to show that we now use the correct
context for these callback. Specifically, we use the context that
cooresponds to the Geolocation object itself, not whatever random
context we happened to be in when we first touched the Geolocation
object.

* fast/dom/Geolocation/callback-to-deleted-context-expected.txt:
* fast/dom/Geolocation/disconnected-frame-expected.txt:
* fast/dom/Geolocation/disconnected-frame-permission-denied-expected.txt:
* fast/dom/Geolocation/resources/callback-to-deleted-context-inner1.html:
* fast/dom/Geolocation/script-tests/callback-to-deleted-context.js:
(onSecondIframeLoaded):
* fast/dom/Geolocation/script-tests/disconnected-frame-permission-denied.js:
(onIframeUnloaded.setTimeout):
* fast/dom/Geolocation/script-tests/disconnected-frame.js:
(onIframeUnloaded.setTimeout):
(onIframeUnloaded):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127923 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[chromium] Add touchscreen specific fling curve parametrization
https://bugs.webkit.org/show_bug.cgi?id=95997

Reviewed by James Robinson.

Added a new set of fling curve parameters with a good feel for touchscreen
initiated flings. Renamed TouchpadFlingPlatformGestureCurve to
TouchFlingPlatformGestureCurve to better reflect that the class
can serve for both touchscreen and touchpad flings when appropriately
parametrized. Updated build files as necessary for the rename.

No new tests - existing tests apply.

Source/WebCore:

* CMakeLists.txt:
* GNUmakefile.list.am:
* WebCore.gypi:
* platform/ScrollAnimatorNone.cpp:
(WebCore::ScrollAnimatorNone::fireUpAnAnimation):
* platform/TouchFlingPlatformGestureCurve.cpp: Renamed from Source/WebCore/platform/TouchpadFlingPlatformGestureCurve.cpp.
(WebCore):
(WebCore::TouchFlingPlatformGestureCurve::createForTouchPad):
(WebCore::TouchFlingPlatformGestureCurve::createForTouchScreen):
Added with touchscreen parameters.
(WebCore::TouchFlingPlatformGestureCurve::create):
(WebCore::position):
(WebCore::velocity):
(WebCore::TouchFlingPlatformGestureCurve::TouchFlingPlatformGestureCurve):
(WebCore::TouchFlingPlatformGestureCurve::~TouchFlingPlatformGestureCurve):
(WebCore::TouchFlingPlatformGestureCurve::debugName):
(WebCore::TouchFlingPlatformGestureCurve::apply):
* platform/TouchFlingPlatformGestureCurve.h: Renamed from Source/WebCore/platform/TouchpadFlingPlatformGestureCurve.h.
(WebCore):
(TouchFlingPlatformGestureCurve):
* platform/chromium/support/PlatformGestureCurveFactory.cpp: invokes
createForTouchPad or createForTouchScreen as appropriate.
(WebKit::PlatformGestureCurveFactory::createCurve):

Source/WebKit/chromium:

* tests/PlatformGestureCurveTest.cpp: To use the renamed curve constructor.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127924 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Handle non-existant TestExpectations files gracefully
https://bugs.webkit.org/show_bug.cgi?id=96149

Reviewed by Eric Seidel.

Even when we get rid of Skipped files, we shouldn't have each port
require a TestExpectations file for each platform if it doesn't
need one.

* Scripts/webkitpy/layout_tests/port/base.py:
(Port.expectations_dict):
* Scripts/webkitpy/layout_tests/port/base_unittest.py:
(PortTest.test_nonexistant_expectations):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127925 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Mac build fix.
https://bugs.webkit.org/show_bug.cgi?id=93640

Reviewed by Abhishek Arya.

The original patch for this bug broke the mac builds.

* WebCore.exp.in: Adding const marker


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127926 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix the remaining linter errors. These are all cases of paths
that don't actually exist or that are duplicated between TestExpectations
and Skipped files. I left in the Skipped file entries since those
were the ones that win out when duplicated.

* platform/efl/TestExpectations:
* platform/mac/TestExpectations:
* platform/qt-4.8/TestExpectations:
* platform/qt/Skipped:
* platform/qt/TestExpectations:
* platform/win/Skipped:
* platform/win/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127927 268f45cc-cd09-0410-ab3c-d52691b4dbfc
StringImpl::find(StringImpl*) doesn't handle cases where search and match strings are different bitness
https://bugs.webkit.org/show_bug.cgi?id=96125

Reviewed by Benjamin Poulain.

Changed findInner and reverseFindInner to be templated on both search and match character types.
Changed both find's and reverseFind to use all four bitness combinations of findInner and
reverseFindInner.

* wtf/text/StringImpl.cpp:
(WTF::findInner):
(WTF::StringImpl::find):
(WTF::reverseFindInner):
(WTF::StringImpl::reverseFind):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127928 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CSS Shaders] WebKitCSSMixFunctionValue.h needs forward declaration of MemoryObjectInfo
https://bugs.webkit.org/show_bug.cgi?id=96150

Reviewed by George Staikos.

Otherwise files that include it may fail to compile.

No new tests, because this patch implements no new functionality.

* css/WebKitCSSMixFunctionValue.h:
(WebCore):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127929 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Object.prototype.__define{G,S}etter__ with non-callable second parameter should throw TypeError instead of SyntaxError
https://bugs.webkit.org/show_bug.cgi?id=93873

Reviewed by Sam Weinig.

Source/JavaScriptCore: 

* runtime/ObjectPrototype.cpp:
(JSC::objectProtoFuncDefineGetter):
    - throw TypeError instead of SyntaxError
(JSC::objectProtoFuncDefineSetter):
    - throw TypeError instead of SyntaxError

LayoutTests: 

* fast/js/property-getters-and-setters-expected.txt:
    - updated results



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127930 268f45cc-cd09-0410-ab3c-d52691b4dbfc
AX: Chromium needs access to canvasHasFallbackContent
https://bugs.webkit.org/show_bug.cgi?id=96124

Reviewed by Chris Fleizach.

Source/WebKit/chromium:

Expose canvasHasFallbackContent on Chromium.

* public/WebAccessibilityObject.h:
(WebAccessibilityObject):
* src/WebAccessibilityObject.cpp:
(WebKit::WebAccessibilityObject::canvasHasFallbackContent):
(WebKit):

Tools:

Distinguish between canvas roles with and without fallback
content on Chromium.

* DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.cpp:
(getRole):

LayoutTests:

Update canvas test to distinguish between canvas elements with
fallback content on Chromium.

* platform/chromium/accessibility/canvas-description-and-role-expected.txt:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127931 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed, rolling out r127920 and r127926.
http://trac.webkit.org/changeset/127920
http://trac.webkit.org/changeset/127926
https://bugs.webkit.org/show_bug.cgi?id=96152

billions and billions of assertion failures on mac debug
builds (Requested by thorton on #webkit).

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

Source/WebCore:

* WebCore.exp.in:
* css/CSSFontFaceSource.cpp:
(WebCore::CSSFontFaceSource::getFontData):
* css/CSSSegmentedFontFace.cpp:
(WebCore::CSSSegmentedFontFace::getFontData):
* dom/Document.cpp:
(WebCore::Document::~Document):
(WebCore::Document::registerCustomFont):
(WebCore):
(WebCore::Document::deleteCustomFonts):
(WebCore::Document::reportMemoryUsage):
* dom/Document.h:
(WebCore):
(Document):
* platform/graphics/FontData.h:
* platform/graphics/FontFallbackList.cpp:
(WebCore::FontFallbackList::releaseFontData):
(WebCore::FontFallbackList::fontDataAt):
(WebCore::FontFallbackList::setPlatformFont):
* platform/graphics/FontFallbackList.h:
(FontFallbackList):
(WebCore::FontFallbackList::setGlyphPageZero):
(WebCore::FontFallbackList::setGlyphPages):
* platform/graphics/GlyphPageTreeNode.cpp:
(WebCore::GlyphPageTreeNode::pruneFontData):

LayoutTests:

* fast/frames/seamless/seamless-custom-font-pruning-crash-expected.txt: Removed.
* fast/frames/seamless/seamless-custom-font-pruning-crash.html: Removed.
* fast/frames/seamless/seamless-nested-crash-expected.txt: Removed.
* fast/frames/seamless/seamless-nested-crash.html: Removed.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127932 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Prevent overflows in FractionalLayoutUnit
https://bugs.webkit.org/show_bug.cgi?id=95883

Reviewed by Eric Seidel.

Source/WebCore:

Avoid overflow in snapSizeToPixel by using the fraction of the
location instead of the full value.

Add safe versions of min/max, adjusted by half a pixel to allow
round to allow rounding without overflowing.

Avoid overflow when snapping a FractionalLayoutRect by using the
safe versions of min/max in infiniteRect.

Avoid overflow when converting from a Length to a LayoutUnit by
limiting the value to FractionalLayoutUnit min/max. This matches
the behavior of the non-subpixel code path where the values are
similarly limited.

Test: fast/sub-pixel/large-sizes.html

* css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::computeLength):
Limit to FractionalLayoutUnit min/max.

* platform/FractionalLayoutUnit.h:
(FractionalLayoutUnit):
(WebCore::FractionalLayoutUnit::nearlyMax):
(WebCore::FractionalLayoutUnit::nearlyMin):
Reduce max/increase min by 1/2 to allow round to operate
without overflowing.

(WebCore::snapSizeToPixel):
* platform/graphics/FractionalLayoutRect.h:
(WebCore::FractionalLayoutRect::infiniteRect):
Use nearlyMin/nearlyMax.

(WebCore::pixelSnappedIntRect):
Change pixelSnappedIntRect to use snapSizeToPixel.

LayoutTests:

Add test for handling of large values.

* fast/sub-pixel/large-sizes-expected.txt: Added.
* fast/sub-pixel/large-sizes.html: Added.
* platform/chromium-win/media/video-zoom-controls-expected.txt:
* platform/chromium/fast/css/large-number-round-trip-expected.txt: Added.
* platform/mac-lion/Skipped:
* platform/mac-snowleopard/Skipped:
* platform/mac-wk2/Skipped:
* platform/mac/Skipped:
* platform/qt-4.8/Skipped:
* platform/qt/Skipped:
* platform/win-wk2/Skipped:
* platform/win-xp/Skipped:
* platform/win/Skipped:
* platform/wincairo/Skipped:
* platform/wk2/Skipped:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127933 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix build of GraphicsContext3DOpenGLCommon.cpp with MSVC
https://bugs.webkit.org/show_bug.cgi?id=96120

Patch by Simon Hausmann <simon.hausmann@nokia.com> on 2012-09-07
Reviewed by Noam Rosenthal.

Variable stack arrays are a GCC extension. Replace their use with OwnArrayPtr, similar to
other functions in the same file.

* platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
(WebCore::GraphicsContext3D::getActiveAttrib):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127934 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Rebaselines after http://trac.webkit.org/changeset/127915.

* fast/css/percent-top-value-with-relative-position-expected.txt: Renamed from LayoutTests/platform/efl/fast/css/percent-top-value-with-relative-position-expected.txt.
* platform/chromium-mac-snowleopard/fast/css/percent-top-value-with-relative-position-expected.png:
* platform/chromium-mac/fast/css/percent-top-value-with-relative-position-expected.png:
* platform/chromium-win/fast/css/percent-top-value-with-relative-position-expected.png:
* platform/chromium/TestExpectations:
* platform/efl/TestExpectations:
* platform/gtk/TestExpectations:
* platform/gtk/fast/css/percent-top-value-with-relative-position-expected.txt: Removed.
* platform/mac/TestExpectations:
* platform/mac/fast/css/percent-top-value-with-relative-position-expected.txt:
* platform/qt/TestExpectations:
* platform/qt/fast/css/percent-top-value-with-relative-position-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127935 268f45cc-cd09-0410-ab3c-d52691b4dbfc
AX: WebCore accessibility roles should be cross-platform
https://bugs.webkit.org/show_bug.cgi?id=94870

Reviewed by Chris Fleizach.

Source/WebCore:

Make 5 accessibility roles cross-platform rather than GTK-only.

Instead of mapping the HR tag to SplitterRole (which is an interactive
splitter control on Mac), create a new role HorizontalRuleRole.

Map all of the new roles to AXGroup on Mac, which matches the existing
behavior. Add a new test for these roles on Chromium.

Test: platform/chromium/accessibility/chromium-only-roles.html

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::supportsARIAAttributes):
* accessibility/AccessibilityObject.h:
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::determineAccessibilityRole):
* accessibility/gtk/AccessibilityObjectAtk.cpp:
(WebCore::AccessibilityObject::accessibilityPlatformIncludesObject):
* accessibility/gtk/WebKitAccessibleWrapperAtk.cpp:
(atkRole):
* accessibility/mac/WebAccessibilityObjectWrapper.mm:
(createAccessibilityRoleMap):

Source/WebKit/chromium:

Add a new accessibility role.

* public/WebAccessibilityRole.h:
* src/AssertMatchingEnums.cpp:

Tools:

Add debug strings to Chromium for new accessibility roles.

* DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.cpp:
(roleToString):

LayoutTests:

Adds a test for some new accessibility roles that aren't present on all platforms.

* platform/chromium/accessibility/chromium-only-roles-expected.txt: Added.
* platform/chromium/accessibility/chromium-only-roles.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127936 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add OVERRIDE to computeLogical{Width,Height} overrides
https://bugs.webkit.org/show_bug.cgi?id=96153

Reviewed by Ojan Vafai.

I plan on renaming these functions to updateLogical{Width,Height} and
I want to be extra sure that I don't mess up.

No new tests, this is just a refactoring.

* rendering/RenderFlowThread.h: Also mark the functions virtual!
* rendering/RenderListBox.h:
(RenderListBox):
* rendering/RenderMeter.h:
(RenderMeter):
* rendering/RenderTable.h:
(RenderTable):
* rendering/RenderTableCell.h:
(RenderTableCell):
* rendering/RenderTextControl.h:
(RenderTextControl):
* rendering/svg/RenderSVGForeignObject.h:
(RenderSVGForeignObject):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127937 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore: Fix a llint C++ interpreter bugs.
https://bugs.webkit.org/show_bug.cgi?id=96127.

Patch by Mark Lam <mark.lam@apple.com> on 2012-09-07
Reviewed by Filip Pizlo.

* llint/LowLevelInterpreter.cpp:
(JSC):
(JSC::CLoop::execute):
* offlineasm/cloop.rb:

Source/WTF: Fixed ASSERT() and ASSERT_AT() macros so that they can be used in
comma expressions.
https://bugs.webkit.org/show_bug.cgi?id=96127.

Patch by Mark Lam <mark.lam@apple.com> on 2012-09-07
Reviewed by Filip Pizlo.

* wtf/Assertions.h:
(wtfAssert):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127938 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Refactored bytecode generator initialization to support moving captured vars around
https://bugs.webkit.org/show_bug.cgi?id=96159

Reviewed by Gavin Barraclough.

This patch separates the stages of allocating registers, declaring identifiers
in the symbol table, and initializing registers, so you can change
allocation decisions without breaking the world.

* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::BytecodeGenerator): Call a set of helper functions
instead of inlining all the code, to help clarity.

(JSC::BytecodeGenerator::allocateCapturedVars):
(JSC::BytecodeGenerator::allocateUncapturedVars):
(JSC::BytecodeGenerator::allocateActivationVar):
(JSC::BytecodeGenerator::allocateArgumentsVars):
(JSC::BytecodeGenerator::allocateCalleeVarUndeclared):
(JSC::BytecodeGenerator::declareParameters):
(JSC::BytecodeGenerator::declareCallee):
(JSC::BytecodeGenerator::initCalleeVar):
(JSC::BytecodeGenerator::initArgumentsVars):
(JSC::BytecodeGenerator::initActivationVar):
(JSC::BytecodeGenerator::initThisParameter):
(JSC::BytecodeGenerator::initFunctionDeclarations):
(JSC::BytecodeGenerator::declareParameter):
(JSC::BytecodeGenerator::createLazyRegisterIfNecessary):
(JSC::BytecodeGenerator::createActivationIfNecessary): Factored these
helper functions out from pre-existing code.

* bytecompiler/BytecodeGenerator.h:
(BytecodeGenerator):
* parser/ASTBuilder.h:
(JSC::ASTBuilder::createFuncDeclStatement):
(JSC::ASTBuilder::addVar):
* parser/Nodes.h:
(JSC::DeclarationStacks::VarDeclaration::VarDeclaration):
(VarDeclaration):
(JSC::DeclarationStacks::FunctionDeclaration::FunctionDeclaration):
(FunctionDeclaration): Declaration stacks get a little more data now,
to support allocating registers before putting things in the symbol
table. I'm convinced that we should eventually just expand the symbol
table to understand these things.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127939 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Chromium] Multiple commits without invalidation allowed per redraw.
https://bugs.webkit.org/show_bug.cgi?id=95661

Patch by David Reveman <reveman@chromium.org> on 2012-09-07
Reviewed by James Robinson.

Source/WebCore:

Always enter COMMIT_STATE_WAITING_FOR_FIRST_DRAW after commit. This
ensures we draw before beginning a new frame.

Unit tests: CCLayerTreeHostTestContinuousCommit.runMultiThread
            CCLayerTreeHostTestContinuousInvalidate.runMultiThread
            CCLayerTreeHostTestContinuousAnimate.runMultiThread

* platform/graphics/chromium/cc/CCSchedulerStateMachine.cpp:
(WebCore::CCSchedulerStateMachine::updateState):

Source/WebKit/chromium:

* tests/CCLayerTreeHostTest.cpp:
(CCLayerTreeHostTestContinuousCommit):
(WebKitTests::CCLayerTreeHostTestContinuousCommit::CCLayerTreeHostTestContinuousCommit):
(WebKitTests):
(WebKitTests::TEST_F):
(CCLayerTreeHostTestContinuousInvalidate):
(WebKitTests::CCLayerTreeHostTestContinuousInvalidate::CCLayerTreeHostTestContinuousInvalidate):
(CCLayerTreeHostTestContinuousAnimate):
(WebKitTests::CCLayerTreeHostTestContinuousAnimate::CCLayerTreeHostTestContinuousAnimate):
* tests/CCSchedulerStateMachineTest.cpp:
(WebCore::TEST):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127940 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed, rolling out r127938.
http://trac.webkit.org/changeset/127938
https://bugs.webkit.org/show_bug.cgi?id=96166

It broke the build (Requested by smfr on #webkit).

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

Source/JavaScriptCore:

* llint/LowLevelInterpreter.cpp:
(JSC):
(JSC::CLoop::execute):
* offlineasm/cloop.rb:

Source/WTF:

* wtf/Assertions.h:

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